From 3fd5f73b7544ea82b615e5f203d1fedbf87ea109 Mon Sep 17 00:00:00 2001 From: status-im-auto Date: Wed, 13 Nov 2024 05:22:22 +0000 Subject: [PATCH] Updates --- buddybook/.vite/manifest.json | 78 +++++++------- buddybook/404.html | 21 ---- .../{ccip-DqOSmZ6J.js => ccip-DU5pFHxb.js} | 2 +- ...{events-EbrwmdBG.js => events-xQ4utD7e.js} | 2 +- .../{index-c_vQ90mY.js => index-BpmIcSNW.js} | 2 +- .../{index-CRce2FXR.js => index-Cu6T4rb4.js} | 2 +- .../{index-BhswOEW5.js => index-DOzQxzSO.js} | 2 +- ...{index-CwoEHhxw.css => index-Dd5JfyyB.css} | 2 +- .../{index-BA4zS8rk.js => index-DlENImLn.js} | 2 +- .../{index-C91wHTLi.js => index-Dzj92ueM.js} | 4 +- .../{index-Cye4tEiE.js => index-uonIXzgQ.js} | 100 +++++++++--------- .../{index-B6MMxlAs.js => index-xz6stGwY.js} | 2 +- ...ex.es-BocJIoGE.js => index.es-C5jEvyUt.js} | 6 +- ...XdsDax.js => inherits_browser-Bb3-ajt6.js} | 2 +- buddybook/index.html | 12 +-- flush-notes/404.html | 2 +- .../_buildManifest.js | 0 .../_ssgManifest.js | 0 flush-notes/index.html | 2 +- flush-notes/index.txt | 2 +- flush-notes/view.html | 2 +- flush-notes/view.txt | 2 +- 22 files changed, 112 insertions(+), 137 deletions(-) delete mode 100644 buddybook/404.html rename buddybook/assets/{ccip-DqOSmZ6J.js => ccip-DU5pFHxb.js} (97%) rename buddybook/assets/{events-EbrwmdBG.js => events-xQ4utD7e.js} (98%) rename buddybook/assets/{index-c_vQ90mY.js => index-BpmIcSNW.js} (96%) rename buddybook/assets/{index-CRce2FXR.js => index-Cu6T4rb4.js} (99%) rename buddybook/assets/{index-BhswOEW5.js => index-DOzQxzSO.js} (99%) rename buddybook/assets/{index-CwoEHhxw.css => index-Dd5JfyyB.css} (54%) rename buddybook/assets/{index-BA4zS8rk.js => index-DlENImLn.js} (99%) rename buddybook/assets/{index-C91wHTLi.js => index-Dzj92ueM.js} (97%) rename buddybook/assets/{index-Cye4tEiE.js => index-uonIXzgQ.js} (95%) rename buddybook/assets/{index-B6MMxlAs.js => index-xz6stGwY.js} (99%) rename buddybook/assets/{index.es-BocJIoGE.js => index.es-C5jEvyUt.js} (99%) rename buddybook/assets/{inherits_browser-DKXdsDax.js => inherits_browser-Bb3-ajt6.js} (85%) rename flush-notes/_next/static/{5-GwyAoDnZqLVyoBYvyMp => QYaJ0AjbbxerL0dOZkk5s}/_buildManifest.js (100%) rename flush-notes/_next/static/{5-GwyAoDnZqLVyoBYvyMp => QYaJ0AjbbxerL0dOZkk5s}/_ssgManifest.js (100%) diff --git a/buddybook/.vite/manifest.json b/buddybook/.vite/manifest.json index 1b9273d..6e95705 100644 --- a/buddybook/.vite/manifest.json +++ b/buddybook/.vite/manifest.json @@ -1,6 +1,6 @@ { - "_events-EbrwmdBG.js": { - "file": "assets/events-EbrwmdBG.js", + "_events-xQ4utD7e.js": { + "file": "assets/events-xQ4utD7e.js", "name": "events", "imports": [ "index.html" @@ -10,8 +10,28 @@ "file": "assets/hooks.module-D0gf0yJl.js", "name": "hooks.module" }, - "_index-C91wHTLi.js": { - "file": "assets/index-C91wHTLi.js", + "_index-BpmIcSNW.js": { + "file": "assets/index-BpmIcSNW.js", + "name": "index", + "isDynamicEntry": true, + "imports": [ + "index.html", + "_events-xQ4utD7e.js" + ] + }, + "_index-Cu6T4rb4.js": { + "file": "assets/index-Cu6T4rb4.js", + "name": "index", + "isDynamicEntry": true, + "imports": [ + "index.html", + "_inherits_browser-Bb3-ajt6.js", + "_hooks.module-D0gf0yJl.js", + "_events-xQ4utD7e.js" + ] + }, + "_index-Dzj92ueM.js": { + "file": "assets/index-Dzj92ueM.js", "name": "index", "isDynamicEntry": true, "imports": [ @@ -21,52 +41,32 @@ "node_modules/@walletconnect/modal-ui/dist/index.js" ] }, - "_index-CRce2FXR.js": { - "file": "assets/index-CRce2FXR.js", - "name": "index", - "isDynamicEntry": true, - "imports": [ - "index.html", - "_inherits_browser-DKXdsDax.js", - "_hooks.module-D0gf0yJl.js", - "_events-EbrwmdBG.js" - ] - }, - "_index-c_vQ90mY.js": { - "file": "assets/index-c_vQ90mY.js", - "name": "index", - "isDynamicEntry": true, - "imports": [ - "index.html", - "_events-EbrwmdBG.js" - ] - }, - "_inherits_browser-DKXdsDax.js": { - "file": "assets/inherits_browser-DKXdsDax.js", + "_inherits_browser-Bb3-ajt6.js": { + "file": "assets/inherits_browser-Bb3-ajt6.js", "name": "inherits_browser", "imports": [ "index.html" ] }, "index.html": { - "file": "assets/index-Cye4tEiE.js", + "file": "assets/index-uonIXzgQ.js", "name": "index", "src": "index.html", "isEntry": true, "dynamicImports": [ "node_modules/viem/_esm/utils/ccip.js", "node_modules/@coinbase/wallet-sdk/dist/index.js", - "_index-CRce2FXR.js", + "_index-Cu6T4rb4.js", "node_modules/@safe-global/safe-apps-sdk/dist/esm/index.js", - "_index-c_vQ90mY.js", + "_index-BpmIcSNW.js", "node_modules/@walletconnect/ethereum-provider/dist/index.es.js" ], "css": [ - "assets/index-CwoEHhxw.css" + "assets/index-Dd5JfyyB.css" ] }, "node_modules/@coinbase/wallet-sdk/dist/index.js": { - "file": "assets/index-B6MMxlAs.js", + "file": "assets/index-xz6stGwY.js", "name": "index", "src": "node_modules/@coinbase/wallet-sdk/dist/index.js", "isDynamicEntry": true, @@ -76,7 +76,7 @@ ] }, "node_modules/@safe-global/safe-apps-sdk/dist/esm/index.js": { - "file": "assets/index-BA4zS8rk.js", + "file": "assets/index-DlENImLn.js", "name": "index", "src": "node_modules/@safe-global/safe-apps-sdk/dist/esm/index.js", "isDynamicEntry": true, @@ -85,31 +85,31 @@ ] }, "node_modules/@walletconnect/ethereum-provider/dist/index.es.js": { - "file": "assets/index.es-BocJIoGE.js", + "file": "assets/index.es-C5jEvyUt.js", "name": "index.es", "src": "node_modules/@walletconnect/ethereum-provider/dist/index.es.js", "isDynamicEntry": true, "imports": [ "index.html", - "_events-EbrwmdBG.js", - "_inherits_browser-DKXdsDax.js" + "_events-xQ4utD7e.js", + "_inherits_browser-Bb3-ajt6.js" ], "dynamicImports": [ - "_index-C91wHTLi.js" + "_index-Dzj92ueM.js" ] }, "node_modules/@walletconnect/modal-ui/dist/index.js": { - "file": "assets/index-BhswOEW5.js", + "file": "assets/index-DOzQxzSO.js", "name": "index", "src": "node_modules/@walletconnect/modal-ui/dist/index.js", "isDynamicEntry": true, "imports": [ - "_index-C91wHTLi.js", + "_index-Dzj92ueM.js", "index.html" ] }, "node_modules/viem/_esm/utils/ccip.js": { - "file": "assets/ccip-DqOSmZ6J.js", + "file": "assets/ccip-DU5pFHxb.js", "name": "ccip", "src": "node_modules/viem/_esm/utils/ccip.js", "isDynamicEntry": true, diff --git a/buddybook/404.html b/buddybook/404.html deleted file mode 100644 index df98f7b..0000000 --- a/buddybook/404.html +++ /dev/null @@ -1,21 +0,0 @@ - - - - - BuddyBook - - - - - \ No newline at end of file diff --git a/buddybook/assets/ccip-DqOSmZ6J.js b/buddybook/assets/ccip-DU5pFHxb.js similarity index 97% rename from buddybook/assets/ccip-DqOSmZ6J.js rename to buddybook/assets/ccip-DU5pFHxb.js index abbab42..bcec42c 100644 --- a/buddybook/assets/ccip-DqOSmZ6J.js +++ b/buddybook/assets/ccip-DU5pFHxb.js @@ -1 +1 @@ -import{i as h,I as m,B as p,w,x as g,y as E,z as O,c as x,e as b,H as y,A as M}from"./index-Cye4tEiE.js";function R(r,a){if(!h(r,{strict:!1}))throw new m({address:r});if(!h(a,{strict:!1}))throw new m({address:a});return r.toLowerCase()===a.toLowerCase()}class S extends p{constructor({callbackSelector:a,cause:t,data:n,extraData:i,sender:d,urls:s}){var c;super(t.shortMessage||"An error occurred while fetching for an offchain result.",{cause:t,metaMessages:[...t.metaMessages||[],(c=t.metaMessages)!=null&&c.length?"":[],"Offchain Gateway Call:",s&&[" Gateway URL(s):",...s.map(f=>` ${w(f)}`)],` Sender: ${d}`,` Data: ${n}`,` Callback selector: ${a}`,` Extra data: ${i}`].flat(),name:"OffchainLookupError"})}}class $ extends p{constructor({result:a,url:t}){super("Offchain gateway response is malformed. Response data must be a hex value.",{metaMessages:[`Gateway URL: ${w(t)}`,`Response: ${g(a)}`],name:"OffchainLookupResponseMalformedError"})}}class A extends p{constructor({sender:a,to:t}){super("Reverted sender address does not match target contract address (`to`).",{metaMessages:[`Contract address: ${t}`,`OffchainLookup sender address: ${a}`],name:"OffchainLookupSenderMismatchError"})}}const D="0x556f1830",C={name:"OffchainLookup",type:"error",inputs:[{name:"sender",type:"address"},{name:"urls",type:"string[]"},{name:"callData",type:"bytes"},{name:"callbackFunction",type:"bytes4"},{name:"extraData",type:"bytes"}]};async function G(r,{blockNumber:a,blockTag:t,data:n,to:i}){const{args:d}=E({data:n,abi:[C]}),[s,c,f,u,o]=d,{ccipRead:e}=r,k=e&&typeof(e==null?void 0:e.request)=="function"?e.request:T;try{if(!R(i,s))throw new A({sender:s,to:i});const l=await k({data:f,sender:s,urls:c}),{data:L}=await O(r,{blockNumber:a,blockTag:t,data:x([u,b([{type:"bytes"},{type:"bytes"}],[l,o])]),to:i});return L}catch(l){throw new S({callbackSelector:u,cause:l,data:n,extraData:o,sender:s,urls:c})}}async function T({data:r,sender:a,urls:t}){var i;let n=new Error("An unknown error occurred.");for(let d=0;d` ${w(f)}`)],` Sender: ${d}`,` Data: ${n}`,` Callback selector: ${a}`,` Extra data: ${i}`].flat(),name:"OffchainLookupError"})}}class $ extends p{constructor({result:a,url:t}){super("Offchain gateway response is malformed. Response data must be a hex value.",{metaMessages:[`Gateway URL: ${w(t)}`,`Response: ${g(a)}`],name:"OffchainLookupResponseMalformedError"})}}class A extends p{constructor({sender:a,to:t}){super("Reverted sender address does not match target contract address (`to`).",{metaMessages:[`Contract address: ${t}`,`OffchainLookup sender address: ${a}`],name:"OffchainLookupSenderMismatchError"})}}const D="0x556f1830",C={name:"OffchainLookup",type:"error",inputs:[{name:"sender",type:"address"},{name:"urls",type:"string[]"},{name:"callData",type:"bytes"},{name:"callbackFunction",type:"bytes4"},{name:"extraData",type:"bytes"}]};async function G(r,{blockNumber:a,blockTag:t,data:n,to:i}){const{args:d}=E({data:n,abi:[C]}),[s,c,f,u,o]=d,{ccipRead:e}=r,k=e&&typeof(e==null?void 0:e.request)=="function"?e.request:T;try{if(!R(i,s))throw new A({sender:s,to:i});const l=await k({data:f,sender:s,urls:c}),{data:L}=await O(r,{blockNumber:a,blockTag:t,data:x([u,b([{type:"bytes"},{type:"bytes"}],[l,o])]),to:i});return L}catch(l){throw new S({callbackSelector:u,cause:l,data:n,extraData:o,sender:s,urls:c})}}async function T({data:r,sender:a,urls:t}){var i;let n=new Error("An unknown error occurred.");for(let d=0;d0&&(s=n[0]),s instanceof Error)throw s;var u=new Error("Unhandled error."+(s?" ("+s.message+")":""));throw u.context=s,u}var c=f[e];if(c===void 0)return!1;if(typeof c=="function")d(c,this,n);else for(var h=c.length,O=E(c,h),r=0;r0&&s.length>i&&!s.warned){s.warned=!0;var u=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");u.name="MaxListenersExceededWarning",u.emitter=t,u.type=e,u.count=s.length,j(u)}return t}o.prototype.addListener=function(e,n){return g(this,e,n,!1)};o.prototype.on=o.prototype.addListener;o.prototype.prependListener=function(e,n){return g(this,e,n,!0)};function R(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function _(t,e,n){var r={fired:!1,wrapFn:void 0,target:t,type:e,listener:n},i=R.bind(r);return i.listener=n,r.wrapFn=i,i}o.prototype.once=function(e,n){return v(n),this.on(e,_(this,e,n)),this};o.prototype.prependOnceListener=function(e,n){return v(n),this.prependListener(e,_(this,e,n)),this};o.prototype.removeListener=function(e,n){var r,i,f,s,u;if(v(n),i=this._events,i===void 0)return this;if(r=i[e],r===void 0)return this;if(r===n||r.listener===n)--this._eventsCount===0?this._events=Object.create(null):(delete i[e],i.removeListener&&this.emit("removeListener",e,r.listener||n));else if(typeof r!="function"){for(f=-1,s=r.length-1;s>=0;s--)if(r[s]===n||r[s].listener===n){u=r[s].listener,f=s;break}if(f<0)return this;f===0?r.shift():N(r,f),r.length===1&&(i[e]=r[0]),i.removeListener!==void 0&&this.emit("removeListener",e,u||n)}return this};o.prototype.off=o.prototype.removeListener;o.prototype.removeAllListeners=function(e){var n,r,i;if(r=this._events,r===void 0)return this;if(r.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):r[e]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete r[e]),this;if(arguments.length===0){var f=Object.keys(r),s;for(i=0;i=0;i--)this.removeListener(e,n[i]);return this};function w(t,e,n){var r=t._events;if(r===void 0)return[];var i=r[e];return i===void 0?[]:typeof i=="function"?n?[i.listener||i]:[i]:n?M(i):E(i,i.length)}o.prototype.listeners=function(e){return w(this,e,!0)};o.prototype.rawListeners=function(e){return w(this,e,!1)};o.listenerCount=function(t,e){return typeof t.listenerCount=="function"?t.listenerCount(e):b.call(t,e)};o.prototype.listenerCount=b;function b(t){var e=this._events;if(e!==void 0){var n=e[t];if(typeof n=="function")return 1;if(n!==void 0)return n.length}return 0}o.prototype.eventNames=function(){return this._eventsCount>0?l(this._events):[]};function E(t,e){for(var n=new Array(e),r=0;r0&&(s=n[0]),s instanceof Error)throw s;var u=new Error("Unhandled error."+(s?" ("+s.message+")":""));throw u.context=s,u}var c=f[e];if(c===void 0)return!1;if(typeof c=="function")d(c,this,n);else for(var h=c.length,O=E(c,h),r=0;r0&&s.length>i&&!s.warned){s.warned=!0;var u=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");u.name="MaxListenersExceededWarning",u.emitter=t,u.type=e,u.count=s.length,j(u)}return t}o.prototype.addListener=function(e,n){return g(this,e,n,!1)};o.prototype.on=o.prototype.addListener;o.prototype.prependListener=function(e,n){return g(this,e,n,!0)};function R(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function _(t,e,n){var r={fired:!1,wrapFn:void 0,target:t,type:e,listener:n},i=R.bind(r);return i.listener=n,r.wrapFn=i,i}o.prototype.once=function(e,n){return v(n),this.on(e,_(this,e,n)),this};o.prototype.prependOnceListener=function(e,n){return v(n),this.prependListener(e,_(this,e,n)),this};o.prototype.removeListener=function(e,n){var r,i,f,s,u;if(v(n),i=this._events,i===void 0)return this;if(r=i[e],r===void 0)return this;if(r===n||r.listener===n)--this._eventsCount===0?this._events=Object.create(null):(delete i[e],i.removeListener&&this.emit("removeListener",e,r.listener||n));else if(typeof r!="function"){for(f=-1,s=r.length-1;s>=0;s--)if(r[s]===n||r[s].listener===n){u=r[s].listener,f=s;break}if(f<0)return this;f===0?r.shift():N(r,f),r.length===1&&(i[e]=r[0]),i.removeListener!==void 0&&this.emit("removeListener",e,u||n)}return this};o.prototype.off=o.prototype.removeListener;o.prototype.removeAllListeners=function(e){var n,r,i;if(r=this._events,r===void 0)return this;if(r.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):r[e]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete r[e]),this;if(arguments.length===0){var f=Object.keys(r),s;for(i=0;i=0;i--)this.removeListener(e,n[i]);return this};function w(t,e,n){var r=t._events;if(r===void 0)return[];var i=r[e];return i===void 0?[]:typeof i=="function"?n?[i.listener||i]:[i]:n?M(i):E(i,i.length)}o.prototype.listeners=function(e){return w(this,e,!0)};o.prototype.rawListeners=function(e){return w(this,e,!1)};o.listenerCount=function(t,e){return typeof t.listenerCount=="function"?t.listenerCount(e):b.call(t,e)};o.prototype.listenerCount=b;function b(t){var e=this._events;if(e!==void 0){var n=e[t];if(typeof n=="function")return 1;if(n!==void 0)return n.length}return 0}o.prototype.eventNames=function(){return this._eventsCount>0?l(this._events):[]};function E(t,e){for(var n=new Array(e),r=0;re[s]})}}}return Object.freeze(Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}))}var l={},g={},f={};Object.defineProperty(f,"__esModule",{value:!0});f.getLowerCase=void 0;function w(n){return n&&n.toLowerCase()}f.getLowerCase=w;Object.defineProperty(g,"__esModule",{value:!0});g.SafeAppProvider=void 0;const k=_,u=f;class y extends k.EventEmitter{constructor(a,i){super(),this.submittedTxs=new Map,this.safe=a,this.sdk=i}async connect(){this.emit("connect",{chainId:this.chainId})}async disconnect(){}get chainId(){return this.safe.chainId}async request(a){const{method:i,params:e=[]}=a;switch(i){case"eth_accounts":return[this.safe.safeAddress];case"net_version":case"eth_chainId":return`0x${this.chainId.toString(16)}`;case"personal_sign":{const[t,r]=e;if(this.safe.safeAddress.toLowerCase()!==r.toLowerCase())throw new Error("The address or message hash is invalid");const h=await this.sdk.txs.signMessage(t);return("signature"in h?h.signature:void 0)||"0x"}case"eth_sign":{const[t,r]=e;if(this.safe.safeAddress.toLowerCase()!==t.toLowerCase()||!r.startsWith("0x"))throw new Error("The address or message hash is invalid");const h=await this.sdk.txs.signMessage(r);return("signature"in h?h.signature:void 0)||"0x"}case"eth_signTypedData":case"eth_signTypedData_v4":{const[t,r]=e,h=typeof r=="string"?JSON.parse(r):r;if(this.safe.safeAddress.toLowerCase()!==t.toLowerCase())throw new Error("The address is invalid");const c=await this.sdk.txs.signTypedMessage(h);return("signature"in c?c.signature:void 0)||"0x"}case"eth_sendTransaction":const s={...e[0],value:e[0].value||"0",data:e[0].data||"0x"};typeof s.gas=="string"&&s.gas.startsWith("0x")&&(s.gas=parseInt(s.gas,16));const o=await this.sdk.txs.send({txs:[s],params:{safeTxGas:s.gas}});return this.submittedTxs.set(o.safeTxHash,{from:this.safe.safeAddress,hash:o.safeTxHash,gas:0,gasPrice:"0x00",nonce:0,input:s.data,value:s.value,to:s.to,blockHash:null,blockNumber:null,transactionIndex:null}),o.safeTxHash;case"eth_blockNumber":return(await this.sdk.eth.getBlockByNumber(["latest"])).number;case"eth_getBalance":return this.sdk.eth.getBalance([(0,u.getLowerCase)(e[0]),e[1]]);case"eth_getCode":return this.sdk.eth.getCode([(0,u.getLowerCase)(e[0]),e[1]]);case"eth_getTransactionCount":return this.sdk.eth.getTransactionCount([(0,u.getLowerCase)(e[0]),e[1]]);case"eth_getStorageAt":return this.sdk.eth.getStorageAt([(0,u.getLowerCase)(e[0]),e[1],e[2]]);case"eth_getBlockByNumber":return this.sdk.eth.getBlockByNumber([e[0],e[1]]);case"eth_getBlockByHash":return this.sdk.eth.getBlockByHash([e[0],e[1]]);case"eth_getTransactionByHash":let d=e[0];try{d=(await this.sdk.txs.getBySafeTxHash(d)).txHash||d}catch{}return this.submittedTxs.has(d)?this.submittedTxs.get(d):this.sdk.eth.getTransactionByHash([d]).then(t=>(t&&(t.hash=e[0]),t));case"eth_getTransactionReceipt":{let t=e[0];try{t=(await this.sdk.txs.getBySafeTxHash(t)).txHash||t}catch{}return this.sdk.eth.getTransactionReceipt([t]).then(r=>(r&&(r.transactionHash=e[0]),r))}case"eth_estimateGas":return this.sdk.eth.getEstimateGas(e[0]);case"eth_call":return this.sdk.eth.call([e[0],e[1]]);case"eth_getLogs":return this.sdk.eth.getPastLogs([e[0]]);case"eth_gasPrice":return this.sdk.eth.getGasPrice();case"wallet_getPermissions":return this.sdk.wallet.getPermissions();case"wallet_requestPermissions":return this.sdk.wallet.requestPermissions(e[0]);case"safe_setSettings":return this.sdk.eth.setSafeSettings([e[0]]);default:throw Error(`"${a.method}" not implemented`)}}send(a,i){a||i("Undefined request"),this.request(a).then(e=>i(null,{jsonrpc:"2.0",id:a.id,result:e})).catch(e=>i(e,null))}}g.SafeAppProvider=y;(function(n){Object.defineProperty(n,"__esModule",{value:!0}),n.SafeAppProvider=void 0;var a=g;Object.defineProperty(n,"SafeAppProvider",{enumerable:!0,get:function(){return a.SafeAppProvider}})})(l);const x=p(l),C=m({__proto__:null,default:x},[l]);export{C as i}; +import{h as p}from"./index-uonIXzgQ.js";import{e as _}from"./events-xQ4utD7e.js";function m(n,a){for(var i=0;ie[s]})}}}return Object.freeze(Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}))}var l={},g={},f={};Object.defineProperty(f,"__esModule",{value:!0});f.getLowerCase=void 0;function w(n){return n&&n.toLowerCase()}f.getLowerCase=w;Object.defineProperty(g,"__esModule",{value:!0});g.SafeAppProvider=void 0;const k=_,u=f;class y extends k.EventEmitter{constructor(a,i){super(),this.submittedTxs=new Map,this.safe=a,this.sdk=i}async connect(){this.emit("connect",{chainId:this.chainId})}async disconnect(){}get chainId(){return this.safe.chainId}async request(a){const{method:i,params:e=[]}=a;switch(i){case"eth_accounts":return[this.safe.safeAddress];case"net_version":case"eth_chainId":return`0x${this.chainId.toString(16)}`;case"personal_sign":{const[t,r]=e;if(this.safe.safeAddress.toLowerCase()!==r.toLowerCase())throw new Error("The address or message hash is invalid");const h=await this.sdk.txs.signMessage(t);return("signature"in h?h.signature:void 0)||"0x"}case"eth_sign":{const[t,r]=e;if(this.safe.safeAddress.toLowerCase()!==t.toLowerCase()||!r.startsWith("0x"))throw new Error("The address or message hash is invalid");const h=await this.sdk.txs.signMessage(r);return("signature"in h?h.signature:void 0)||"0x"}case"eth_signTypedData":case"eth_signTypedData_v4":{const[t,r]=e,h=typeof r=="string"?JSON.parse(r):r;if(this.safe.safeAddress.toLowerCase()!==t.toLowerCase())throw new Error("The address is invalid");const c=await this.sdk.txs.signTypedMessage(h);return("signature"in c?c.signature:void 0)||"0x"}case"eth_sendTransaction":const s={...e[0],value:e[0].value||"0",data:e[0].data||"0x"};typeof s.gas=="string"&&s.gas.startsWith("0x")&&(s.gas=parseInt(s.gas,16));const o=await this.sdk.txs.send({txs:[s],params:{safeTxGas:s.gas}});return this.submittedTxs.set(o.safeTxHash,{from:this.safe.safeAddress,hash:o.safeTxHash,gas:0,gasPrice:"0x00",nonce:0,input:s.data,value:s.value,to:s.to,blockHash:null,blockNumber:null,transactionIndex:null}),o.safeTxHash;case"eth_blockNumber":return(await this.sdk.eth.getBlockByNumber(["latest"])).number;case"eth_getBalance":return this.sdk.eth.getBalance([(0,u.getLowerCase)(e[0]),e[1]]);case"eth_getCode":return this.sdk.eth.getCode([(0,u.getLowerCase)(e[0]),e[1]]);case"eth_getTransactionCount":return this.sdk.eth.getTransactionCount([(0,u.getLowerCase)(e[0]),e[1]]);case"eth_getStorageAt":return this.sdk.eth.getStorageAt([(0,u.getLowerCase)(e[0]),e[1],e[2]]);case"eth_getBlockByNumber":return this.sdk.eth.getBlockByNumber([e[0],e[1]]);case"eth_getBlockByHash":return this.sdk.eth.getBlockByHash([e[0],e[1]]);case"eth_getTransactionByHash":let d=e[0];try{d=(await this.sdk.txs.getBySafeTxHash(d)).txHash||d}catch{}return this.submittedTxs.has(d)?this.submittedTxs.get(d):this.sdk.eth.getTransactionByHash([d]).then(t=>(t&&(t.hash=e[0]),t));case"eth_getTransactionReceipt":{let t=e[0];try{t=(await this.sdk.txs.getBySafeTxHash(t)).txHash||t}catch{}return this.sdk.eth.getTransactionReceipt([t]).then(r=>(r&&(r.transactionHash=e[0]),r))}case"eth_estimateGas":return this.sdk.eth.getEstimateGas(e[0]);case"eth_call":return this.sdk.eth.call([e[0],e[1]]);case"eth_getLogs":return this.sdk.eth.getPastLogs([e[0]]);case"eth_gasPrice":return this.sdk.eth.getGasPrice();case"wallet_getPermissions":return this.sdk.wallet.getPermissions();case"wallet_requestPermissions":return this.sdk.wallet.requestPermissions(e[0]);case"safe_setSettings":return this.sdk.eth.setSafeSettings([e[0]]);default:throw Error(`"${a.method}" not implemented`)}}send(a,i){a||i("Undefined request"),this.request(a).then(e=>i(null,{jsonrpc:"2.0",id:a.id,result:e})).catch(e=>i(e,null))}}g.SafeAppProvider=y;(function(n){Object.defineProperty(n,"__esModule",{value:!0}),n.SafeAppProvider=void 0;var a=g;Object.defineProperty(n,"SafeAppProvider",{enumerable:!0,get:function(){return a.SafeAppProvider}})})(l);const x=p(l),C=m({__proto__:null,default:x},[l]);export{C as i}; diff --git a/buddybook/assets/index-CRce2FXR.js b/buddybook/assets/index-Cu6T4rb4.js similarity index 99% rename from buddybook/assets/index-CRce2FXR.js rename to buddybook/assets/index-Cu6T4rb4.js index 9a30e0e..558da2f 100644 --- a/buddybook/assets/index-CRce2FXR.js +++ b/buddybook/assets/index-Cu6T4rb4.js @@ -1,4 +1,4 @@ -import{E as xo,f as Q,j as Zr,p as ii,q as su,r as ou,h as au}from"./index-Cye4tEiE.js";import{r as Ws,i as vt}from"./inherits_browser-DKXdsDax.js";import{p as cu,a as lu}from"./hooks.module-D0gf0yJl.js";import{e as si}from"./events-EbrwmdBG.js";const uu=Object.freeze(Object.defineProperty({__proto__:null,EventEmitter:xo,default:xo},Symbol.toStringTag,{value:"Module"}));var ac={},hn={},oi={};Object.defineProperty(oi,"__esModule",{value:!0});oi.walletLogo=void 0;const hu=(e,t)=>{let r;switch(e){case"standard":return r=t,`data:image/svg+xml,%3Csvg width='${t}' height='${r}' viewBox='0 0 1024 1024' fill='none' xmlns='http://www.w3.org/2000/svg'%3E %3Crect width='1024' height='1024' fill='%230052FF'/%3E %3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M152 512C152 710.823 313.177 872 512 872C710.823 872 872 710.823 872 512C872 313.177 710.823 152 512 152C313.177 152 152 313.177 152 512ZM420 396C406.745 396 396 406.745 396 420V604C396 617.255 406.745 628 420 628H604C617.255 628 628 617.255 628 604V420C628 406.745 617.255 396 604 396H420Z' fill='white'/%3E %3C/svg%3E `;case"circle":return r=t,`data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='${t}' height='${r}' viewBox='0 0 999.81 999.81'%3E%3Cdefs%3E%3Cstyle%3E.cls-1%7Bfill:%230052fe;%7D.cls-2%7Bfill:%23fefefe;%7D.cls-3%7Bfill:%230152fe;%7D%3C/style%3E%3C/defs%3E%3Cpath class='cls-1' d='M655-115.9h56c.83,1.59,2.36.88,3.56,1a478,478,0,0,1,75.06,10.42C891.4-81.76,978.33-32.58,1049.19,44q116.7,126,131.94,297.61c.38,4.14-.34,8.53,1.78,12.45v59c-1.58.84-.91,2.35-1,3.56a482.05,482.05,0,0,1-10.38,74.05c-24,106.72-76.64,196.76-158.83,268.93s-178.18,112.82-287.2,122.6c-4.83.43-9.86-.25-14.51,1.77H654c-1-1.68-2.69-.91-4.06-1a496.89,496.89,0,0,1-105.9-18.59c-93.54-27.42-172.78-77.59-236.91-150.94Q199.34,590.1,184.87,426.58c-.47-5.19.25-10.56-1.77-15.59V355c1.68-1,.91-2.7,1-4.06a498.12,498.12,0,0,1,18.58-105.9c26-88.75,72.64-164.9,140.6-227.57q126-116.27,297.21-131.61C645.32-114.57,650.35-113.88,655-115.9Zm377.92,500c0-192.44-156.31-349.49-347.56-350.15-194.13-.68-350.94,155.13-352.29,347.42-1.37,194.55,155.51,352.1,348.56,352.47C876.15,734.23,1032.93,577.84,1032.93,384.11Z' transform='translate(-183.1 115.9)'/%3E%3Cpath class='cls-2' d='M1032.93,384.11c0,193.73-156.78,350.12-351.29,349.74-193-.37-349.93-157.92-348.56-352.47C334.43,189.09,491.24,33.28,685.37,34,876.62,34.62,1032.94,191.67,1032.93,384.11ZM683,496.81q43.74,0,87.48,0c15.55,0,25.32-9.72,25.33-25.21q0-87.48,0-175c0-15.83-9.68-25.46-25.59-25.46H595.77c-15.88,0-25.57,9.64-25.58,25.46q0,87.23,0,174.45c0,16.18,9.59,25.7,25.84,25.71Z' transform='translate(-183.1 115.9)'/%3E%3Cpath class='cls-3' d='M683,496.81H596c-16.25,0-25.84-9.53-25.84-25.71q0-87.23,0-174.45c0-15.82,9.7-25.46,25.58-25.46H770.22c15.91,0,25.59,9.63,25.59,25.46q0,87.47,0,175c0,15.49-9.78,25.2-25.33,25.21Q726.74,496.84,683,496.81Z' transform='translate(-183.1 115.9)'/%3E%3C/svg%3E`;case"text":return r=(.1*t).toFixed(2),`data:image/svg+xml,%3Csvg width='${t}' height='${r}' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 528.15 53.64'%3E%3Cdefs%3E%3Cstyle%3E.cls-1%7Bfill:%230052ff;%7D%3C/style%3E%3C/defs%3E%3Ctitle%3ECoinbase_Wordmark_SubBrands_ALL%3C/title%3E%3Cpath class='cls-1' d='M164.45,15a15,15,0,0,0-11.74,5.4V0h-8.64V52.92h8.5V48a15,15,0,0,0,11.88,5.62c10.37,0,18.21-8.21,18.21-19.3S174.67,15,164.45,15Zm-1.3,30.67c-6.19,0-10.73-4.83-10.73-11.31S157,23,163.22,23s10.66,4.82,10.66,11.37S169.34,45.65,163.15,45.65Zm83.31-14.91-6.34-.93c-3-.43-5.18-1.44-5.18-3.82,0-2.59,2.8-3.89,6.62-3.89,4.18,0,6.84,1.8,7.42,4.76h8.35c-.94-7.49-6.7-11.88-15.55-11.88-9.15,0-15.2,4.68-15.2,11.3,0,6.34,4,10,12,11.16l6.33.94c3.1.43,4.83,1.65,4.83,4,0,2.95-3,4.17-7.2,4.17-5.12,0-8-2.09-8.43-5.25h-8.49c.79,7.27,6.48,12.38,16.84,12.38,9.44,0,15.7-4.32,15.7-11.74C258.12,35.28,253.58,31.82,246.46,30.74Zm-27.65-2.3c0-8.06-4.9-13.46-15.27-13.46-9.79,0-15.26,5-16.34,12.6h8.57c.43-3,2.73-5.4,7.63-5.4,4.39,0,6.55,1.94,6.55,4.32,0,3.09-4,3.88-8.85,4.39-6.63.72-14.84,3-14.84,11.66,0,6.7,5,11,12.89,11,6.19,0,10.08-2.59,12-6.7.28,3.67,3,6.05,6.84,6.05h5v-7.7h-4.25Zm-8.5,9.36c0,5-4.32,8.64-9.57,8.64-3.24,0-6-1.37-6-4.25,0-3.67,4.39-4.68,8.42-5.11s6-1.22,7.13-2.88ZM281.09,15c-11.09,0-19.23,8.35-19.23,19.36,0,11.6,8.72,19.3,19.37,19.3,9,0,16.06-5.33,17.86-12.89h-9c-1.3,3.31-4.47,5.19-8.71,5.19-5.55,0-9.72-3.46-10.66-9.51H299.3V33.12C299.3,22.46,291.53,15,281.09,15Zm-9.87,15.26c1.37-5.18,5.26-7.7,9.72-7.7,4.9,0,8.64,2.8,9.51,7.7ZM19.3,23a9.84,9.84,0,0,1,9.5,7h9.14c-1.65-8.93-9-15-18.57-15A19,19,0,0,0,0,34.34c0,11.09,8.28,19.3,19.37,19.3,9.36,0,16.85-6,18.5-15H28.8a9.75,9.75,0,0,1-9.43,7.06c-6.27,0-10.66-4.83-10.66-11.31S13,23,19.3,23Zm41.11-8A19,19,0,0,0,41,34.34c0,11.09,8.28,19.3,19.37,19.3A19,19,0,0,0,79.92,34.27C79.92,23.33,71.64,15,60.41,15Zm.07,30.67c-6.19,0-10.73-4.83-10.73-11.31S54.22,23,60.41,23s10.8,4.89,10.8,11.37S66.67,45.65,60.48,45.65ZM123.41,15c-5.62,0-9.29,2.3-11.45,5.54V15.7h-8.57V52.92H112V32.69C112,27,115.63,23,121,23c5,0,8.06,3.53,8.06,8.64V52.92h8.64V31C137.66,21.6,132.84,15,123.41,15ZM92,.36a5.36,5.36,0,0,0-5.55,5.47,5.55,5.55,0,0,0,11.09,0A5.35,5.35,0,0,0,92,.36Zm-9.72,23h5.4V52.92h8.64V15.7h-14Zm298.17-7.7L366.2,52.92H372L375.29,44H392l3.33,8.88h6L386.87,15.7ZM377,39.23l6.45-17.56h.1l6.56,17.56ZM362.66,15.7l-7.88,29h-.11l-8.14-29H341l-8,28.93h-.1l-8-28.87H319L329.82,53h5.45l8.19-29.24h.11L352,53h5.66L368.1,15.7Zm135.25,0v4.86h12.32V52.92h5.6V20.56h12.32V15.7ZM467.82,52.92h25.54V48.06H473.43v-12h18.35V31.35H473.43V20.56h19.93V15.7H467.82ZM443,15.7h-5.6V52.92h24.32V48.06H443Zm-30.45,0h-5.61V52.92h24.32V48.06H412.52Z'/%3E%3C/svg%3E`;case"textWithLogo":return r=(.25*t).toFixed(2),`data:image/svg+xml,%3Csvg width='${t}' height='${r}' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 308.44 77.61'%3E%3Cdefs%3E%3Cstyle%3E.cls-1%7Bfill:%230052ff;%7D%3C/style%3E%3C/defs%3E%3Cpath class='cls-1' d='M142.94,20.2l-7.88,29H135l-8.15-29h-5.55l-8,28.93h-.11l-8-28.87H99.27l10.84,37.27h5.44l8.2-29.24h.1l8.41,29.24h5.66L148.39,20.2Zm17.82,0L146.48,57.42h5.82l3.28-8.88h16.65l3.34,8.88h6L167.16,20.2Zm-3.44,23.52,6.45-17.55h.11l6.56,17.55ZM278.2,20.2v4.86h12.32V57.42h5.6V25.06h12.32V20.2ZM248.11,57.42h25.54V52.55H253.71V40.61h18.35V35.85H253.71V25.06h19.94V20.2H248.11ZM223.26,20.2h-5.61V57.42H242V52.55H223.26Zm-30.46,0h-5.6V57.42h24.32V52.55H192.8Zm-154,38A19.41,19.41,0,1,1,57.92,35.57H77.47a38.81,38.81,0,1,0,0,6.47H57.92A19.39,19.39,0,0,1,38.81,58.21Z'/%3E%3C/svg%3E`;case"textLight":return r=(.1*t).toFixed(2),`data:image/svg+xml,%3Csvg width='${t}' height='${r}' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 528.15 53.64'%3E%3Cdefs%3E%3Cstyle%3E.cls-1%7Bfill:%23fefefe;%7D%3C/style%3E%3C/defs%3E%3Ctitle%3ECoinbase_Wordmark_SubBrands_ALL%3C/title%3E%3Cpath class='cls-1' d='M164.45,15a15,15,0,0,0-11.74,5.4V0h-8.64V52.92h8.5V48a15,15,0,0,0,11.88,5.62c10.37,0,18.21-8.21,18.21-19.3S174.67,15,164.45,15Zm-1.3,30.67c-6.19,0-10.73-4.83-10.73-11.31S157,23,163.22,23s10.66,4.82,10.66,11.37S169.34,45.65,163.15,45.65Zm83.31-14.91-6.34-.93c-3-.43-5.18-1.44-5.18-3.82,0-2.59,2.8-3.89,6.62-3.89,4.18,0,6.84,1.8,7.42,4.76h8.35c-.94-7.49-6.7-11.88-15.55-11.88-9.15,0-15.2,4.68-15.2,11.3,0,6.34,4,10,12,11.16l6.33.94c3.1.43,4.83,1.65,4.83,4,0,2.95-3,4.17-7.2,4.17-5.12,0-8-2.09-8.43-5.25h-8.49c.79,7.27,6.48,12.38,16.84,12.38,9.44,0,15.7-4.32,15.7-11.74C258.12,35.28,253.58,31.82,246.46,30.74Zm-27.65-2.3c0-8.06-4.9-13.46-15.27-13.46-9.79,0-15.26,5-16.34,12.6h8.57c.43-3,2.73-5.4,7.63-5.4,4.39,0,6.55,1.94,6.55,4.32,0,3.09-4,3.88-8.85,4.39-6.63.72-14.84,3-14.84,11.66,0,6.7,5,11,12.89,11,6.19,0,10.08-2.59,12-6.7.28,3.67,3,6.05,6.84,6.05h5v-7.7h-4.25Zm-8.5,9.36c0,5-4.32,8.64-9.57,8.64-3.24,0-6-1.37-6-4.25,0-3.67,4.39-4.68,8.42-5.11s6-1.22,7.13-2.88ZM281.09,15c-11.09,0-19.23,8.35-19.23,19.36,0,11.6,8.72,19.3,19.37,19.3,9,0,16.06-5.33,17.86-12.89h-9c-1.3,3.31-4.47,5.19-8.71,5.19-5.55,0-9.72-3.46-10.66-9.51H299.3V33.12C299.3,22.46,291.53,15,281.09,15Zm-9.87,15.26c1.37-5.18,5.26-7.7,9.72-7.7,4.9,0,8.64,2.8,9.51,7.7ZM19.3,23a9.84,9.84,0,0,1,9.5,7h9.14c-1.65-8.93-9-15-18.57-15A19,19,0,0,0,0,34.34c0,11.09,8.28,19.3,19.37,19.3,9.36,0,16.85-6,18.5-15H28.8a9.75,9.75,0,0,1-9.43,7.06c-6.27,0-10.66-4.83-10.66-11.31S13,23,19.3,23Zm41.11-8A19,19,0,0,0,41,34.34c0,11.09,8.28,19.3,19.37,19.3A19,19,0,0,0,79.92,34.27C79.92,23.33,71.64,15,60.41,15Zm.07,30.67c-6.19,0-10.73-4.83-10.73-11.31S54.22,23,60.41,23s10.8,4.89,10.8,11.37S66.67,45.65,60.48,45.65ZM123.41,15c-5.62,0-9.29,2.3-11.45,5.54V15.7h-8.57V52.92H112V32.69C112,27,115.63,23,121,23c5,0,8.06,3.53,8.06,8.64V52.92h8.64V31C137.66,21.6,132.84,15,123.41,15ZM92,.36a5.36,5.36,0,0,0-5.55,5.47,5.55,5.55,0,0,0,11.09,0A5.35,5.35,0,0,0,92,.36Zm-9.72,23h5.4V52.92h8.64V15.7h-14Zm298.17-7.7L366.2,52.92H372L375.29,44H392l3.33,8.88h6L386.87,15.7ZM377,39.23l6.45-17.56h.1l6.56,17.56ZM362.66,15.7l-7.88,29h-.11l-8.14-29H341l-8,28.93h-.1l-8-28.87H319L329.82,53h5.45l8.19-29.24h.11L352,53h5.66L368.1,15.7Zm135.25,0v4.86h12.32V52.92h5.6V20.56h12.32V15.7ZM467.82,52.92h25.54V48.06H473.43v-12h18.35V31.35H473.43V20.56h19.93V15.7H467.82ZM443,15.7h-5.6V52.92h24.32V48.06H443Zm-30.45,0h-5.61V52.92h24.32V48.06H412.52Z'/%3E%3C/svg%3E`;case"textWithLogoLight":return r=(.25*t).toFixed(2),`data:image/svg+xml,%3Csvg width='${t}' height='${r}' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 308.44 77.61'%3E%3Cdefs%3E%3Cstyle%3E.cls-1%7Bfill:%23fefefe;%7D%3C/style%3E%3C/defs%3E%3Cpath class='cls-1' d='M142.94,20.2l-7.88,29H135l-8.15-29h-5.55l-8,28.93h-.11l-8-28.87H99.27l10.84,37.27h5.44l8.2-29.24h.1l8.41,29.24h5.66L148.39,20.2Zm17.82,0L146.48,57.42h5.82l3.28-8.88h16.65l3.34,8.88h6L167.16,20.2Zm-3.44,23.52,6.45-17.55h.11l6.56,17.55ZM278.2,20.2v4.86h12.32V57.42h5.6V25.06h12.32V20.2ZM248.11,57.42h25.54V52.55H253.71V40.61h18.35V35.85H253.71V25.06h19.94V20.2H248.11ZM223.26,20.2h-5.61V57.42H242V52.55H223.26Zm-30.46,0h-5.6V57.42h24.32V52.55H192.8Zm-154,38A19.41,19.41,0,1,1,57.92,35.57H77.47a38.81,38.81,0,1,0,0,6.47H57.92A19.39,19.39,0,0,1,38.81,58.21Z'/%3E%3C/svg%3E`;default:return r=t,`data:image/svg+xml,%3Csvg width='${t}' height='${r}' viewBox='0 0 1024 1024' fill='none' xmlns='http://www.w3.org/2000/svg'%3E %3Crect width='1024' height='1024' fill='%230052FF'/%3E %3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M152 512C152 710.823 313.177 872 512 872C710.823 872 872 710.823 872 512C872 313.177 710.823 152 512 152C313.177 152 152 313.177 152 512ZM420 396C406.745 396 396 406.745 396 420V604C396 617.255 406.745 628 420 628H604C617.255 628 628 617.255 628 604V420C628 406.745 617.255 396 604 396H420Z' fill='white'/%3E %3C/svg%3E `}};oi.walletLogo=hu;var ai={};Object.defineProperty(ai,"__esModule",{value:!0});ai.LINK_API_URL=void 0;ai.LINK_API_URL="https://www.walletlink.org";var q={},Vs={exports:{}};Vs.exports;(function(e){(function(t,r){function n(S,o){if(!S)throw new Error(o||"Assertion failed")}function i(S,o){S.super_=o;var u=function(){};u.prototype=o.prototype,S.prototype=new u,S.prototype.constructor=S}function s(S,o,u){if(s.isBN(S))return S;this.negative=0,this.words=null,this.length=0,this.red=null,S!==null&&((o==="le"||o==="be")&&(u=o,o=10),this._init(S||0,o||10,u||"be"))}typeof t=="object"?t.exports=s:r.BN=s,s.BN=s,s.wordSize=26;var a;try{typeof window<"u"&&typeof window.Buffer<"u"?a=window.Buffer:a=Ws.Buffer}catch{}s.isBN=function(o){return o instanceof s?!0:o!==null&&typeof o=="object"&&o.constructor.wordSize===s.wordSize&&Array.isArray(o.words)},s.max=function(o,u){return o.cmp(u)>0?o:u},s.min=function(o,u){return o.cmp(u)<0?o:u},s.prototype._init=function(o,u,f){if(typeof o=="number")return this._initNumber(o,u,f);if(typeof o=="object")return this._initArray(o,u,f);u==="hex"&&(u=16),n(u===(u|0)&&u>=2&&u<=36),o=o.toString().replace(/\s+/g,"");var p=0;o[0]==="-"&&(p++,this.negative=1),p=0;p-=3)E=o[p]|o[p-1]<<8|o[p-2]<<16,this.words[v]|=E<>>26-k&67108863,k+=24,k>=26&&(k-=26,v++);else if(f==="le")for(p=0,v=0;p>>26-k&67108863,k+=24,k>=26&&(k-=26,v++);return this._strip()};function l(S,o){var u=S.charCodeAt(o);if(u>=48&&u<=57)return u-48;if(u>=65&&u<=70)return u-55;if(u>=97&&u<=102)return u-87;n(!1,"Invalid character in "+S)}function d(S,o,u){var f=l(S,u);return u-1>=o&&(f|=l(S,u-1)<<4),f}s.prototype._parseHex=function(o,u,f){this.length=Math.ceil((o.length-u)/6),this.words=new Array(this.length);for(var p=0;p=u;p-=2)k=d(o,u,p)<=18?(v-=18,E+=1,this.words[E]|=k>>>26):v+=8;else{var g=o.length-u;for(p=g%2===0?u+1:u;p=18?(v-=18,E+=1,this.words[E]|=k>>>26):v+=8}this._strip()};function h(S,o,u,f){for(var p=0,v=0,E=Math.min(S.length,u),k=o;k=49?v=g-49+10:g>=17?v=g-17+10:v=g,n(g>=0&&v1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},s.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},typeof Symbol<"u"&&typeof Symbol.for=="function")try{s.prototype[Symbol.for("nodejs.util.inspect.custom")]=R}catch{s.prototype.inspect=R}else s.prototype.inspect=R;function R(){return(this.red?""}var y=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],C=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],x=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];s.prototype.toString=function(o,u){o=o||10,u=u|0||1;var f;if(o===16||o==="hex"){f="";for(var p=0,v=0,E=0;E>>24-p&16777215,p+=2,p>=26&&(p-=26,E--),v!==0||E!==this.length-1?f=y[6-g.length]+g+f:f=g+f}for(v!==0&&(f=v.toString(16)+f);f.length%u!==0;)f="0"+f;return this.negative!==0&&(f="-"+f),f}if(o===(o|0)&&o>=2&&o<=36){var c=C[o],w=x[o];f="";var U=this.clone();for(U.negative=0;!U.isZero();){var H=U.modrn(w).toString(o);U=U.idivn(w),U.isZero()?f=H+f:f=y[c-H.length]+H+f}for(this.isZero()&&(f="0"+f);f.length%u!==0;)f="0"+f;return this.negative!==0&&(f="-"+f),f}n(!1,"Base should be between 2 and 36")},s.prototype.toNumber=function(){var o=this.words[0];return this.length===2?o+=this.words[1]*67108864:this.length===3&&this.words[2]===1?o+=4503599627370496+this.words[1]*67108864:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-o:o},s.prototype.toJSON=function(){return this.toString(16,2)},a&&(s.prototype.toBuffer=function(o,u){return this.toArrayLike(a,o,u)}),s.prototype.toArray=function(o,u){return this.toArrayLike(Array,o,u)};var B=function(o,u){return o.allocUnsafe?o.allocUnsafe(u):new o(u)};s.prototype.toArrayLike=function(o,u,f){this._strip();var p=this.byteLength(),v=f||Math.max(1,p);n(p<=v,"byte array longer than desired length"),n(v>0,"Requested array length <= 0");var E=B(o,v),k=u==="le"?"LE":"BE";return this["_toArrayLike"+k](E,p),E},s.prototype._toArrayLikeLE=function(o,u){for(var f=0,p=0,v=0,E=0;v>8&255),f>16&255),E===6?(f>24&255),p=0,E=0):(p=k>>>24,E+=2)}if(f=0&&(o[f--]=k>>8&255),f>=0&&(o[f--]=k>>16&255),E===6?(f>=0&&(o[f--]=k>>24&255),p=0,E=0):(p=k>>>24,E+=2)}if(f>=0)for(o[f--]=p;f>=0;)o[f--]=0},Math.clz32?s.prototype._countBits=function(o){return 32-Math.clz32(o)}:s.prototype._countBits=function(o){var u=o,f=0;return u>=4096&&(f+=13,u>>>=13),u>=64&&(f+=7,u>>>=7),u>=8&&(f+=4,u>>>=4),u>=2&&(f+=2,u>>>=2),f+u},s.prototype._zeroBits=function(o){if(o===0)return 26;var u=o,f=0;return u&8191||(f+=13,u>>>=13),u&127||(f+=7,u>>>=7),u&15||(f+=4,u>>>=4),u&3||(f+=2,u>>>=2),u&1||f++,f},s.prototype.bitLength=function(){var o=this.words[this.length-1],u=this._countBits(o);return(this.length-1)*26+u};function O(S){for(var o=new Array(S.bitLength()),u=0;u>>p&1}return o}s.prototype.zeroBits=function(){if(this.isZero())return 0;for(var o=0,u=0;uo.length?this.clone().ior(o):o.clone().ior(this)},s.prototype.uor=function(o){return this.length>o.length?this.clone().iuor(o):o.clone().iuor(this)},s.prototype.iuand=function(o){var u;this.length>o.length?u=o:u=this;for(var f=0;fo.length?this.clone().iand(o):o.clone().iand(this)},s.prototype.uand=function(o){return this.length>o.length?this.clone().iuand(o):o.clone().iuand(this)},s.prototype.iuxor=function(o){var u,f;this.length>o.length?(u=this,f=o):(u=o,f=this);for(var p=0;po.length?this.clone().ixor(o):o.clone().ixor(this)},s.prototype.uxor=function(o){return this.length>o.length?this.clone().iuxor(o):o.clone().iuxor(this)},s.prototype.inotn=function(o){n(typeof o=="number"&&o>=0);var u=Math.ceil(o/26)|0,f=o%26;this._expand(u),f>0&&u--;for(var p=0;p0&&(this.words[p]=~this.words[p]&67108863>>26-f),this._strip()},s.prototype.notn=function(o){return this.clone().inotn(o)},s.prototype.setn=function(o,u){n(typeof o=="number"&&o>=0);var f=o/26|0,p=o%26;return this._expand(f+1),u?this.words[f]=this.words[f]|1<o.length?(f=this,p=o):(f=o,p=this);for(var v=0,E=0;E>>26;for(;v!==0&&E>>26;if(this.length=f.length,v!==0)this.words[this.length]=v,this.length++;else if(f!==this)for(;Eo.length?this.clone().iadd(o):o.clone().iadd(this)},s.prototype.isub=function(o){if(o.negative!==0){o.negative=0;var u=this.iadd(o);return o.negative=1,u._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(o),this.negative=1,this._normSign();var f=this.cmp(o);if(f===0)return this.negative=0,this.length=1,this.words[0]=0,this;var p,v;f>0?(p=this,v=o):(p=o,v=this);for(var E=0,k=0;k>26,this.words[k]=u&67108863;for(;E!==0&&k>26,this.words[k]=u&67108863;if(E===0&&k>>26,U=g&67108863,H=Math.min(c,o.length-1),V=Math.max(0,c-S.length+1);V<=H;V++){var A=c-V|0;p=S.words[A]|0,v=o.words[V]|0,E=p*v+U,w+=E/67108864|0,U=E&67108863}u.words[c]=U|0,g=w|0}return g!==0?u.words[c]=g|0:u.length--,u._strip()}var T=function(o,u,f){var p=o.words,v=u.words,E=f.words,k=0,g,c,w,U=p[0]|0,H=U&8191,V=U>>>13,A=p[1]|0,I=A&8191,$=A>>>13,K=p[2]|0,G=K&8191,b=K>>>13,_=p[3]|0,P=_&8191,j=_>>>13,ue=p[4]|0,J=ue&8191,Y=ue>>>13,at=p[5]|0,he=at&8191,pe=at>>>13,Ht=p[6]|0,ge=Ht&8191,de=Ht>>>13,xt=p[7]|0,fe=xt&8191,le=xt>>>13,nt=p[8]|0,ce=nt&8191,me=nt>>>13,wr=p[9]|0,ve=wr&8191,be=wr>>>13,_r=v[0]|0,we=_r&8191,_e=_r>>>13,yr=v[1]|0,ye=yr&8191,Ee=yr>>>13,Er=v[2]|0,Se=Er&8191,Re=Er>>>13,Sr=v[3]|0,Me=Sr&8191,ke=Sr>>>13,Rr=v[4]|0,Ce=Rr&8191,Ie=Rr>>>13,Mr=v[5]|0,xe=Mr&8191,Ae=Mr>>>13,kr=v[6]|0,Te=kr&8191,Ne=kr>>>13,Cr=v[7]|0,Le=Cr&8191,Oe=Cr>>>13,Ir=v[8]|0,Pe=Ir&8191,$e=Ir>>>13,xr=v[9]|0,Be=xr&8191,De=xr>>>13;f.negative=o.negative^u.negative,f.length=19,g=Math.imul(H,we),c=Math.imul(H,_e),c=c+Math.imul(V,we)|0,w=Math.imul(V,_e);var Ut=(k+g|0)+((c&8191)<<13)|0;k=(w+(c>>>13)|0)+(Ut>>>26)|0,Ut&=67108863,g=Math.imul(I,we),c=Math.imul(I,_e),c=c+Math.imul($,we)|0,w=Math.imul($,_e),g=g+Math.imul(H,ye)|0,c=c+Math.imul(H,Ee)|0,c=c+Math.imul(V,ye)|0,w=w+Math.imul(V,Ee)|0;var Wt=(k+g|0)+((c&8191)<<13)|0;k=(w+(c>>>13)|0)+(Wt>>>26)|0,Wt&=67108863,g=Math.imul(G,we),c=Math.imul(G,_e),c=c+Math.imul(b,we)|0,w=Math.imul(b,_e),g=g+Math.imul(I,ye)|0,c=c+Math.imul(I,Ee)|0,c=c+Math.imul($,ye)|0,w=w+Math.imul($,Ee)|0,g=g+Math.imul(H,Se)|0,c=c+Math.imul(H,Re)|0,c=c+Math.imul(V,Se)|0,w=w+Math.imul(V,Re)|0;var Vt=(k+g|0)+((c&8191)<<13)|0;k=(w+(c>>>13)|0)+(Vt>>>26)|0,Vt&=67108863,g=Math.imul(P,we),c=Math.imul(P,_e),c=c+Math.imul(j,we)|0,w=Math.imul(j,_e),g=g+Math.imul(G,ye)|0,c=c+Math.imul(G,Ee)|0,c=c+Math.imul(b,ye)|0,w=w+Math.imul(b,Ee)|0,g=g+Math.imul(I,Se)|0,c=c+Math.imul(I,Re)|0,c=c+Math.imul($,Se)|0,w=w+Math.imul($,Re)|0,g=g+Math.imul(H,Me)|0,c=c+Math.imul(H,ke)|0,c=c+Math.imul(V,Me)|0,w=w+Math.imul(V,ke)|0;var zt=(k+g|0)+((c&8191)<<13)|0;k=(w+(c>>>13)|0)+(zt>>>26)|0,zt&=67108863,g=Math.imul(J,we),c=Math.imul(J,_e),c=c+Math.imul(Y,we)|0,w=Math.imul(Y,_e),g=g+Math.imul(P,ye)|0,c=c+Math.imul(P,Ee)|0,c=c+Math.imul(j,ye)|0,w=w+Math.imul(j,Ee)|0,g=g+Math.imul(G,Se)|0,c=c+Math.imul(G,Re)|0,c=c+Math.imul(b,Se)|0,w=w+Math.imul(b,Re)|0,g=g+Math.imul(I,Me)|0,c=c+Math.imul(I,ke)|0,c=c+Math.imul($,Me)|0,w=w+Math.imul($,ke)|0,g=g+Math.imul(H,Ce)|0,c=c+Math.imul(H,Ie)|0,c=c+Math.imul(V,Ce)|0,w=w+Math.imul(V,Ie)|0;var qt=(k+g|0)+((c&8191)<<13)|0;k=(w+(c>>>13)|0)+(qt>>>26)|0,qt&=67108863,g=Math.imul(he,we),c=Math.imul(he,_e),c=c+Math.imul(pe,we)|0,w=Math.imul(pe,_e),g=g+Math.imul(J,ye)|0,c=c+Math.imul(J,Ee)|0,c=c+Math.imul(Y,ye)|0,w=w+Math.imul(Y,Ee)|0,g=g+Math.imul(P,Se)|0,c=c+Math.imul(P,Re)|0,c=c+Math.imul(j,Se)|0,w=w+Math.imul(j,Re)|0,g=g+Math.imul(G,Me)|0,c=c+Math.imul(G,ke)|0,c=c+Math.imul(b,Me)|0,w=w+Math.imul(b,ke)|0,g=g+Math.imul(I,Ce)|0,c=c+Math.imul(I,Ie)|0,c=c+Math.imul($,Ce)|0,w=w+Math.imul($,Ie)|0,g=g+Math.imul(H,xe)|0,c=c+Math.imul(H,Ae)|0,c=c+Math.imul(V,xe)|0,w=w+Math.imul(V,Ae)|0;var Jt=(k+g|0)+((c&8191)<<13)|0;k=(w+(c>>>13)|0)+(Jt>>>26)|0,Jt&=67108863,g=Math.imul(ge,we),c=Math.imul(ge,_e),c=c+Math.imul(de,we)|0,w=Math.imul(de,_e),g=g+Math.imul(he,ye)|0,c=c+Math.imul(he,Ee)|0,c=c+Math.imul(pe,ye)|0,w=w+Math.imul(pe,Ee)|0,g=g+Math.imul(J,Se)|0,c=c+Math.imul(J,Re)|0,c=c+Math.imul(Y,Se)|0,w=w+Math.imul(Y,Re)|0,g=g+Math.imul(P,Me)|0,c=c+Math.imul(P,ke)|0,c=c+Math.imul(j,Me)|0,w=w+Math.imul(j,ke)|0,g=g+Math.imul(G,Ce)|0,c=c+Math.imul(G,Ie)|0,c=c+Math.imul(b,Ce)|0,w=w+Math.imul(b,Ie)|0,g=g+Math.imul(I,xe)|0,c=c+Math.imul(I,Ae)|0,c=c+Math.imul($,xe)|0,w=w+Math.imul($,Ae)|0,g=g+Math.imul(H,Te)|0,c=c+Math.imul(H,Ne)|0,c=c+Math.imul(V,Te)|0,w=w+Math.imul(V,Ne)|0;var Gt=(k+g|0)+((c&8191)<<13)|0;k=(w+(c>>>13)|0)+(Gt>>>26)|0,Gt&=67108863,g=Math.imul(fe,we),c=Math.imul(fe,_e),c=c+Math.imul(le,we)|0,w=Math.imul(le,_e),g=g+Math.imul(ge,ye)|0,c=c+Math.imul(ge,Ee)|0,c=c+Math.imul(de,ye)|0,w=w+Math.imul(de,Ee)|0,g=g+Math.imul(he,Se)|0,c=c+Math.imul(he,Re)|0,c=c+Math.imul(pe,Se)|0,w=w+Math.imul(pe,Re)|0,g=g+Math.imul(J,Me)|0,c=c+Math.imul(J,ke)|0,c=c+Math.imul(Y,Me)|0,w=w+Math.imul(Y,ke)|0,g=g+Math.imul(P,Ce)|0,c=c+Math.imul(P,Ie)|0,c=c+Math.imul(j,Ce)|0,w=w+Math.imul(j,Ie)|0,g=g+Math.imul(G,xe)|0,c=c+Math.imul(G,Ae)|0,c=c+Math.imul(b,xe)|0,w=w+Math.imul(b,Ae)|0,g=g+Math.imul(I,Te)|0,c=c+Math.imul(I,Ne)|0,c=c+Math.imul($,Te)|0,w=w+Math.imul($,Ne)|0,g=g+Math.imul(H,Le)|0,c=c+Math.imul(H,Oe)|0,c=c+Math.imul(V,Le)|0,w=w+Math.imul(V,Oe)|0;var Zt=(k+g|0)+((c&8191)<<13)|0;k=(w+(c>>>13)|0)+(Zt>>>26)|0,Zt&=67108863,g=Math.imul(ce,we),c=Math.imul(ce,_e),c=c+Math.imul(me,we)|0,w=Math.imul(me,_e),g=g+Math.imul(fe,ye)|0,c=c+Math.imul(fe,Ee)|0,c=c+Math.imul(le,ye)|0,w=w+Math.imul(le,Ee)|0,g=g+Math.imul(ge,Se)|0,c=c+Math.imul(ge,Re)|0,c=c+Math.imul(de,Se)|0,w=w+Math.imul(de,Re)|0,g=g+Math.imul(he,Me)|0,c=c+Math.imul(he,ke)|0,c=c+Math.imul(pe,Me)|0,w=w+Math.imul(pe,ke)|0,g=g+Math.imul(J,Ce)|0,c=c+Math.imul(J,Ie)|0,c=c+Math.imul(Y,Ce)|0,w=w+Math.imul(Y,Ie)|0,g=g+Math.imul(P,xe)|0,c=c+Math.imul(P,Ae)|0,c=c+Math.imul(j,xe)|0,w=w+Math.imul(j,Ae)|0,g=g+Math.imul(G,Te)|0,c=c+Math.imul(G,Ne)|0,c=c+Math.imul(b,Te)|0,w=w+Math.imul(b,Ne)|0,g=g+Math.imul(I,Le)|0,c=c+Math.imul(I,Oe)|0,c=c+Math.imul($,Le)|0,w=w+Math.imul($,Oe)|0,g=g+Math.imul(H,Pe)|0,c=c+Math.imul(H,$e)|0,c=c+Math.imul(V,Pe)|0,w=w+Math.imul(V,$e)|0;var Kt=(k+g|0)+((c&8191)<<13)|0;k=(w+(c>>>13)|0)+(Kt>>>26)|0,Kt&=67108863,g=Math.imul(ve,we),c=Math.imul(ve,_e),c=c+Math.imul(be,we)|0,w=Math.imul(be,_e),g=g+Math.imul(ce,ye)|0,c=c+Math.imul(ce,Ee)|0,c=c+Math.imul(me,ye)|0,w=w+Math.imul(me,Ee)|0,g=g+Math.imul(fe,Se)|0,c=c+Math.imul(fe,Re)|0,c=c+Math.imul(le,Se)|0,w=w+Math.imul(le,Re)|0,g=g+Math.imul(ge,Me)|0,c=c+Math.imul(ge,ke)|0,c=c+Math.imul(de,Me)|0,w=w+Math.imul(de,ke)|0,g=g+Math.imul(he,Ce)|0,c=c+Math.imul(he,Ie)|0,c=c+Math.imul(pe,Ce)|0,w=w+Math.imul(pe,Ie)|0,g=g+Math.imul(J,xe)|0,c=c+Math.imul(J,Ae)|0,c=c+Math.imul(Y,xe)|0,w=w+Math.imul(Y,Ae)|0,g=g+Math.imul(P,Te)|0,c=c+Math.imul(P,Ne)|0,c=c+Math.imul(j,Te)|0,w=w+Math.imul(j,Ne)|0,g=g+Math.imul(G,Le)|0,c=c+Math.imul(G,Oe)|0,c=c+Math.imul(b,Le)|0,w=w+Math.imul(b,Oe)|0,g=g+Math.imul(I,Pe)|0,c=c+Math.imul(I,$e)|0,c=c+Math.imul($,Pe)|0,w=w+Math.imul($,$e)|0,g=g+Math.imul(H,Be)|0,c=c+Math.imul(H,De)|0,c=c+Math.imul(V,Be)|0,w=w+Math.imul(V,De)|0;var Qt=(k+g|0)+((c&8191)<<13)|0;k=(w+(c>>>13)|0)+(Qt>>>26)|0,Qt&=67108863,g=Math.imul(ve,ye),c=Math.imul(ve,Ee),c=c+Math.imul(be,ye)|0,w=Math.imul(be,Ee),g=g+Math.imul(ce,Se)|0,c=c+Math.imul(ce,Re)|0,c=c+Math.imul(me,Se)|0,w=w+Math.imul(me,Re)|0,g=g+Math.imul(fe,Me)|0,c=c+Math.imul(fe,ke)|0,c=c+Math.imul(le,Me)|0,w=w+Math.imul(le,ke)|0,g=g+Math.imul(ge,Ce)|0,c=c+Math.imul(ge,Ie)|0,c=c+Math.imul(de,Ce)|0,w=w+Math.imul(de,Ie)|0,g=g+Math.imul(he,xe)|0,c=c+Math.imul(he,Ae)|0,c=c+Math.imul(pe,xe)|0,w=w+Math.imul(pe,Ae)|0,g=g+Math.imul(J,Te)|0,c=c+Math.imul(J,Ne)|0,c=c+Math.imul(Y,Te)|0,w=w+Math.imul(Y,Ne)|0,g=g+Math.imul(P,Le)|0,c=c+Math.imul(P,Oe)|0,c=c+Math.imul(j,Le)|0,w=w+Math.imul(j,Oe)|0,g=g+Math.imul(G,Pe)|0,c=c+Math.imul(G,$e)|0,c=c+Math.imul(b,Pe)|0,w=w+Math.imul(b,$e)|0,g=g+Math.imul(I,Be)|0,c=c+Math.imul(I,De)|0,c=c+Math.imul($,Be)|0,w=w+Math.imul($,De)|0;var Yt=(k+g|0)+((c&8191)<<13)|0;k=(w+(c>>>13)|0)+(Yt>>>26)|0,Yt&=67108863,g=Math.imul(ve,Se),c=Math.imul(ve,Re),c=c+Math.imul(be,Se)|0,w=Math.imul(be,Re),g=g+Math.imul(ce,Me)|0,c=c+Math.imul(ce,ke)|0,c=c+Math.imul(me,Me)|0,w=w+Math.imul(me,ke)|0,g=g+Math.imul(fe,Ce)|0,c=c+Math.imul(fe,Ie)|0,c=c+Math.imul(le,Ce)|0,w=w+Math.imul(le,Ie)|0,g=g+Math.imul(ge,xe)|0,c=c+Math.imul(ge,Ae)|0,c=c+Math.imul(de,xe)|0,w=w+Math.imul(de,Ae)|0,g=g+Math.imul(he,Te)|0,c=c+Math.imul(he,Ne)|0,c=c+Math.imul(pe,Te)|0,w=w+Math.imul(pe,Ne)|0,g=g+Math.imul(J,Le)|0,c=c+Math.imul(J,Oe)|0,c=c+Math.imul(Y,Le)|0,w=w+Math.imul(Y,Oe)|0,g=g+Math.imul(P,Pe)|0,c=c+Math.imul(P,$e)|0,c=c+Math.imul(j,Pe)|0,w=w+Math.imul(j,$e)|0,g=g+Math.imul(G,Be)|0,c=c+Math.imul(G,De)|0,c=c+Math.imul(b,Be)|0,w=w+Math.imul(b,De)|0;var Xt=(k+g|0)+((c&8191)<<13)|0;k=(w+(c>>>13)|0)+(Xt>>>26)|0,Xt&=67108863,g=Math.imul(ve,Me),c=Math.imul(ve,ke),c=c+Math.imul(be,Me)|0,w=Math.imul(be,ke),g=g+Math.imul(ce,Ce)|0,c=c+Math.imul(ce,Ie)|0,c=c+Math.imul(me,Ce)|0,w=w+Math.imul(me,Ie)|0,g=g+Math.imul(fe,xe)|0,c=c+Math.imul(fe,Ae)|0,c=c+Math.imul(le,xe)|0,w=w+Math.imul(le,Ae)|0,g=g+Math.imul(ge,Te)|0,c=c+Math.imul(ge,Ne)|0,c=c+Math.imul(de,Te)|0,w=w+Math.imul(de,Ne)|0,g=g+Math.imul(he,Le)|0,c=c+Math.imul(he,Oe)|0,c=c+Math.imul(pe,Le)|0,w=w+Math.imul(pe,Oe)|0,g=g+Math.imul(J,Pe)|0,c=c+Math.imul(J,$e)|0,c=c+Math.imul(Y,Pe)|0,w=w+Math.imul(Y,$e)|0,g=g+Math.imul(P,Be)|0,c=c+Math.imul(P,De)|0,c=c+Math.imul(j,Be)|0,w=w+Math.imul(j,De)|0;var er=(k+g|0)+((c&8191)<<13)|0;k=(w+(c>>>13)|0)+(er>>>26)|0,er&=67108863,g=Math.imul(ve,Ce),c=Math.imul(ve,Ie),c=c+Math.imul(be,Ce)|0,w=Math.imul(be,Ie),g=g+Math.imul(ce,xe)|0,c=c+Math.imul(ce,Ae)|0,c=c+Math.imul(me,xe)|0,w=w+Math.imul(me,Ae)|0,g=g+Math.imul(fe,Te)|0,c=c+Math.imul(fe,Ne)|0,c=c+Math.imul(le,Te)|0,w=w+Math.imul(le,Ne)|0,g=g+Math.imul(ge,Le)|0,c=c+Math.imul(ge,Oe)|0,c=c+Math.imul(de,Le)|0,w=w+Math.imul(de,Oe)|0,g=g+Math.imul(he,Pe)|0,c=c+Math.imul(he,$e)|0,c=c+Math.imul(pe,Pe)|0,w=w+Math.imul(pe,$e)|0,g=g+Math.imul(J,Be)|0,c=c+Math.imul(J,De)|0,c=c+Math.imul(Y,Be)|0,w=w+Math.imul(Y,De)|0;var tr=(k+g|0)+((c&8191)<<13)|0;k=(w+(c>>>13)|0)+(tr>>>26)|0,tr&=67108863,g=Math.imul(ve,xe),c=Math.imul(ve,Ae),c=c+Math.imul(be,xe)|0,w=Math.imul(be,Ae),g=g+Math.imul(ce,Te)|0,c=c+Math.imul(ce,Ne)|0,c=c+Math.imul(me,Te)|0,w=w+Math.imul(me,Ne)|0,g=g+Math.imul(fe,Le)|0,c=c+Math.imul(fe,Oe)|0,c=c+Math.imul(le,Le)|0,w=w+Math.imul(le,Oe)|0,g=g+Math.imul(ge,Pe)|0,c=c+Math.imul(ge,$e)|0,c=c+Math.imul(de,Pe)|0,w=w+Math.imul(de,$e)|0,g=g+Math.imul(he,Be)|0,c=c+Math.imul(he,De)|0,c=c+Math.imul(pe,Be)|0,w=w+Math.imul(pe,De)|0;var rs=(k+g|0)+((c&8191)<<13)|0;k=(w+(c>>>13)|0)+(rs>>>26)|0,rs&=67108863,g=Math.imul(ve,Te),c=Math.imul(ve,Ne),c=c+Math.imul(be,Te)|0,w=Math.imul(be,Ne),g=g+Math.imul(ce,Le)|0,c=c+Math.imul(ce,Oe)|0,c=c+Math.imul(me,Le)|0,w=w+Math.imul(me,Oe)|0,g=g+Math.imul(fe,Pe)|0,c=c+Math.imul(fe,$e)|0,c=c+Math.imul(le,Pe)|0,w=w+Math.imul(le,$e)|0,g=g+Math.imul(ge,Be)|0,c=c+Math.imul(ge,De)|0,c=c+Math.imul(de,Be)|0,w=w+Math.imul(de,De)|0;var ns=(k+g|0)+((c&8191)<<13)|0;k=(w+(c>>>13)|0)+(ns>>>26)|0,ns&=67108863,g=Math.imul(ve,Le),c=Math.imul(ve,Oe),c=c+Math.imul(be,Le)|0,w=Math.imul(be,Oe),g=g+Math.imul(ce,Pe)|0,c=c+Math.imul(ce,$e)|0,c=c+Math.imul(me,Pe)|0,w=w+Math.imul(me,$e)|0,g=g+Math.imul(fe,Be)|0,c=c+Math.imul(fe,De)|0,c=c+Math.imul(le,Be)|0,w=w+Math.imul(le,De)|0;var is=(k+g|0)+((c&8191)<<13)|0;k=(w+(c>>>13)|0)+(is>>>26)|0,is&=67108863,g=Math.imul(ve,Pe),c=Math.imul(ve,$e),c=c+Math.imul(be,Pe)|0,w=Math.imul(be,$e),g=g+Math.imul(ce,Be)|0,c=c+Math.imul(ce,De)|0,c=c+Math.imul(me,Be)|0,w=w+Math.imul(me,De)|0;var ss=(k+g|0)+((c&8191)<<13)|0;k=(w+(c>>>13)|0)+(ss>>>26)|0,ss&=67108863,g=Math.imul(ve,Be),c=Math.imul(ve,De),c=c+Math.imul(be,Be)|0,w=Math.imul(be,De);var os=(k+g|0)+((c&8191)<<13)|0;return k=(w+(c>>>13)|0)+(os>>>26)|0,os&=67108863,E[0]=Ut,E[1]=Wt,E[2]=Vt,E[3]=zt,E[4]=qt,E[5]=Jt,E[6]=Gt,E[7]=Zt,E[8]=Kt,E[9]=Qt,E[10]=Yt,E[11]=Xt,E[12]=er,E[13]=tr,E[14]=rs,E[15]=ns,E[16]=is,E[17]=ss,E[18]=os,k!==0&&(E[19]=k,f.length++),f};Math.imul||(T=M);function N(S,o,u){u.negative=o.negative^S.negative,u.length=S.length+o.length;for(var f=0,p=0,v=0;v>>26)|0,p+=E>>>26,E&=67108863}u.words[v]=k,f=E,E=p}return f!==0?u.words[v]=f:u.length--,u._strip()}function D(S,o,u){return N(S,o,u)}s.prototype.mulTo=function(o,u){var f,p=this.length+o.length;return this.length===10&&o.length===10?f=T(this,o,u):p<63?f=M(this,o,u):p<1024?f=N(this,o,u):f=D(this,o,u),f},s.prototype.mul=function(o){var u=new s(null);return u.words=new Array(this.length+o.length),this.mulTo(o,u)},s.prototype.mulf=function(o){var u=new s(null);return u.words=new Array(this.length+o.length),D(this,o,u)},s.prototype.imul=function(o){return this.clone().mulTo(o,this)},s.prototype.imuln=function(o){var u=o<0;u&&(o=-o),n(typeof o=="number"),n(o<67108864);for(var f=0,p=0;p>=26,f+=v/67108864|0,f+=E>>>26,this.words[p]=E&67108863}return f!==0&&(this.words[p]=f,this.length++),u?this.ineg():this},s.prototype.muln=function(o){return this.clone().imuln(o)},s.prototype.sqr=function(){return this.mul(this)},s.prototype.isqr=function(){return this.imul(this.clone())},s.prototype.pow=function(o){var u=O(o);if(u.length===0)return new s(1);for(var f=this,p=0;p=0);var u=o%26,f=(o-u)/26,p=67108863>>>26-u<<26-u,v;if(u!==0){var E=0;for(v=0;v>>26-u}E&&(this.words[v]=E,this.length++)}if(f!==0){for(v=this.length-1;v>=0;v--)this.words[v+f]=this.words[v];for(v=0;v=0);var p;u?p=(u-u%26)/26:p=0;var v=o%26,E=Math.min((o-v)/26,this.length),k=67108863^67108863>>>v<E)for(this.length-=E,c=0;c=0&&(w!==0||c>=p);c--){var U=this.words[c]|0;this.words[c]=w<<26-v|U>>>v,w=U&k}return g&&w!==0&&(g.words[g.length++]=w),this.length===0&&(this.words[0]=0,this.length=1),this._strip()},s.prototype.ishrn=function(o,u,f){return n(this.negative===0),this.iushrn(o,u,f)},s.prototype.shln=function(o){return this.clone().ishln(o)},s.prototype.ushln=function(o){return this.clone().iushln(o)},s.prototype.shrn=function(o){return this.clone().ishrn(o)},s.prototype.ushrn=function(o){return this.clone().iushrn(o)},s.prototype.testn=function(o){n(typeof o=="number"&&o>=0);var u=o%26,f=(o-u)/26,p=1<=0);var u=o%26,f=(o-u)/26;if(n(this.negative===0,"imaskn works only with positive numbers"),this.length<=f)return this;if(u!==0&&f++,this.length=Math.min(f,this.length),u!==0){var p=67108863^67108863>>>u<=67108864;u++)this.words[u]-=67108864,u===this.length-1?this.words[u+1]=1:this.words[u+1]++;return this.length=Math.max(this.length,u+1),this},s.prototype.isubn=function(o){if(n(typeof o=="number"),n(o<67108864),o<0)return this.iaddn(-o);if(this.negative!==0)return this.negative=0,this.iaddn(o),this.negative=1,this;if(this.words[0]-=o,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var u=0;u>26)-(g/67108864|0),this.words[v+f]=E&67108863}for(;v>26,this.words[v+f]=E&67108863;if(k===0)return this._strip();for(n(k===-1),k=0,v=0;v>26,this.words[v]=E&67108863;return this.negative=1,this._strip()},s.prototype._wordDiv=function(o,u){var f=this.length-o.length,p=this.clone(),v=o,E=v.words[v.length-1]|0,k=this._countBits(E);f=26-k,f!==0&&(v=v.ushln(f),p.iushln(f),E=v.words[v.length-1]|0);var g=p.length-v.length,c;if(u!=="mod"){c=new s(null),c.length=g+1,c.words=new Array(c.length);for(var w=0;w=0;H--){var V=(p.words[v.length+H]|0)*67108864+(p.words[v.length+H-1]|0);for(V=Math.min(V/E|0,67108863),p._ishlnsubmul(v,V,H);p.negative!==0;)V--,p.negative=0,p._ishlnsubmul(v,1,H),p.isZero()||(p.negative^=1);c&&(c.words[H]=V)}return c&&c._strip(),p._strip(),u!=="div"&&f!==0&&p.iushrn(f),{div:c||null,mod:p}},s.prototype.divmod=function(o,u,f){if(n(!o.isZero()),this.isZero())return{div:new s(0),mod:new s(0)};var p,v,E;return this.negative!==0&&o.negative===0?(E=this.neg().divmod(o,u),u!=="mod"&&(p=E.div.neg()),u!=="div"&&(v=E.mod.neg(),f&&v.negative!==0&&v.iadd(o)),{div:p,mod:v}):this.negative===0&&o.negative!==0?(E=this.divmod(o.neg(),u),u!=="mod"&&(p=E.div.neg()),{div:p,mod:E.mod}):this.negative&o.negative?(E=this.neg().divmod(o.neg(),u),u!=="div"&&(v=E.mod.neg(),f&&v.negative!==0&&v.isub(o)),{div:E.div,mod:v}):o.length>this.length||this.cmp(o)<0?{div:new s(0),mod:this}:o.length===1?u==="div"?{div:this.divn(o.words[0]),mod:null}:u==="mod"?{div:null,mod:new s(this.modrn(o.words[0]))}:{div:this.divn(o.words[0]),mod:new s(this.modrn(o.words[0]))}:this._wordDiv(o,u)},s.prototype.div=function(o){return this.divmod(o,"div",!1).div},s.prototype.mod=function(o){return this.divmod(o,"mod",!1).mod},s.prototype.umod=function(o){return this.divmod(o,"mod",!0).mod},s.prototype.divRound=function(o){var u=this.divmod(o);if(u.mod.isZero())return u.div;var f=u.div.negative!==0?u.mod.isub(o):u.mod,p=o.ushrn(1),v=o.andln(1),E=f.cmp(p);return E<0||v===1&&E===0?u.div:u.div.negative!==0?u.div.isubn(1):u.div.iaddn(1)},s.prototype.modrn=function(o){var u=o<0;u&&(o=-o),n(o<=67108863);for(var f=(1<<26)%o,p=0,v=this.length-1;v>=0;v--)p=(f*p+(this.words[v]|0))%o;return u?-p:p},s.prototype.modn=function(o){return this.modrn(o)},s.prototype.idivn=function(o){var u=o<0;u&&(o=-o),n(o<=67108863);for(var f=0,p=this.length-1;p>=0;p--){var v=(this.words[p]|0)+f*67108864;this.words[p]=v/o|0,f=v%o}return this._strip(),u?this.ineg():this},s.prototype.divn=function(o){return this.clone().idivn(o)},s.prototype.egcd=function(o){n(o.negative===0),n(!o.isZero());var u=this,f=o.clone();u.negative!==0?u=u.umod(o):u=u.clone();for(var p=new s(1),v=new s(0),E=new s(0),k=new s(1),g=0;u.isEven()&&f.isEven();)u.iushrn(1),f.iushrn(1),++g;for(var c=f.clone(),w=u.clone();!u.isZero();){for(var U=0,H=1;!(u.words[0]&H)&&U<26;++U,H<<=1);if(U>0)for(u.iushrn(U);U-- >0;)(p.isOdd()||v.isOdd())&&(p.iadd(c),v.isub(w)),p.iushrn(1),v.iushrn(1);for(var V=0,A=1;!(f.words[0]&A)&&V<26;++V,A<<=1);if(V>0)for(f.iushrn(V);V-- >0;)(E.isOdd()||k.isOdd())&&(E.iadd(c),k.isub(w)),E.iushrn(1),k.iushrn(1);u.cmp(f)>=0?(u.isub(f),p.isub(E),v.isub(k)):(f.isub(u),E.isub(p),k.isub(v))}return{a:E,b:k,gcd:f.iushln(g)}},s.prototype._invmp=function(o){n(o.negative===0),n(!o.isZero());var u=this,f=o.clone();u.negative!==0?u=u.umod(o):u=u.clone();for(var p=new s(1),v=new s(0),E=f.clone();u.cmpn(1)>0&&f.cmpn(1)>0;){for(var k=0,g=1;!(u.words[0]&g)&&k<26;++k,g<<=1);if(k>0)for(u.iushrn(k);k-- >0;)p.isOdd()&&p.iadd(E),p.iushrn(1);for(var c=0,w=1;!(f.words[0]&w)&&c<26;++c,w<<=1);if(c>0)for(f.iushrn(c);c-- >0;)v.isOdd()&&v.iadd(E),v.iushrn(1);u.cmp(f)>=0?(u.isub(f),p.isub(v)):(f.isub(u),v.isub(p))}var U;return u.cmpn(1)===0?U=p:U=v,U.cmpn(0)<0&&U.iadd(o),U},s.prototype.gcd=function(o){if(this.isZero())return o.abs();if(o.isZero())return this.abs();var u=this.clone(),f=o.clone();u.negative=0,f.negative=0;for(var p=0;u.isEven()&&f.isEven();p++)u.iushrn(1),f.iushrn(1);do{for(;u.isEven();)u.iushrn(1);for(;f.isEven();)f.iushrn(1);var v=u.cmp(f);if(v<0){var E=u;u=f,f=E}else if(v===0||f.cmpn(1)===0)break;u.isub(f)}while(!0);return f.iushln(p)},s.prototype.invm=function(o){return this.egcd(o).a.umod(o)},s.prototype.isEven=function(){return(this.words[0]&1)===0},s.prototype.isOdd=function(){return(this.words[0]&1)===1},s.prototype.andln=function(o){return this.words[0]&o},s.prototype.bincn=function(o){n(typeof o=="number");var u=o%26,f=(o-u)/26,p=1<>>26,k&=67108863,this.words[E]=k}return v!==0&&(this.words[E]=v,this.length++),this},s.prototype.isZero=function(){return this.length===1&&this.words[0]===0},s.prototype.cmpn=function(o){var u=o<0;if(this.negative!==0&&!u)return-1;if(this.negative===0&&u)return 1;this._strip();var f;if(this.length>1)f=1;else{u&&(o=-o),n(o<=67108863,"Number is too big");var p=this.words[0]|0;f=p===o?0:po.length)return 1;if(this.length=0;f--){var p=this.words[f]|0,v=o.words[f]|0;if(p!==v){pv&&(u=1);break}}return u},s.prototype.gtn=function(o){return this.cmpn(o)===1},s.prototype.gt=function(o){return this.cmp(o)===1},s.prototype.gten=function(o){return this.cmpn(o)>=0},s.prototype.gte=function(o){return this.cmp(o)>=0},s.prototype.ltn=function(o){return this.cmpn(o)===-1},s.prototype.lt=function(o){return this.cmp(o)===-1},s.prototype.lten=function(o){return this.cmpn(o)<=0},s.prototype.lte=function(o){return this.cmp(o)<=0},s.prototype.eqn=function(o){return this.cmpn(o)===0},s.prototype.eq=function(o){return this.cmp(o)===0},s.red=function(o){return new X(o)},s.prototype.toRed=function(o){return n(!this.red,"Already a number in reduction context"),n(this.negative===0,"red works only with positives"),o.convertTo(this)._forceRed(o)},s.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},s.prototype._forceRed=function(o){return this.red=o,this},s.prototype.forceRed=function(o){return n(!this.red,"Already a number in reduction context"),this._forceRed(o)},s.prototype.redAdd=function(o){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,o)},s.prototype.redIAdd=function(o){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,o)},s.prototype.redSub=function(o){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,o)},s.prototype.redISub=function(o){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,o)},s.prototype.redShl=function(o){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,o)},s.prototype.redMul=function(o){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,o),this.red.mul(this,o)},s.prototype.redIMul=function(o){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,o),this.red.imul(this,o)},s.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},s.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},s.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},s.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},s.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},s.prototype.redPow=function(o){return n(this.red&&!o.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,o)};var L={k256:null,p224:null,p192:null,p25519:null};function F(S,o){this.name=S,this.p=new s(o,16),this.n=this.p.bitLength(),this.k=new s(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}F.prototype._tmp=function(){var o=new s(null);return o.words=new Array(Math.ceil(this.n/13)),o},F.prototype.ireduce=function(o){var u=o,f;do this.split(u,this.tmp),u=this.imulK(u),u=u.iadd(this.tmp),f=u.bitLength();while(f>this.n);var p=f0?u.isub(this.p):u.strip!==void 0?u.strip():u._strip(),u},F.prototype.split=function(o,u){o.iushrn(this.n,0,u)},F.prototype.imulK=function(o){return o.imul(this.k)};function W(){F.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}i(W,F),W.prototype.split=function(o,u){for(var f=4194303,p=Math.min(o.length,9),v=0;v>>22,E=k}E>>>=22,o.words[v-10]=E,E===0&&o.length>10?o.length-=10:o.length-=9},W.prototype.imulK=function(o){o.words[o.length]=0,o.words[o.length+1]=0,o.length+=2;for(var u=0,f=0;f>>=26,o.words[f]=v,u=p}return u!==0&&(o.words[o.length++]=u),o},s._prime=function(o){if(L[o])return L[o];var u;if(o==="k256")u=new W;else if(o==="p224")u=new te;else if(o==="p192")u=new Z;else if(o==="p25519")u=new z;else throw new Error("Unknown prime "+o);return L[o]=u,u};function X(S){if(typeof S=="string"){var o=s._prime(S);this.m=o.p,this.prime=o}else n(S.gtn(1),"modulus must be greater than 1"),this.m=S,this.prime=null}X.prototype._verify1=function(o){n(o.negative===0,"red works only with positives"),n(o.red,"red works only with red numbers")},X.prototype._verify2=function(o,u){n((o.negative|u.negative)===0,"red works only with positives"),n(o.red&&o.red===u.red,"red works only with red numbers")},X.prototype.imod=function(o){return this.prime?this.prime.ireduce(o)._forceRed(this):(m(o,o.umod(this.m)._forceRed(this)),o)},X.prototype.neg=function(o){return o.isZero()?o.clone():this.m.sub(o)._forceRed(this)},X.prototype.add=function(o,u){this._verify2(o,u);var f=o.add(u);return f.cmp(this.m)>=0&&f.isub(this.m),f._forceRed(this)},X.prototype.iadd=function(o,u){this._verify2(o,u);var f=o.iadd(u);return f.cmp(this.m)>=0&&f.isub(this.m),f},X.prototype.sub=function(o,u){this._verify2(o,u);var f=o.sub(u);return f.cmpn(0)<0&&f.iadd(this.m),f._forceRed(this)},X.prototype.isub=function(o,u){this._verify2(o,u);var f=o.isub(u);return f.cmpn(0)<0&&f.iadd(this.m),f},X.prototype.shl=function(o,u){return this._verify1(o),this.imod(o.ushln(u))},X.prototype.imul=function(o,u){return this._verify2(o,u),this.imod(o.imul(u))},X.prototype.mul=function(o,u){return this._verify2(o,u),this.imod(o.mul(u))},X.prototype.isqr=function(o){return this.imul(o,o.clone())},X.prototype.sqr=function(o){return this.mul(o,o)},X.prototype.sqrt=function(o){if(o.isZero())return o.clone();var u=this.m.andln(3);if(n(u%2===1),u===3){var f=this.m.add(new s(1)).iushrn(2);return this.pow(o,f)}for(var p=this.m.subn(1),v=0;!p.isZero()&&p.andln(1)===0;)v++,p.iushrn(1);n(!p.isZero());var E=new s(1).toRed(this),k=E.redNeg(),g=this.m.subn(1).iushrn(1),c=this.m.bitLength();for(c=new s(2*c*c).toRed(this);this.pow(c,g).cmp(k)!==0;)c.redIAdd(k);for(var w=this.pow(c,p),U=this.pow(o,p.addn(1).iushrn(1)),H=this.pow(o,p),V=v;H.cmp(E)!==0;){for(var A=H,I=0;A.cmp(E)!==0;I++)A=A.redSqr();n(I=0;v--){for(var w=u.words[v],U=c-1;U>=0;U--){var H=w>>U&1;if(E!==p[0]&&(E=this.sqr(E)),H===0&&k===0){g=0;continue}k<<=1,k|=H,g++,!(g!==f&&(v!==0||U!==0))&&(E=this.mul(E,p[k]),g=0,k=0)}c=26}return E},X.prototype.convertTo=function(o){var u=o.umod(this.m);return u===o?u.clone():u},X.prototype.convertFrom=function(o){var u=o.clone();return u.red=null,u},s.mont=function(o){return new ne(o)};function ne(S){X.call(this,S),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new s(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}i(ne,X),ne.prototype.convertTo=function(o){return this.imod(o.ushln(this.shift))},ne.prototype.convertFrom=function(o){var u=this.imod(o.mul(this.rinv));return u.red=null,u},ne.prototype.imul=function(o,u){if(o.isZero()||u.isZero())return o.words[0]=0,o.length=1,o;var f=o.imul(u),p=f.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),v=f.isub(p).iushrn(this.shift),E=v;return v.cmp(this.m)>=0?E=v.isub(this.m):v.cmpn(0)<0&&(E=v.iadd(this.m)),E._forceRed(this)},ne.prototype.mul=function(o,u){if(o.isZero()||u.isZero())return new s(0)._forceRed(this);var f=o.mul(u),p=f.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),v=f.isub(p).iushrn(this.shift),E=v;return v.cmp(this.m)>=0?E=v.isub(this.m):v.cmpn(0)<0&&(E=v.iadd(this.m)),E._forceRed(this)},ne.prototype.invm=function(o){var u=this.imod(o._invmp(this.m).mul(this.r2));return u._forceRed(this)}})(e,Q)})(Vs);var ci=Vs.exports,gn={},Nt={};Object.defineProperty(Nt,"__esModule",{value:!0});Nt.errorValues=Nt.standardErrorCodes=void 0;Nt.standardErrorCodes={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}};Nt.errorValues={"-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."}};var li={},ui={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.serialize=e.getErrorCode=e.isValidCode=e.getMessageFromCode=e.JSON_RPC_SERVER_ERROR_MESSAGE=void 0;const t=Nt,r="Unspecified error message.";e.JSON_RPC_SERVER_ERROR_MESSAGE="Unspecified server error.";function n(y,C=r){if(y&&Number.isInteger(y)){const x=y.toString();if(m(t.errorValues,x))return t.errorValues[x].message;if(d(y))return e.JSON_RPC_SERVER_ERROR_MESSAGE}return C}e.getMessageFromCode=n;function i(y){if(!Number.isInteger(y))return!1;const C=y.toString();return!!(t.errorValues[C]||d(y))}e.isValidCode=i;function s(y){var C;if(typeof y=="number")return y;if(a(y))return(C=y.code)!==null&&C!==void 0?C:y.errorCode}e.getErrorCode=s;function a(y){return typeof y=="object"&&y!==null&&(typeof y.code=="number"||typeof y.errorCode=="number")}function l(y,{shouldIncludeStack:C=!1}={}){const x={};if(y&&typeof y=="object"&&!Array.isArray(y)&&m(y,"code")&&i(y.code)){const B=y;x.code=B.code,B.message&&typeof B.message=="string"?(x.message=B.message,m(B,"data")&&(x.data=B.data)):(x.message=n(x.code),x.data={originalError:h(y)})}else x.code=t.standardErrorCodes.rpc.internal,x.message=R(y,"message")?y.message:r,x.data={originalError:h(y)};return C&&(x.stack=R(y,"stack")?y.stack:void 0),x}e.serialize=l;function d(y){return y>=-32099&&y<=-32e3}function h(y){return y&&typeof y=="object"&&!Array.isArray(y)?Object.assign({},y):y}function m(y,C){return Object.prototype.hasOwnProperty.call(y,C)}function R(y,C){return typeof y=="object"&&y!==null&&C in y&&typeof y[C]=="string"}})(ui);Object.defineProperty(li,"__esModule",{value:!0});li.standardErrors=void 0;const Ge=Nt,cc=ui;li.standardErrors={rpc:{parse:e=>ct(Ge.standardErrorCodes.rpc.parse,e),invalidRequest:e=>ct(Ge.standardErrorCodes.rpc.invalidRequest,e),invalidParams:e=>ct(Ge.standardErrorCodes.rpc.invalidParams,e),methodNotFound:e=>ct(Ge.standardErrorCodes.rpc.methodNotFound,e),internal:e=>ct(Ge.standardErrorCodes.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 ct(t,e)},invalidInput:e=>ct(Ge.standardErrorCodes.rpc.invalidInput,e),resourceNotFound:e=>ct(Ge.standardErrorCodes.rpc.resourceNotFound,e),resourceUnavailable:e=>ct(Ge.standardErrorCodes.rpc.resourceUnavailable,e),transactionRejected:e=>ct(Ge.standardErrorCodes.rpc.transactionRejected,e),methodNotSupported:e=>ct(Ge.standardErrorCodes.rpc.methodNotSupported,e),limitExceeded:e=>ct(Ge.standardErrorCodes.rpc.limitExceeded,e)},provider:{userRejectedRequest:e=>Ar(Ge.standardErrorCodes.provider.userRejectedRequest,e),unauthorized:e=>Ar(Ge.standardErrorCodes.provider.unauthorized,e),unsupportedMethod:e=>Ar(Ge.standardErrorCodes.provider.unsupportedMethod,e),disconnected:e=>Ar(Ge.standardErrorCodes.provider.disconnected,e),chainDisconnected:e=>Ar(Ge.standardErrorCodes.provider.chainDisconnected,e),unsupportedChain:e=>Ar(Ge.standardErrorCodes.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:r,data:n}=e;if(!r||typeof r!="string")throw new Error('"message" must be a nonempty string');return new hc(t,r,n)}}};function ct(e,t){const[r,n]=lc(t);return new uc(e,r||(0,cc.getMessageFromCode)(e),n)}function Ar(e,t){const[r,n]=lc(t);return new hc(e,r||(0,cc.getMessageFromCode)(e),n)}function lc(e){if(e){if(typeof e=="string")return[e];if(typeof e=="object"&&!Array.isArray(e)){const{message:t,data:r}=e;if(t&&typeof t!="string")throw new Error("Must specify string message.");return[t||void 0,r]}}return[]}let uc=class extends Error{constructor(t,r,n){if(!Number.isInteger(t))throw new Error('"code" must be an integer.');if(!r||typeof r!="string")throw new Error('"message" must be a nonempty string.');super(r),this.code=t,n!==void 0&&(this.data=n)}},hc=class extends uc{constructor(t,r,n){if(!du(t))throw new Error('"code" must be an integer such that: 1000 <= code <= 4999');super(t,r,n)}};function du(e){return Number.isInteger(e)&&e>=1e3&&e<=4999}var hi={},Kr={};Object.defineProperty(Kr,"__esModule",{value:!0});Kr.isErrorResponse=void 0;function fu(e){return e.errorMessage!==void 0}Kr.isErrorResponse=fu;var Qr={};Object.defineProperty(Qr,"__esModule",{value:!0});Qr.LIB_VERSION=void 0;Qr.LIB_VERSION="3.9.3";Object.defineProperty(hi,"__esModule",{value:!0});hi.serializeError=void 0;const pu=Kr,gu=Qr,mu=Nt,vu=ui;function bu(e,t){const r=(0,vu.serialize)(wu(e),{shouldIncludeStack:!0}),n=new URL("https://docs.cloud.coinbase.com/wallet-sdk/docs/errors");n.searchParams.set("version",gu.LIB_VERSION),n.searchParams.set("code",r.code.toString());const i=_u(r.data,t);return i&&n.searchParams.set("method",i),n.searchParams.set("message",r.message),Object.assign(Object.assign({},r),{docUrl:n.href})}hi.serializeError=bu;function wu(e){return typeof e=="string"?{message:e,code:mu.standardErrorCodes.rpc.internal}:(0,pu.isErrorResponse)(e)?Object.assign(Object.assign({},e),{message:e.errorMessage,code:e.errorCode,data:{method:e.method}}):e}function _u(e,t){const r=e==null?void 0:e.method;if(r)return r;if(t!==void 0){if(typeof t=="string")return t;if(Array.isArray(t)){if(t.length>0)return t[0].method}else return t.method}}(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.standardErrors=e.standardErrorCodes=e.serializeError=e.getMessageFromCode=e.getErrorCode=void 0;const t=Nt;Object.defineProperty(e,"standardErrorCodes",{enumerable:!0,get:function(){return t.standardErrorCodes}});const r=li;Object.defineProperty(e,"standardErrors",{enumerable:!0,get:function(){return r.standardErrors}});const n=hi;Object.defineProperty(e,"serializeError",{enumerable:!0,get:function(){return n.serializeError}});const i=ui;Object.defineProperty(e,"getErrorCode",{enumerable:!0,get:function(){return i.getErrorCode}}),Object.defineProperty(e,"getMessageFromCode",{enumerable:!0,get:function(){return i.getMessageFromCode}})})(gn);var Ve={};Object.defineProperty(Ve,"__esModule",{value:!0});Ve.ProviderType=Ve.RegExpString=Ve.IntNumber=Ve.BigIntString=Ve.AddressString=Ve.HexString=Ve.OpaqueType=void 0;function mn(){return e=>e}Ve.OpaqueType=mn;Ve.HexString=mn();Ve.AddressString=mn();Ve.BigIntString=mn();function yu(e){return Math.floor(e)}Ve.IntNumber=yu;Ve.RegExpString=mn();var Ao;(function(e){e.CoinbaseWallet="CoinbaseWallet",e.MetaMask="MetaMask",e.Unselected=""})(Ao||(Ve.ProviderType=Ao={}));var Eu=Q&&Q.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(q,"__esModule",{value:!0});q.isMobileWeb=q.getLocation=q.isInIFrame=q.createQrUrl=q.getFavicon=q.range=q.isBigNumber=q.ensureParsedJSONObject=q.ensureBN=q.ensureRegExpString=q.ensureIntNumber=q.ensureBuffer=q.ensureAddressString=q.ensureEvenLengthHexString=q.ensureHexString=q.isHexString=q.prepend0x=q.strip0x=q.has0xPrefix=q.hexStringFromIntNumber=q.intNumberFromHexString=q.bigIntStringFromBN=q.hexStringFromBuffer=q.hexStringToUint8Array=q.uint8ArrayToHex=q.randomBytesHex=void 0;const $t=Eu(ci),pr=gn,dt=Ve,dc=/^[0-9]*$/,fc=/^[a-f0-9]*$/;function Su(e){return pc(crypto.getRandomValues(new Uint8Array(e)))}q.randomBytesHex=Su;function pc(e){return[...e].map(t=>t.toString(16).padStart(2,"0")).join("")}q.uint8ArrayToHex=pc;function Ru(e){return new Uint8Array(e.match(/.{1,2}/g).map(t=>parseInt(t,16)))}q.hexStringToUint8Array=Ru;function Mu(e,t=!1){const r=e.toString("hex");return(0,dt.HexString)(t?`0x${r}`:r)}q.hexStringFromBuffer=Mu;function ku(e){return(0,dt.BigIntString)(e.toString(10))}q.bigIntStringFromBN=ku;function Cu(e){return(0,dt.IntNumber)(new $t.default(bn(e,!1),16).toNumber())}q.intNumberFromHexString=Cu;function Iu(e){return(0,dt.HexString)(`0x${new $t.default(e).toString(16)}`)}q.hexStringFromIntNumber=Iu;function zs(e){return e.startsWith("0x")||e.startsWith("0X")}q.has0xPrefix=zs;function di(e){return zs(e)?e.slice(2):e}q.strip0x=di;function gc(e){return zs(e)?`0x${e.slice(2)}`:`0x${e}`}q.prepend0x=gc;function vn(e){if(typeof e!="string")return!1;const t=di(e).toLowerCase();return fc.test(t)}q.isHexString=vn;function mc(e,t=!1){if(typeof e=="string"){const r=di(e).toLowerCase();if(fc.test(r))return(0,dt.HexString)(t?`0x${r}`:r)}throw pr.standardErrors.rpc.invalidParams(`"${String(e)}" is not a hexadecimal string`)}q.ensureHexString=mc;function bn(e,t=!1){let r=mc(e,!1);return r.length%2===1&&(r=(0,dt.HexString)(`0${r}`)),t?(0,dt.HexString)(`0x${r}`):r}q.ensureEvenLengthHexString=bn;function xu(e){if(typeof e=="string"){const t=di(e).toLowerCase();if(vn(t)&&t.length===40)return(0,dt.AddressString)(gc(t))}throw pr.standardErrors.rpc.invalidParams(`Invalid Ethereum address: ${String(e)}`)}q.ensureAddressString=xu;function Au(e){if(Buffer.isBuffer(e))return e;if(typeof e=="string"){if(vn(e)){const t=bn(e,!1);return Buffer.from(t,"hex")}return Buffer.from(e,"utf8")}throw pr.standardErrors.rpc.invalidParams(`Not binary data: ${String(e)}`)}q.ensureBuffer=Au;function vc(e){if(typeof e=="number"&&Number.isInteger(e))return(0,dt.IntNumber)(e);if(typeof e=="string"){if(dc.test(e))return(0,dt.IntNumber)(Number(e));if(vn(e))return(0,dt.IntNumber)(new $t.default(bn(e,!1),16).toNumber())}throw pr.standardErrors.rpc.invalidParams(`Not an integer: ${String(e)}`)}q.ensureIntNumber=vc;function Tu(e){if(e instanceof RegExp)return(0,dt.RegExpString)(e.toString());throw pr.standardErrors.rpc.invalidParams(`Not a RegExp: ${String(e)}`)}q.ensureRegExpString=Tu;function Nu(e){if(e!==null&&($t.default.isBN(e)||bc(e)))return new $t.default(e.toString(10),10);if(typeof e=="number")return new $t.default(vc(e));if(typeof e=="string"){if(dc.test(e))return new $t.default(e,10);if(vn(e))return new $t.default(bn(e,!1),16)}throw pr.standardErrors.rpc.invalidParams(`Not an integer: ${String(e)}`)}q.ensureBN=Nu;function Lu(e){if(typeof e=="string")return JSON.parse(e);if(typeof e=="object")return e;throw pr.standardErrors.rpc.invalidParams(`Not a JSON string or an object: ${String(e)}`)}q.ensureParsedJSONObject=Lu;function bc(e){if(e==null||typeof e.constructor!="function")return!1;const{constructor:t}=e;return typeof t.config=="function"&&typeof t.EUCLID=="number"}q.isBigNumber=bc;function Ou(e,t){return Array.from({length:t-e},(r,n)=>e+n)}q.range=Ou;function Pu(){const e=document.querySelector('link[sizes="192x192"]')||document.querySelector('link[sizes="180x180"]')||document.querySelector('link[rel="icon"]')||document.querySelector('link[rel="shortcut icon"]'),{protocol:t,host:r}=document.location,n=e?e.getAttribute("href"):null;return!n||n.startsWith("javascript:")||n.startsWith("vbscript:")?null:n.startsWith("http://")||n.startsWith("https://")||n.startsWith("data:")?n:n.startsWith("//")?t+n:`${t}//${r}${n}`}q.getFavicon=Pu;function $u(e,t,r,n,i,s){const a=n?"parent-id":"id",l=new URLSearchParams({[a]:e,secret:t,server:r,v:i,chainId:s.toString()}).toString();return`${r}/#/link?${l}`}q.createQrUrl=$u;function wc(){try{return window.frameElement!==null}catch{return!1}}q.isInIFrame=wc;function Bu(){try{return wc()&&window.top?window.top.location:window.location}catch{return window.location}}q.getLocation=Bu;function Du(){var e;return/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test((e=window==null?void 0:window.navigator)===null||e===void 0?void 0:e.userAgent)}q.isMobileWeb=Du;var fi={};Object.defineProperty(fi,"__esModule",{value:!0});fi.ScopedLocalStorage=void 0;class Fu{constructor(t){this.scope=t}setItem(t,r){localStorage.setItem(this.scopedKey(t),r)}getItem(t){return localStorage.getItem(this.scopedKey(t))}removeItem(t){localStorage.removeItem(this.scopedKey(t))}clear(){const t=this.scopedKey(""),r=[];for(let n=0;nlocalStorage.removeItem(n))}scopedKey(t){return`${this.scope}:${t}`}}fi.ScopedLocalStorage=Fu;var Ur={};const ju=Zr(uu);var wn={},_n={},Yr={};Object.defineProperty(Yr,"__esModule",{value:!0});Yr.EVENTS=void 0;Yr.EVENTS={STARTED_CONNECTING:"walletlink_sdk.started.connecting",CONNECTED_STATE_CHANGE:"walletlink_sdk.connected",DISCONNECTED:"walletlink_sdk.disconnected",METADATA_DESTROYED:"walletlink_sdk_metadata_destroyed",LINKED:"walletlink_sdk.linked",FAILURE:"walletlink_sdk.generic_failure",SESSION_CONFIG_RECEIVED:"walletlink_sdk.session_config_event_received",ETH_ACCOUNTS_STATE:"walletlink_sdk.eth_accounts_state",SESSION_STATE_CHANGE:"walletlink_sdk.session_state_change",UNLINKED_ERROR_STATE:"walletlink_sdk.unlinked_error_state",SKIPPED_CLEARING_SESSION:"walletlink_sdk.skipped_clearing_session",GENERAL_ERROR:"walletlink_sdk.general_error",WEB3_REQUEST:"walletlink_sdk.web3.request",WEB3_REQUEST_PUBLISHED:"walletlink_sdk.web3.request_published",WEB3_RESPONSE:"walletlink_sdk.web3.response",METHOD_NOT_IMPLEMENTED:"walletlink_sdk.method_not_implemented",UNKNOWN_ADDRESS_ENCOUNTERED:"walletlink_sdk.unknown_address_encountered"};var ht={};Object.defineProperty(ht,"__esModule",{value:!0});ht.RelayAbstract=ht.APP_VERSION_KEY=ht.LOCAL_STORAGE_ADDRESSES_KEY=ht.WALLET_USER_NAME_KEY=void 0;const To=gn;ht.WALLET_USER_NAME_KEY="walletUsername";ht.LOCAL_STORAGE_ADDRESSES_KEY="Addresses";ht.APP_VERSION_KEY="AppVersion";class Hu{async makeEthereumJSONRPCRequest(t,r){if(!r)throw new Error("Error: No jsonRpcUrl provided");return window.fetch(r,{method:"POST",body:JSON.stringify(t),mode:"cors",headers:{"Content-Type":"application/json"}}).then(n=>n.json()).then(n=>{if(!n)throw To.standardErrors.rpc.parse({});const i=n,{error:s}=i;if(s)throw(0,To.serializeError)(s,t.method);return i})}}ht.RelayAbstract=Hu;var Xr={},_c={exports:{}},Ps={exports:{}};/*! safe-buffer. MIT License. Feross Aboukhadijeh */(function(e,t){var r=ii,n=r.Buffer;function i(a,l){for(var d in a)l[d]=a[d]}n.from&&n.alloc&&n.allocUnsafe&&n.allocUnsafeSlow?e.exports=r:(i(r,t),t.Buffer=s);function s(a,l,d){return n(a,l,d)}s.prototype=Object.create(n.prototype),i(n,s),s.from=function(a,l,d){if(typeof a=="number")throw new TypeError("Argument must not be a number");return n(a,l,d)},s.alloc=function(a,l,d){if(typeof a!="number")throw new TypeError("Argument must be a number");var h=n(a);return l!==void 0?typeof d=="string"?h.fill(l,d):h.fill(l):h.fill(0),h},s.allocUnsafe=function(a){if(typeof a!="number")throw new TypeError("Argument must be a number");return n(a)},s.allocUnsafeSlow=function(a){if(typeof a!="number")throw new TypeError("Argument must be a number");return r.SlowBuffer(a)}})(Ps,Ps.exports);var jt=Ps.exports,yc=jt.Buffer;function pi(e,t){this._block=yc.alloc(e),this._finalSize=t,this._blockSize=e,this._len=0}pi.prototype.update=function(e,t){typeof e=="string"&&(t=t||"utf8",e=yc.from(e,t));for(var r=this._block,n=this._blockSize,i=e.length,s=this._len,a=0;a=this._finalSize&&(this._update(this._block),this._block.fill(0));var r=this._len*8;if(r<=4294967295)this._block.writeUInt32BE(r,this._blockSize-4);else{var n=(r&4294967295)>>>0,i=(r-n)/4294967296;this._block.writeUInt32BE(i,this._blockSize-8),this._block.writeUInt32BE(n,this._blockSize-4)}this._update(this._block);var s=this._hash();return e?s.toString(e):s};pi.prototype._update=function(){throw new Error("_update must be implemented by subclass")};var en=pi,Uu=vt,Ec=en,Wu=jt.Buffer,Vu=[1518500249,1859775393,-1894007588,-899497514],zu=new Array(80);function yn(){this.init(),this._w=zu,Ec.call(this,64,56)}Uu(yn,Ec);yn.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this};function qu(e){return e<<5|e>>>27}function Ju(e){return e<<30|e>>>2}function Gu(e,t,r,n){return e===0?t&r|~t&n:e===2?t&r|t&n|r&n:t^r^n}yn.prototype._update=function(e){for(var t=this._w,r=this._a|0,n=this._b|0,i=this._c|0,s=this._d|0,a=this._e|0,l=0;l<16;++l)t[l]=e.readInt32BE(l*4);for(;l<80;++l)t[l]=t[l-3]^t[l-8]^t[l-14]^t[l-16];for(var d=0;d<80;++d){var h=~~(d/20),m=qu(r)+Gu(h,n,i,s)+a+t[d]+Vu[h]|0;a=s,s=i,i=Ju(n),n=r,r=m}this._a=r+this._a|0,this._b=n+this._b|0,this._c=i+this._c|0,this._d=s+this._d|0,this._e=a+this._e|0};yn.prototype._hash=function(){var e=Wu.allocUnsafe(20);return e.writeInt32BE(this._a|0,0),e.writeInt32BE(this._b|0,4),e.writeInt32BE(this._c|0,8),e.writeInt32BE(this._d|0,12),e.writeInt32BE(this._e|0,16),e};var Zu=yn,Ku=vt,Sc=en,Qu=jt.Buffer,Yu=[1518500249,1859775393,-1894007588,-899497514],Xu=new Array(80);function En(){this.init(),this._w=Xu,Sc.call(this,64,56)}Ku(En,Sc);En.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this};function eh(e){return e<<1|e>>>31}function th(e){return e<<5|e>>>27}function rh(e){return e<<30|e>>>2}function nh(e,t,r,n){return e===0?t&r|~t&n:e===2?t&r|t&n|r&n:t^r^n}En.prototype._update=function(e){for(var t=this._w,r=this._a|0,n=this._b|0,i=this._c|0,s=this._d|0,a=this._e|0,l=0;l<16;++l)t[l]=e.readInt32BE(l*4);for(;l<80;++l)t[l]=eh(t[l-3]^t[l-8]^t[l-14]^t[l-16]);for(var d=0;d<80;++d){var h=~~(d/20),m=th(r)+nh(h,n,i,s)+a+t[d]+Yu[h]|0;a=s,s=i,i=rh(n),n=r,r=m}this._a=r+this._a|0,this._b=n+this._b|0,this._c=i+this._c|0,this._d=s+this._d|0,this._e=a+this._e|0};En.prototype._hash=function(){var e=Qu.allocUnsafe(20);return e.writeInt32BE(this._a|0,0),e.writeInt32BE(this._b|0,4),e.writeInt32BE(this._c|0,8),e.writeInt32BE(this._d|0,12),e.writeInt32BE(this._e|0,16),e};var ih=En,sh=vt,Rc=en,oh=jt.Buffer,ah=[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],ch=new Array(64);function Sn(){this.init(),this._w=ch,Rc.call(this,64,56)}sh(Sn,Rc);Sn.prototype.init=function(){return this._a=1779033703,this._b=3144134277,this._c=1013904242,this._d=2773480762,this._e=1359893119,this._f=2600822924,this._g=528734635,this._h=1541459225,this};function lh(e,t,r){return r^e&(t^r)}function uh(e,t,r){return e&t|r&(e|t)}function hh(e){return(e>>>2|e<<30)^(e>>>13|e<<19)^(e>>>22|e<<10)}function dh(e){return(e>>>6|e<<26)^(e>>>11|e<<21)^(e>>>25|e<<7)}function fh(e){return(e>>>7|e<<25)^(e>>>18|e<<14)^e>>>3}function ph(e){return(e>>>17|e<<15)^(e>>>19|e<<13)^e>>>10}Sn.prototype._update=function(e){for(var t=this._w,r=this._a|0,n=this._b|0,i=this._c|0,s=this._d|0,a=this._e|0,l=this._f|0,d=this._g|0,h=this._h|0,m=0;m<16;++m)t[m]=e.readInt32BE(m*4);for(;m<64;++m)t[m]=ph(t[m-2])+t[m-7]+fh(t[m-15])+t[m-16]|0;for(var R=0;R<64;++R){var y=h+dh(a)+lh(a,l,d)+ah[R]+t[R]|0,C=hh(r)+uh(r,n,i)|0;h=d,d=l,l=a,a=s+y|0,s=i,i=n,n=r,r=y+C|0}this._a=r+this._a|0,this._b=n+this._b|0,this._c=i+this._c|0,this._d=s+this._d|0,this._e=a+this._e|0,this._f=l+this._f|0,this._g=d+this._g|0,this._h=h+this._h|0};Sn.prototype._hash=function(){var e=oh.allocUnsafe(32);return e.writeInt32BE(this._a,0),e.writeInt32BE(this._b,4),e.writeInt32BE(this._c,8),e.writeInt32BE(this._d,12),e.writeInt32BE(this._e,16),e.writeInt32BE(this._f,20),e.writeInt32BE(this._g,24),e.writeInt32BE(this._h,28),e};var Mc=Sn,gh=vt,mh=Mc,vh=en,bh=jt.Buffer,wh=new Array(64);function gi(){this.init(),this._w=wh,vh.call(this,64,56)}gh(gi,mh);gi.prototype.init=function(){return this._a=3238371032,this._b=914150663,this._c=812702999,this._d=4144912697,this._e=4290775857,this._f=1750603025,this._g=1694076839,this._h=3204075428,this};gi.prototype._hash=function(){var e=bh.allocUnsafe(28);return e.writeInt32BE(this._a,0),e.writeInt32BE(this._b,4),e.writeInt32BE(this._c,8),e.writeInt32BE(this._d,12),e.writeInt32BE(this._e,16),e.writeInt32BE(this._f,20),e.writeInt32BE(this._g,24),e};var _h=gi,yh=vt,kc=en,Eh=jt.Buffer,No=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591],Sh=new Array(160);function Rn(){this.init(),this._w=Sh,kc.call(this,128,112)}yh(Rn,kc);Rn.prototype.init=function(){return this._ah=1779033703,this._bh=3144134277,this._ch=1013904242,this._dh=2773480762,this._eh=1359893119,this._fh=2600822924,this._gh=528734635,this._hh=1541459225,this._al=4089235720,this._bl=2227873595,this._cl=4271175723,this._dl=1595750129,this._el=2917565137,this._fl=725511199,this._gl=4215389547,this._hl=327033209,this};function Lo(e,t,r){return r^e&(t^r)}function Oo(e,t,r){return e&t|r&(e|t)}function Po(e,t){return(e>>>28|t<<4)^(t>>>2|e<<30)^(t>>>7|e<<25)}function $o(e,t){return(e>>>14|t<<18)^(e>>>18|t<<14)^(t>>>9|e<<23)}function Rh(e,t){return(e>>>1|t<<31)^(e>>>8|t<<24)^e>>>7}function Mh(e,t){return(e>>>1|t<<31)^(e>>>8|t<<24)^(e>>>7|t<<25)}function kh(e,t){return(e>>>19|t<<13)^(t>>>29|e<<3)^e>>>6}function Ch(e,t){return(e>>>19|t<<13)^(t>>>29|e<<3)^(e>>>6|t<<26)}function qe(e,t){return e>>>0>>0?1:0}Rn.prototype._update=function(e){for(var t=this._w,r=this._ah|0,n=this._bh|0,i=this._ch|0,s=this._dh|0,a=this._eh|0,l=this._fh|0,d=this._gh|0,h=this._hh|0,m=this._al|0,R=this._bl|0,y=this._cl|0,C=this._dl|0,x=this._el|0,B=this._fl|0,O=this._gl|0,M=this._hl|0,T=0;T<32;T+=2)t[T]=e.readInt32BE(T*4),t[T+1]=e.readInt32BE(T*4+4);for(;T<160;T+=2){var N=t[T-30],D=t[T-15*2+1],L=Rh(N,D),F=Mh(D,N);N=t[T-2*2],D=t[T-2*2+1];var W=kh(N,D),te=Ch(D,N),Z=t[T-7*2],z=t[T-7*2+1],X=t[T-16*2],ne=t[T-16*2+1],S=F+z|0,o=L+Z+qe(S,F)|0;S=S+te|0,o=o+W+qe(S,te)|0,S=S+ne|0,o=o+X+qe(S,ne)|0,t[T]=o,t[T+1]=S}for(var u=0;u<160;u+=2){o=t[u],S=t[u+1];var f=Oo(r,n,i),p=Oo(m,R,y),v=Po(r,m),E=Po(m,r),k=$o(a,x),g=$o(x,a),c=No[u],w=No[u+1],U=Lo(a,l,d),H=Lo(x,B,O),V=M+g|0,A=h+k+qe(V,M)|0;V=V+H|0,A=A+U+qe(V,H)|0,V=V+w|0,A=A+c+qe(V,w)|0,V=V+S|0,A=A+o+qe(V,S)|0;var I=E+p|0,$=v+f+qe(I,E)|0;h=d,M=O,d=l,O=B,l=a,B=x,x=C+V|0,a=s+A+qe(x,C)|0,s=i,C=y,i=n,y=R,n=r,R=m,m=V+I|0,r=A+$+qe(m,V)|0}this._al=this._al+m|0,this._bl=this._bl+R|0,this._cl=this._cl+y|0,this._dl=this._dl+C|0,this._el=this._el+x|0,this._fl=this._fl+B|0,this._gl=this._gl+O|0,this._hl=this._hl+M|0,this._ah=this._ah+r+qe(this._al,m)|0,this._bh=this._bh+n+qe(this._bl,R)|0,this._ch=this._ch+i+qe(this._cl,y)|0,this._dh=this._dh+s+qe(this._dl,C)|0,this._eh=this._eh+a+qe(this._el,x)|0,this._fh=this._fh+l+qe(this._fl,B)|0,this._gh=this._gh+d+qe(this._gl,O)|0,this._hh=this._hh+h+qe(this._hl,M)|0};Rn.prototype._hash=function(){var e=Eh.allocUnsafe(64);function t(r,n,i){e.writeInt32BE(r,i),e.writeInt32BE(n,i+4)}return t(this._ah,this._al,0),t(this._bh,this._bl,8),t(this._ch,this._cl,16),t(this._dh,this._dl,24),t(this._eh,this._el,32),t(this._fh,this._fl,40),t(this._gh,this._gl,48),t(this._hh,this._hl,56),e};var Cc=Rn,Ih=vt,xh=Cc,Ah=en,Th=jt.Buffer,Nh=new Array(160);function mi(){this.init(),this._w=Nh,Ah.call(this,128,112)}Ih(mi,xh);mi.prototype.init=function(){return this._ah=3418070365,this._bh=1654270250,this._ch=2438529370,this._dh=355462360,this._eh=1731405415,this._fh=2394180231,this._gh=3675008525,this._hh=1203062813,this._al=3238371032,this._bl=914150663,this._cl=812702999,this._dl=4144912697,this._el=4290775857,this._fl=1750603025,this._gl=1694076839,this._hl=3204075428,this};mi.prototype._hash=function(){var e=Th.allocUnsafe(48);function t(r,n,i){e.writeInt32BE(r,i),e.writeInt32BE(n,i+4)}return t(this._ah,this._al,0),t(this._bh,this._bl,8),t(this._ch,this._cl,16),t(this._dh,this._dl,24),t(this._eh,this._el,32),t(this._fh,this._fl,40),e};var Lh=mi,gr=_c.exports=function(t){t=t.toLowerCase();var r=gr[t];if(!r)throw new Error(t+" is not supported (we accept pull requests)");return new r};gr.sha=Zu;gr.sha1=ih;gr.sha224=_h;gr.sha256=Mc;gr.sha384=Lh;gr.sha512=Cc;var Oh=_c.exports;Object.defineProperty(Xr,"__esModule",{value:!0});Xr.Session=void 0;const Bo=Oh,Do=q,Fo="session:id",jo="session:secret",Ho="session:linked";class qs{constructor(t,r,n,i){this._storage=t,this._id=r||(0,Do.randomBytesHex)(16),this._secret=n||(0,Do.randomBytesHex)(32),this._key=new Bo.sha256().update(`${this._id}, ${this._secret} WalletLink`).digest("hex"),this._linked=!!i}static load(t){const r=t.getItem(Fo),n=t.getItem(Ho),i=t.getItem(jo);return r&&i?new qs(t,r,i,n==="1"):null}static hash(t){return new Bo.sha256().update(t).digest("hex")}get id(){return this._id}get secret(){return this._secret}get key(){return this._key}get linked(){return this._linked}set linked(t){this._linked=t,this.persistLinked()}save(){return this._storage.setItem(Fo,this._id),this._storage.setItem(jo,this._secret),this.persistLinked(),this}persistLinked(){this._storage.setItem(Ho,this._linked?"1":"0")}}Xr.Session=qs;var vi={},bi={};Object.defineProperty(bi,"__esModule",{value:!0});bi.Cipher=void 0;const jn=q;class Ph{constructor(t){this.secret=t}async encrypt(t){const r=this.secret;if(r.length!==64)throw Error("secret must be 256 bits");const n=crypto.getRandomValues(new Uint8Array(12)),i=await crypto.subtle.importKey("raw",(0,jn.hexStringToUint8Array)(r),{name:"aes-gcm"},!1,["encrypt","decrypt"]),s=new TextEncoder,a=await window.crypto.subtle.encrypt({name:"AES-GCM",iv:n},i,s.encode(t)),l=16,d=a.slice(a.byteLength-l),h=a.slice(0,a.byteLength-l),m=new Uint8Array(d),R=new Uint8Array(h),y=new Uint8Array([...n,...m,...R]);return(0,jn.uint8ArrayToHex)(y)}async decrypt(t){const r=this.secret;if(r.length!==64)throw Error("secret must be 256 bits");return new Promise((n,i)=>{(async function(){const s=await crypto.subtle.importKey("raw",(0,jn.hexStringToUint8Array)(r),{name:"aes-gcm"},!1,["encrypt","decrypt"]),a=(0,jn.hexStringToUint8Array)(t),l=a.slice(0,12),d=a.slice(12,28),h=a.slice(28),m=new Uint8Array([...h,...d]),R={name:"AES-GCM",iv:new Uint8Array(l)};try{const y=await window.crypto.subtle.decrypt(R,s,m),C=new TextDecoder;n(C.decode(y))}catch(y){i(y)}})()})}}bi.Cipher=Ph;var wi={};Object.defineProperty(wi,"__esModule",{value:!0});wi.WalletLinkHTTP=void 0;class $h{constructor(t,r,n){this.linkAPIUrl=t,this.sessionId=r;const i=`${r}:${n}`;this.auth=`Basic ${btoa(i)}`}async markUnseenEventsAsSeen(t){return Promise.all(t.map(r=>fetch(`${this.linkAPIUrl}/events/${r.eventId}/seen`,{method:"POST",headers:{Authorization:this.auth}}))).catch(r=>console.error("Unabled to mark event as failed:",r))}async fetchUnseenEvents(){var t;const r=await fetch(`${this.linkAPIUrl}/events?unseen=true`,{headers:{Authorization:this.auth}});if(r.ok){const{events:n,error:i}=await r.json();if(i)throw new Error(`Check unseen events failed: ${i}`);const s=(t=n==null?void 0:n.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(s),s}throw new Error(`Check unseen events failed: ${r.status}`)}}wi.WalletLinkHTTP=$h;var Wr={};Object.defineProperty(Wr,"__esModule",{value:!0});Wr.WalletLinkWebSocket=Wr.ConnectionState=void 0;var Br;(function(e){e[e.DISCONNECTED=0]="DISCONNECTED",e[e.CONNECTING=1]="CONNECTING",e[e.CONNECTED=2]="CONNECTED"})(Br||(Wr.ConnectionState=Br={}));class Bh{setConnectionStateListener(t){this.connectionStateListener=t}setIncomingDataListener(t){this.incomingDataListener=t}constructor(t,r=WebSocket){this.WebSocketClass=r,this.webSocket=null,this.pendingData=[],this.url=t.replace(/^http/,"ws")}async connect(){if(this.webSocket)throw new Error("webSocket object is not null");return new Promise((t,r)=>{var n;let i;try{this.webSocket=i=new this.WebSocketClass(this.url)}catch(s){r(s);return}(n=this.connectionStateListener)===null||n===void 0||n.call(this,Br.CONNECTING),i.onclose=s=>{var a;this.clearWebSocket(),r(new Error(`websocket error ${s.code}: ${s.reason}`)),(a=this.connectionStateListener)===null||a===void 0||a.call(this,Br.DISCONNECTED)},i.onopen=s=>{var a;t(),(a=this.connectionStateListener)===null||a===void 0||a.call(this,Br.CONNECTED),this.pendingData.length>0&&([...this.pendingData].forEach(d=>this.sendData(d)),this.pendingData=[])},i.onmessage=s=>{var a,l;if(s.data==="h")(a=this.incomingDataListener)===null||a===void 0||a.call(this,{type:"Heartbeat"});else try{const d=JSON.parse(s.data);(l=this.incomingDataListener)===null||l===void 0||l.call(this,d)}catch{}}})}disconnect(){var t;const{webSocket:r}=this;if(r){this.clearWebSocket(),(t=this.connectionStateListener)===null||t===void 0||t.call(this,Br.DISCONNECTED),this.connectionStateListener=void 0,this.incomingDataListener=void 0;try{r.close()}catch{}}}sendData(t){const{webSocket:r}=this;if(!r){this.pendingData.push(t),this.connect();return}r.send(t)}clearWebSocket(){const{webSocket:t}=this;t&&(this.webSocket=null,t.onclose=null,t.onerror=null,t.onmessage=null,t.onopen=null)}}Wr.WalletLinkWebSocket=Bh;Object.defineProperty(vi,"__esModule",{value:!0});vi.WalletLinkConnection=void 0;const Tr=Ve,Dh=bi,_t=Yr,Uo=ht,Nr=Xr,Fh=wi,Hn=Wr,Wo=1e4,jh=6e4;class Hh{constructor({session:t,linkAPIUrl:r,listener:n,diagnostic:i,WebSocketClass:s=WebSocket}){this.destroyed=!1,this.lastHeartbeatResponse=0,this.nextReqId=(0,Tr.IntNumber)(1),this._connected=!1,this._linked=!1,this.shouldFetchUnseenEventsOnConnect=!1,this.requestResolutions=new Map,this.handleSessionMetadataUpdated=l=>{if(!l)return;new Map([["__destroyed",this.handleDestroyed],["EthereumAddress",this.handleAccountUpdated],["WalletUsername",this.handleWalletUsernameUpdated],["AppVersion",this.handleAppVersionUpdated],["ChainId",h=>l.JsonRpcUrl&&this.handleChainUpdated(h,l.JsonRpcUrl)]]).forEach((h,m)=>{const R=l[m];R!==void 0&&h(R)})},this.handleDestroyed=l=>{var d,h;l==="1"&&((d=this.listener)===null||d===void 0||d.resetAndReload(),(h=this.diagnostic)===null||h===void 0||h.log(_t.EVENTS.METADATA_DESTROYED,{alreadyDestroyed:this.isDestroyed,sessionIdHash:Nr.Session.hash(this.session.id)}))},this.handleAccountUpdated=async l=>{var d,h;try{const m=await this.cipher.decrypt(l);(d=this.listener)===null||d===void 0||d.accountUpdated(m)}catch{(h=this.diagnostic)===null||h===void 0||h.log(_t.EVENTS.GENERAL_ERROR,{message:"Had error decrypting",value:"selectedAddress"})}},this.handleMetadataUpdated=async(l,d)=>{var h,m;try{const R=await this.cipher.decrypt(d);(h=this.listener)===null||h===void 0||h.metadataUpdated(l,R)}catch{(m=this.diagnostic)===null||m===void 0||m.log(_t.EVENTS.GENERAL_ERROR,{message:"Had error decrypting",value:l})}},this.handleWalletUsernameUpdated=async l=>{this.handleMetadataUpdated(Uo.WALLET_USER_NAME_KEY,l)},this.handleAppVersionUpdated=async l=>{this.handleMetadataUpdated(Uo.APP_VERSION_KEY,l)},this.handleChainUpdated=async(l,d)=>{var h,m;try{const R=await this.cipher.decrypt(l),y=await this.cipher.decrypt(d);(h=this.listener)===null||h===void 0||h.chainUpdated(R,y)}catch{(m=this.diagnostic)===null||m===void 0||m.log(_t.EVENTS.GENERAL_ERROR,{message:"Had error decrypting",value:"chainId|jsonRpcUrl"})}},this.session=t,this.cipher=new Dh.Cipher(t.secret),this.diagnostic=i,this.listener=n;const a=new Hn.WalletLinkWebSocket(`${r}/rpc`,s);a.setConnectionStateListener(async l=>{var d;(d=this.diagnostic)===null||d===void 0||d.log(_t.EVENTS.CONNECTED_STATE_CHANGE,{state:l,sessionIdHash:Nr.Session.hash(t.id)});let h=!1;switch(l){case Hn.ConnectionState.DISCONNECTED:if(!this.destroyed){const m=async()=>{await new Promise(R=>setTimeout(R,5e3)),this.destroyed||a.connect().catch(()=>{m()})};m()}break;case Hn.ConnectionState.CONNECTED:try{await this.authenticate(),this.sendIsLinked(),this.sendGetSessionConfig(),h=!0}catch{}this.updateLastHeartbeat(),setInterval(()=>{this.heartbeat()},Wo),this.shouldFetchUnseenEventsOnConnect&&this.fetchUnseenEventsAPI();break;case Hn.ConnectionState.CONNECTING:break}this.connected!==h&&(this.connected=h)}),a.setIncomingDataListener(l=>{var d,h,m;switch(l.type){case"Heartbeat":this.updateLastHeartbeat();return;case"IsLinkedOK":case"Linked":{const R=l.type==="IsLinkedOK"?l.linked:void 0;(d=this.diagnostic)===null||d===void 0||d.log(_t.EVENTS.LINKED,{sessionIdHash:Nr.Session.hash(t.id),linked:R,type:l.type,onlineGuests:l.onlineGuests}),this.linked=R||l.onlineGuests>0;break}case"GetSessionConfigOK":case"SessionConfigUpdated":{(h=this.diagnostic)===null||h===void 0||h.log(_t.EVENTS.SESSION_CONFIG_RECEIVED,{sessionIdHash:Nr.Session.hash(t.id),metadata_keys:l&&l.metadata?Object.keys(l.metadata):void 0}),this.handleSessionMetadataUpdated(l.metadata);break}case"Event":{this.handleIncomingEvent(l);break}}l.id!==void 0&&((m=this.requestResolutions.get(l.id))===null||m===void 0||m(l))}),this.ws=a,this.http=new Fh.WalletLinkHTTP(r,t.id,t.key)}connect(){var t;if(this.destroyed)throw new Error("instance is destroyed");(t=this.diagnostic)===null||t===void 0||t.log(_t.EVENTS.STARTED_CONNECTING,{sessionIdHash:Nr.Session.hash(this.session.id)}),this.ws.connect()}destroy(){var t;this.destroyed=!0,this.ws.disconnect(),(t=this.diagnostic)===null||t===void 0||t.log(_t.EVENTS.DISCONNECTED,{sessionIdHash:Nr.Session.hash(this.session.id)}),this.listener=void 0}get isDestroyed(){return this.destroyed}get connected(){return this._connected}set connected(t){var r,n;this._connected=t,t&&((r=this.onceConnected)===null||r===void 0||r.call(this)),(n=this.listener)===null||n===void 0||n.connectedUpdated(t)}setOnceConnected(t){return new Promise(r=>{this.connected?t().then(r):this.onceConnected=()=>{t().then(r),this.onceConnected=void 0}})}get linked(){return this._linked}set linked(t){var r,n;this._linked=t,t&&((r=this.onceLinked)===null||r===void 0||r.call(this)),(n=this.listener)===null||n===void 0||n.linkedUpdated(t)}setOnceLinked(t){return new Promise(r=>{this.linked?t().then(r):this.onceLinked=()=>{t().then(r),this.onceLinked=void 0}})}async handleIncomingEvent(t){var r,n;if(!(t.type!=="Event"||t.event!=="Web3Response"))try{const i=await this.cipher.decrypt(t.data),s=JSON.parse(i);if(s.type!=="WEB3_RESPONSE")return;(r=this.listener)===null||r===void 0||r.handleWeb3ResponseMessage(s)}catch{(n=this.diagnostic)===null||n===void 0||n.log(_t.EVENTS.GENERAL_ERROR,{message:"Had error decrypting",value:"incomingEvent"})}}async checkUnseenEvents(){if(!this.connected){this.shouldFetchUnseenEventsOnConnect=!0;return}await new Promise(t=>setTimeout(t,250));try{await this.fetchUnseenEventsAPI()}catch(t){console.error("Unable to check for unseen events",t)}}async fetchUnseenEventsAPI(){this.shouldFetchUnseenEventsOnConnect=!1,(await this.http.fetchUnseenEvents()).forEach(r=>this.handleIncomingEvent(r))}async setSessionMetadata(t,r){const n={type:"SetSessionConfig",id:(0,Tr.IntNumber)(this.nextReqId++),sessionId:this.session.id,metadata:{[t]:r}};return this.setOnceConnected(async()=>{const i=await this.makeRequest(n);if(i.type==="Fail")throw new Error(i.error||"failed to set session metadata")})}async publishEvent(t,r,n=!1){const i=await this.cipher.encrypt(JSON.stringify(Object.assign(Object.assign({},r),{origin:location.origin,relaySource:window.coinbaseWalletExtension?"injected_sdk":"sdk"}))),s={type:"PublishEvent",id:(0,Tr.IntNumber)(this.nextReqId++),sessionId:this.session.id,event:t,data:i,callWebhook:n};return this.setOnceLinked(async()=>{const a=await this.makeRequest(s);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>Wo*2){this.ws.disconnect();return}try{this.ws.sendData("h")}catch{}}async makeRequest(t,r=jh){const n=t.id;this.sendData(t);let i;return Promise.race([new Promise((s,a)=>{i=window.setTimeout(()=>{a(new Error(`request ${n} timed out`))},r)}),new Promise(s=>{this.requestResolutions.set(n,a=>{clearTimeout(i),s(a),this.requestResolutions.delete(n)})})])}async authenticate(){const t={type:"HostSession",id:(0,Tr.IntNumber)(this.nextReqId++),sessionId:this.session.id,sessionKey:this.session.key},r=await this.makeRequest(t);if(r.type==="Fail")throw new Error(r.error||"failed to authentcate")}sendIsLinked(){const t={type:"IsLinked",id:(0,Tr.IntNumber)(this.nextReqId++),sessionId:this.session.id};this.sendData(t)}sendGetSessionConfig(){const t={type:"GetSessionConfig",id:(0,Tr.IntNumber)(this.nextReqId++),sessionId:this.session.id};this.sendData(t)}}vi.WalletLinkConnection=Hh;var Mn={},kn={},Js={};Object.defineProperty(Js,"__esModule",{value:!0});Js.default='@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}';var Uh=Q&&Q.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(kn,"__esModule",{value:!0});kn.injectCssReset=void 0;const Wh=Uh(Js);function Vh(){const e=document.createElement("style");e.type="text/css",e.appendChild(document.createTextNode(Wh.default)),document.documentElement.appendChild(e)}kn.injectCssReset=Vh;var _i={};const tt=Zr(cu);var yi={};function Ic(e){var t,r,n="";if(typeof e=="string"||typeof e=="number")n+=e;else if(typeof e=="object")if(Array.isArray(e))for(t=0;t65536?(n[0]=240|(i&1835008)>>>18,n[1]=128|(i&258048)>>>12,n[2]=128|(i&4032)>>>6,n[3]=128|i&63):i>2048?(n[0]=224|(i&61440)>>>12,n[1]=128|(i&4032)>>>6,n[2]=128|i&63):i>128?(n[0]=192|(i&1984)>>>6,n[1]=128|i&63):n[0]=i,this.parsedData.push(n)}this.parsedData=Array.prototype.concat.apply([],this.parsedData),this.parsedData.length!=this.data.length&&(this.parsedData.unshift(191),this.parsedData.unshift(187),this.parsedData.unshift(239))}xc.prototype={getLength:function(e){return this.parsedData.length},write:function(e){for(var t=0,r=this.parsedData.length;t=7&&this.setupTypeNumber(e),this.dataCache==null&&(this.dataCache=kt.createData(this.typeNumber,this.errorCorrectLevel,this.dataList)),this.mapData(this.dataCache,t)},setupPositionProbePattern:function(e,t){for(var r=-1;r<=7;r++)if(!(e+r<=-1||this.moduleCount<=e+r))for(var n=-1;n<=7;n++)t+n<=-1||this.moduleCount<=t+n||(0<=r&&r<=6&&(n==0||n==6)||0<=n&&n<=6&&(r==0||r==6)||2<=r&&r<=4&&2<=n&&n<=4?this.modules[e+r][t+n]=!0:this.modules[e+r][t+n]=!1)},getBestMaskPattern:function(){for(var e=0,t=0,r=0;r<8;r++){this.makeImpl(!0,r);var n=je.getLostPoint(this);(r==0||e>n)&&(e=n,t=r)}return t},createMovieClip:function(e,t,r){var n=e.createEmptyMovieClip(t,r),i=1;this.make();for(var s=0;s>r&1)==1;this.modules[Math.floor(r/3)][r%3+this.moduleCount-8-3]=n}for(var r=0;r<18;r++){var n=!e&&(t>>r&1)==1;this.modules[r%3+this.moduleCount-8-3][Math.floor(r/3)]=n}},setupTypeInfo:function(e,t){for(var r=this.errorCorrectLevel<<3|t,n=je.getBCHTypeInfo(r),i=0;i<15;i++){var s=!e&&(n>>i&1)==1;i<6?this.modules[i][8]=s:i<8?this.modules[i+1][8]=s:this.modules[this.moduleCount-15+i][8]=s}for(var i=0;i<15;i++){var s=!e&&(n>>i&1)==1;i<8?this.modules[8][this.moduleCount-i-1]=s:i<9?this.modules[8][15-i-1+1]=s:this.modules[8][15-i-1]=s}this.modules[this.moduleCount-8][8]=!e},mapData:function(e,t){for(var r=-1,n=this.moduleCount-1,i=7,s=0,a=this.moduleCount-1;a>0;a-=2)for(a==6&&a--;;){for(var l=0;l<2;l++)if(this.modules[n][a-l]==null){var d=!1;s>>i&1)==1);var h=je.getMask(t,n,a-l);h&&(d=!d),this.modules[n][a-l]=d,i--,i==-1&&(s++,i=7)}if(n+=r,n<0||this.moduleCount<=n){n-=r,r=-r;break}}}};kt.PAD0=236;kt.PAD1=17;kt.createData=function(e,t,r){for(var n=Mt.getRSBlocks(e,t),i=new Ac,s=0;sl*8)throw new Error("code length overflow. ("+i.getLengthInBits()+">"+l*8+")");for(i.getLengthInBits()+4<=l*8&&i.put(0,4);i.getLengthInBits()%8!=0;)i.putBit(!1);for(;!(i.getLengthInBits()>=l*8||(i.put(kt.PAD0,8),i.getLengthInBits()>=l*8));)i.put(kt.PAD1,8);return kt.createBytes(i,n)};kt.createBytes=function(e,t){for(var r=0,n=0,i=0,s=new Array(t.length),a=new Array(t.length),l=0;l=0?C.get(x):0}}for(var B=0,m=0;m=0;)t^=je.G15<=0;)t^=je.G18<>>=1;return t},getPatternPosition:function(e){return je.PATTERN_POSITION_TABLE[e-1]},getMask:function(e,t,r){switch(e){case Ot.PATTERN000:return(t+r)%2==0;case Ot.PATTERN001:return t%2==0;case Ot.PATTERN010:return r%3==0;case Ot.PATTERN011:return(t+r)%3==0;case Ot.PATTERN100:return(Math.floor(t/2)+Math.floor(r/3))%2==0;case Ot.PATTERN101:return t*r%2+t*r%3==0;case Ot.PATTERN110:return(t*r%2+t*r%3)%2==0;case Ot.PATTERN111:return(t*r%3+(t+r)%2)%2==0;default:throw new Error("bad maskPattern:"+e)}},getErrorCorrectPolynomial:function(e){for(var t=new Dr([1],0),r=0;r5&&(r+=3+s-5)}for(var n=0;n=256;)e-=255;return Je.EXP_TABLE[e]},EXP_TABLE:new Array(256),LOG_TABLE:new Array(256)};for(var Ze=0;Ze<8;Ze++)Je.EXP_TABLE[Ze]=1<>>7-e%8&1)==1},put:function(e,t){for(var r=0;r>>t-r-1&1)==1)},getLengthInBits:function(){return this.length},putBit:function(e){var t=Math.floor(this.length/8);this.buffer.length<=t&&this.buffer.push(0),e&&(this.buffer[t]|=128>>>this.length%8),this.length++}};var as=[[17,14,11,7],[32,26,20,14],[53,42,32,24],[78,62,46,34],[106,84,60,44],[134,106,74,58],[154,122,86,64],[192,152,108,84],[230,180,130,98],[271,213,151,119],[321,251,177,137],[367,287,203,155],[425,331,241,177],[458,362,258,194],[520,412,292,220],[586,450,322,250],[644,504,364,280],[718,560,394,310],[792,624,442,338],[858,666,482,382],[929,711,509,403],[1003,779,565,439],[1091,857,611,461],[1171,911,661,511],[1273,997,715,535],[1367,1059,751,593],[1465,1125,805,625],[1528,1190,868,658],[1628,1264,908,698],[1732,1370,982,742],[1840,1452,1030,790],[1952,1538,1112,842],[2068,1628,1168,898],[2188,1722,1228,958],[2303,1809,1283,983],[2431,1911,1351,1051],[2563,1989,1423,1093],[2699,2099,1499,1139],[2809,2213,1579,1219],[2953,2331,1663,1273]];function Tc(e){if(this.options={padding:4,width:256,height:256,typeNumber:4,color:"#000000",background:"#ffffff",ecl:"M",image:{svg:"",width:0,height:0}},typeof e=="string"&&(e={content:e}),e)for(var t in e)this.options[t]=e[t];if(typeof this.options.content!="string")throw new Error("Expected 'content' as string!");if(this.options.content.length===0)throw new Error("Expected 'content' to be non-empty!");if(!(this.options.padding>=0))throw new Error("Expected 'padding' value to be non-negative!");if(!(this.options.width>0)||!(this.options.height>0))throw new Error("Expected 'width' or 'height' value to be higher than zero!");function r(d){switch(d){case"L":return Bt.L;case"M":return Bt.M;case"Q":return Bt.Q;case"H":return Bt.H;default:throw new Error("Unknwon error correction level: "+d)}}function n(d,h){for(var m=i(d),R=1,y=0,C=0,x=as.length;C<=x;C++){var B=as[C];if(!B)throw new Error("Content too long: expected "+y+" but got "+m);switch(h){case"L":y=B[0];break;case"M":y=B[1];break;case"Q":y=B[2];break;case"H":y=B[3];break;default:throw new Error("Unknwon error correction level: "+h)}if(m<=y)break;R++}if(R>as.length)throw new Error("Content too long");return R}function i(d){var h=encodeURI(d).toString().replace(/\%[0-9a-fA-F]{2}/g,"a");return h.length+(h.length!=d?3:0)}var s=this.options.content,a=n(s,this.options.ecl),l=r(this.options.ecl);this.qrcode=new kt(a,l),this.qrcode.addData(s),this.qrcode.make()}Tc.prototype.svg=function(e){var t=this.options||{},r=this.qrcode.modules;typeof e>"u"&&(e={container:t.container||"svg"});for(var n=typeof t.pretty<"u"?!!t.pretty:!0,i=n?" ":"",s=n?`\r +import{E as xo,f as Q,j as Zr,p as ii,q as su,r as ou,h as au}from"./index-uonIXzgQ.js";import{r as Ws,i as vt}from"./inherits_browser-Bb3-ajt6.js";import{p as cu,a as lu}from"./hooks.module-D0gf0yJl.js";import{e as si}from"./events-xQ4utD7e.js";const uu=Object.freeze(Object.defineProperty({__proto__:null,EventEmitter:xo,default:xo},Symbol.toStringTag,{value:"Module"}));var ac={},hn={},oi={};Object.defineProperty(oi,"__esModule",{value:!0});oi.walletLogo=void 0;const hu=(e,t)=>{let r;switch(e){case"standard":return r=t,`data:image/svg+xml,%3Csvg width='${t}' height='${r}' viewBox='0 0 1024 1024' fill='none' xmlns='http://www.w3.org/2000/svg'%3E %3Crect width='1024' height='1024' fill='%230052FF'/%3E %3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M152 512C152 710.823 313.177 872 512 872C710.823 872 872 710.823 872 512C872 313.177 710.823 152 512 152C313.177 152 152 313.177 152 512ZM420 396C406.745 396 396 406.745 396 420V604C396 617.255 406.745 628 420 628H604C617.255 628 628 617.255 628 604V420C628 406.745 617.255 396 604 396H420Z' fill='white'/%3E %3C/svg%3E `;case"circle":return r=t,`data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='${t}' height='${r}' viewBox='0 0 999.81 999.81'%3E%3Cdefs%3E%3Cstyle%3E.cls-1%7Bfill:%230052fe;%7D.cls-2%7Bfill:%23fefefe;%7D.cls-3%7Bfill:%230152fe;%7D%3C/style%3E%3C/defs%3E%3Cpath class='cls-1' d='M655-115.9h56c.83,1.59,2.36.88,3.56,1a478,478,0,0,1,75.06,10.42C891.4-81.76,978.33-32.58,1049.19,44q116.7,126,131.94,297.61c.38,4.14-.34,8.53,1.78,12.45v59c-1.58.84-.91,2.35-1,3.56a482.05,482.05,0,0,1-10.38,74.05c-24,106.72-76.64,196.76-158.83,268.93s-178.18,112.82-287.2,122.6c-4.83.43-9.86-.25-14.51,1.77H654c-1-1.68-2.69-.91-4.06-1a496.89,496.89,0,0,1-105.9-18.59c-93.54-27.42-172.78-77.59-236.91-150.94Q199.34,590.1,184.87,426.58c-.47-5.19.25-10.56-1.77-15.59V355c1.68-1,.91-2.7,1-4.06a498.12,498.12,0,0,1,18.58-105.9c26-88.75,72.64-164.9,140.6-227.57q126-116.27,297.21-131.61C645.32-114.57,650.35-113.88,655-115.9Zm377.92,500c0-192.44-156.31-349.49-347.56-350.15-194.13-.68-350.94,155.13-352.29,347.42-1.37,194.55,155.51,352.1,348.56,352.47C876.15,734.23,1032.93,577.84,1032.93,384.11Z' transform='translate(-183.1 115.9)'/%3E%3Cpath class='cls-2' d='M1032.93,384.11c0,193.73-156.78,350.12-351.29,349.74-193-.37-349.93-157.92-348.56-352.47C334.43,189.09,491.24,33.28,685.37,34,876.62,34.62,1032.94,191.67,1032.93,384.11ZM683,496.81q43.74,0,87.48,0c15.55,0,25.32-9.72,25.33-25.21q0-87.48,0-175c0-15.83-9.68-25.46-25.59-25.46H595.77c-15.88,0-25.57,9.64-25.58,25.46q0,87.23,0,174.45c0,16.18,9.59,25.7,25.84,25.71Z' transform='translate(-183.1 115.9)'/%3E%3Cpath class='cls-3' d='M683,496.81H596c-16.25,0-25.84-9.53-25.84-25.71q0-87.23,0-174.45c0-15.82,9.7-25.46,25.58-25.46H770.22c15.91,0,25.59,9.63,25.59,25.46q0,87.47,0,175c0,15.49-9.78,25.2-25.33,25.21Q726.74,496.84,683,496.81Z' transform='translate(-183.1 115.9)'/%3E%3C/svg%3E`;case"text":return r=(.1*t).toFixed(2),`data:image/svg+xml,%3Csvg width='${t}' height='${r}' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 528.15 53.64'%3E%3Cdefs%3E%3Cstyle%3E.cls-1%7Bfill:%230052ff;%7D%3C/style%3E%3C/defs%3E%3Ctitle%3ECoinbase_Wordmark_SubBrands_ALL%3C/title%3E%3Cpath class='cls-1' d='M164.45,15a15,15,0,0,0-11.74,5.4V0h-8.64V52.92h8.5V48a15,15,0,0,0,11.88,5.62c10.37,0,18.21-8.21,18.21-19.3S174.67,15,164.45,15Zm-1.3,30.67c-6.19,0-10.73-4.83-10.73-11.31S157,23,163.22,23s10.66,4.82,10.66,11.37S169.34,45.65,163.15,45.65Zm83.31-14.91-6.34-.93c-3-.43-5.18-1.44-5.18-3.82,0-2.59,2.8-3.89,6.62-3.89,4.18,0,6.84,1.8,7.42,4.76h8.35c-.94-7.49-6.7-11.88-15.55-11.88-9.15,0-15.2,4.68-15.2,11.3,0,6.34,4,10,12,11.16l6.33.94c3.1.43,4.83,1.65,4.83,4,0,2.95-3,4.17-7.2,4.17-5.12,0-8-2.09-8.43-5.25h-8.49c.79,7.27,6.48,12.38,16.84,12.38,9.44,0,15.7-4.32,15.7-11.74C258.12,35.28,253.58,31.82,246.46,30.74Zm-27.65-2.3c0-8.06-4.9-13.46-15.27-13.46-9.79,0-15.26,5-16.34,12.6h8.57c.43-3,2.73-5.4,7.63-5.4,4.39,0,6.55,1.94,6.55,4.32,0,3.09-4,3.88-8.85,4.39-6.63.72-14.84,3-14.84,11.66,0,6.7,5,11,12.89,11,6.19,0,10.08-2.59,12-6.7.28,3.67,3,6.05,6.84,6.05h5v-7.7h-4.25Zm-8.5,9.36c0,5-4.32,8.64-9.57,8.64-3.24,0-6-1.37-6-4.25,0-3.67,4.39-4.68,8.42-5.11s6-1.22,7.13-2.88ZM281.09,15c-11.09,0-19.23,8.35-19.23,19.36,0,11.6,8.72,19.3,19.37,19.3,9,0,16.06-5.33,17.86-12.89h-9c-1.3,3.31-4.47,5.19-8.71,5.19-5.55,0-9.72-3.46-10.66-9.51H299.3V33.12C299.3,22.46,291.53,15,281.09,15Zm-9.87,15.26c1.37-5.18,5.26-7.7,9.72-7.7,4.9,0,8.64,2.8,9.51,7.7ZM19.3,23a9.84,9.84,0,0,1,9.5,7h9.14c-1.65-8.93-9-15-18.57-15A19,19,0,0,0,0,34.34c0,11.09,8.28,19.3,19.37,19.3,9.36,0,16.85-6,18.5-15H28.8a9.75,9.75,0,0,1-9.43,7.06c-6.27,0-10.66-4.83-10.66-11.31S13,23,19.3,23Zm41.11-8A19,19,0,0,0,41,34.34c0,11.09,8.28,19.3,19.37,19.3A19,19,0,0,0,79.92,34.27C79.92,23.33,71.64,15,60.41,15Zm.07,30.67c-6.19,0-10.73-4.83-10.73-11.31S54.22,23,60.41,23s10.8,4.89,10.8,11.37S66.67,45.65,60.48,45.65ZM123.41,15c-5.62,0-9.29,2.3-11.45,5.54V15.7h-8.57V52.92H112V32.69C112,27,115.63,23,121,23c5,0,8.06,3.53,8.06,8.64V52.92h8.64V31C137.66,21.6,132.84,15,123.41,15ZM92,.36a5.36,5.36,0,0,0-5.55,5.47,5.55,5.55,0,0,0,11.09,0A5.35,5.35,0,0,0,92,.36Zm-9.72,23h5.4V52.92h8.64V15.7h-14Zm298.17-7.7L366.2,52.92H372L375.29,44H392l3.33,8.88h6L386.87,15.7ZM377,39.23l6.45-17.56h.1l6.56,17.56ZM362.66,15.7l-7.88,29h-.11l-8.14-29H341l-8,28.93h-.1l-8-28.87H319L329.82,53h5.45l8.19-29.24h.11L352,53h5.66L368.1,15.7Zm135.25,0v4.86h12.32V52.92h5.6V20.56h12.32V15.7ZM467.82,52.92h25.54V48.06H473.43v-12h18.35V31.35H473.43V20.56h19.93V15.7H467.82ZM443,15.7h-5.6V52.92h24.32V48.06H443Zm-30.45,0h-5.61V52.92h24.32V48.06H412.52Z'/%3E%3C/svg%3E`;case"textWithLogo":return r=(.25*t).toFixed(2),`data:image/svg+xml,%3Csvg width='${t}' height='${r}' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 308.44 77.61'%3E%3Cdefs%3E%3Cstyle%3E.cls-1%7Bfill:%230052ff;%7D%3C/style%3E%3C/defs%3E%3Cpath class='cls-1' d='M142.94,20.2l-7.88,29H135l-8.15-29h-5.55l-8,28.93h-.11l-8-28.87H99.27l10.84,37.27h5.44l8.2-29.24h.1l8.41,29.24h5.66L148.39,20.2Zm17.82,0L146.48,57.42h5.82l3.28-8.88h16.65l3.34,8.88h6L167.16,20.2Zm-3.44,23.52,6.45-17.55h.11l6.56,17.55ZM278.2,20.2v4.86h12.32V57.42h5.6V25.06h12.32V20.2ZM248.11,57.42h25.54V52.55H253.71V40.61h18.35V35.85H253.71V25.06h19.94V20.2H248.11ZM223.26,20.2h-5.61V57.42H242V52.55H223.26Zm-30.46,0h-5.6V57.42h24.32V52.55H192.8Zm-154,38A19.41,19.41,0,1,1,57.92,35.57H77.47a38.81,38.81,0,1,0,0,6.47H57.92A19.39,19.39,0,0,1,38.81,58.21Z'/%3E%3C/svg%3E`;case"textLight":return r=(.1*t).toFixed(2),`data:image/svg+xml,%3Csvg width='${t}' height='${r}' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 528.15 53.64'%3E%3Cdefs%3E%3Cstyle%3E.cls-1%7Bfill:%23fefefe;%7D%3C/style%3E%3C/defs%3E%3Ctitle%3ECoinbase_Wordmark_SubBrands_ALL%3C/title%3E%3Cpath class='cls-1' d='M164.45,15a15,15,0,0,0-11.74,5.4V0h-8.64V52.92h8.5V48a15,15,0,0,0,11.88,5.62c10.37,0,18.21-8.21,18.21-19.3S174.67,15,164.45,15Zm-1.3,30.67c-6.19,0-10.73-4.83-10.73-11.31S157,23,163.22,23s10.66,4.82,10.66,11.37S169.34,45.65,163.15,45.65Zm83.31-14.91-6.34-.93c-3-.43-5.18-1.44-5.18-3.82,0-2.59,2.8-3.89,6.62-3.89,4.18,0,6.84,1.8,7.42,4.76h8.35c-.94-7.49-6.7-11.88-15.55-11.88-9.15,0-15.2,4.68-15.2,11.3,0,6.34,4,10,12,11.16l6.33.94c3.1.43,4.83,1.65,4.83,4,0,2.95-3,4.17-7.2,4.17-5.12,0-8-2.09-8.43-5.25h-8.49c.79,7.27,6.48,12.38,16.84,12.38,9.44,0,15.7-4.32,15.7-11.74C258.12,35.28,253.58,31.82,246.46,30.74Zm-27.65-2.3c0-8.06-4.9-13.46-15.27-13.46-9.79,0-15.26,5-16.34,12.6h8.57c.43-3,2.73-5.4,7.63-5.4,4.39,0,6.55,1.94,6.55,4.32,0,3.09-4,3.88-8.85,4.39-6.63.72-14.84,3-14.84,11.66,0,6.7,5,11,12.89,11,6.19,0,10.08-2.59,12-6.7.28,3.67,3,6.05,6.84,6.05h5v-7.7h-4.25Zm-8.5,9.36c0,5-4.32,8.64-9.57,8.64-3.24,0-6-1.37-6-4.25,0-3.67,4.39-4.68,8.42-5.11s6-1.22,7.13-2.88ZM281.09,15c-11.09,0-19.23,8.35-19.23,19.36,0,11.6,8.72,19.3,19.37,19.3,9,0,16.06-5.33,17.86-12.89h-9c-1.3,3.31-4.47,5.19-8.71,5.19-5.55,0-9.72-3.46-10.66-9.51H299.3V33.12C299.3,22.46,291.53,15,281.09,15Zm-9.87,15.26c1.37-5.18,5.26-7.7,9.72-7.7,4.9,0,8.64,2.8,9.51,7.7ZM19.3,23a9.84,9.84,0,0,1,9.5,7h9.14c-1.65-8.93-9-15-18.57-15A19,19,0,0,0,0,34.34c0,11.09,8.28,19.3,19.37,19.3,9.36,0,16.85-6,18.5-15H28.8a9.75,9.75,0,0,1-9.43,7.06c-6.27,0-10.66-4.83-10.66-11.31S13,23,19.3,23Zm41.11-8A19,19,0,0,0,41,34.34c0,11.09,8.28,19.3,19.37,19.3A19,19,0,0,0,79.92,34.27C79.92,23.33,71.64,15,60.41,15Zm.07,30.67c-6.19,0-10.73-4.83-10.73-11.31S54.22,23,60.41,23s10.8,4.89,10.8,11.37S66.67,45.65,60.48,45.65ZM123.41,15c-5.62,0-9.29,2.3-11.45,5.54V15.7h-8.57V52.92H112V32.69C112,27,115.63,23,121,23c5,0,8.06,3.53,8.06,8.64V52.92h8.64V31C137.66,21.6,132.84,15,123.41,15ZM92,.36a5.36,5.36,0,0,0-5.55,5.47,5.55,5.55,0,0,0,11.09,0A5.35,5.35,0,0,0,92,.36Zm-9.72,23h5.4V52.92h8.64V15.7h-14Zm298.17-7.7L366.2,52.92H372L375.29,44H392l3.33,8.88h6L386.87,15.7ZM377,39.23l6.45-17.56h.1l6.56,17.56ZM362.66,15.7l-7.88,29h-.11l-8.14-29H341l-8,28.93h-.1l-8-28.87H319L329.82,53h5.45l8.19-29.24h.11L352,53h5.66L368.1,15.7Zm135.25,0v4.86h12.32V52.92h5.6V20.56h12.32V15.7ZM467.82,52.92h25.54V48.06H473.43v-12h18.35V31.35H473.43V20.56h19.93V15.7H467.82ZM443,15.7h-5.6V52.92h24.32V48.06H443Zm-30.45,0h-5.61V52.92h24.32V48.06H412.52Z'/%3E%3C/svg%3E`;case"textWithLogoLight":return r=(.25*t).toFixed(2),`data:image/svg+xml,%3Csvg width='${t}' height='${r}' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 308.44 77.61'%3E%3Cdefs%3E%3Cstyle%3E.cls-1%7Bfill:%23fefefe;%7D%3C/style%3E%3C/defs%3E%3Cpath class='cls-1' d='M142.94,20.2l-7.88,29H135l-8.15-29h-5.55l-8,28.93h-.11l-8-28.87H99.27l10.84,37.27h5.44l8.2-29.24h.1l8.41,29.24h5.66L148.39,20.2Zm17.82,0L146.48,57.42h5.82l3.28-8.88h16.65l3.34,8.88h6L167.16,20.2Zm-3.44,23.52,6.45-17.55h.11l6.56,17.55ZM278.2,20.2v4.86h12.32V57.42h5.6V25.06h12.32V20.2ZM248.11,57.42h25.54V52.55H253.71V40.61h18.35V35.85H253.71V25.06h19.94V20.2H248.11ZM223.26,20.2h-5.61V57.42H242V52.55H223.26Zm-30.46,0h-5.6V57.42h24.32V52.55H192.8Zm-154,38A19.41,19.41,0,1,1,57.92,35.57H77.47a38.81,38.81,0,1,0,0,6.47H57.92A19.39,19.39,0,0,1,38.81,58.21Z'/%3E%3C/svg%3E`;default:return r=t,`data:image/svg+xml,%3Csvg width='${t}' height='${r}' viewBox='0 0 1024 1024' fill='none' xmlns='http://www.w3.org/2000/svg'%3E %3Crect width='1024' height='1024' fill='%230052FF'/%3E %3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M152 512C152 710.823 313.177 872 512 872C710.823 872 872 710.823 872 512C872 313.177 710.823 152 512 152C313.177 152 152 313.177 152 512ZM420 396C406.745 396 396 406.745 396 420V604C396 617.255 406.745 628 420 628H604C617.255 628 628 617.255 628 604V420C628 406.745 617.255 396 604 396H420Z' fill='white'/%3E %3C/svg%3E `}};oi.walletLogo=hu;var ai={};Object.defineProperty(ai,"__esModule",{value:!0});ai.LINK_API_URL=void 0;ai.LINK_API_URL="https://www.walletlink.org";var q={},Vs={exports:{}};Vs.exports;(function(e){(function(t,r){function n(S,o){if(!S)throw new Error(o||"Assertion failed")}function i(S,o){S.super_=o;var u=function(){};u.prototype=o.prototype,S.prototype=new u,S.prototype.constructor=S}function s(S,o,u){if(s.isBN(S))return S;this.negative=0,this.words=null,this.length=0,this.red=null,S!==null&&((o==="le"||o==="be")&&(u=o,o=10),this._init(S||0,o||10,u||"be"))}typeof t=="object"?t.exports=s:r.BN=s,s.BN=s,s.wordSize=26;var a;try{typeof window<"u"&&typeof window.Buffer<"u"?a=window.Buffer:a=Ws.Buffer}catch{}s.isBN=function(o){return o instanceof s?!0:o!==null&&typeof o=="object"&&o.constructor.wordSize===s.wordSize&&Array.isArray(o.words)},s.max=function(o,u){return o.cmp(u)>0?o:u},s.min=function(o,u){return o.cmp(u)<0?o:u},s.prototype._init=function(o,u,f){if(typeof o=="number")return this._initNumber(o,u,f);if(typeof o=="object")return this._initArray(o,u,f);u==="hex"&&(u=16),n(u===(u|0)&&u>=2&&u<=36),o=o.toString().replace(/\s+/g,"");var p=0;o[0]==="-"&&(p++,this.negative=1),p=0;p-=3)E=o[p]|o[p-1]<<8|o[p-2]<<16,this.words[v]|=E<>>26-k&67108863,k+=24,k>=26&&(k-=26,v++);else if(f==="le")for(p=0,v=0;p>>26-k&67108863,k+=24,k>=26&&(k-=26,v++);return this._strip()};function l(S,o){var u=S.charCodeAt(o);if(u>=48&&u<=57)return u-48;if(u>=65&&u<=70)return u-55;if(u>=97&&u<=102)return u-87;n(!1,"Invalid character in "+S)}function d(S,o,u){var f=l(S,u);return u-1>=o&&(f|=l(S,u-1)<<4),f}s.prototype._parseHex=function(o,u,f){this.length=Math.ceil((o.length-u)/6),this.words=new Array(this.length);for(var p=0;p=u;p-=2)k=d(o,u,p)<=18?(v-=18,E+=1,this.words[E]|=k>>>26):v+=8;else{var g=o.length-u;for(p=g%2===0?u+1:u;p=18?(v-=18,E+=1,this.words[E]|=k>>>26):v+=8}this._strip()};function h(S,o,u,f){for(var p=0,v=0,E=Math.min(S.length,u),k=o;k=49?v=g-49+10:g>=17?v=g-17+10:v=g,n(g>=0&&v1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},s.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},typeof Symbol<"u"&&typeof Symbol.for=="function")try{s.prototype[Symbol.for("nodejs.util.inspect.custom")]=R}catch{s.prototype.inspect=R}else s.prototype.inspect=R;function R(){return(this.red?""}var y=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],C=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],x=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];s.prototype.toString=function(o,u){o=o||10,u=u|0||1;var f;if(o===16||o==="hex"){f="";for(var p=0,v=0,E=0;E>>24-p&16777215,p+=2,p>=26&&(p-=26,E--),v!==0||E!==this.length-1?f=y[6-g.length]+g+f:f=g+f}for(v!==0&&(f=v.toString(16)+f);f.length%u!==0;)f="0"+f;return this.negative!==0&&(f="-"+f),f}if(o===(o|0)&&o>=2&&o<=36){var c=C[o],w=x[o];f="";var U=this.clone();for(U.negative=0;!U.isZero();){var H=U.modrn(w).toString(o);U=U.idivn(w),U.isZero()?f=H+f:f=y[c-H.length]+H+f}for(this.isZero()&&(f="0"+f);f.length%u!==0;)f="0"+f;return this.negative!==0&&(f="-"+f),f}n(!1,"Base should be between 2 and 36")},s.prototype.toNumber=function(){var o=this.words[0];return this.length===2?o+=this.words[1]*67108864:this.length===3&&this.words[2]===1?o+=4503599627370496+this.words[1]*67108864:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-o:o},s.prototype.toJSON=function(){return this.toString(16,2)},a&&(s.prototype.toBuffer=function(o,u){return this.toArrayLike(a,o,u)}),s.prototype.toArray=function(o,u){return this.toArrayLike(Array,o,u)};var B=function(o,u){return o.allocUnsafe?o.allocUnsafe(u):new o(u)};s.prototype.toArrayLike=function(o,u,f){this._strip();var p=this.byteLength(),v=f||Math.max(1,p);n(p<=v,"byte array longer than desired length"),n(v>0,"Requested array length <= 0");var E=B(o,v),k=u==="le"?"LE":"BE";return this["_toArrayLike"+k](E,p),E},s.prototype._toArrayLikeLE=function(o,u){for(var f=0,p=0,v=0,E=0;v>8&255),f>16&255),E===6?(f>24&255),p=0,E=0):(p=k>>>24,E+=2)}if(f=0&&(o[f--]=k>>8&255),f>=0&&(o[f--]=k>>16&255),E===6?(f>=0&&(o[f--]=k>>24&255),p=0,E=0):(p=k>>>24,E+=2)}if(f>=0)for(o[f--]=p;f>=0;)o[f--]=0},Math.clz32?s.prototype._countBits=function(o){return 32-Math.clz32(o)}:s.prototype._countBits=function(o){var u=o,f=0;return u>=4096&&(f+=13,u>>>=13),u>=64&&(f+=7,u>>>=7),u>=8&&(f+=4,u>>>=4),u>=2&&(f+=2,u>>>=2),f+u},s.prototype._zeroBits=function(o){if(o===0)return 26;var u=o,f=0;return u&8191||(f+=13,u>>>=13),u&127||(f+=7,u>>>=7),u&15||(f+=4,u>>>=4),u&3||(f+=2,u>>>=2),u&1||f++,f},s.prototype.bitLength=function(){var o=this.words[this.length-1],u=this._countBits(o);return(this.length-1)*26+u};function O(S){for(var o=new Array(S.bitLength()),u=0;u>>p&1}return o}s.prototype.zeroBits=function(){if(this.isZero())return 0;for(var o=0,u=0;uo.length?this.clone().ior(o):o.clone().ior(this)},s.prototype.uor=function(o){return this.length>o.length?this.clone().iuor(o):o.clone().iuor(this)},s.prototype.iuand=function(o){var u;this.length>o.length?u=o:u=this;for(var f=0;fo.length?this.clone().iand(o):o.clone().iand(this)},s.prototype.uand=function(o){return this.length>o.length?this.clone().iuand(o):o.clone().iuand(this)},s.prototype.iuxor=function(o){var u,f;this.length>o.length?(u=this,f=o):(u=o,f=this);for(var p=0;po.length?this.clone().ixor(o):o.clone().ixor(this)},s.prototype.uxor=function(o){return this.length>o.length?this.clone().iuxor(o):o.clone().iuxor(this)},s.prototype.inotn=function(o){n(typeof o=="number"&&o>=0);var u=Math.ceil(o/26)|0,f=o%26;this._expand(u),f>0&&u--;for(var p=0;p0&&(this.words[p]=~this.words[p]&67108863>>26-f),this._strip()},s.prototype.notn=function(o){return this.clone().inotn(o)},s.prototype.setn=function(o,u){n(typeof o=="number"&&o>=0);var f=o/26|0,p=o%26;return this._expand(f+1),u?this.words[f]=this.words[f]|1<o.length?(f=this,p=o):(f=o,p=this);for(var v=0,E=0;E>>26;for(;v!==0&&E>>26;if(this.length=f.length,v!==0)this.words[this.length]=v,this.length++;else if(f!==this)for(;Eo.length?this.clone().iadd(o):o.clone().iadd(this)},s.prototype.isub=function(o){if(o.negative!==0){o.negative=0;var u=this.iadd(o);return o.negative=1,u._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(o),this.negative=1,this._normSign();var f=this.cmp(o);if(f===0)return this.negative=0,this.length=1,this.words[0]=0,this;var p,v;f>0?(p=this,v=o):(p=o,v=this);for(var E=0,k=0;k>26,this.words[k]=u&67108863;for(;E!==0&&k>26,this.words[k]=u&67108863;if(E===0&&k>>26,U=g&67108863,H=Math.min(c,o.length-1),V=Math.max(0,c-S.length+1);V<=H;V++){var A=c-V|0;p=S.words[A]|0,v=o.words[V]|0,E=p*v+U,w+=E/67108864|0,U=E&67108863}u.words[c]=U|0,g=w|0}return g!==0?u.words[c]=g|0:u.length--,u._strip()}var T=function(o,u,f){var p=o.words,v=u.words,E=f.words,k=0,g,c,w,U=p[0]|0,H=U&8191,V=U>>>13,A=p[1]|0,I=A&8191,$=A>>>13,K=p[2]|0,G=K&8191,b=K>>>13,_=p[3]|0,P=_&8191,j=_>>>13,ue=p[4]|0,J=ue&8191,Y=ue>>>13,at=p[5]|0,he=at&8191,pe=at>>>13,Ht=p[6]|0,ge=Ht&8191,de=Ht>>>13,xt=p[7]|0,fe=xt&8191,le=xt>>>13,nt=p[8]|0,ce=nt&8191,me=nt>>>13,wr=p[9]|0,ve=wr&8191,be=wr>>>13,_r=v[0]|0,we=_r&8191,_e=_r>>>13,yr=v[1]|0,ye=yr&8191,Ee=yr>>>13,Er=v[2]|0,Se=Er&8191,Re=Er>>>13,Sr=v[3]|0,Me=Sr&8191,ke=Sr>>>13,Rr=v[4]|0,Ce=Rr&8191,Ie=Rr>>>13,Mr=v[5]|0,xe=Mr&8191,Ae=Mr>>>13,kr=v[6]|0,Te=kr&8191,Ne=kr>>>13,Cr=v[7]|0,Le=Cr&8191,Oe=Cr>>>13,Ir=v[8]|0,Pe=Ir&8191,$e=Ir>>>13,xr=v[9]|0,Be=xr&8191,De=xr>>>13;f.negative=o.negative^u.negative,f.length=19,g=Math.imul(H,we),c=Math.imul(H,_e),c=c+Math.imul(V,we)|0,w=Math.imul(V,_e);var Ut=(k+g|0)+((c&8191)<<13)|0;k=(w+(c>>>13)|0)+(Ut>>>26)|0,Ut&=67108863,g=Math.imul(I,we),c=Math.imul(I,_e),c=c+Math.imul($,we)|0,w=Math.imul($,_e),g=g+Math.imul(H,ye)|0,c=c+Math.imul(H,Ee)|0,c=c+Math.imul(V,ye)|0,w=w+Math.imul(V,Ee)|0;var Wt=(k+g|0)+((c&8191)<<13)|0;k=(w+(c>>>13)|0)+(Wt>>>26)|0,Wt&=67108863,g=Math.imul(G,we),c=Math.imul(G,_e),c=c+Math.imul(b,we)|0,w=Math.imul(b,_e),g=g+Math.imul(I,ye)|0,c=c+Math.imul(I,Ee)|0,c=c+Math.imul($,ye)|0,w=w+Math.imul($,Ee)|0,g=g+Math.imul(H,Se)|0,c=c+Math.imul(H,Re)|0,c=c+Math.imul(V,Se)|0,w=w+Math.imul(V,Re)|0;var Vt=(k+g|0)+((c&8191)<<13)|0;k=(w+(c>>>13)|0)+(Vt>>>26)|0,Vt&=67108863,g=Math.imul(P,we),c=Math.imul(P,_e),c=c+Math.imul(j,we)|0,w=Math.imul(j,_e),g=g+Math.imul(G,ye)|0,c=c+Math.imul(G,Ee)|0,c=c+Math.imul(b,ye)|0,w=w+Math.imul(b,Ee)|0,g=g+Math.imul(I,Se)|0,c=c+Math.imul(I,Re)|0,c=c+Math.imul($,Se)|0,w=w+Math.imul($,Re)|0,g=g+Math.imul(H,Me)|0,c=c+Math.imul(H,ke)|0,c=c+Math.imul(V,Me)|0,w=w+Math.imul(V,ke)|0;var zt=(k+g|0)+((c&8191)<<13)|0;k=(w+(c>>>13)|0)+(zt>>>26)|0,zt&=67108863,g=Math.imul(J,we),c=Math.imul(J,_e),c=c+Math.imul(Y,we)|0,w=Math.imul(Y,_e),g=g+Math.imul(P,ye)|0,c=c+Math.imul(P,Ee)|0,c=c+Math.imul(j,ye)|0,w=w+Math.imul(j,Ee)|0,g=g+Math.imul(G,Se)|0,c=c+Math.imul(G,Re)|0,c=c+Math.imul(b,Se)|0,w=w+Math.imul(b,Re)|0,g=g+Math.imul(I,Me)|0,c=c+Math.imul(I,ke)|0,c=c+Math.imul($,Me)|0,w=w+Math.imul($,ke)|0,g=g+Math.imul(H,Ce)|0,c=c+Math.imul(H,Ie)|0,c=c+Math.imul(V,Ce)|0,w=w+Math.imul(V,Ie)|0;var qt=(k+g|0)+((c&8191)<<13)|0;k=(w+(c>>>13)|0)+(qt>>>26)|0,qt&=67108863,g=Math.imul(he,we),c=Math.imul(he,_e),c=c+Math.imul(pe,we)|0,w=Math.imul(pe,_e),g=g+Math.imul(J,ye)|0,c=c+Math.imul(J,Ee)|0,c=c+Math.imul(Y,ye)|0,w=w+Math.imul(Y,Ee)|0,g=g+Math.imul(P,Se)|0,c=c+Math.imul(P,Re)|0,c=c+Math.imul(j,Se)|0,w=w+Math.imul(j,Re)|0,g=g+Math.imul(G,Me)|0,c=c+Math.imul(G,ke)|0,c=c+Math.imul(b,Me)|0,w=w+Math.imul(b,ke)|0,g=g+Math.imul(I,Ce)|0,c=c+Math.imul(I,Ie)|0,c=c+Math.imul($,Ce)|0,w=w+Math.imul($,Ie)|0,g=g+Math.imul(H,xe)|0,c=c+Math.imul(H,Ae)|0,c=c+Math.imul(V,xe)|0,w=w+Math.imul(V,Ae)|0;var Jt=(k+g|0)+((c&8191)<<13)|0;k=(w+(c>>>13)|0)+(Jt>>>26)|0,Jt&=67108863,g=Math.imul(ge,we),c=Math.imul(ge,_e),c=c+Math.imul(de,we)|0,w=Math.imul(de,_e),g=g+Math.imul(he,ye)|0,c=c+Math.imul(he,Ee)|0,c=c+Math.imul(pe,ye)|0,w=w+Math.imul(pe,Ee)|0,g=g+Math.imul(J,Se)|0,c=c+Math.imul(J,Re)|0,c=c+Math.imul(Y,Se)|0,w=w+Math.imul(Y,Re)|0,g=g+Math.imul(P,Me)|0,c=c+Math.imul(P,ke)|0,c=c+Math.imul(j,Me)|0,w=w+Math.imul(j,ke)|0,g=g+Math.imul(G,Ce)|0,c=c+Math.imul(G,Ie)|0,c=c+Math.imul(b,Ce)|0,w=w+Math.imul(b,Ie)|0,g=g+Math.imul(I,xe)|0,c=c+Math.imul(I,Ae)|0,c=c+Math.imul($,xe)|0,w=w+Math.imul($,Ae)|0,g=g+Math.imul(H,Te)|0,c=c+Math.imul(H,Ne)|0,c=c+Math.imul(V,Te)|0,w=w+Math.imul(V,Ne)|0;var Gt=(k+g|0)+((c&8191)<<13)|0;k=(w+(c>>>13)|0)+(Gt>>>26)|0,Gt&=67108863,g=Math.imul(fe,we),c=Math.imul(fe,_e),c=c+Math.imul(le,we)|0,w=Math.imul(le,_e),g=g+Math.imul(ge,ye)|0,c=c+Math.imul(ge,Ee)|0,c=c+Math.imul(de,ye)|0,w=w+Math.imul(de,Ee)|0,g=g+Math.imul(he,Se)|0,c=c+Math.imul(he,Re)|0,c=c+Math.imul(pe,Se)|0,w=w+Math.imul(pe,Re)|0,g=g+Math.imul(J,Me)|0,c=c+Math.imul(J,ke)|0,c=c+Math.imul(Y,Me)|0,w=w+Math.imul(Y,ke)|0,g=g+Math.imul(P,Ce)|0,c=c+Math.imul(P,Ie)|0,c=c+Math.imul(j,Ce)|0,w=w+Math.imul(j,Ie)|0,g=g+Math.imul(G,xe)|0,c=c+Math.imul(G,Ae)|0,c=c+Math.imul(b,xe)|0,w=w+Math.imul(b,Ae)|0,g=g+Math.imul(I,Te)|0,c=c+Math.imul(I,Ne)|0,c=c+Math.imul($,Te)|0,w=w+Math.imul($,Ne)|0,g=g+Math.imul(H,Le)|0,c=c+Math.imul(H,Oe)|0,c=c+Math.imul(V,Le)|0,w=w+Math.imul(V,Oe)|0;var Zt=(k+g|0)+((c&8191)<<13)|0;k=(w+(c>>>13)|0)+(Zt>>>26)|0,Zt&=67108863,g=Math.imul(ce,we),c=Math.imul(ce,_e),c=c+Math.imul(me,we)|0,w=Math.imul(me,_e),g=g+Math.imul(fe,ye)|0,c=c+Math.imul(fe,Ee)|0,c=c+Math.imul(le,ye)|0,w=w+Math.imul(le,Ee)|0,g=g+Math.imul(ge,Se)|0,c=c+Math.imul(ge,Re)|0,c=c+Math.imul(de,Se)|0,w=w+Math.imul(de,Re)|0,g=g+Math.imul(he,Me)|0,c=c+Math.imul(he,ke)|0,c=c+Math.imul(pe,Me)|0,w=w+Math.imul(pe,ke)|0,g=g+Math.imul(J,Ce)|0,c=c+Math.imul(J,Ie)|0,c=c+Math.imul(Y,Ce)|0,w=w+Math.imul(Y,Ie)|0,g=g+Math.imul(P,xe)|0,c=c+Math.imul(P,Ae)|0,c=c+Math.imul(j,xe)|0,w=w+Math.imul(j,Ae)|0,g=g+Math.imul(G,Te)|0,c=c+Math.imul(G,Ne)|0,c=c+Math.imul(b,Te)|0,w=w+Math.imul(b,Ne)|0,g=g+Math.imul(I,Le)|0,c=c+Math.imul(I,Oe)|0,c=c+Math.imul($,Le)|0,w=w+Math.imul($,Oe)|0,g=g+Math.imul(H,Pe)|0,c=c+Math.imul(H,$e)|0,c=c+Math.imul(V,Pe)|0,w=w+Math.imul(V,$e)|0;var Kt=(k+g|0)+((c&8191)<<13)|0;k=(w+(c>>>13)|0)+(Kt>>>26)|0,Kt&=67108863,g=Math.imul(ve,we),c=Math.imul(ve,_e),c=c+Math.imul(be,we)|0,w=Math.imul(be,_e),g=g+Math.imul(ce,ye)|0,c=c+Math.imul(ce,Ee)|0,c=c+Math.imul(me,ye)|0,w=w+Math.imul(me,Ee)|0,g=g+Math.imul(fe,Se)|0,c=c+Math.imul(fe,Re)|0,c=c+Math.imul(le,Se)|0,w=w+Math.imul(le,Re)|0,g=g+Math.imul(ge,Me)|0,c=c+Math.imul(ge,ke)|0,c=c+Math.imul(de,Me)|0,w=w+Math.imul(de,ke)|0,g=g+Math.imul(he,Ce)|0,c=c+Math.imul(he,Ie)|0,c=c+Math.imul(pe,Ce)|0,w=w+Math.imul(pe,Ie)|0,g=g+Math.imul(J,xe)|0,c=c+Math.imul(J,Ae)|0,c=c+Math.imul(Y,xe)|0,w=w+Math.imul(Y,Ae)|0,g=g+Math.imul(P,Te)|0,c=c+Math.imul(P,Ne)|0,c=c+Math.imul(j,Te)|0,w=w+Math.imul(j,Ne)|0,g=g+Math.imul(G,Le)|0,c=c+Math.imul(G,Oe)|0,c=c+Math.imul(b,Le)|0,w=w+Math.imul(b,Oe)|0,g=g+Math.imul(I,Pe)|0,c=c+Math.imul(I,$e)|0,c=c+Math.imul($,Pe)|0,w=w+Math.imul($,$e)|0,g=g+Math.imul(H,Be)|0,c=c+Math.imul(H,De)|0,c=c+Math.imul(V,Be)|0,w=w+Math.imul(V,De)|0;var Qt=(k+g|0)+((c&8191)<<13)|0;k=(w+(c>>>13)|0)+(Qt>>>26)|0,Qt&=67108863,g=Math.imul(ve,ye),c=Math.imul(ve,Ee),c=c+Math.imul(be,ye)|0,w=Math.imul(be,Ee),g=g+Math.imul(ce,Se)|0,c=c+Math.imul(ce,Re)|0,c=c+Math.imul(me,Se)|0,w=w+Math.imul(me,Re)|0,g=g+Math.imul(fe,Me)|0,c=c+Math.imul(fe,ke)|0,c=c+Math.imul(le,Me)|0,w=w+Math.imul(le,ke)|0,g=g+Math.imul(ge,Ce)|0,c=c+Math.imul(ge,Ie)|0,c=c+Math.imul(de,Ce)|0,w=w+Math.imul(de,Ie)|0,g=g+Math.imul(he,xe)|0,c=c+Math.imul(he,Ae)|0,c=c+Math.imul(pe,xe)|0,w=w+Math.imul(pe,Ae)|0,g=g+Math.imul(J,Te)|0,c=c+Math.imul(J,Ne)|0,c=c+Math.imul(Y,Te)|0,w=w+Math.imul(Y,Ne)|0,g=g+Math.imul(P,Le)|0,c=c+Math.imul(P,Oe)|0,c=c+Math.imul(j,Le)|0,w=w+Math.imul(j,Oe)|0,g=g+Math.imul(G,Pe)|0,c=c+Math.imul(G,$e)|0,c=c+Math.imul(b,Pe)|0,w=w+Math.imul(b,$e)|0,g=g+Math.imul(I,Be)|0,c=c+Math.imul(I,De)|0,c=c+Math.imul($,Be)|0,w=w+Math.imul($,De)|0;var Yt=(k+g|0)+((c&8191)<<13)|0;k=(w+(c>>>13)|0)+(Yt>>>26)|0,Yt&=67108863,g=Math.imul(ve,Se),c=Math.imul(ve,Re),c=c+Math.imul(be,Se)|0,w=Math.imul(be,Re),g=g+Math.imul(ce,Me)|0,c=c+Math.imul(ce,ke)|0,c=c+Math.imul(me,Me)|0,w=w+Math.imul(me,ke)|0,g=g+Math.imul(fe,Ce)|0,c=c+Math.imul(fe,Ie)|0,c=c+Math.imul(le,Ce)|0,w=w+Math.imul(le,Ie)|0,g=g+Math.imul(ge,xe)|0,c=c+Math.imul(ge,Ae)|0,c=c+Math.imul(de,xe)|0,w=w+Math.imul(de,Ae)|0,g=g+Math.imul(he,Te)|0,c=c+Math.imul(he,Ne)|0,c=c+Math.imul(pe,Te)|0,w=w+Math.imul(pe,Ne)|0,g=g+Math.imul(J,Le)|0,c=c+Math.imul(J,Oe)|0,c=c+Math.imul(Y,Le)|0,w=w+Math.imul(Y,Oe)|0,g=g+Math.imul(P,Pe)|0,c=c+Math.imul(P,$e)|0,c=c+Math.imul(j,Pe)|0,w=w+Math.imul(j,$e)|0,g=g+Math.imul(G,Be)|0,c=c+Math.imul(G,De)|0,c=c+Math.imul(b,Be)|0,w=w+Math.imul(b,De)|0;var Xt=(k+g|0)+((c&8191)<<13)|0;k=(w+(c>>>13)|0)+(Xt>>>26)|0,Xt&=67108863,g=Math.imul(ve,Me),c=Math.imul(ve,ke),c=c+Math.imul(be,Me)|0,w=Math.imul(be,ke),g=g+Math.imul(ce,Ce)|0,c=c+Math.imul(ce,Ie)|0,c=c+Math.imul(me,Ce)|0,w=w+Math.imul(me,Ie)|0,g=g+Math.imul(fe,xe)|0,c=c+Math.imul(fe,Ae)|0,c=c+Math.imul(le,xe)|0,w=w+Math.imul(le,Ae)|0,g=g+Math.imul(ge,Te)|0,c=c+Math.imul(ge,Ne)|0,c=c+Math.imul(de,Te)|0,w=w+Math.imul(de,Ne)|0,g=g+Math.imul(he,Le)|0,c=c+Math.imul(he,Oe)|0,c=c+Math.imul(pe,Le)|0,w=w+Math.imul(pe,Oe)|0,g=g+Math.imul(J,Pe)|0,c=c+Math.imul(J,$e)|0,c=c+Math.imul(Y,Pe)|0,w=w+Math.imul(Y,$e)|0,g=g+Math.imul(P,Be)|0,c=c+Math.imul(P,De)|0,c=c+Math.imul(j,Be)|0,w=w+Math.imul(j,De)|0;var er=(k+g|0)+((c&8191)<<13)|0;k=(w+(c>>>13)|0)+(er>>>26)|0,er&=67108863,g=Math.imul(ve,Ce),c=Math.imul(ve,Ie),c=c+Math.imul(be,Ce)|0,w=Math.imul(be,Ie),g=g+Math.imul(ce,xe)|0,c=c+Math.imul(ce,Ae)|0,c=c+Math.imul(me,xe)|0,w=w+Math.imul(me,Ae)|0,g=g+Math.imul(fe,Te)|0,c=c+Math.imul(fe,Ne)|0,c=c+Math.imul(le,Te)|0,w=w+Math.imul(le,Ne)|0,g=g+Math.imul(ge,Le)|0,c=c+Math.imul(ge,Oe)|0,c=c+Math.imul(de,Le)|0,w=w+Math.imul(de,Oe)|0,g=g+Math.imul(he,Pe)|0,c=c+Math.imul(he,$e)|0,c=c+Math.imul(pe,Pe)|0,w=w+Math.imul(pe,$e)|0,g=g+Math.imul(J,Be)|0,c=c+Math.imul(J,De)|0,c=c+Math.imul(Y,Be)|0,w=w+Math.imul(Y,De)|0;var tr=(k+g|0)+((c&8191)<<13)|0;k=(w+(c>>>13)|0)+(tr>>>26)|0,tr&=67108863,g=Math.imul(ve,xe),c=Math.imul(ve,Ae),c=c+Math.imul(be,xe)|0,w=Math.imul(be,Ae),g=g+Math.imul(ce,Te)|0,c=c+Math.imul(ce,Ne)|0,c=c+Math.imul(me,Te)|0,w=w+Math.imul(me,Ne)|0,g=g+Math.imul(fe,Le)|0,c=c+Math.imul(fe,Oe)|0,c=c+Math.imul(le,Le)|0,w=w+Math.imul(le,Oe)|0,g=g+Math.imul(ge,Pe)|0,c=c+Math.imul(ge,$e)|0,c=c+Math.imul(de,Pe)|0,w=w+Math.imul(de,$e)|0,g=g+Math.imul(he,Be)|0,c=c+Math.imul(he,De)|0,c=c+Math.imul(pe,Be)|0,w=w+Math.imul(pe,De)|0;var rs=(k+g|0)+((c&8191)<<13)|0;k=(w+(c>>>13)|0)+(rs>>>26)|0,rs&=67108863,g=Math.imul(ve,Te),c=Math.imul(ve,Ne),c=c+Math.imul(be,Te)|0,w=Math.imul(be,Ne),g=g+Math.imul(ce,Le)|0,c=c+Math.imul(ce,Oe)|0,c=c+Math.imul(me,Le)|0,w=w+Math.imul(me,Oe)|0,g=g+Math.imul(fe,Pe)|0,c=c+Math.imul(fe,$e)|0,c=c+Math.imul(le,Pe)|0,w=w+Math.imul(le,$e)|0,g=g+Math.imul(ge,Be)|0,c=c+Math.imul(ge,De)|0,c=c+Math.imul(de,Be)|0,w=w+Math.imul(de,De)|0;var ns=(k+g|0)+((c&8191)<<13)|0;k=(w+(c>>>13)|0)+(ns>>>26)|0,ns&=67108863,g=Math.imul(ve,Le),c=Math.imul(ve,Oe),c=c+Math.imul(be,Le)|0,w=Math.imul(be,Oe),g=g+Math.imul(ce,Pe)|0,c=c+Math.imul(ce,$e)|0,c=c+Math.imul(me,Pe)|0,w=w+Math.imul(me,$e)|0,g=g+Math.imul(fe,Be)|0,c=c+Math.imul(fe,De)|0,c=c+Math.imul(le,Be)|0,w=w+Math.imul(le,De)|0;var is=(k+g|0)+((c&8191)<<13)|0;k=(w+(c>>>13)|0)+(is>>>26)|0,is&=67108863,g=Math.imul(ve,Pe),c=Math.imul(ve,$e),c=c+Math.imul(be,Pe)|0,w=Math.imul(be,$e),g=g+Math.imul(ce,Be)|0,c=c+Math.imul(ce,De)|0,c=c+Math.imul(me,Be)|0,w=w+Math.imul(me,De)|0;var ss=(k+g|0)+((c&8191)<<13)|0;k=(w+(c>>>13)|0)+(ss>>>26)|0,ss&=67108863,g=Math.imul(ve,Be),c=Math.imul(ve,De),c=c+Math.imul(be,Be)|0,w=Math.imul(be,De);var os=(k+g|0)+((c&8191)<<13)|0;return k=(w+(c>>>13)|0)+(os>>>26)|0,os&=67108863,E[0]=Ut,E[1]=Wt,E[2]=Vt,E[3]=zt,E[4]=qt,E[5]=Jt,E[6]=Gt,E[7]=Zt,E[8]=Kt,E[9]=Qt,E[10]=Yt,E[11]=Xt,E[12]=er,E[13]=tr,E[14]=rs,E[15]=ns,E[16]=is,E[17]=ss,E[18]=os,k!==0&&(E[19]=k,f.length++),f};Math.imul||(T=M);function N(S,o,u){u.negative=o.negative^S.negative,u.length=S.length+o.length;for(var f=0,p=0,v=0;v>>26)|0,p+=E>>>26,E&=67108863}u.words[v]=k,f=E,E=p}return f!==0?u.words[v]=f:u.length--,u._strip()}function D(S,o,u){return N(S,o,u)}s.prototype.mulTo=function(o,u){var f,p=this.length+o.length;return this.length===10&&o.length===10?f=T(this,o,u):p<63?f=M(this,o,u):p<1024?f=N(this,o,u):f=D(this,o,u),f},s.prototype.mul=function(o){var u=new s(null);return u.words=new Array(this.length+o.length),this.mulTo(o,u)},s.prototype.mulf=function(o){var u=new s(null);return u.words=new Array(this.length+o.length),D(this,o,u)},s.prototype.imul=function(o){return this.clone().mulTo(o,this)},s.prototype.imuln=function(o){var u=o<0;u&&(o=-o),n(typeof o=="number"),n(o<67108864);for(var f=0,p=0;p>=26,f+=v/67108864|0,f+=E>>>26,this.words[p]=E&67108863}return f!==0&&(this.words[p]=f,this.length++),u?this.ineg():this},s.prototype.muln=function(o){return this.clone().imuln(o)},s.prototype.sqr=function(){return this.mul(this)},s.prototype.isqr=function(){return this.imul(this.clone())},s.prototype.pow=function(o){var u=O(o);if(u.length===0)return new s(1);for(var f=this,p=0;p=0);var u=o%26,f=(o-u)/26,p=67108863>>>26-u<<26-u,v;if(u!==0){var E=0;for(v=0;v>>26-u}E&&(this.words[v]=E,this.length++)}if(f!==0){for(v=this.length-1;v>=0;v--)this.words[v+f]=this.words[v];for(v=0;v=0);var p;u?p=(u-u%26)/26:p=0;var v=o%26,E=Math.min((o-v)/26,this.length),k=67108863^67108863>>>v<E)for(this.length-=E,c=0;c=0&&(w!==0||c>=p);c--){var U=this.words[c]|0;this.words[c]=w<<26-v|U>>>v,w=U&k}return g&&w!==0&&(g.words[g.length++]=w),this.length===0&&(this.words[0]=0,this.length=1),this._strip()},s.prototype.ishrn=function(o,u,f){return n(this.negative===0),this.iushrn(o,u,f)},s.prototype.shln=function(o){return this.clone().ishln(o)},s.prototype.ushln=function(o){return this.clone().iushln(o)},s.prototype.shrn=function(o){return this.clone().ishrn(o)},s.prototype.ushrn=function(o){return this.clone().iushrn(o)},s.prototype.testn=function(o){n(typeof o=="number"&&o>=0);var u=o%26,f=(o-u)/26,p=1<=0);var u=o%26,f=(o-u)/26;if(n(this.negative===0,"imaskn works only with positive numbers"),this.length<=f)return this;if(u!==0&&f++,this.length=Math.min(f,this.length),u!==0){var p=67108863^67108863>>>u<=67108864;u++)this.words[u]-=67108864,u===this.length-1?this.words[u+1]=1:this.words[u+1]++;return this.length=Math.max(this.length,u+1),this},s.prototype.isubn=function(o){if(n(typeof o=="number"),n(o<67108864),o<0)return this.iaddn(-o);if(this.negative!==0)return this.negative=0,this.iaddn(o),this.negative=1,this;if(this.words[0]-=o,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var u=0;u>26)-(g/67108864|0),this.words[v+f]=E&67108863}for(;v>26,this.words[v+f]=E&67108863;if(k===0)return this._strip();for(n(k===-1),k=0,v=0;v>26,this.words[v]=E&67108863;return this.negative=1,this._strip()},s.prototype._wordDiv=function(o,u){var f=this.length-o.length,p=this.clone(),v=o,E=v.words[v.length-1]|0,k=this._countBits(E);f=26-k,f!==0&&(v=v.ushln(f),p.iushln(f),E=v.words[v.length-1]|0);var g=p.length-v.length,c;if(u!=="mod"){c=new s(null),c.length=g+1,c.words=new Array(c.length);for(var w=0;w=0;H--){var V=(p.words[v.length+H]|0)*67108864+(p.words[v.length+H-1]|0);for(V=Math.min(V/E|0,67108863),p._ishlnsubmul(v,V,H);p.negative!==0;)V--,p.negative=0,p._ishlnsubmul(v,1,H),p.isZero()||(p.negative^=1);c&&(c.words[H]=V)}return c&&c._strip(),p._strip(),u!=="div"&&f!==0&&p.iushrn(f),{div:c||null,mod:p}},s.prototype.divmod=function(o,u,f){if(n(!o.isZero()),this.isZero())return{div:new s(0),mod:new s(0)};var p,v,E;return this.negative!==0&&o.negative===0?(E=this.neg().divmod(o,u),u!=="mod"&&(p=E.div.neg()),u!=="div"&&(v=E.mod.neg(),f&&v.negative!==0&&v.iadd(o)),{div:p,mod:v}):this.negative===0&&o.negative!==0?(E=this.divmod(o.neg(),u),u!=="mod"&&(p=E.div.neg()),{div:p,mod:E.mod}):this.negative&o.negative?(E=this.neg().divmod(o.neg(),u),u!=="div"&&(v=E.mod.neg(),f&&v.negative!==0&&v.isub(o)),{div:E.div,mod:v}):o.length>this.length||this.cmp(o)<0?{div:new s(0),mod:this}:o.length===1?u==="div"?{div:this.divn(o.words[0]),mod:null}:u==="mod"?{div:null,mod:new s(this.modrn(o.words[0]))}:{div:this.divn(o.words[0]),mod:new s(this.modrn(o.words[0]))}:this._wordDiv(o,u)},s.prototype.div=function(o){return this.divmod(o,"div",!1).div},s.prototype.mod=function(o){return this.divmod(o,"mod",!1).mod},s.prototype.umod=function(o){return this.divmod(o,"mod",!0).mod},s.prototype.divRound=function(o){var u=this.divmod(o);if(u.mod.isZero())return u.div;var f=u.div.negative!==0?u.mod.isub(o):u.mod,p=o.ushrn(1),v=o.andln(1),E=f.cmp(p);return E<0||v===1&&E===0?u.div:u.div.negative!==0?u.div.isubn(1):u.div.iaddn(1)},s.prototype.modrn=function(o){var u=o<0;u&&(o=-o),n(o<=67108863);for(var f=(1<<26)%o,p=0,v=this.length-1;v>=0;v--)p=(f*p+(this.words[v]|0))%o;return u?-p:p},s.prototype.modn=function(o){return this.modrn(o)},s.prototype.idivn=function(o){var u=o<0;u&&(o=-o),n(o<=67108863);for(var f=0,p=this.length-1;p>=0;p--){var v=(this.words[p]|0)+f*67108864;this.words[p]=v/o|0,f=v%o}return this._strip(),u?this.ineg():this},s.prototype.divn=function(o){return this.clone().idivn(o)},s.prototype.egcd=function(o){n(o.negative===0),n(!o.isZero());var u=this,f=o.clone();u.negative!==0?u=u.umod(o):u=u.clone();for(var p=new s(1),v=new s(0),E=new s(0),k=new s(1),g=0;u.isEven()&&f.isEven();)u.iushrn(1),f.iushrn(1),++g;for(var c=f.clone(),w=u.clone();!u.isZero();){for(var U=0,H=1;!(u.words[0]&H)&&U<26;++U,H<<=1);if(U>0)for(u.iushrn(U);U-- >0;)(p.isOdd()||v.isOdd())&&(p.iadd(c),v.isub(w)),p.iushrn(1),v.iushrn(1);for(var V=0,A=1;!(f.words[0]&A)&&V<26;++V,A<<=1);if(V>0)for(f.iushrn(V);V-- >0;)(E.isOdd()||k.isOdd())&&(E.iadd(c),k.isub(w)),E.iushrn(1),k.iushrn(1);u.cmp(f)>=0?(u.isub(f),p.isub(E),v.isub(k)):(f.isub(u),E.isub(p),k.isub(v))}return{a:E,b:k,gcd:f.iushln(g)}},s.prototype._invmp=function(o){n(o.negative===0),n(!o.isZero());var u=this,f=o.clone();u.negative!==0?u=u.umod(o):u=u.clone();for(var p=new s(1),v=new s(0),E=f.clone();u.cmpn(1)>0&&f.cmpn(1)>0;){for(var k=0,g=1;!(u.words[0]&g)&&k<26;++k,g<<=1);if(k>0)for(u.iushrn(k);k-- >0;)p.isOdd()&&p.iadd(E),p.iushrn(1);for(var c=0,w=1;!(f.words[0]&w)&&c<26;++c,w<<=1);if(c>0)for(f.iushrn(c);c-- >0;)v.isOdd()&&v.iadd(E),v.iushrn(1);u.cmp(f)>=0?(u.isub(f),p.isub(v)):(f.isub(u),v.isub(p))}var U;return u.cmpn(1)===0?U=p:U=v,U.cmpn(0)<0&&U.iadd(o),U},s.prototype.gcd=function(o){if(this.isZero())return o.abs();if(o.isZero())return this.abs();var u=this.clone(),f=o.clone();u.negative=0,f.negative=0;for(var p=0;u.isEven()&&f.isEven();p++)u.iushrn(1),f.iushrn(1);do{for(;u.isEven();)u.iushrn(1);for(;f.isEven();)f.iushrn(1);var v=u.cmp(f);if(v<0){var E=u;u=f,f=E}else if(v===0||f.cmpn(1)===0)break;u.isub(f)}while(!0);return f.iushln(p)},s.prototype.invm=function(o){return this.egcd(o).a.umod(o)},s.prototype.isEven=function(){return(this.words[0]&1)===0},s.prototype.isOdd=function(){return(this.words[0]&1)===1},s.prototype.andln=function(o){return this.words[0]&o},s.prototype.bincn=function(o){n(typeof o=="number");var u=o%26,f=(o-u)/26,p=1<>>26,k&=67108863,this.words[E]=k}return v!==0&&(this.words[E]=v,this.length++),this},s.prototype.isZero=function(){return this.length===1&&this.words[0]===0},s.prototype.cmpn=function(o){var u=o<0;if(this.negative!==0&&!u)return-1;if(this.negative===0&&u)return 1;this._strip();var f;if(this.length>1)f=1;else{u&&(o=-o),n(o<=67108863,"Number is too big");var p=this.words[0]|0;f=p===o?0:po.length)return 1;if(this.length=0;f--){var p=this.words[f]|0,v=o.words[f]|0;if(p!==v){pv&&(u=1);break}}return u},s.prototype.gtn=function(o){return this.cmpn(o)===1},s.prototype.gt=function(o){return this.cmp(o)===1},s.prototype.gten=function(o){return this.cmpn(o)>=0},s.prototype.gte=function(o){return this.cmp(o)>=0},s.prototype.ltn=function(o){return this.cmpn(o)===-1},s.prototype.lt=function(o){return this.cmp(o)===-1},s.prototype.lten=function(o){return this.cmpn(o)<=0},s.prototype.lte=function(o){return this.cmp(o)<=0},s.prototype.eqn=function(o){return this.cmpn(o)===0},s.prototype.eq=function(o){return this.cmp(o)===0},s.red=function(o){return new X(o)},s.prototype.toRed=function(o){return n(!this.red,"Already a number in reduction context"),n(this.negative===0,"red works only with positives"),o.convertTo(this)._forceRed(o)},s.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},s.prototype._forceRed=function(o){return this.red=o,this},s.prototype.forceRed=function(o){return n(!this.red,"Already a number in reduction context"),this._forceRed(o)},s.prototype.redAdd=function(o){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,o)},s.prototype.redIAdd=function(o){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,o)},s.prototype.redSub=function(o){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,o)},s.prototype.redISub=function(o){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,o)},s.prototype.redShl=function(o){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,o)},s.prototype.redMul=function(o){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,o),this.red.mul(this,o)},s.prototype.redIMul=function(o){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,o),this.red.imul(this,o)},s.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},s.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},s.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},s.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},s.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},s.prototype.redPow=function(o){return n(this.red&&!o.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,o)};var L={k256:null,p224:null,p192:null,p25519:null};function F(S,o){this.name=S,this.p=new s(o,16),this.n=this.p.bitLength(),this.k=new s(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}F.prototype._tmp=function(){var o=new s(null);return o.words=new Array(Math.ceil(this.n/13)),o},F.prototype.ireduce=function(o){var u=o,f;do this.split(u,this.tmp),u=this.imulK(u),u=u.iadd(this.tmp),f=u.bitLength();while(f>this.n);var p=f0?u.isub(this.p):u.strip!==void 0?u.strip():u._strip(),u},F.prototype.split=function(o,u){o.iushrn(this.n,0,u)},F.prototype.imulK=function(o){return o.imul(this.k)};function W(){F.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}i(W,F),W.prototype.split=function(o,u){for(var f=4194303,p=Math.min(o.length,9),v=0;v>>22,E=k}E>>>=22,o.words[v-10]=E,E===0&&o.length>10?o.length-=10:o.length-=9},W.prototype.imulK=function(o){o.words[o.length]=0,o.words[o.length+1]=0,o.length+=2;for(var u=0,f=0;f>>=26,o.words[f]=v,u=p}return u!==0&&(o.words[o.length++]=u),o},s._prime=function(o){if(L[o])return L[o];var u;if(o==="k256")u=new W;else if(o==="p224")u=new te;else if(o==="p192")u=new Z;else if(o==="p25519")u=new z;else throw new Error("Unknown prime "+o);return L[o]=u,u};function X(S){if(typeof S=="string"){var o=s._prime(S);this.m=o.p,this.prime=o}else n(S.gtn(1),"modulus must be greater than 1"),this.m=S,this.prime=null}X.prototype._verify1=function(o){n(o.negative===0,"red works only with positives"),n(o.red,"red works only with red numbers")},X.prototype._verify2=function(o,u){n((o.negative|u.negative)===0,"red works only with positives"),n(o.red&&o.red===u.red,"red works only with red numbers")},X.prototype.imod=function(o){return this.prime?this.prime.ireduce(o)._forceRed(this):(m(o,o.umod(this.m)._forceRed(this)),o)},X.prototype.neg=function(o){return o.isZero()?o.clone():this.m.sub(o)._forceRed(this)},X.prototype.add=function(o,u){this._verify2(o,u);var f=o.add(u);return f.cmp(this.m)>=0&&f.isub(this.m),f._forceRed(this)},X.prototype.iadd=function(o,u){this._verify2(o,u);var f=o.iadd(u);return f.cmp(this.m)>=0&&f.isub(this.m),f},X.prototype.sub=function(o,u){this._verify2(o,u);var f=o.sub(u);return f.cmpn(0)<0&&f.iadd(this.m),f._forceRed(this)},X.prototype.isub=function(o,u){this._verify2(o,u);var f=o.isub(u);return f.cmpn(0)<0&&f.iadd(this.m),f},X.prototype.shl=function(o,u){return this._verify1(o),this.imod(o.ushln(u))},X.prototype.imul=function(o,u){return this._verify2(o,u),this.imod(o.imul(u))},X.prototype.mul=function(o,u){return this._verify2(o,u),this.imod(o.mul(u))},X.prototype.isqr=function(o){return this.imul(o,o.clone())},X.prototype.sqr=function(o){return this.mul(o,o)},X.prototype.sqrt=function(o){if(o.isZero())return o.clone();var u=this.m.andln(3);if(n(u%2===1),u===3){var f=this.m.add(new s(1)).iushrn(2);return this.pow(o,f)}for(var p=this.m.subn(1),v=0;!p.isZero()&&p.andln(1)===0;)v++,p.iushrn(1);n(!p.isZero());var E=new s(1).toRed(this),k=E.redNeg(),g=this.m.subn(1).iushrn(1),c=this.m.bitLength();for(c=new s(2*c*c).toRed(this);this.pow(c,g).cmp(k)!==0;)c.redIAdd(k);for(var w=this.pow(c,p),U=this.pow(o,p.addn(1).iushrn(1)),H=this.pow(o,p),V=v;H.cmp(E)!==0;){for(var A=H,I=0;A.cmp(E)!==0;I++)A=A.redSqr();n(I=0;v--){for(var w=u.words[v],U=c-1;U>=0;U--){var H=w>>U&1;if(E!==p[0]&&(E=this.sqr(E)),H===0&&k===0){g=0;continue}k<<=1,k|=H,g++,!(g!==f&&(v!==0||U!==0))&&(E=this.mul(E,p[k]),g=0,k=0)}c=26}return E},X.prototype.convertTo=function(o){var u=o.umod(this.m);return u===o?u.clone():u},X.prototype.convertFrom=function(o){var u=o.clone();return u.red=null,u},s.mont=function(o){return new ne(o)};function ne(S){X.call(this,S),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new s(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}i(ne,X),ne.prototype.convertTo=function(o){return this.imod(o.ushln(this.shift))},ne.prototype.convertFrom=function(o){var u=this.imod(o.mul(this.rinv));return u.red=null,u},ne.prototype.imul=function(o,u){if(o.isZero()||u.isZero())return o.words[0]=0,o.length=1,o;var f=o.imul(u),p=f.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),v=f.isub(p).iushrn(this.shift),E=v;return v.cmp(this.m)>=0?E=v.isub(this.m):v.cmpn(0)<0&&(E=v.iadd(this.m)),E._forceRed(this)},ne.prototype.mul=function(o,u){if(o.isZero()||u.isZero())return new s(0)._forceRed(this);var f=o.mul(u),p=f.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),v=f.isub(p).iushrn(this.shift),E=v;return v.cmp(this.m)>=0?E=v.isub(this.m):v.cmpn(0)<0&&(E=v.iadd(this.m)),E._forceRed(this)},ne.prototype.invm=function(o){var u=this.imod(o._invmp(this.m).mul(this.r2));return u._forceRed(this)}})(e,Q)})(Vs);var ci=Vs.exports,gn={},Nt={};Object.defineProperty(Nt,"__esModule",{value:!0});Nt.errorValues=Nt.standardErrorCodes=void 0;Nt.standardErrorCodes={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}};Nt.errorValues={"-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."}};var li={},ui={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.serialize=e.getErrorCode=e.isValidCode=e.getMessageFromCode=e.JSON_RPC_SERVER_ERROR_MESSAGE=void 0;const t=Nt,r="Unspecified error message.";e.JSON_RPC_SERVER_ERROR_MESSAGE="Unspecified server error.";function n(y,C=r){if(y&&Number.isInteger(y)){const x=y.toString();if(m(t.errorValues,x))return t.errorValues[x].message;if(d(y))return e.JSON_RPC_SERVER_ERROR_MESSAGE}return C}e.getMessageFromCode=n;function i(y){if(!Number.isInteger(y))return!1;const C=y.toString();return!!(t.errorValues[C]||d(y))}e.isValidCode=i;function s(y){var C;if(typeof y=="number")return y;if(a(y))return(C=y.code)!==null&&C!==void 0?C:y.errorCode}e.getErrorCode=s;function a(y){return typeof y=="object"&&y!==null&&(typeof y.code=="number"||typeof y.errorCode=="number")}function l(y,{shouldIncludeStack:C=!1}={}){const x={};if(y&&typeof y=="object"&&!Array.isArray(y)&&m(y,"code")&&i(y.code)){const B=y;x.code=B.code,B.message&&typeof B.message=="string"?(x.message=B.message,m(B,"data")&&(x.data=B.data)):(x.message=n(x.code),x.data={originalError:h(y)})}else x.code=t.standardErrorCodes.rpc.internal,x.message=R(y,"message")?y.message:r,x.data={originalError:h(y)};return C&&(x.stack=R(y,"stack")?y.stack:void 0),x}e.serialize=l;function d(y){return y>=-32099&&y<=-32e3}function h(y){return y&&typeof y=="object"&&!Array.isArray(y)?Object.assign({},y):y}function m(y,C){return Object.prototype.hasOwnProperty.call(y,C)}function R(y,C){return typeof y=="object"&&y!==null&&C in y&&typeof y[C]=="string"}})(ui);Object.defineProperty(li,"__esModule",{value:!0});li.standardErrors=void 0;const Ge=Nt,cc=ui;li.standardErrors={rpc:{parse:e=>ct(Ge.standardErrorCodes.rpc.parse,e),invalidRequest:e=>ct(Ge.standardErrorCodes.rpc.invalidRequest,e),invalidParams:e=>ct(Ge.standardErrorCodes.rpc.invalidParams,e),methodNotFound:e=>ct(Ge.standardErrorCodes.rpc.methodNotFound,e),internal:e=>ct(Ge.standardErrorCodes.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 ct(t,e)},invalidInput:e=>ct(Ge.standardErrorCodes.rpc.invalidInput,e),resourceNotFound:e=>ct(Ge.standardErrorCodes.rpc.resourceNotFound,e),resourceUnavailable:e=>ct(Ge.standardErrorCodes.rpc.resourceUnavailable,e),transactionRejected:e=>ct(Ge.standardErrorCodes.rpc.transactionRejected,e),methodNotSupported:e=>ct(Ge.standardErrorCodes.rpc.methodNotSupported,e),limitExceeded:e=>ct(Ge.standardErrorCodes.rpc.limitExceeded,e)},provider:{userRejectedRequest:e=>Ar(Ge.standardErrorCodes.provider.userRejectedRequest,e),unauthorized:e=>Ar(Ge.standardErrorCodes.provider.unauthorized,e),unsupportedMethod:e=>Ar(Ge.standardErrorCodes.provider.unsupportedMethod,e),disconnected:e=>Ar(Ge.standardErrorCodes.provider.disconnected,e),chainDisconnected:e=>Ar(Ge.standardErrorCodes.provider.chainDisconnected,e),unsupportedChain:e=>Ar(Ge.standardErrorCodes.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:r,data:n}=e;if(!r||typeof r!="string")throw new Error('"message" must be a nonempty string');return new hc(t,r,n)}}};function ct(e,t){const[r,n]=lc(t);return new uc(e,r||(0,cc.getMessageFromCode)(e),n)}function Ar(e,t){const[r,n]=lc(t);return new hc(e,r||(0,cc.getMessageFromCode)(e),n)}function lc(e){if(e){if(typeof e=="string")return[e];if(typeof e=="object"&&!Array.isArray(e)){const{message:t,data:r}=e;if(t&&typeof t!="string")throw new Error("Must specify string message.");return[t||void 0,r]}}return[]}let uc=class extends Error{constructor(t,r,n){if(!Number.isInteger(t))throw new Error('"code" must be an integer.');if(!r||typeof r!="string")throw new Error('"message" must be a nonempty string.');super(r),this.code=t,n!==void 0&&(this.data=n)}},hc=class extends uc{constructor(t,r,n){if(!du(t))throw new Error('"code" must be an integer such that: 1000 <= code <= 4999');super(t,r,n)}};function du(e){return Number.isInteger(e)&&e>=1e3&&e<=4999}var hi={},Kr={};Object.defineProperty(Kr,"__esModule",{value:!0});Kr.isErrorResponse=void 0;function fu(e){return e.errorMessage!==void 0}Kr.isErrorResponse=fu;var Qr={};Object.defineProperty(Qr,"__esModule",{value:!0});Qr.LIB_VERSION=void 0;Qr.LIB_VERSION="3.9.3";Object.defineProperty(hi,"__esModule",{value:!0});hi.serializeError=void 0;const pu=Kr,gu=Qr,mu=Nt,vu=ui;function bu(e,t){const r=(0,vu.serialize)(wu(e),{shouldIncludeStack:!0}),n=new URL("https://docs.cloud.coinbase.com/wallet-sdk/docs/errors");n.searchParams.set("version",gu.LIB_VERSION),n.searchParams.set("code",r.code.toString());const i=_u(r.data,t);return i&&n.searchParams.set("method",i),n.searchParams.set("message",r.message),Object.assign(Object.assign({},r),{docUrl:n.href})}hi.serializeError=bu;function wu(e){return typeof e=="string"?{message:e,code:mu.standardErrorCodes.rpc.internal}:(0,pu.isErrorResponse)(e)?Object.assign(Object.assign({},e),{message:e.errorMessage,code:e.errorCode,data:{method:e.method}}):e}function _u(e,t){const r=e==null?void 0:e.method;if(r)return r;if(t!==void 0){if(typeof t=="string")return t;if(Array.isArray(t)){if(t.length>0)return t[0].method}else return t.method}}(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.standardErrors=e.standardErrorCodes=e.serializeError=e.getMessageFromCode=e.getErrorCode=void 0;const t=Nt;Object.defineProperty(e,"standardErrorCodes",{enumerable:!0,get:function(){return t.standardErrorCodes}});const r=li;Object.defineProperty(e,"standardErrors",{enumerable:!0,get:function(){return r.standardErrors}});const n=hi;Object.defineProperty(e,"serializeError",{enumerable:!0,get:function(){return n.serializeError}});const i=ui;Object.defineProperty(e,"getErrorCode",{enumerable:!0,get:function(){return i.getErrorCode}}),Object.defineProperty(e,"getMessageFromCode",{enumerable:!0,get:function(){return i.getMessageFromCode}})})(gn);var Ve={};Object.defineProperty(Ve,"__esModule",{value:!0});Ve.ProviderType=Ve.RegExpString=Ve.IntNumber=Ve.BigIntString=Ve.AddressString=Ve.HexString=Ve.OpaqueType=void 0;function mn(){return e=>e}Ve.OpaqueType=mn;Ve.HexString=mn();Ve.AddressString=mn();Ve.BigIntString=mn();function yu(e){return Math.floor(e)}Ve.IntNumber=yu;Ve.RegExpString=mn();var Ao;(function(e){e.CoinbaseWallet="CoinbaseWallet",e.MetaMask="MetaMask",e.Unselected=""})(Ao||(Ve.ProviderType=Ao={}));var Eu=Q&&Q.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(q,"__esModule",{value:!0});q.isMobileWeb=q.getLocation=q.isInIFrame=q.createQrUrl=q.getFavicon=q.range=q.isBigNumber=q.ensureParsedJSONObject=q.ensureBN=q.ensureRegExpString=q.ensureIntNumber=q.ensureBuffer=q.ensureAddressString=q.ensureEvenLengthHexString=q.ensureHexString=q.isHexString=q.prepend0x=q.strip0x=q.has0xPrefix=q.hexStringFromIntNumber=q.intNumberFromHexString=q.bigIntStringFromBN=q.hexStringFromBuffer=q.hexStringToUint8Array=q.uint8ArrayToHex=q.randomBytesHex=void 0;const $t=Eu(ci),pr=gn,dt=Ve,dc=/^[0-9]*$/,fc=/^[a-f0-9]*$/;function Su(e){return pc(crypto.getRandomValues(new Uint8Array(e)))}q.randomBytesHex=Su;function pc(e){return[...e].map(t=>t.toString(16).padStart(2,"0")).join("")}q.uint8ArrayToHex=pc;function Ru(e){return new Uint8Array(e.match(/.{1,2}/g).map(t=>parseInt(t,16)))}q.hexStringToUint8Array=Ru;function Mu(e,t=!1){const r=e.toString("hex");return(0,dt.HexString)(t?`0x${r}`:r)}q.hexStringFromBuffer=Mu;function ku(e){return(0,dt.BigIntString)(e.toString(10))}q.bigIntStringFromBN=ku;function Cu(e){return(0,dt.IntNumber)(new $t.default(bn(e,!1),16).toNumber())}q.intNumberFromHexString=Cu;function Iu(e){return(0,dt.HexString)(`0x${new $t.default(e).toString(16)}`)}q.hexStringFromIntNumber=Iu;function zs(e){return e.startsWith("0x")||e.startsWith("0X")}q.has0xPrefix=zs;function di(e){return zs(e)?e.slice(2):e}q.strip0x=di;function gc(e){return zs(e)?`0x${e.slice(2)}`:`0x${e}`}q.prepend0x=gc;function vn(e){if(typeof e!="string")return!1;const t=di(e).toLowerCase();return fc.test(t)}q.isHexString=vn;function mc(e,t=!1){if(typeof e=="string"){const r=di(e).toLowerCase();if(fc.test(r))return(0,dt.HexString)(t?`0x${r}`:r)}throw pr.standardErrors.rpc.invalidParams(`"${String(e)}" is not a hexadecimal string`)}q.ensureHexString=mc;function bn(e,t=!1){let r=mc(e,!1);return r.length%2===1&&(r=(0,dt.HexString)(`0${r}`)),t?(0,dt.HexString)(`0x${r}`):r}q.ensureEvenLengthHexString=bn;function xu(e){if(typeof e=="string"){const t=di(e).toLowerCase();if(vn(t)&&t.length===40)return(0,dt.AddressString)(gc(t))}throw pr.standardErrors.rpc.invalidParams(`Invalid Ethereum address: ${String(e)}`)}q.ensureAddressString=xu;function Au(e){if(Buffer.isBuffer(e))return e;if(typeof e=="string"){if(vn(e)){const t=bn(e,!1);return Buffer.from(t,"hex")}return Buffer.from(e,"utf8")}throw pr.standardErrors.rpc.invalidParams(`Not binary data: ${String(e)}`)}q.ensureBuffer=Au;function vc(e){if(typeof e=="number"&&Number.isInteger(e))return(0,dt.IntNumber)(e);if(typeof e=="string"){if(dc.test(e))return(0,dt.IntNumber)(Number(e));if(vn(e))return(0,dt.IntNumber)(new $t.default(bn(e,!1),16).toNumber())}throw pr.standardErrors.rpc.invalidParams(`Not an integer: ${String(e)}`)}q.ensureIntNumber=vc;function Tu(e){if(e instanceof RegExp)return(0,dt.RegExpString)(e.toString());throw pr.standardErrors.rpc.invalidParams(`Not a RegExp: ${String(e)}`)}q.ensureRegExpString=Tu;function Nu(e){if(e!==null&&($t.default.isBN(e)||bc(e)))return new $t.default(e.toString(10),10);if(typeof e=="number")return new $t.default(vc(e));if(typeof e=="string"){if(dc.test(e))return new $t.default(e,10);if(vn(e))return new $t.default(bn(e,!1),16)}throw pr.standardErrors.rpc.invalidParams(`Not an integer: ${String(e)}`)}q.ensureBN=Nu;function Lu(e){if(typeof e=="string")return JSON.parse(e);if(typeof e=="object")return e;throw pr.standardErrors.rpc.invalidParams(`Not a JSON string or an object: ${String(e)}`)}q.ensureParsedJSONObject=Lu;function bc(e){if(e==null||typeof e.constructor!="function")return!1;const{constructor:t}=e;return typeof t.config=="function"&&typeof t.EUCLID=="number"}q.isBigNumber=bc;function Ou(e,t){return Array.from({length:t-e},(r,n)=>e+n)}q.range=Ou;function Pu(){const e=document.querySelector('link[sizes="192x192"]')||document.querySelector('link[sizes="180x180"]')||document.querySelector('link[rel="icon"]')||document.querySelector('link[rel="shortcut icon"]'),{protocol:t,host:r}=document.location,n=e?e.getAttribute("href"):null;return!n||n.startsWith("javascript:")||n.startsWith("vbscript:")?null:n.startsWith("http://")||n.startsWith("https://")||n.startsWith("data:")?n:n.startsWith("//")?t+n:`${t}//${r}${n}`}q.getFavicon=Pu;function $u(e,t,r,n,i,s){const a=n?"parent-id":"id",l=new URLSearchParams({[a]:e,secret:t,server:r,v:i,chainId:s.toString()}).toString();return`${r}/#/link?${l}`}q.createQrUrl=$u;function wc(){try{return window.frameElement!==null}catch{return!1}}q.isInIFrame=wc;function Bu(){try{return wc()&&window.top?window.top.location:window.location}catch{return window.location}}q.getLocation=Bu;function Du(){var e;return/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test((e=window==null?void 0:window.navigator)===null||e===void 0?void 0:e.userAgent)}q.isMobileWeb=Du;var fi={};Object.defineProperty(fi,"__esModule",{value:!0});fi.ScopedLocalStorage=void 0;class Fu{constructor(t){this.scope=t}setItem(t,r){localStorage.setItem(this.scopedKey(t),r)}getItem(t){return localStorage.getItem(this.scopedKey(t))}removeItem(t){localStorage.removeItem(this.scopedKey(t))}clear(){const t=this.scopedKey(""),r=[];for(let n=0;nlocalStorage.removeItem(n))}scopedKey(t){return`${this.scope}:${t}`}}fi.ScopedLocalStorage=Fu;var Ur={};const ju=Zr(uu);var wn={},_n={},Yr={};Object.defineProperty(Yr,"__esModule",{value:!0});Yr.EVENTS=void 0;Yr.EVENTS={STARTED_CONNECTING:"walletlink_sdk.started.connecting",CONNECTED_STATE_CHANGE:"walletlink_sdk.connected",DISCONNECTED:"walletlink_sdk.disconnected",METADATA_DESTROYED:"walletlink_sdk_metadata_destroyed",LINKED:"walletlink_sdk.linked",FAILURE:"walletlink_sdk.generic_failure",SESSION_CONFIG_RECEIVED:"walletlink_sdk.session_config_event_received",ETH_ACCOUNTS_STATE:"walletlink_sdk.eth_accounts_state",SESSION_STATE_CHANGE:"walletlink_sdk.session_state_change",UNLINKED_ERROR_STATE:"walletlink_sdk.unlinked_error_state",SKIPPED_CLEARING_SESSION:"walletlink_sdk.skipped_clearing_session",GENERAL_ERROR:"walletlink_sdk.general_error",WEB3_REQUEST:"walletlink_sdk.web3.request",WEB3_REQUEST_PUBLISHED:"walletlink_sdk.web3.request_published",WEB3_RESPONSE:"walletlink_sdk.web3.response",METHOD_NOT_IMPLEMENTED:"walletlink_sdk.method_not_implemented",UNKNOWN_ADDRESS_ENCOUNTERED:"walletlink_sdk.unknown_address_encountered"};var ht={};Object.defineProperty(ht,"__esModule",{value:!0});ht.RelayAbstract=ht.APP_VERSION_KEY=ht.LOCAL_STORAGE_ADDRESSES_KEY=ht.WALLET_USER_NAME_KEY=void 0;const To=gn;ht.WALLET_USER_NAME_KEY="walletUsername";ht.LOCAL_STORAGE_ADDRESSES_KEY="Addresses";ht.APP_VERSION_KEY="AppVersion";class Hu{async makeEthereumJSONRPCRequest(t,r){if(!r)throw new Error("Error: No jsonRpcUrl provided");return window.fetch(r,{method:"POST",body:JSON.stringify(t),mode:"cors",headers:{"Content-Type":"application/json"}}).then(n=>n.json()).then(n=>{if(!n)throw To.standardErrors.rpc.parse({});const i=n,{error:s}=i;if(s)throw(0,To.serializeError)(s,t.method);return i})}}ht.RelayAbstract=Hu;var Xr={},_c={exports:{}},Ps={exports:{}};/*! safe-buffer. MIT License. Feross Aboukhadijeh */(function(e,t){var r=ii,n=r.Buffer;function i(a,l){for(var d in a)l[d]=a[d]}n.from&&n.alloc&&n.allocUnsafe&&n.allocUnsafeSlow?e.exports=r:(i(r,t),t.Buffer=s);function s(a,l,d){return n(a,l,d)}s.prototype=Object.create(n.prototype),i(n,s),s.from=function(a,l,d){if(typeof a=="number")throw new TypeError("Argument must not be a number");return n(a,l,d)},s.alloc=function(a,l,d){if(typeof a!="number")throw new TypeError("Argument must be a number");var h=n(a);return l!==void 0?typeof d=="string"?h.fill(l,d):h.fill(l):h.fill(0),h},s.allocUnsafe=function(a){if(typeof a!="number")throw new TypeError("Argument must be a number");return n(a)},s.allocUnsafeSlow=function(a){if(typeof a!="number")throw new TypeError("Argument must be a number");return r.SlowBuffer(a)}})(Ps,Ps.exports);var jt=Ps.exports,yc=jt.Buffer;function pi(e,t){this._block=yc.alloc(e),this._finalSize=t,this._blockSize=e,this._len=0}pi.prototype.update=function(e,t){typeof e=="string"&&(t=t||"utf8",e=yc.from(e,t));for(var r=this._block,n=this._blockSize,i=e.length,s=this._len,a=0;a=this._finalSize&&(this._update(this._block),this._block.fill(0));var r=this._len*8;if(r<=4294967295)this._block.writeUInt32BE(r,this._blockSize-4);else{var n=(r&4294967295)>>>0,i=(r-n)/4294967296;this._block.writeUInt32BE(i,this._blockSize-8),this._block.writeUInt32BE(n,this._blockSize-4)}this._update(this._block);var s=this._hash();return e?s.toString(e):s};pi.prototype._update=function(){throw new Error("_update must be implemented by subclass")};var en=pi,Uu=vt,Ec=en,Wu=jt.Buffer,Vu=[1518500249,1859775393,-1894007588,-899497514],zu=new Array(80);function yn(){this.init(),this._w=zu,Ec.call(this,64,56)}Uu(yn,Ec);yn.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this};function qu(e){return e<<5|e>>>27}function Ju(e){return e<<30|e>>>2}function Gu(e,t,r,n){return e===0?t&r|~t&n:e===2?t&r|t&n|r&n:t^r^n}yn.prototype._update=function(e){for(var t=this._w,r=this._a|0,n=this._b|0,i=this._c|0,s=this._d|0,a=this._e|0,l=0;l<16;++l)t[l]=e.readInt32BE(l*4);for(;l<80;++l)t[l]=t[l-3]^t[l-8]^t[l-14]^t[l-16];for(var d=0;d<80;++d){var h=~~(d/20),m=qu(r)+Gu(h,n,i,s)+a+t[d]+Vu[h]|0;a=s,s=i,i=Ju(n),n=r,r=m}this._a=r+this._a|0,this._b=n+this._b|0,this._c=i+this._c|0,this._d=s+this._d|0,this._e=a+this._e|0};yn.prototype._hash=function(){var e=Wu.allocUnsafe(20);return e.writeInt32BE(this._a|0,0),e.writeInt32BE(this._b|0,4),e.writeInt32BE(this._c|0,8),e.writeInt32BE(this._d|0,12),e.writeInt32BE(this._e|0,16),e};var Zu=yn,Ku=vt,Sc=en,Qu=jt.Buffer,Yu=[1518500249,1859775393,-1894007588,-899497514],Xu=new Array(80);function En(){this.init(),this._w=Xu,Sc.call(this,64,56)}Ku(En,Sc);En.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this};function eh(e){return e<<1|e>>>31}function th(e){return e<<5|e>>>27}function rh(e){return e<<30|e>>>2}function nh(e,t,r,n){return e===0?t&r|~t&n:e===2?t&r|t&n|r&n:t^r^n}En.prototype._update=function(e){for(var t=this._w,r=this._a|0,n=this._b|0,i=this._c|0,s=this._d|0,a=this._e|0,l=0;l<16;++l)t[l]=e.readInt32BE(l*4);for(;l<80;++l)t[l]=eh(t[l-3]^t[l-8]^t[l-14]^t[l-16]);for(var d=0;d<80;++d){var h=~~(d/20),m=th(r)+nh(h,n,i,s)+a+t[d]+Yu[h]|0;a=s,s=i,i=rh(n),n=r,r=m}this._a=r+this._a|0,this._b=n+this._b|0,this._c=i+this._c|0,this._d=s+this._d|0,this._e=a+this._e|0};En.prototype._hash=function(){var e=Qu.allocUnsafe(20);return e.writeInt32BE(this._a|0,0),e.writeInt32BE(this._b|0,4),e.writeInt32BE(this._c|0,8),e.writeInt32BE(this._d|0,12),e.writeInt32BE(this._e|0,16),e};var ih=En,sh=vt,Rc=en,oh=jt.Buffer,ah=[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],ch=new Array(64);function Sn(){this.init(),this._w=ch,Rc.call(this,64,56)}sh(Sn,Rc);Sn.prototype.init=function(){return this._a=1779033703,this._b=3144134277,this._c=1013904242,this._d=2773480762,this._e=1359893119,this._f=2600822924,this._g=528734635,this._h=1541459225,this};function lh(e,t,r){return r^e&(t^r)}function uh(e,t,r){return e&t|r&(e|t)}function hh(e){return(e>>>2|e<<30)^(e>>>13|e<<19)^(e>>>22|e<<10)}function dh(e){return(e>>>6|e<<26)^(e>>>11|e<<21)^(e>>>25|e<<7)}function fh(e){return(e>>>7|e<<25)^(e>>>18|e<<14)^e>>>3}function ph(e){return(e>>>17|e<<15)^(e>>>19|e<<13)^e>>>10}Sn.prototype._update=function(e){for(var t=this._w,r=this._a|0,n=this._b|0,i=this._c|0,s=this._d|0,a=this._e|0,l=this._f|0,d=this._g|0,h=this._h|0,m=0;m<16;++m)t[m]=e.readInt32BE(m*4);for(;m<64;++m)t[m]=ph(t[m-2])+t[m-7]+fh(t[m-15])+t[m-16]|0;for(var R=0;R<64;++R){var y=h+dh(a)+lh(a,l,d)+ah[R]+t[R]|0,C=hh(r)+uh(r,n,i)|0;h=d,d=l,l=a,a=s+y|0,s=i,i=n,n=r,r=y+C|0}this._a=r+this._a|0,this._b=n+this._b|0,this._c=i+this._c|0,this._d=s+this._d|0,this._e=a+this._e|0,this._f=l+this._f|0,this._g=d+this._g|0,this._h=h+this._h|0};Sn.prototype._hash=function(){var e=oh.allocUnsafe(32);return e.writeInt32BE(this._a,0),e.writeInt32BE(this._b,4),e.writeInt32BE(this._c,8),e.writeInt32BE(this._d,12),e.writeInt32BE(this._e,16),e.writeInt32BE(this._f,20),e.writeInt32BE(this._g,24),e.writeInt32BE(this._h,28),e};var Mc=Sn,gh=vt,mh=Mc,vh=en,bh=jt.Buffer,wh=new Array(64);function gi(){this.init(),this._w=wh,vh.call(this,64,56)}gh(gi,mh);gi.prototype.init=function(){return this._a=3238371032,this._b=914150663,this._c=812702999,this._d=4144912697,this._e=4290775857,this._f=1750603025,this._g=1694076839,this._h=3204075428,this};gi.prototype._hash=function(){var e=bh.allocUnsafe(28);return e.writeInt32BE(this._a,0),e.writeInt32BE(this._b,4),e.writeInt32BE(this._c,8),e.writeInt32BE(this._d,12),e.writeInt32BE(this._e,16),e.writeInt32BE(this._f,20),e.writeInt32BE(this._g,24),e};var _h=gi,yh=vt,kc=en,Eh=jt.Buffer,No=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591],Sh=new Array(160);function Rn(){this.init(),this._w=Sh,kc.call(this,128,112)}yh(Rn,kc);Rn.prototype.init=function(){return this._ah=1779033703,this._bh=3144134277,this._ch=1013904242,this._dh=2773480762,this._eh=1359893119,this._fh=2600822924,this._gh=528734635,this._hh=1541459225,this._al=4089235720,this._bl=2227873595,this._cl=4271175723,this._dl=1595750129,this._el=2917565137,this._fl=725511199,this._gl=4215389547,this._hl=327033209,this};function Lo(e,t,r){return r^e&(t^r)}function Oo(e,t,r){return e&t|r&(e|t)}function Po(e,t){return(e>>>28|t<<4)^(t>>>2|e<<30)^(t>>>7|e<<25)}function $o(e,t){return(e>>>14|t<<18)^(e>>>18|t<<14)^(t>>>9|e<<23)}function Rh(e,t){return(e>>>1|t<<31)^(e>>>8|t<<24)^e>>>7}function Mh(e,t){return(e>>>1|t<<31)^(e>>>8|t<<24)^(e>>>7|t<<25)}function kh(e,t){return(e>>>19|t<<13)^(t>>>29|e<<3)^e>>>6}function Ch(e,t){return(e>>>19|t<<13)^(t>>>29|e<<3)^(e>>>6|t<<26)}function qe(e,t){return e>>>0>>0?1:0}Rn.prototype._update=function(e){for(var t=this._w,r=this._ah|0,n=this._bh|0,i=this._ch|0,s=this._dh|0,a=this._eh|0,l=this._fh|0,d=this._gh|0,h=this._hh|0,m=this._al|0,R=this._bl|0,y=this._cl|0,C=this._dl|0,x=this._el|0,B=this._fl|0,O=this._gl|0,M=this._hl|0,T=0;T<32;T+=2)t[T]=e.readInt32BE(T*4),t[T+1]=e.readInt32BE(T*4+4);for(;T<160;T+=2){var N=t[T-30],D=t[T-15*2+1],L=Rh(N,D),F=Mh(D,N);N=t[T-2*2],D=t[T-2*2+1];var W=kh(N,D),te=Ch(D,N),Z=t[T-7*2],z=t[T-7*2+1],X=t[T-16*2],ne=t[T-16*2+1],S=F+z|0,o=L+Z+qe(S,F)|0;S=S+te|0,o=o+W+qe(S,te)|0,S=S+ne|0,o=o+X+qe(S,ne)|0,t[T]=o,t[T+1]=S}for(var u=0;u<160;u+=2){o=t[u],S=t[u+1];var f=Oo(r,n,i),p=Oo(m,R,y),v=Po(r,m),E=Po(m,r),k=$o(a,x),g=$o(x,a),c=No[u],w=No[u+1],U=Lo(a,l,d),H=Lo(x,B,O),V=M+g|0,A=h+k+qe(V,M)|0;V=V+H|0,A=A+U+qe(V,H)|0,V=V+w|0,A=A+c+qe(V,w)|0,V=V+S|0,A=A+o+qe(V,S)|0;var I=E+p|0,$=v+f+qe(I,E)|0;h=d,M=O,d=l,O=B,l=a,B=x,x=C+V|0,a=s+A+qe(x,C)|0,s=i,C=y,i=n,y=R,n=r,R=m,m=V+I|0,r=A+$+qe(m,V)|0}this._al=this._al+m|0,this._bl=this._bl+R|0,this._cl=this._cl+y|0,this._dl=this._dl+C|0,this._el=this._el+x|0,this._fl=this._fl+B|0,this._gl=this._gl+O|0,this._hl=this._hl+M|0,this._ah=this._ah+r+qe(this._al,m)|0,this._bh=this._bh+n+qe(this._bl,R)|0,this._ch=this._ch+i+qe(this._cl,y)|0,this._dh=this._dh+s+qe(this._dl,C)|0,this._eh=this._eh+a+qe(this._el,x)|0,this._fh=this._fh+l+qe(this._fl,B)|0,this._gh=this._gh+d+qe(this._gl,O)|0,this._hh=this._hh+h+qe(this._hl,M)|0};Rn.prototype._hash=function(){var e=Eh.allocUnsafe(64);function t(r,n,i){e.writeInt32BE(r,i),e.writeInt32BE(n,i+4)}return t(this._ah,this._al,0),t(this._bh,this._bl,8),t(this._ch,this._cl,16),t(this._dh,this._dl,24),t(this._eh,this._el,32),t(this._fh,this._fl,40),t(this._gh,this._gl,48),t(this._hh,this._hl,56),e};var Cc=Rn,Ih=vt,xh=Cc,Ah=en,Th=jt.Buffer,Nh=new Array(160);function mi(){this.init(),this._w=Nh,Ah.call(this,128,112)}Ih(mi,xh);mi.prototype.init=function(){return this._ah=3418070365,this._bh=1654270250,this._ch=2438529370,this._dh=355462360,this._eh=1731405415,this._fh=2394180231,this._gh=3675008525,this._hh=1203062813,this._al=3238371032,this._bl=914150663,this._cl=812702999,this._dl=4144912697,this._el=4290775857,this._fl=1750603025,this._gl=1694076839,this._hl=3204075428,this};mi.prototype._hash=function(){var e=Th.allocUnsafe(48);function t(r,n,i){e.writeInt32BE(r,i),e.writeInt32BE(n,i+4)}return t(this._ah,this._al,0),t(this._bh,this._bl,8),t(this._ch,this._cl,16),t(this._dh,this._dl,24),t(this._eh,this._el,32),t(this._fh,this._fl,40),e};var Lh=mi,gr=_c.exports=function(t){t=t.toLowerCase();var r=gr[t];if(!r)throw new Error(t+" is not supported (we accept pull requests)");return new r};gr.sha=Zu;gr.sha1=ih;gr.sha224=_h;gr.sha256=Mc;gr.sha384=Lh;gr.sha512=Cc;var Oh=_c.exports;Object.defineProperty(Xr,"__esModule",{value:!0});Xr.Session=void 0;const Bo=Oh,Do=q,Fo="session:id",jo="session:secret",Ho="session:linked";class qs{constructor(t,r,n,i){this._storage=t,this._id=r||(0,Do.randomBytesHex)(16),this._secret=n||(0,Do.randomBytesHex)(32),this._key=new Bo.sha256().update(`${this._id}, ${this._secret} WalletLink`).digest("hex"),this._linked=!!i}static load(t){const r=t.getItem(Fo),n=t.getItem(Ho),i=t.getItem(jo);return r&&i?new qs(t,r,i,n==="1"):null}static hash(t){return new Bo.sha256().update(t).digest("hex")}get id(){return this._id}get secret(){return this._secret}get key(){return this._key}get linked(){return this._linked}set linked(t){this._linked=t,this.persistLinked()}save(){return this._storage.setItem(Fo,this._id),this._storage.setItem(jo,this._secret),this.persistLinked(),this}persistLinked(){this._storage.setItem(Ho,this._linked?"1":"0")}}Xr.Session=qs;var vi={},bi={};Object.defineProperty(bi,"__esModule",{value:!0});bi.Cipher=void 0;const jn=q;class Ph{constructor(t){this.secret=t}async encrypt(t){const r=this.secret;if(r.length!==64)throw Error("secret must be 256 bits");const n=crypto.getRandomValues(new Uint8Array(12)),i=await crypto.subtle.importKey("raw",(0,jn.hexStringToUint8Array)(r),{name:"aes-gcm"},!1,["encrypt","decrypt"]),s=new TextEncoder,a=await window.crypto.subtle.encrypt({name:"AES-GCM",iv:n},i,s.encode(t)),l=16,d=a.slice(a.byteLength-l),h=a.slice(0,a.byteLength-l),m=new Uint8Array(d),R=new Uint8Array(h),y=new Uint8Array([...n,...m,...R]);return(0,jn.uint8ArrayToHex)(y)}async decrypt(t){const r=this.secret;if(r.length!==64)throw Error("secret must be 256 bits");return new Promise((n,i)=>{(async function(){const s=await crypto.subtle.importKey("raw",(0,jn.hexStringToUint8Array)(r),{name:"aes-gcm"},!1,["encrypt","decrypt"]),a=(0,jn.hexStringToUint8Array)(t),l=a.slice(0,12),d=a.slice(12,28),h=a.slice(28),m=new Uint8Array([...h,...d]),R={name:"AES-GCM",iv:new Uint8Array(l)};try{const y=await window.crypto.subtle.decrypt(R,s,m),C=new TextDecoder;n(C.decode(y))}catch(y){i(y)}})()})}}bi.Cipher=Ph;var wi={};Object.defineProperty(wi,"__esModule",{value:!0});wi.WalletLinkHTTP=void 0;class $h{constructor(t,r,n){this.linkAPIUrl=t,this.sessionId=r;const i=`${r}:${n}`;this.auth=`Basic ${btoa(i)}`}async markUnseenEventsAsSeen(t){return Promise.all(t.map(r=>fetch(`${this.linkAPIUrl}/events/${r.eventId}/seen`,{method:"POST",headers:{Authorization:this.auth}}))).catch(r=>console.error("Unabled to mark event as failed:",r))}async fetchUnseenEvents(){var t;const r=await fetch(`${this.linkAPIUrl}/events?unseen=true`,{headers:{Authorization:this.auth}});if(r.ok){const{events:n,error:i}=await r.json();if(i)throw new Error(`Check unseen events failed: ${i}`);const s=(t=n==null?void 0:n.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(s),s}throw new Error(`Check unseen events failed: ${r.status}`)}}wi.WalletLinkHTTP=$h;var Wr={};Object.defineProperty(Wr,"__esModule",{value:!0});Wr.WalletLinkWebSocket=Wr.ConnectionState=void 0;var Br;(function(e){e[e.DISCONNECTED=0]="DISCONNECTED",e[e.CONNECTING=1]="CONNECTING",e[e.CONNECTED=2]="CONNECTED"})(Br||(Wr.ConnectionState=Br={}));class Bh{setConnectionStateListener(t){this.connectionStateListener=t}setIncomingDataListener(t){this.incomingDataListener=t}constructor(t,r=WebSocket){this.WebSocketClass=r,this.webSocket=null,this.pendingData=[],this.url=t.replace(/^http/,"ws")}async connect(){if(this.webSocket)throw new Error("webSocket object is not null");return new Promise((t,r)=>{var n;let i;try{this.webSocket=i=new this.WebSocketClass(this.url)}catch(s){r(s);return}(n=this.connectionStateListener)===null||n===void 0||n.call(this,Br.CONNECTING),i.onclose=s=>{var a;this.clearWebSocket(),r(new Error(`websocket error ${s.code}: ${s.reason}`)),(a=this.connectionStateListener)===null||a===void 0||a.call(this,Br.DISCONNECTED)},i.onopen=s=>{var a;t(),(a=this.connectionStateListener)===null||a===void 0||a.call(this,Br.CONNECTED),this.pendingData.length>0&&([...this.pendingData].forEach(d=>this.sendData(d)),this.pendingData=[])},i.onmessage=s=>{var a,l;if(s.data==="h")(a=this.incomingDataListener)===null||a===void 0||a.call(this,{type:"Heartbeat"});else try{const d=JSON.parse(s.data);(l=this.incomingDataListener)===null||l===void 0||l.call(this,d)}catch{}}})}disconnect(){var t;const{webSocket:r}=this;if(r){this.clearWebSocket(),(t=this.connectionStateListener)===null||t===void 0||t.call(this,Br.DISCONNECTED),this.connectionStateListener=void 0,this.incomingDataListener=void 0;try{r.close()}catch{}}}sendData(t){const{webSocket:r}=this;if(!r){this.pendingData.push(t),this.connect();return}r.send(t)}clearWebSocket(){const{webSocket:t}=this;t&&(this.webSocket=null,t.onclose=null,t.onerror=null,t.onmessage=null,t.onopen=null)}}Wr.WalletLinkWebSocket=Bh;Object.defineProperty(vi,"__esModule",{value:!0});vi.WalletLinkConnection=void 0;const Tr=Ve,Dh=bi,_t=Yr,Uo=ht,Nr=Xr,Fh=wi,Hn=Wr,Wo=1e4,jh=6e4;class Hh{constructor({session:t,linkAPIUrl:r,listener:n,diagnostic:i,WebSocketClass:s=WebSocket}){this.destroyed=!1,this.lastHeartbeatResponse=0,this.nextReqId=(0,Tr.IntNumber)(1),this._connected=!1,this._linked=!1,this.shouldFetchUnseenEventsOnConnect=!1,this.requestResolutions=new Map,this.handleSessionMetadataUpdated=l=>{if(!l)return;new Map([["__destroyed",this.handleDestroyed],["EthereumAddress",this.handleAccountUpdated],["WalletUsername",this.handleWalletUsernameUpdated],["AppVersion",this.handleAppVersionUpdated],["ChainId",h=>l.JsonRpcUrl&&this.handleChainUpdated(h,l.JsonRpcUrl)]]).forEach((h,m)=>{const R=l[m];R!==void 0&&h(R)})},this.handleDestroyed=l=>{var d,h;l==="1"&&((d=this.listener)===null||d===void 0||d.resetAndReload(),(h=this.diagnostic)===null||h===void 0||h.log(_t.EVENTS.METADATA_DESTROYED,{alreadyDestroyed:this.isDestroyed,sessionIdHash:Nr.Session.hash(this.session.id)}))},this.handleAccountUpdated=async l=>{var d,h;try{const m=await this.cipher.decrypt(l);(d=this.listener)===null||d===void 0||d.accountUpdated(m)}catch{(h=this.diagnostic)===null||h===void 0||h.log(_t.EVENTS.GENERAL_ERROR,{message:"Had error decrypting",value:"selectedAddress"})}},this.handleMetadataUpdated=async(l,d)=>{var h,m;try{const R=await this.cipher.decrypt(d);(h=this.listener)===null||h===void 0||h.metadataUpdated(l,R)}catch{(m=this.diagnostic)===null||m===void 0||m.log(_t.EVENTS.GENERAL_ERROR,{message:"Had error decrypting",value:l})}},this.handleWalletUsernameUpdated=async l=>{this.handleMetadataUpdated(Uo.WALLET_USER_NAME_KEY,l)},this.handleAppVersionUpdated=async l=>{this.handleMetadataUpdated(Uo.APP_VERSION_KEY,l)},this.handleChainUpdated=async(l,d)=>{var h,m;try{const R=await this.cipher.decrypt(l),y=await this.cipher.decrypt(d);(h=this.listener)===null||h===void 0||h.chainUpdated(R,y)}catch{(m=this.diagnostic)===null||m===void 0||m.log(_t.EVENTS.GENERAL_ERROR,{message:"Had error decrypting",value:"chainId|jsonRpcUrl"})}},this.session=t,this.cipher=new Dh.Cipher(t.secret),this.diagnostic=i,this.listener=n;const a=new Hn.WalletLinkWebSocket(`${r}/rpc`,s);a.setConnectionStateListener(async l=>{var d;(d=this.diagnostic)===null||d===void 0||d.log(_t.EVENTS.CONNECTED_STATE_CHANGE,{state:l,sessionIdHash:Nr.Session.hash(t.id)});let h=!1;switch(l){case Hn.ConnectionState.DISCONNECTED:if(!this.destroyed){const m=async()=>{await new Promise(R=>setTimeout(R,5e3)),this.destroyed||a.connect().catch(()=>{m()})};m()}break;case Hn.ConnectionState.CONNECTED:try{await this.authenticate(),this.sendIsLinked(),this.sendGetSessionConfig(),h=!0}catch{}this.updateLastHeartbeat(),setInterval(()=>{this.heartbeat()},Wo),this.shouldFetchUnseenEventsOnConnect&&this.fetchUnseenEventsAPI();break;case Hn.ConnectionState.CONNECTING:break}this.connected!==h&&(this.connected=h)}),a.setIncomingDataListener(l=>{var d,h,m;switch(l.type){case"Heartbeat":this.updateLastHeartbeat();return;case"IsLinkedOK":case"Linked":{const R=l.type==="IsLinkedOK"?l.linked:void 0;(d=this.diagnostic)===null||d===void 0||d.log(_t.EVENTS.LINKED,{sessionIdHash:Nr.Session.hash(t.id),linked:R,type:l.type,onlineGuests:l.onlineGuests}),this.linked=R||l.onlineGuests>0;break}case"GetSessionConfigOK":case"SessionConfigUpdated":{(h=this.diagnostic)===null||h===void 0||h.log(_t.EVENTS.SESSION_CONFIG_RECEIVED,{sessionIdHash:Nr.Session.hash(t.id),metadata_keys:l&&l.metadata?Object.keys(l.metadata):void 0}),this.handleSessionMetadataUpdated(l.metadata);break}case"Event":{this.handleIncomingEvent(l);break}}l.id!==void 0&&((m=this.requestResolutions.get(l.id))===null||m===void 0||m(l))}),this.ws=a,this.http=new Fh.WalletLinkHTTP(r,t.id,t.key)}connect(){var t;if(this.destroyed)throw new Error("instance is destroyed");(t=this.diagnostic)===null||t===void 0||t.log(_t.EVENTS.STARTED_CONNECTING,{sessionIdHash:Nr.Session.hash(this.session.id)}),this.ws.connect()}destroy(){var t;this.destroyed=!0,this.ws.disconnect(),(t=this.diagnostic)===null||t===void 0||t.log(_t.EVENTS.DISCONNECTED,{sessionIdHash:Nr.Session.hash(this.session.id)}),this.listener=void 0}get isDestroyed(){return this.destroyed}get connected(){return this._connected}set connected(t){var r,n;this._connected=t,t&&((r=this.onceConnected)===null||r===void 0||r.call(this)),(n=this.listener)===null||n===void 0||n.connectedUpdated(t)}setOnceConnected(t){return new Promise(r=>{this.connected?t().then(r):this.onceConnected=()=>{t().then(r),this.onceConnected=void 0}})}get linked(){return this._linked}set linked(t){var r,n;this._linked=t,t&&((r=this.onceLinked)===null||r===void 0||r.call(this)),(n=this.listener)===null||n===void 0||n.linkedUpdated(t)}setOnceLinked(t){return new Promise(r=>{this.linked?t().then(r):this.onceLinked=()=>{t().then(r),this.onceLinked=void 0}})}async handleIncomingEvent(t){var r,n;if(!(t.type!=="Event"||t.event!=="Web3Response"))try{const i=await this.cipher.decrypt(t.data),s=JSON.parse(i);if(s.type!=="WEB3_RESPONSE")return;(r=this.listener)===null||r===void 0||r.handleWeb3ResponseMessage(s)}catch{(n=this.diagnostic)===null||n===void 0||n.log(_t.EVENTS.GENERAL_ERROR,{message:"Had error decrypting",value:"incomingEvent"})}}async checkUnseenEvents(){if(!this.connected){this.shouldFetchUnseenEventsOnConnect=!0;return}await new Promise(t=>setTimeout(t,250));try{await this.fetchUnseenEventsAPI()}catch(t){console.error("Unable to check for unseen events",t)}}async fetchUnseenEventsAPI(){this.shouldFetchUnseenEventsOnConnect=!1,(await this.http.fetchUnseenEvents()).forEach(r=>this.handleIncomingEvent(r))}async setSessionMetadata(t,r){const n={type:"SetSessionConfig",id:(0,Tr.IntNumber)(this.nextReqId++),sessionId:this.session.id,metadata:{[t]:r}};return this.setOnceConnected(async()=>{const i=await this.makeRequest(n);if(i.type==="Fail")throw new Error(i.error||"failed to set session metadata")})}async publishEvent(t,r,n=!1){const i=await this.cipher.encrypt(JSON.stringify(Object.assign(Object.assign({},r),{origin:location.origin,relaySource:window.coinbaseWalletExtension?"injected_sdk":"sdk"}))),s={type:"PublishEvent",id:(0,Tr.IntNumber)(this.nextReqId++),sessionId:this.session.id,event:t,data:i,callWebhook:n};return this.setOnceLinked(async()=>{const a=await this.makeRequest(s);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>Wo*2){this.ws.disconnect();return}try{this.ws.sendData("h")}catch{}}async makeRequest(t,r=jh){const n=t.id;this.sendData(t);let i;return Promise.race([new Promise((s,a)=>{i=window.setTimeout(()=>{a(new Error(`request ${n} timed out`))},r)}),new Promise(s=>{this.requestResolutions.set(n,a=>{clearTimeout(i),s(a),this.requestResolutions.delete(n)})})])}async authenticate(){const t={type:"HostSession",id:(0,Tr.IntNumber)(this.nextReqId++),sessionId:this.session.id,sessionKey:this.session.key},r=await this.makeRequest(t);if(r.type==="Fail")throw new Error(r.error||"failed to authentcate")}sendIsLinked(){const t={type:"IsLinked",id:(0,Tr.IntNumber)(this.nextReqId++),sessionId:this.session.id};this.sendData(t)}sendGetSessionConfig(){const t={type:"GetSessionConfig",id:(0,Tr.IntNumber)(this.nextReqId++),sessionId:this.session.id};this.sendData(t)}}vi.WalletLinkConnection=Hh;var Mn={},kn={},Js={};Object.defineProperty(Js,"__esModule",{value:!0});Js.default='@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}';var Uh=Q&&Q.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(kn,"__esModule",{value:!0});kn.injectCssReset=void 0;const Wh=Uh(Js);function Vh(){const e=document.createElement("style");e.type="text/css",e.appendChild(document.createTextNode(Wh.default)),document.documentElement.appendChild(e)}kn.injectCssReset=Vh;var _i={};const tt=Zr(cu);var yi={};function Ic(e){var t,r,n="";if(typeof e=="string"||typeof e=="number")n+=e;else if(typeof e=="object")if(Array.isArray(e))for(t=0;t65536?(n[0]=240|(i&1835008)>>>18,n[1]=128|(i&258048)>>>12,n[2]=128|(i&4032)>>>6,n[3]=128|i&63):i>2048?(n[0]=224|(i&61440)>>>12,n[1]=128|(i&4032)>>>6,n[2]=128|i&63):i>128?(n[0]=192|(i&1984)>>>6,n[1]=128|i&63):n[0]=i,this.parsedData.push(n)}this.parsedData=Array.prototype.concat.apply([],this.parsedData),this.parsedData.length!=this.data.length&&(this.parsedData.unshift(191),this.parsedData.unshift(187),this.parsedData.unshift(239))}xc.prototype={getLength:function(e){return this.parsedData.length},write:function(e){for(var t=0,r=this.parsedData.length;t=7&&this.setupTypeNumber(e),this.dataCache==null&&(this.dataCache=kt.createData(this.typeNumber,this.errorCorrectLevel,this.dataList)),this.mapData(this.dataCache,t)},setupPositionProbePattern:function(e,t){for(var r=-1;r<=7;r++)if(!(e+r<=-1||this.moduleCount<=e+r))for(var n=-1;n<=7;n++)t+n<=-1||this.moduleCount<=t+n||(0<=r&&r<=6&&(n==0||n==6)||0<=n&&n<=6&&(r==0||r==6)||2<=r&&r<=4&&2<=n&&n<=4?this.modules[e+r][t+n]=!0:this.modules[e+r][t+n]=!1)},getBestMaskPattern:function(){for(var e=0,t=0,r=0;r<8;r++){this.makeImpl(!0,r);var n=je.getLostPoint(this);(r==0||e>n)&&(e=n,t=r)}return t},createMovieClip:function(e,t,r){var n=e.createEmptyMovieClip(t,r),i=1;this.make();for(var s=0;s>r&1)==1;this.modules[Math.floor(r/3)][r%3+this.moduleCount-8-3]=n}for(var r=0;r<18;r++){var n=!e&&(t>>r&1)==1;this.modules[r%3+this.moduleCount-8-3][Math.floor(r/3)]=n}},setupTypeInfo:function(e,t){for(var r=this.errorCorrectLevel<<3|t,n=je.getBCHTypeInfo(r),i=0;i<15;i++){var s=!e&&(n>>i&1)==1;i<6?this.modules[i][8]=s:i<8?this.modules[i+1][8]=s:this.modules[this.moduleCount-15+i][8]=s}for(var i=0;i<15;i++){var s=!e&&(n>>i&1)==1;i<8?this.modules[8][this.moduleCount-i-1]=s:i<9?this.modules[8][15-i-1+1]=s:this.modules[8][15-i-1]=s}this.modules[this.moduleCount-8][8]=!e},mapData:function(e,t){for(var r=-1,n=this.moduleCount-1,i=7,s=0,a=this.moduleCount-1;a>0;a-=2)for(a==6&&a--;;){for(var l=0;l<2;l++)if(this.modules[n][a-l]==null){var d=!1;s>>i&1)==1);var h=je.getMask(t,n,a-l);h&&(d=!d),this.modules[n][a-l]=d,i--,i==-1&&(s++,i=7)}if(n+=r,n<0||this.moduleCount<=n){n-=r,r=-r;break}}}};kt.PAD0=236;kt.PAD1=17;kt.createData=function(e,t,r){for(var n=Mt.getRSBlocks(e,t),i=new Ac,s=0;sl*8)throw new Error("code length overflow. ("+i.getLengthInBits()+">"+l*8+")");for(i.getLengthInBits()+4<=l*8&&i.put(0,4);i.getLengthInBits()%8!=0;)i.putBit(!1);for(;!(i.getLengthInBits()>=l*8||(i.put(kt.PAD0,8),i.getLengthInBits()>=l*8));)i.put(kt.PAD1,8);return kt.createBytes(i,n)};kt.createBytes=function(e,t){for(var r=0,n=0,i=0,s=new Array(t.length),a=new Array(t.length),l=0;l=0?C.get(x):0}}for(var B=0,m=0;m=0;)t^=je.G15<=0;)t^=je.G18<>>=1;return t},getPatternPosition:function(e){return je.PATTERN_POSITION_TABLE[e-1]},getMask:function(e,t,r){switch(e){case Ot.PATTERN000:return(t+r)%2==0;case Ot.PATTERN001:return t%2==0;case Ot.PATTERN010:return r%3==0;case Ot.PATTERN011:return(t+r)%3==0;case Ot.PATTERN100:return(Math.floor(t/2)+Math.floor(r/3))%2==0;case Ot.PATTERN101:return t*r%2+t*r%3==0;case Ot.PATTERN110:return(t*r%2+t*r%3)%2==0;case Ot.PATTERN111:return(t*r%3+(t+r)%2)%2==0;default:throw new Error("bad maskPattern:"+e)}},getErrorCorrectPolynomial:function(e){for(var t=new Dr([1],0),r=0;r5&&(r+=3+s-5)}for(var n=0;n=256;)e-=255;return Je.EXP_TABLE[e]},EXP_TABLE:new Array(256),LOG_TABLE:new Array(256)};for(var Ze=0;Ze<8;Ze++)Je.EXP_TABLE[Ze]=1<>>7-e%8&1)==1},put:function(e,t){for(var r=0;r>>t-r-1&1)==1)},getLengthInBits:function(){return this.length},putBit:function(e){var t=Math.floor(this.length/8);this.buffer.length<=t&&this.buffer.push(0),e&&(this.buffer[t]|=128>>>this.length%8),this.length++}};var as=[[17,14,11,7],[32,26,20,14],[53,42,32,24],[78,62,46,34],[106,84,60,44],[134,106,74,58],[154,122,86,64],[192,152,108,84],[230,180,130,98],[271,213,151,119],[321,251,177,137],[367,287,203,155],[425,331,241,177],[458,362,258,194],[520,412,292,220],[586,450,322,250],[644,504,364,280],[718,560,394,310],[792,624,442,338],[858,666,482,382],[929,711,509,403],[1003,779,565,439],[1091,857,611,461],[1171,911,661,511],[1273,997,715,535],[1367,1059,751,593],[1465,1125,805,625],[1528,1190,868,658],[1628,1264,908,698],[1732,1370,982,742],[1840,1452,1030,790],[1952,1538,1112,842],[2068,1628,1168,898],[2188,1722,1228,958],[2303,1809,1283,983],[2431,1911,1351,1051],[2563,1989,1423,1093],[2699,2099,1499,1139],[2809,2213,1579,1219],[2953,2331,1663,1273]];function Tc(e){if(this.options={padding:4,width:256,height:256,typeNumber:4,color:"#000000",background:"#ffffff",ecl:"M",image:{svg:"",width:0,height:0}},typeof e=="string"&&(e={content:e}),e)for(var t in e)this.options[t]=e[t];if(typeof this.options.content!="string")throw new Error("Expected 'content' as string!");if(this.options.content.length===0)throw new Error("Expected 'content' to be non-empty!");if(!(this.options.padding>=0))throw new Error("Expected 'padding' value to be non-negative!");if(!(this.options.width>0)||!(this.options.height>0))throw new Error("Expected 'width' or 'height' value to be higher than zero!");function r(d){switch(d){case"L":return Bt.L;case"M":return Bt.M;case"Q":return Bt.Q;case"H":return Bt.H;default:throw new Error("Unknwon error correction level: "+d)}}function n(d,h){for(var m=i(d),R=1,y=0,C=0,x=as.length;C<=x;C++){var B=as[C];if(!B)throw new Error("Content too long: expected "+y+" but got "+m);switch(h){case"L":y=B[0];break;case"M":y=B[1];break;case"Q":y=B[2];break;case"H":y=B[3];break;default:throw new Error("Unknwon error correction level: "+h)}if(m<=y)break;R++}if(R>as.length)throw new Error("Content too long");return R}function i(d){var h=encodeURI(d).toString().replace(/\%[0-9a-fA-F]{2}/g,"a");return h.length+(h.length!=d?3:0)}var s=this.options.content,a=n(s,this.options.ecl),l=r(this.options.ecl);this.qrcode=new kt(a,l),this.qrcode.addData(s),this.qrcode.make()}Tc.prototype.svg=function(e){var t=this.options||{},r=this.qrcode.modules;typeof e>"u"&&(e={container:t.container||"svg"});for(var n=typeof t.pretty<"u"?!!t.pretty:!0,i=n?" ":"",s=n?`\r `:"",a=t.width,l=t.height,d=r.length,h=a/(d+2*t.padding),m=l/(d+2*t.padding),R=typeof t.join<"u"?!!t.join:!1,y=typeof t.swap<"u"?!!t.swap:!1,C=typeof t.xmlDeclaration<"u"?!!t.xmlDeclaration:!0,x=typeof t.predefined<"u"?!!t.predefined:!1,B=x?i+''+s:"",O=i+''+s,M="",T="",N=0;N'+s:M+=i+''+s}}R&&(M=i+'');let X="";if(this.options.image!==void 0&&this.options.image.svg){const S=a*this.options.image.width/100,o=l*this.options.image.height/100,u=a/2-S/2,f=l/2-o/2;X+=``,X+=this.options.image.svg+s,X+=""}var ne="";switch(e.container){case"svg":C&&(ne+=''+s),ne+=''+s,ne+=B+O+M,ne+=X,ne+="";break;case"svg-viewbox":C&&(ne+=''+s),ne+=''+s,ne+=B+O+M,ne+=X,ne+="";break;case"g":ne+=''+s,ne+=B+O+M,ne+=X,ne+="";break;default:ne+=(B+O+M+X).replace(/^\s+/,"");break}return ne};var Zh=Tc,Kh=Q&&Q.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(ki,"__esModule",{value:!0});ki.QRCode=void 0;const Qh=tt,qo=Ei,Yh=Kh(Zh),Xh=e=>{const[t,r]=(0,qo.useState)("");return(0,qo.useEffect)(()=>{var n,i;const s=new Yh.default({content:e.content,background:e.bgColor||"#ffffff",color:e.fgColor||"#000000",container:"svg",ecl:"M",width:(n=e.width)!==null&&n!==void 0?n:256,height:(i=e.height)!==null&&i!==void 0?i:256,padding:0,image:e.image}),a=Buffer.from(s.svg(),"utf8").toString("base64");r(`data:image/svg+xml;base64,${a}`)},[e.bgColor,e.content,e.fgColor,e.height,e.image,e.width]),t?(0,Qh.h)("img",{src:t,alt:"QR Code"}):null};ki.QRCode=Xh;var Ci={},Gs={};Object.defineProperty(Gs,"__esModule",{value:!0});Gs.default=".-cbwsdk-css-reset .-cbwsdk-spinner{display:inline-block}.-cbwsdk-css-reset .-cbwsdk-spinner svg{display:inline-block;animation:2s linear infinite -cbwsdk-spinner-svg}.-cbwsdk-css-reset .-cbwsdk-spinner svg circle{animation:1.9s ease-in-out infinite both -cbwsdk-spinner-circle;display:block;fill:rgba(0,0,0,0);stroke-dasharray:283;stroke-dashoffset:280;stroke-linecap:round;stroke-width:10px;transform-origin:50% 50%}@keyframes -cbwsdk-spinner-svg{0%{transform:rotateZ(0deg)}100%{transform:rotateZ(360deg)}}@keyframes -cbwsdk-spinner-circle{0%,25%{stroke-dashoffset:280;transform:rotate(0)}50%,75%{stroke-dashoffset:75;transform:rotate(45deg)}100%{stroke-dashoffset:280;transform:rotate(360deg)}}";var ed=Q&&Q.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Ci,"__esModule",{value:!0});Ci.Spinner=void 0;const Wn=tt,td=ed(Gs),rd=e=>{var t;const r=(t=e.size)!==null&&t!==void 0?t:64,n=e.color||"#000";return(0,Wn.h)("div",{class:"-cbwsdk-spinner"},(0,Wn.h)("style",null,td.default),(0,Wn.h)("svg",{viewBox:"0 0 100 100",xmlns:"http://www.w3.org/2000/svg",style:{width:r,height:r}},(0,Wn.h)("circle",{style:{cx:50,cy:50,r:45,stroke:n}})))};Ci.Spinner=rd;var Zs={};Object.defineProperty(Zs,"__esModule",{value:!0});Zs.default=".-cbwsdk-css-reset .-cbwsdk-connect-content{height:430px;width:700px;border-radius:12px;padding:30px}.-cbwsdk-css-reset .-cbwsdk-connect-content.light{background:#fff}.-cbwsdk-css-reset .-cbwsdk-connect-content.dark{background:#0a0b0d}.-cbwsdk-css-reset .-cbwsdk-connect-content-header{display:flex;align-items:center;justify-content:space-between;margin:0 0 30px}.-cbwsdk-css-reset .-cbwsdk-connect-content-heading{font-style:normal;font-weight:500;font-size:28px;line-height:36px;margin:0}.-cbwsdk-css-reset .-cbwsdk-connect-content-heading.light{color:#0a0b0d}.-cbwsdk-css-reset .-cbwsdk-connect-content-heading.dark{color:#fff}.-cbwsdk-css-reset .-cbwsdk-connect-content-layout{display:flex;flex-direction:row}.-cbwsdk-css-reset .-cbwsdk-connect-content-column-left{margin-right:30px;display:flex;flex-direction:column;justify-content:space-between}.-cbwsdk-css-reset .-cbwsdk-connect-content-column-right{flex:25%;margin-right:34px}.-cbwsdk-css-reset .-cbwsdk-connect-content-qr-wrapper{width:220px;height:220px;border-radius:12px;display:flex;justify-content:center;align-items:center;background:#fff}.-cbwsdk-css-reset .-cbwsdk-connect-content-qr-connecting{position:absolute;top:0;bottom:0;left:0;right:0;display:flex;flex-direction:column;align-items:center;justify-content:center}.-cbwsdk-css-reset .-cbwsdk-connect-content-qr-connecting.light{background-color:rgba(255,255,255,.95)}.-cbwsdk-css-reset .-cbwsdk-connect-content-qr-connecting.light>p{color:#0a0b0d}.-cbwsdk-css-reset .-cbwsdk-connect-content-qr-connecting.dark{background-color:rgba(10,11,13,.9)}.-cbwsdk-css-reset .-cbwsdk-connect-content-qr-connecting.dark>p{color:#fff}.-cbwsdk-css-reset .-cbwsdk-connect-content-qr-connecting>p{font-size:12px;font-weight:bold;margin-top:16px}.-cbwsdk-css-reset .-cbwsdk-connect-content-update-app{border-radius:8px;font-size:14px;line-height:20px;padding:12px;width:339px}.-cbwsdk-css-reset .-cbwsdk-connect-content-update-app.light{background:#eef0f3;color:#5b636e}.-cbwsdk-css-reset .-cbwsdk-connect-content-update-app.dark{background:#1e2025;color:#8a919e}.-cbwsdk-css-reset .-cbwsdk-cancel-button{-webkit-appearance:none;border:none;background:none;cursor:pointer;padding:0;margin:0}.-cbwsdk-css-reset .-cbwsdk-cancel-button-x{position:relative;display:block;cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-wallet-steps{padding:0 0 0 16px;margin:0;width:100%;list-style:decimal}.-cbwsdk-css-reset .-cbwsdk-wallet-steps-item{list-style-type:decimal;display:list-item;font-style:normal;font-weight:400;font-size:16px;line-height:24px;margin-top:20px}.-cbwsdk-css-reset .-cbwsdk-wallet-steps-item.light{color:#0a0b0d}.-cbwsdk-css-reset .-cbwsdk-wallet-steps-item.dark{color:#fff}.-cbwsdk-css-reset .-cbwsdk-wallet-steps-item-wrapper{display:flex;align-items:center}.-cbwsdk-css-reset .-cbwsdk-wallet-steps-pad-left{margin-left:6px}.-cbwsdk-css-reset .-cbwsdk-wallet-steps-icon{display:flex;border-radius:50%;height:24px;width:24px}.-cbwsdk-css-reset .-cbwsdk-wallet-steps-icon svg{margin:auto;display:block}.-cbwsdk-css-reset .-cbwsdk-wallet-steps-icon.light{background:#0052ff}.-cbwsdk-css-reset .-cbwsdk-wallet-steps-icon.dark{background:#588af5}.-cbwsdk-css-reset .-cbwsdk-connect-item{align-items:center;display:flex;flex-direction:row;padding:16px 24px;gap:12px;cursor:pointer;border-radius:100px;font-weight:600}.-cbwsdk-css-reset .-cbwsdk-connect-item.light{background:#f5f8ff;color:#0052ff}.-cbwsdk-css-reset .-cbwsdk-connect-item.dark{background:#001033;color:#588af5}.-cbwsdk-css-reset .-cbwsdk-connect-item-copy-wrapper{margin:0 4px 0 8px}.-cbwsdk-css-reset .-cbwsdk-connect-item-title{margin:0 0 0;font-size:16px;line-height:24px;font-weight:500}.-cbwsdk-css-reset .-cbwsdk-connect-item-description{font-weight:400;font-size:14px;line-height:20px;margin:0}";var Nc=Q&&Q.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Vr,"__esModule",{value:!0});Vr.CoinbaseWalletSteps=Vr.ConnectContent=void 0;const hr=Nc(Cn),oe=tt,nd=q,id=Qr,sd=Si,od=Ri,ad=Mi,cd=ki,ld=Ci,ud=Nc(Zs),cs={title:"Coinbase Wallet app",description:"Connect with your self-custody wallet",steps:Lc},hd=e=>e==="light"?"#FFFFFF":"#0A0B0D";function dd(e){const{theme:t}=e,r=(0,nd.createQrUrl)(e.sessionId,e.sessionSecret,e.linkAPIUrl,e.isParentConnection,e.version,e.chainId),n=cs.steps;return(0,oe.h)("div",{"data-testid":"connect-content",className:(0,hr.default)("-cbwsdk-connect-content",t)},(0,oe.h)("style",null,ud.default),(0,oe.h)("div",{className:"-cbwsdk-connect-content-header"},(0,oe.h)("h2",{className:(0,hr.default)("-cbwsdk-connect-content-heading",t)},"Scan to connect with our mobile app"),e.onCancel&&(0,oe.h)("button",{type:"button",className:"-cbwsdk-cancel-button",onClick:e.onCancel},(0,oe.h)(sd.CloseIcon,{fill:t==="light"?"#0A0B0D":"#FFFFFF"}))),(0,oe.h)("div",{className:"-cbwsdk-connect-content-layout"},(0,oe.h)("div",{className:"-cbwsdk-connect-content-column-left"},(0,oe.h)(fd,{title:cs.title,description:cs.description,theme:t})),(0,oe.h)("div",{className:"-cbwsdk-connect-content-column-right"},(0,oe.h)("div",{className:"-cbwsdk-connect-content-qr-wrapper"},(0,oe.h)(cd.QRCode,{content:r,width:200,height:200,fgColor:"#000",bgColor:"transparent"}),(0,oe.h)("input",{type:"hidden",name:"cbw-cbwsdk-version",value:id.LIB_VERSION}),(0,oe.h)("input",{type:"hidden",value:r})),(0,oe.h)(n,{theme:t}),!e.isConnected&&(0,oe.h)("div",{"data-testid":"connecting-spinner",className:(0,hr.default)("-cbwsdk-connect-content-qr-connecting",t)},(0,oe.h)(ld.Spinner,{size:36,color:t==="dark"?"#FFF":"#000"}),(0,oe.h)("p",null,"Connecting...")))))}Vr.ConnectContent=dd;function fd({title:e,description:t,theme:r}){return(0,oe.h)("div",{className:(0,hr.default)("-cbwsdk-connect-item",r)},(0,oe.h)("div",null,(0,oe.h)(od.CoinbaseWalletRound,null)),(0,oe.h)("div",{className:"-cbwsdk-connect-item-copy-wrapper"},(0,oe.h)("h3",{className:"-cbwsdk-connect-item-title"},e),(0,oe.h)("p",{className:"-cbwsdk-connect-item-description"},t)))}function Lc({theme:e}){return(0,oe.h)("ol",{className:"-cbwsdk-wallet-steps"},(0,oe.h)("li",{className:(0,hr.default)("-cbwsdk-wallet-steps-item",e)},(0,oe.h)("div",{className:"-cbwsdk-wallet-steps-item-wrapper"},"Open Coinbase Wallet app")),(0,oe.h)("li",{className:(0,hr.default)("-cbwsdk-wallet-steps-item",e)},(0,oe.h)("div",{className:"-cbwsdk-wallet-steps-item-wrapper"},(0,oe.h)("span",null,"Tap ",(0,oe.h)("strong",null,"Scan")," "),(0,oe.h)("span",{className:(0,hr.default)("-cbwsdk-wallet-steps-pad-left","-cbwsdk-wallet-steps-icon",e)},(0,oe.h)(ad.QRCodeIcon,{fill:hd(e)})))))}Vr.CoinbaseWalletSteps=Lc;var Ii={},xi={};Object.defineProperty(xi,"__esModule",{value:!0});xi.ArrowLeftIcon=void 0;const Jo=tt;function pd(e){return(0,Jo.h)("svg",Object.assign({width:"16",height:"16",viewBox:"0 0 16 16",xmlns:"http://www.w3.org/2000/svg"},e),(0,Jo.h)("path",{d:"M8.60675 0.155884L7.37816 1.28209L12.7723 7.16662H0V8.83328H12.6548L6.82149 14.6666L8 15.8451L15.8201 8.02501L8.60675 0.155884Z"}))}xi.ArrowLeftIcon=pd;var Ai={};Object.defineProperty(Ai,"__esModule",{value:!0});Ai.LaptopIcon=void 0;const ls=tt;function gd(e){return(0,ls.h)("svg",Object.assign({width:"14",height:"14",viewBox:"0 0 14 14",xmlns:"http://www.w3.org/2000/svg"},e),(0,ls.h)("path",{d:"M1.8001 2.2002H12.2001V9.40019H1.8001V2.2002ZM3.4001 3.8002V7.80019H10.6001V3.8002H3.4001Z"}),(0,ls.h)("path",{d:"M13.4001 10.2002H0.600098C0.600098 11.0838 1.31644 11.8002 2.2001 11.8002H11.8001C12.6838 11.8002 13.4001 11.0838 13.4001 10.2002Z"}))}Ai.LaptopIcon=gd;var Ti={};Object.defineProperty(Ti,"__esModule",{value:!0});Ti.SafeIcon=void 0;const Go=tt;function md(e){return(0,Go.h)("svg",Object.assign({width:"14",height:"14",viewBox:"0 0 14 14",xmlns:"http://www.w3.org/2000/svg"},e),(0,Go.h)("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M0.600098 0.600098V11.8001H13.4001V0.600098H0.600098ZM7.0001 9.2001C5.3441 9.2001 4.0001 7.8561 4.0001 6.2001C4.0001 4.5441 5.3441 3.2001 7.0001 3.2001C8.6561 3.2001 10.0001 4.5441 10.0001 6.2001C10.0001 7.8561 8.6561 9.2001 7.0001 9.2001ZM0.600098 12.6001H3.8001V13.4001H0.600098V12.6001ZM10.2001 12.6001H13.4001V13.4001H10.2001V12.6001ZM8.8001 6.2001C8.8001 7.19421 7.99421 8.0001 7.0001 8.0001C6.00598 8.0001 5.2001 7.19421 5.2001 6.2001C5.2001 5.20598 6.00598 4.4001 7.0001 4.4001C7.99421 4.4001 8.8001 5.20598 8.8001 6.2001Z"}))}Ti.SafeIcon=md;var Ks={};Object.defineProperty(Ks,"__esModule",{value:!0});Ks.default=".-cbwsdk-css-reset .-cbwsdk-try-extension{display:flex;margin-top:12px;height:202px;width:700px;border-radius:12px;padding:30px}.-cbwsdk-css-reset .-cbwsdk-try-extension.light{background:#fff}.-cbwsdk-css-reset .-cbwsdk-try-extension.dark{background:#0a0b0d}.-cbwsdk-css-reset .-cbwsdk-try-extension-column-half{flex:50%}.-cbwsdk-css-reset .-cbwsdk-try-extension-heading{font-style:normal;font-weight:500;font-size:25px;line-height:32px;margin:0;max-width:204px}.-cbwsdk-css-reset .-cbwsdk-try-extension-heading.light{color:#0a0b0d}.-cbwsdk-css-reset .-cbwsdk-try-extension-heading.dark{color:#fff}.-cbwsdk-css-reset .-cbwsdk-try-extension-cta{appearance:none;border:none;background:none;color:#0052ff;cursor:pointer;padding:0;text-decoration:none;display:block;font-weight:600;font-size:16px;line-height:24px}.-cbwsdk-css-reset .-cbwsdk-try-extension-cta.light{color:#0052ff}.-cbwsdk-css-reset .-cbwsdk-try-extension-cta.dark{color:#588af5}.-cbwsdk-css-reset .-cbwsdk-try-extension-cta-wrapper{display:flex;align-items:center;margin-top:12px}.-cbwsdk-css-reset .-cbwsdk-try-extension-cta-icon{display:block;margin-left:4px;height:14px}.-cbwsdk-css-reset .-cbwsdk-try-extension-list{display:flex;flex-direction:column;justify-content:center;align-items:center;margin:0;padding:0;list-style:none;height:100%}.-cbwsdk-css-reset .-cbwsdk-try-extension-list-item{display:flex;align-items:center;flex-flow:nowrap;margin-top:24px}.-cbwsdk-css-reset .-cbwsdk-try-extension-list-item:first-of-type{margin-top:0}.-cbwsdk-css-reset .-cbwsdk-try-extension-list-item-icon-wrapper{display:block}.-cbwsdk-css-reset .-cbwsdk-try-extension-list-item-icon{display:flex;height:32px;width:32px;border-radius:50%}.-cbwsdk-css-reset .-cbwsdk-try-extension-list-item-icon svg{margin:auto;display:block}.-cbwsdk-css-reset .-cbwsdk-try-extension-list-item-icon.light{background:#eef0f3}.-cbwsdk-css-reset .-cbwsdk-try-extension-list-item-icon.dark{background:#1e2025}.-cbwsdk-css-reset .-cbwsdk-try-extension-list-item-copy{display:block;font-weight:400;font-size:14px;line-height:20px;padding-left:12px}.-cbwsdk-css-reset .-cbwsdk-try-extension-list-item-copy.light{color:#5b636e}.-cbwsdk-css-reset .-cbwsdk-try-extension-list-item-copy.dark{color:#8a919e}";var Oc=Q&&Q.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Ii,"__esModule",{value:!0});Ii.TryExtensionContent=void 0;const rr=Oc(Cn),We=tt,us=Ei,vd=xi,bd=Ai,wd=Ti,_d=Oc(Ks);function yd({theme:e}){const[t,r]=(0,us.useState)(!1),n=(0,us.useCallback)(()=>{window.open("https://api.wallet.coinbase.com/rpc/v2/desktop/chrome","_blank")},[]),i=(0,us.useCallback)(()=>{t?window.location.reload():(n(),r(!0))},[n,t]);return(0,We.h)("div",{class:(0,rr.default)("-cbwsdk-try-extension",e)},(0,We.h)("style",null,_d.default),(0,We.h)("div",{class:"-cbwsdk-try-extension-column-half"},(0,We.h)("h3",{class:(0,rr.default)("-cbwsdk-try-extension-heading",e)},"Or try the Coinbase Wallet browser extension"),(0,We.h)("div",{class:"-cbwsdk-try-extension-cta-wrapper"},(0,We.h)("button",{class:(0,rr.default)("-cbwsdk-try-extension-cta",e),onClick:i},t?"Refresh":"Install"),(0,We.h)("div",null,!t&&(0,We.h)(vd.ArrowLeftIcon,{class:"-cbwsdk-try-extension-cta-icon",fill:e==="light"?"#0052FF":"#588AF5"})))),(0,We.h)("div",{class:"-cbwsdk-try-extension-column-half"},(0,We.h)("ul",{class:"-cbwsdk-try-extension-list"},(0,We.h)("li",{class:"-cbwsdk-try-extension-list-item"},(0,We.h)("div",{class:"-cbwsdk-try-extension-list-item-icon-wrapper"},(0,We.h)("span",{class:(0,rr.default)("-cbwsdk-try-extension-list-item-icon",e)},(0,We.h)(bd.LaptopIcon,{fill:e==="light"?"#0A0B0D":"#FFFFFF"}))),(0,We.h)("div",{class:(0,rr.default)("-cbwsdk-try-extension-list-item-copy",e)},"Connect with dapps with just one click on your desktop browser")),(0,We.h)("li",{class:"-cbwsdk-try-extension-list-item"},(0,We.h)("div",{class:"-cbwsdk-try-extension-list-item-icon-wrapper"},(0,We.h)("span",{class:(0,rr.default)("-cbwsdk-try-extension-list-item-icon",e)},(0,We.h)(wd.SafeIcon,{fill:e==="light"?"#0A0B0D":"#FFFFFF"}))),(0,We.h)("div",{class:(0,rr.default)("-cbwsdk-try-extension-list-item-copy",e)},"Add an additional layer of security by using a supported Ledger hardware wallet")))))}Ii.TryExtensionContent=yd;var Qs={};Object.defineProperty(Qs,"__esModule",{value:!0});Qs.default=".-cbwsdk-css-reset .-cbwsdk-connect-dialog{z-index:2147483647;position:fixed;top:0;left:0;right:0;bottom:0;display:flex;align-items:center;justify-content:center}.-cbwsdk-css-reset .-cbwsdk-connect-dialog-backdrop{z-index:2147483647;position:fixed;top:0;left:0;right:0;bottom:0;transition:opacity .25s}.-cbwsdk-css-reset .-cbwsdk-connect-dialog-backdrop.light{background-color:rgba(0,0,0,.5)}.-cbwsdk-css-reset .-cbwsdk-connect-dialog-backdrop.dark{background-color:rgba(50,53,61,.4)}.-cbwsdk-css-reset .-cbwsdk-connect-dialog-backdrop-hidden{opacity:0}.-cbwsdk-css-reset .-cbwsdk-connect-dialog-box{display:flex;position:relative;flex-direction:column;transform:scale(1);transition:opacity .25s,transform .25s}.-cbwsdk-css-reset .-cbwsdk-connect-dialog-box-hidden{opacity:0;transform:scale(0.85)}.-cbwsdk-css-reset .-cbwsdk-connect-dialog-container{display:block}.-cbwsdk-css-reset .-cbwsdk-connect-dialog-container-hidden{display:none}";var Pc=Q&&Q.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(yi,"__esModule",{value:!0});yi.ConnectDialog=void 0;const hs=Pc(Cn),nr=tt,ds=Ei,Ed=Vr,Sd=Ii,Rd=Pc(Qs),Md=e=>{const{isOpen:t,darkMode:r}=e,[n,i]=(0,ds.useState)(!t),[s,a]=(0,ds.useState)(!t);(0,ds.useEffect)(()=>{const d=[window.setTimeout(()=>{a(!t)},10)];return t?i(!1):d.push(window.setTimeout(()=>{i(!0)},360)),()=>{d.forEach(window.clearTimeout)}},[t]);const l=r?"dark":"light";return(0,nr.h)("div",{class:(0,hs.default)("-cbwsdk-connect-dialog-container",n&&"-cbwsdk-connect-dialog-container-hidden")},(0,nr.h)("style",null,Rd.default),(0,nr.h)("div",{class:(0,hs.default)("-cbwsdk-connect-dialog-backdrop",l,s&&"-cbwsdk-connect-dialog-backdrop-hidden")}),(0,nr.h)("div",{class:"-cbwsdk-connect-dialog"},(0,nr.h)("div",{class:(0,hs.default)("-cbwsdk-connect-dialog-box",s&&"-cbwsdk-connect-dialog-box-hidden")},e.connectDisabled?null:(0,nr.h)(Ed.ConnectContent,{theme:l,version:e.version,sessionId:e.sessionId,sessionSecret:e.sessionSecret,linkAPIUrl:e.linkAPIUrl,isConnected:e.isConnected,isParentConnection:e.isParentConnection,chainId:e.chainId,onCancel:e.onCancel}),(0,nr.h)(Sd.TryExtensionContent,{theme:l}))))};yi.ConnectDialog=Md;Object.defineProperty(_i,"__esModule",{value:!0});_i.LinkFlow=void 0;const fs=tt,kd=yi;class Cd{constructor(t){this.connected=!1,this.chainId=1,this.isOpen=!1,this.onCancel=null,this.root=null,this.connectDisabled=!1,this.darkMode=t.darkMode,this.version=t.version,this.sessionId=t.sessionId,this.sessionSecret=t.sessionSecret,this.linkAPIUrl=t.linkAPIUrl,this.isParentConnection=t.isParentConnection}attach(t){this.root=document.createElement("div"),this.root.className="-cbwsdk-link-flow-root",t.appendChild(this.root),this.render()}setConnected(t){this.connected!==t&&(this.connected=t,this.render())}setChainId(t){this.chainId!==t&&(this.chainId=t,this.render())}detach(){var t;this.root&&((0,fs.render)(null,this.root),(t=this.root.parentElement)===null||t===void 0||t.removeChild(this.root))}setConnectDisabled(t){this.connectDisabled=t}open(t){this.isOpen=!0,this.onCancel=t.onCancel,this.render()}close(){this.isOpen=!1,this.onCancel=null,this.render()}render(){this.root&&(0,fs.render)((0,fs.h)(kd.ConnectDialog,{darkMode:this.darkMode,version:this.version,sessionId:this.sessionId,sessionSecret:this.sessionSecret,linkAPIUrl:this.linkAPIUrl,isOpen:this.isOpen,isConnected:this.connected,isParentConnection:this.isParentConnection,chainId:this.chainId,onCancel:this.onCancel,connectDisabled:this.connectDisabled}),this.root)}}_i.LinkFlow=Cd;var Ys={},Xs={};Object.defineProperty(Xs,"__esModule",{value:!0});Xs.default=".-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}";(function(e){var t=Q&&Q.__importDefault||function(R){return R&&R.__esModule?R:{default:R}};Object.defineProperty(e,"__esModule",{value:!0}),e.SnackbarInstance=e.SnackbarContainer=e.Snackbar=void 0;const r=t(Cn),n=tt,i=Ei,s=t(Xs),a="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzIiIGhlaWdodD0iMzIiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTEuNDkyIDEwLjQxOWE4LjkzIDguOTMgMCAwMTguOTMtOC45M2gxMS4xNjNhOC45MyA4LjkzIDAgMDE4LjkzIDguOTN2MTEuMTYzYTguOTMgOC45MyAwIDAxLTguOTMgOC45M0gxMC40MjJhOC45MyA4LjkzIDAgMDEtOC45My04LjkzVjEwLjQxOXoiIGZpbGw9IiMxNjUyRjAiLz48cGF0aCBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZD0iTTEwLjQxOSAwSDIxLjU4QzI3LjMzNSAwIDMyIDQuNjY1IDMyIDEwLjQxOVYyMS41OEMzMiAyNy4zMzUgMjcuMzM1IDMyIDIxLjU4MSAzMkgxMC40MkM0LjY2NSAzMiAwIDI3LjMzNSAwIDIxLjU4MVYxMC40MkMwIDQuNjY1IDQuNjY1IDAgMTAuNDE5IDB6bTAgMS40ODhhOC45MyA4LjkzIDAgMDAtOC45MyA4LjkzdjExLjE2M2E4LjkzIDguOTMgMCAwMDguOTMgOC45M0gyMS41OGE4LjkzIDguOTMgMCAwMDguOTMtOC45M1YxMC40MmE4LjkzIDguOTMgMCAwMC04LjkzLTguOTNIMTAuNDJ6IiBmaWxsPSIjZmZmIi8+PHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik0xNS45OTggMjYuMDQ5Yy01LjU0OSAwLTEwLjA0Ny00LjQ5OC0xMC4wNDctMTAuMDQ3IDAtNS41NDggNC40OTgtMTAuMDQ2IDEwLjA0Ny0xMC4wNDYgNS41NDggMCAxMC4wNDYgNC40OTggMTAuMDQ2IDEwLjA0NiAwIDUuNTQ5LTQuNDk4IDEwLjA0Ny0xMC4wNDYgMTAuMDQ3eiIgZmlsbD0iI2ZmZiIvPjxwYXRoIGQ9Ik0xMi43NjIgMTQuMjU0YzAtLjgyMi42NjctMS40ODkgMS40ODktMS40ODloMy40OTdjLjgyMiAwIDEuNDg4LjY2NiAxLjQ4OCAxLjQ4OXYzLjQ5N2MwIC44MjItLjY2NiAxLjQ4OC0xLjQ4OCAxLjQ4OGgtMy40OTdhMS40ODggMS40ODggMCAwMS0xLjQ4OS0xLjQ4OHYtMy40OTh6IiBmaWxsPSIjMTY1MkYwIi8+PC9zdmc+",l="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTIiIGhlaWdodD0iMTIiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTEyIDYuNzV2LTEuNWwtMS43Mi0uNTdjLS4wOC0uMjctLjE5LS41Mi0uMzItLjc3bC44MS0xLjYyLTEuMDYtMS4wNi0xLjYyLjgxYy0uMjQtLjEzLS41LS4yNC0uNzctLjMyTDYuNzUgMGgtMS41bC0uNTcgMS43MmMtLjI3LjA4LS41My4xOS0uNzcuMzJsLTEuNjItLjgxLTEuMDYgMS4wNi44MSAxLjYyYy0uMTMuMjQtLjI0LjUtLjMyLjc3TDAgNS4yNXYxLjVsMS43Mi41N2MuMDguMjcuMTkuNTMuMzIuNzdsLS44MSAxLjYyIDEuMDYgMS4wNiAxLjYyLS44MWMuMjQuMTMuNS4yMy43Ny4zMkw1LjI1IDEyaDEuNWwuNTctMS43MmMuMjctLjA4LjUyLS4xOS43Ny0uMzJsMS42Mi44MSAxLjA2LTEuMDYtLjgxLTEuNjJjLjEzLS4yNC4yMy0uNS4zMi0uNzdMMTIgNi43NXpNNiA4LjVhMi41IDIuNSAwIDAxMC01IDIuNSAyLjUgMCAwMTAgNXoiIGZpbGw9IiMwNTBGMTkiLz48L3N2Zz4=";class d{constructor(y){this.items=new Map,this.nextItemKey=0,this.root=null,this.darkMode=y.darkMode}attach(y){this.root=document.createElement("div"),this.root.className="-cbwsdk-snackbar-root",y.appendChild(this.root),this.render()}presentItem(y){const C=this.nextItemKey++;return this.items.set(C,y),this.render(),()=>{this.items.delete(C),this.render()}}clear(){this.items.clear(),this.render()}render(){this.root&&(0,n.render)((0,n.h)("div",null,(0,n.h)(e.SnackbarContainer,{darkMode:this.darkMode},Array.from(this.items.entries()).map(([y,C])=>(0,n.h)(e.SnackbarInstance,Object.assign({},C,{key:y}))))),this.root)}}e.Snackbar=d;const h=R=>(0,n.h)("div",{class:(0,r.default)("-cbwsdk-snackbar-container")},(0,n.h)("style",null,s.default),(0,n.h)("div",{class:"-cbwsdk-snackbar"},R.children));e.SnackbarContainer=h;const m=({autoExpand:R,message:y,menuItems:C})=>{const[x,B]=(0,i.useState)(!0),[O,M]=(0,i.useState)(R??!1);(0,i.useEffect)(()=>{const N=[window.setTimeout(()=>{B(!1)},1),window.setTimeout(()=>{M(!0)},1e4)];return()=>{N.forEach(window.clearTimeout)}});const T=()=>{M(!O)};return(0,n.h)("div",{class:(0,r.default)("-cbwsdk-snackbar-instance",x&&"-cbwsdk-snackbar-instance-hidden",O&&"-cbwsdk-snackbar-instance-expanded")},(0,n.h)("div",{class:"-cbwsdk-snackbar-instance-header",onClick:T},(0,n.h)("img",{src:a,class:"-cbwsdk-snackbar-instance-header-cblogo"})," ",(0,n.h)("div",{class:"-cbwsdk-snackbar-instance-header-message"},y),(0,n.h)("div",{class:"-gear-container"},!O&&(0,n.h)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},(0,n.h)("circle",{cx:"12",cy:"12",r:"12",fill:"#F5F7F8"})),(0,n.h)("img",{src:l,class:"-gear-icon",title:"Expand"}))),C&&C.length>0&&(0,n.h)("div",{class:"-cbwsdk-snackbar-instance-menu"},C.map((N,D)=>(0,n.h)("div",{class:(0,r.default)("-cbwsdk-snackbar-instance-menu-item",N.isRed&&"-cbwsdk-snackbar-instance-menu-item-is-red"),onClick:N.onClick,key:D},(0,n.h)("svg",{width:N.svgWidth,height:N.svgHeight,viewBox:"0 0 10 11",fill:"none",xmlns:"http://www.w3.org/2000/svg"},(0,n.h)("path",{"fill-rule":N.defaultFillRule,"clip-rule":N.defaultClipRule,d:N.path,fill:"#AAAAAA"})),(0,n.h)("span",{class:(0,r.default)("-cbwsdk-snackbar-instance-menu-item-info",N.isRed&&"-cbwsdk-snackbar-instance-menu-item-info-is-red")},N.info)))))};e.SnackbarInstance=m})(Ys);Object.defineProperty(Mn,"__esModule",{value:!0});Mn.WalletLinkRelayUI=void 0;const Id=kn,xd=_i,Ad=Ys;class Td{constructor(t){this.standalone=null,this.attached=!1,this.snackbar=new Ad.Snackbar({darkMode:t.darkMode}),this.linkFlow=new xd.LinkFlow({darkMode:t.darkMode,version:t.version,sessionId:t.session.id,sessionSecret:t.session.secret,linkAPIUrl:t.linkAPIUrl,isParentConnection:!1})}attach(){if(this.attached)throw new Error("Coinbase Wallet SDK UI is already attached");const t=document.documentElement,r=document.createElement("div");r.className="-cbwsdk-css-reset",t.appendChild(r),this.linkFlow.attach(r),this.snackbar.attach(r),this.attached=!0,(0,Id.injectCssReset)()}setConnected(t){this.linkFlow.setConnected(t)}setChainId(t){this.linkFlow.setChainId(t)}setConnectDisabled(t){this.linkFlow.setConnectDisabled(t)}addEthereumChain(){}watchAsset(){}switchEthereumChain(){}requestEthereumAccounts(t){this.linkFlow.open({onCancel:t.onCancel})}hideRequestEthereumAccounts(){this.linkFlow.close()}signEthereumMessage(){}signEthereumTransaction(){}submitEthereumTransaction(){}ethereumAddressFromSignedMessage(){}showConnecting(t){let r;return t.isUnlinkedErrorState?r={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}]}:r={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:"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}]},this.snackbar.presentItem(r)}reloadUI(){document.location.reload()}inlineAccountsResponse(){return!1}inlineAddEthereumChain(){return!1}inlineWatchAsset(){return!1}inlineSwitchEthereumChain(){return!1}setStandalone(t){this.standalone=t}isStandalone(){var t;return(t=this.standalone)!==null&&t!==void 0?t:!1}}Mn.WalletLinkRelayUI=Td;Object.defineProperty(_n,"__esModule",{value:!0});_n.WalletLinkRelay=void 0;const Lr=gn,Nd=Ve,Fe=q,ir=Yr,Zo=ht,Pt=Xr,Ld=vi,sr=Kr,Od=Mn;class Tt extends Zo.RelayAbstract{constructor(t){var r;super(),this.accountsCallback=null,this.chainCallbackParams={chainId:"",jsonRpcUrl:""},this.chainCallback=null,this.dappDefaultChain=1,this.appName="",this.appLogoUrl=null,this.linkedUpdated=a=>{var l;this.isLinked=a;const d=this.storage.getItem(Zo.LOCAL_STORAGE_ADDRESSES_KEY);if(a&&(this.session.linked=a),this.isUnlinkedErrorState=!1,d){const h=d.split(" "),m=this.storage.getItem("IsStandaloneSigning")==="true";if(h[0]!==""&&!a&&this.session.linked&&!m){this.isUnlinkedErrorState=!0;const R=this.getSessionIdHash();(l=this.diagnostic)===null||l===void 0||l.log(ir.EVENTS.UNLINKED_ERROR_STATE,{sessionIdHash:R})}}},this.metadataUpdated=(a,l)=>{this.storage.setItem(a,l)},this.chainUpdated=(a,l)=>{this.chainCallbackParams.chainId===a&&this.chainCallbackParams.jsonRpcUrl===l||(this.chainCallbackParams={chainId:a,jsonRpcUrl:l},this.chainCallback&&this.chainCallback(a,l))},this.accountUpdated=a=>{this.accountsCallback&&this.accountsCallback([a]),Tt.accountRequestCallbackIds.size>0&&(Array.from(Tt.accountRequestCallbackIds.values()).forEach(l=>{const d={type:"WEB3_RESPONSE",id:l,response:{method:"requestEthereumAccounts",result:[a]}};this.invokeCallback(Object.assign(Object.assign({},d),{id:l}))}),Tt.accountRequestCallbackIds.clear())},this.connectedUpdated=a=>{this.ui.setConnected(a)},this.resetAndReload=this.resetAndReload.bind(this),this.linkAPIUrl=t.linkAPIUrl,this.storage=t.storage,this.options=t;const{session:n,ui:i,connection:s}=this.subscribe();this._session=n,this.connection=s,this.relayEventManager=t.relayEventManager,this.diagnostic=t.diagnosticLogger,this._reloadOnDisconnect=(r=t.reloadOnDisconnect)!==null&&r!==void 0?r:!0,this.ui=i}subscribe(){const t=Pt.Session.load(this.storage)||new Pt.Session(this.storage).save(),{linkAPIUrl:r,diagnostic:n}=this,i=new Ld.WalletLinkConnection({session:t,linkAPIUrl:r,diagnostic:n,listener:this}),{version:s,darkMode:a}=this.options,l=this.options.uiConstructor({linkAPIUrl:r,version:s,darkMode:a,session:t});return i.connect(),{session:t,ui:l,connection:i}}attachUI(){this.ui.attach()}resetAndReload(){Promise.race([this.connection.setSessionMetadata("__destroyed","1"),new Promise(t=>setTimeout(()=>t(null),1e3))]).then(()=>{var t,r;const n=this.ui.isStandalone();(t=this.diagnostic)===null||t===void 0||t.log(ir.EVENTS.SESSION_STATE_CHANGE,{method:"relay::resetAndReload",sessionMetadataChange:"__destroyed, 1",sessionIdHash:this.getSessionIdHash()}),this.connection.destroy();const i=Pt.Session.load(this.storage);if((i==null?void 0:i.id)===this._session.id?this.storage.clear():i&&((r=this.diagnostic)===null||r===void 0||r.log(ir.EVENTS.SKIPPED_CLEARING_SESSION,{sessionIdHash:this.getSessionIdHash(),storedSessionIdHash:Pt.Session.hash(i.id)})),this._reloadOnDisconnect){this.ui.reloadUI();return}this.accountsCallback&&this.accountsCallback([],!0);const{session:s,ui:a,connection:l}=this.subscribe();this._session=s,this.connection=l,this.ui=a,n&&this.ui.setStandalone&&this.ui.setStandalone(!0),this.options.headlessMode||this.attachUI()}).catch(t=>{var r;(r=this.diagnostic)===null||r===void 0||r.log(ir.EVENTS.FAILURE,{method:"relay::resetAndReload",message:`failed to reset and reload with ${t}`,sessionIdHash:this.getSessionIdHash()})})}setAppInfo(t,r){this.appName=t,this.appLogoUrl=r}getStorageItem(t){return this.storage.getItem(t)}get session(){return this._session}setStorageItem(t,r){this.storage.setItem(t,r)}signEthereumMessage(t,r,n,i){return this.sendRequest({method:"signEthereumMessage",params:{message:(0,Fe.hexStringFromBuffer)(t,!0),address:r,addPrefix:n,typedDataJson:i||null}})}ethereumAddressFromSignedMessage(t,r,n){return this.sendRequest({method:"ethereumAddressFromSignedMessage",params:{message:(0,Fe.hexStringFromBuffer)(t,!0),signature:(0,Fe.hexStringFromBuffer)(r,!0),addPrefix:n}})}signEthereumTransaction(t){return this.sendRequest({method:"signEthereumTransaction",params:{fromAddress:t.fromAddress,toAddress:t.toAddress,weiValue:(0,Fe.bigIntStringFromBN)(t.weiValue),data:(0,Fe.hexStringFromBuffer)(t.data,!0),nonce:t.nonce,gasPriceInWei:t.gasPriceInWei?(0,Fe.bigIntStringFromBN)(t.gasPriceInWei):null,maxFeePerGas:t.gasPriceInWei?(0,Fe.bigIntStringFromBN)(t.gasPriceInWei):null,maxPriorityFeePerGas:t.gasPriceInWei?(0,Fe.bigIntStringFromBN)(t.gasPriceInWei):null,gasLimit:t.gasLimit?(0,Fe.bigIntStringFromBN)(t.gasLimit):null,chainId:t.chainId,shouldSubmit:!1}})}signAndSubmitEthereumTransaction(t){return this.sendRequest({method:"signEthereumTransaction",params:{fromAddress:t.fromAddress,toAddress:t.toAddress,weiValue:(0,Fe.bigIntStringFromBN)(t.weiValue),data:(0,Fe.hexStringFromBuffer)(t.data,!0),nonce:t.nonce,gasPriceInWei:t.gasPriceInWei?(0,Fe.bigIntStringFromBN)(t.gasPriceInWei):null,maxFeePerGas:t.maxFeePerGas?(0,Fe.bigIntStringFromBN)(t.maxFeePerGas):null,maxPriorityFeePerGas:t.maxPriorityFeePerGas?(0,Fe.bigIntStringFromBN)(t.maxPriorityFeePerGas):null,gasLimit:t.gasLimit?(0,Fe.bigIntStringFromBN)(t.gasLimit):null,chainId:t.chainId,shouldSubmit:!0}})}submitEthereumTransaction(t,r){return this.sendRequest({method:"submitEthereumTransaction",params:{signedTransaction:(0,Fe.hexStringFromBuffer)(t,!0),chainId:r}})}scanQRCode(t){return this.sendRequest({method:"scanQRCode",params:{regExp:t}})}getQRCodeUrl(){return(0,Fe.createQrUrl)(this._session.id,this._session.secret,this.linkAPIUrl,!1,this.options.version,this.dappDefaultChain)}genericRequest(t,r){return this.sendRequest({method:"generic",params:{action:r,data:t}})}sendGenericMessage(t){return this.sendRequest(t)}sendRequest(t){let r=null;const n=(0,Fe.randomBytesHex)(8),i=a=>{this.publishWeb3RequestCanceledEvent(n),this.handleErrorResponse(n,t.method,a),r==null||r()};return{promise:new Promise((a,l)=>{this.ui.isStandalone()||(r=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:i,onResetConnection:this.resetAndReload})),this.relayEventManager.callbacks.set(n,d=>{if(r==null||r(),(0,sr.isErrorResponse)(d))return l(new Error(d.errorMessage));a(d)}),this.ui.isStandalone()?this.sendRequestStandalone(n,t):this.publishWeb3RequestEvent(n,t)}),cancel:i}}setConnectDisabled(t){this.ui.setConnectDisabled(t)}setAccountsCallback(t){this.accountsCallback=t}setChainCallback(t){this.chainCallback=t}setDappDefaultChainCallback(t){this.dappDefaultChain=t,this.ui instanceof Od.WalletLinkRelayUI&&this.ui.setChainId(t)}publishWeb3RequestEvent(t,r){var n;const i={type:"WEB3_REQUEST",id:t,request:r},s=Pt.Session.load(this.storage);(n=this.diagnostic)===null||n===void 0||n.log(ir.EVENTS.WEB3_REQUEST,{eventId:i.id,method:`relay::${r.method}`,sessionIdHash:this.getSessionIdHash(),storedSessionIdHash:s?Pt.Session.hash(s.id):"",isSessionMismatched:((s==null?void 0:s.id)!==this._session.id).toString()}),this.publishEvent("Web3Request",i,!0).then(a=>{var l;(l=this.diagnostic)===null||l===void 0||l.log(ir.EVENTS.WEB3_REQUEST_PUBLISHED,{eventId:i.id,method:`relay::${r.method}`,sessionIdHash:this.getSessionIdHash(),storedSessionIdHash:s?Pt.Session.hash(s.id):"",isSessionMismatched:((s==null?void 0:s.id)!==this._session.id).toString()})}).catch(a=>{this.handleWeb3ResponseMessage({type:"WEB3_RESPONSE",id:i.id,response:{method:r.method,errorMessage:a.message}})})}publishWeb3RequestCanceledEvent(t){const r={type:"WEB3_REQUEST_CANCELED",id:t};this.publishEvent("Web3RequestCanceled",r,!1).then()}publishEvent(t,r,n){return this.connection.publishEvent(t,r,n)}handleWeb3ResponseMessage(t){var r;const{response:n}=t;if((r=this.diagnostic)===null||r===void 0||r.log(ir.EVENTS.WEB3_RESPONSE,{eventId:t.id,method:`relay::${n.method}`,sessionIdHash:this.getSessionIdHash()}),n.method==="requestEthereumAccounts"){Tt.accountRequestCallbackIds.forEach(i=>this.invokeCallback(Object.assign(Object.assign({},t),{id:i}))),Tt.accountRequestCallbackIds.clear();return}this.invokeCallback(t)}handleErrorResponse(t,r,n,i){var s;const a=(s=n==null?void 0:n.message)!==null&&s!==void 0?s:(0,Lr.getMessageFromCode)(i);this.handleWeb3ResponseMessage({type:"WEB3_RESPONSE",id:t,response:{method:r,errorMessage:a,errorCode:i}})}invokeCallback(t){const r=this.relayEventManager.callbacks.get(t.id);r&&(r(t.response),this.relayEventManager.callbacks.delete(t.id))}requestEthereumAccounts(){const t={method:"requestEthereumAccounts",params:{appName:this.appName,appLogoUrl:this.appLogoUrl||null}},r=(0,Fe.randomBytesHex)(8),n=s=>{this.publishWeb3RequestCanceledEvent(r),this.handleErrorResponse(r,t.method,s)};return{promise:new Promise((s,a)=>{if(this.relayEventManager.callbacks.set(r,l=>{if(this.ui.hideRequestEthereumAccounts(),(0,sr.isErrorResponse)(l))return a(new Error(l.errorMessage));s(l)}),this.ui.inlineAccountsResponse()){const l=d=>{this.handleWeb3ResponseMessage({type:"WEB3_RESPONSE",id:r,response:{method:"requestEthereumAccounts",result:d}})};this.ui.requestEthereumAccounts({onCancel:n,onAccounts:l})}else{const l=Lr.standardErrors.provider.userRejectedRequest("User denied account authorization");this.ui.requestEthereumAccounts({onCancel:()=>n(l)})}Tt.accountRequestCallbackIds.add(r),!this.ui.inlineAccountsResponse()&&!this.ui.isStandalone()&&this.publishWeb3RequestEvent(r,t)}),cancel:n}}selectProvider(t){const r={method:"selectProvider",params:{providerOptions:t}},n=(0,Fe.randomBytesHex)(8),i=a=>{this.publishWeb3RequestCanceledEvent(n),this.handleErrorResponse(n,r.method,a)},s=new Promise((a,l)=>{this.relayEventManager.callbacks.set(n,m=>{if((0,sr.isErrorResponse)(m))return l(new Error(m.errorMessage));a(m)});const d=m=>{this.handleWeb3ResponseMessage({type:"WEB3_RESPONSE",id:n,response:{method:"selectProvider",result:Nd.ProviderType.Unselected}})},h=m=>{this.handleWeb3ResponseMessage({type:"WEB3_RESPONSE",id:n,response:{method:"selectProvider",result:m}})};this.ui.selectProvider&&this.ui.selectProvider({onApprove:h,onCancel:d,providerOptions:t})});return{cancel:i,promise:s}}watchAsset(t,r,n,i,s,a){const l={method:"watchAsset",params:{type:t,options:{address:r,symbol:n,decimals:i,image:s},chainId:a}};let d=null;const h=(0,Fe.randomBytesHex)(8),m=y=>{this.publishWeb3RequestCanceledEvent(h),this.handleErrorResponse(h,l.method,y),d==null||d()};this.ui.inlineWatchAsset()||(d=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:m,onResetConnection:this.resetAndReload}));const R=new Promise((y,C)=>{this.relayEventManager.callbacks.set(h,O=>{if(d==null||d(),(0,sr.isErrorResponse)(O))return C(new Error(O.errorMessage));y(O)});const x=O=>{this.handleWeb3ResponseMessage({type:"WEB3_RESPONSE",id:h,response:{method:"watchAsset",result:!1}})},B=()=>{this.handleWeb3ResponseMessage({type:"WEB3_RESPONSE",id:h,response:{method:"watchAsset",result:!0}})};this.ui.inlineWatchAsset()&&this.ui.watchAsset({onApprove:B,onCancel:x,type:t,address:r,symbol:n,decimals:i,image:s,chainId:a}),!this.ui.inlineWatchAsset()&&!this.ui.isStandalone()&&this.publishWeb3RequestEvent(h,l)});return{cancel:m,promise:R}}addEthereumChain(t,r,n,i,s,a){const l={method:"addEthereumChain",params:{chainId:t,rpcUrls:r,blockExplorerUrls:i,chainName:s,iconUrls:n,nativeCurrency:a}};let d=null;const h=(0,Fe.randomBytesHex)(8),m=y=>{this.publishWeb3RequestCanceledEvent(h),this.handleErrorResponse(h,l.method,y),d==null||d()};return this.ui.inlineAddEthereumChain(t)||(d=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:m,onResetConnection:this.resetAndReload})),{promise:new Promise((y,C)=>{this.relayEventManager.callbacks.set(h,O=>{if(d==null||d(),(0,sr.isErrorResponse)(O))return C(new Error(O.errorMessage));y(O)});const x=O=>{this.handleWeb3ResponseMessage({type:"WEB3_RESPONSE",id:h,response:{method:"addEthereumChain",result:{isApproved:!1,rpcUrl:""}}})},B=O=>{this.handleWeb3ResponseMessage({type:"WEB3_RESPONSE",id:h,response:{method:"addEthereumChain",result:{isApproved:!0,rpcUrl:O}}})};this.ui.inlineAddEthereumChain(t)&&this.ui.addEthereumChain({onCancel:x,onApprove:B,chainId:l.params.chainId,rpcUrls:l.params.rpcUrls,blockExplorerUrls:l.params.blockExplorerUrls,chainName:l.params.chainName,iconUrls:l.params.iconUrls,nativeCurrency:l.params.nativeCurrency}),!this.ui.inlineAddEthereumChain(t)&&!this.ui.isStandalone()&&this.publishWeb3RequestEvent(h,l)}),cancel:m}}switchEthereumChain(t,r){const n={method:"switchEthereumChain",params:Object.assign({chainId:t},{address:r})},i=(0,Fe.randomBytesHex)(8),s=l=>{this.publishWeb3RequestCanceledEvent(i),this.handleErrorResponse(i,n.method,l)};return{promise:new Promise((l,d)=>{this.relayEventManager.callbacks.set(i,R=>{if((0,sr.isErrorResponse)(R)&&R.errorCode)return d(Lr.standardErrors.provider.custom({code:R.errorCode,message:"Unrecognized chain ID. Try adding the chain using addEthereumChain first."}));if((0,sr.isErrorResponse)(R))return d(new Error(R.errorMessage));l(R)});const h=R=>{var y;if(R){const C=(y=(0,Lr.getErrorCode)(R))!==null&&y!==void 0?y:Lr.standardErrorCodes.provider.unsupportedChain;this.handleErrorResponse(i,"switchEthereumChain",R instanceof Error?R:Lr.standardErrors.provider.unsupportedChain(t),C)}else this.handleWeb3ResponseMessage({type:"WEB3_RESPONSE",id:i,response:{method:"switchEthereumChain",result:{isApproved:!1,rpcUrl:""}}})},m=R=>{this.handleWeb3ResponseMessage({type:"WEB3_RESPONSE",id:i,response:{method:"switchEthereumChain",result:{isApproved:!0,rpcUrl:R}}})};this.ui.switchEthereumChain({onCancel:h,onApprove:m,chainId:n.params.chainId,address:n.params.address}),!this.ui.inlineSwitchEthereumChain()&&!this.ui.isStandalone()&&this.publishWeb3RequestEvent(i,n)}),cancel:s}}inlineAddEthereumChain(t){return this.ui.inlineAddEthereumChain(t)}getSessionIdHash(){return Pt.Session.hash(this._session.id)}sendRequestStandalone(t,r){const n=s=>{this.handleErrorResponse(t,r.method,s)},i=s=>{this.handleWeb3ResponseMessage({type:"WEB3_RESPONSE",id:t,response:s})};switch(r.method){case"signEthereumMessage":this.ui.signEthereumMessage({request:r,onSuccess:i,onCancel:n});break;case"signEthereumTransaction":this.ui.signEthereumTransaction({request:r,onSuccess:i,onCancel:n});break;case"submitEthereumTransaction":this.ui.submitEthereumTransaction({request:r,onSuccess:i,onCancel:n});break;case"ethereumAddressFromSignedMessage":this.ui.ethereumAddressFromSignedMessage({request:r,onSuccess:i});break;default:n();break}}}_n.WalletLinkRelay=Tt;Tt.accountRequestCallbackIds=new Set;var In={},Ni={},$c={};(function(e){var t=Q&&Q.__createBinding||(Object.create?function(n,i,s,a){a===void 0&&(a=s);var l=Object.getOwnPropertyDescriptor(i,s);(!l||("get"in l?!i.__esModule:l.writable||l.configurable))&&(l={enumerable:!0,get:function(){return i[s]}}),Object.defineProperty(n,a,l)}:function(n,i,s,a){a===void 0&&(a=s),n[a]=i[s]}),r=Q&&Q.__exportStar||function(n,i){for(var s in n)s!=="default"&&!Object.prototype.hasOwnProperty.call(i,s)&&t(i,n,s)};Object.defineProperty(e,"__esModule",{value:!0}),r(Ys,e)})($c);var eo={};Object.defineProperty(eo,"__esModule",{value:!0});eo.default=".-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}";var Bc=Q&&Q.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Ni,"__esModule",{value:!0});Ni.RedirectDialog=void 0;const Pd=Bc(Cn),Rt=tt,$d=kn,Bd=$c,Dd=Bc(eo);class Fd{constructor(){this.root=null}attach(){const t=document.documentElement;this.root=document.createElement("div"),this.root.className="-cbwsdk-css-reset",t.appendChild(this.root),(0,$d.injectCssReset)()}present(t){this.render(t)}clear(){this.render(null)}render(t){this.root&&((0,Rt.render)(null,this.root),t&&(0,Rt.render)((0,Rt.h)(jd,Object.assign({},t,{onDismiss:()=>{this.clear()}})),this.root))}}Ni.RedirectDialog=Fd;const jd=({title:e,buttonText:t,darkMode:r,onButtonClick:n,onDismiss:i})=>{const s=r?"dark":"light";return(0,Rt.h)(Bd.SnackbarContainer,{darkMode:r},(0,Rt.h)("div",{class:"-cbwsdk-redirect-dialog"},(0,Rt.h)("style",null,Dd.default),(0,Rt.h)("div",{class:"-cbwsdk-redirect-dialog-backdrop",onClick:i}),(0,Rt.h)("div",{class:(0,Pd.default)("-cbwsdk-redirect-dialog-box",s)},(0,Rt.h)("p",null,e),(0,Rt.h)("button",{onClick:n},t))))};Object.defineProperty(In,"__esModule",{value:!0});In.MobileRelayUI=void 0;const Hd=Ni;class Ud{constructor(t){this.attached=!1,this.darkMode=!1,this.redirectDialog=new Hd.RedirectDialog,this.darkMode=t.darkMode}attach(){if(this.attached)throw new Error("Coinbase Wallet SDK UI is already attached");this.redirectDialog.attach(),this.attached=!0}setConnected(t){}redirectToCoinbaseWallet(t){const r=new URL("https://go.cb-w.com/walletlink");r.searchParams.append("redirect_url",window.location.href),t&&r.searchParams.append("wl_url",t);const n=document.createElement("a");n.target="cbw-opener",n.href=r.href,n.rel="noreferrer noopener",n.click()}openCoinbaseWalletDeeplink(t){this.redirectDialog.present({title:"Redirecting to Coinbase Wallet...",buttonText:"Open",darkMode:this.darkMode,onButtonClick:()=>{this.redirectToCoinbaseWallet(t)}}),setTimeout(()=>{this.redirectToCoinbaseWallet(t)},99)}showConnecting(t){return()=>{this.redirectDialog.clear()}}hideRequestEthereumAccounts(){this.redirectDialog.clear()}requestEthereumAccounts(){}addEthereumChain(){}watchAsset(){}selectProvider(){}switchEthereumChain(){}signEthereumMessage(){}signEthereumTransaction(){}submitEthereumTransaction(){}ethereumAddressFromSignedMessage(){}reloadUI(){}setStandalone(){}setConnectDisabled(){}inlineAccountsResponse(){return!1}inlineAddEthereumChain(){return!1}inlineWatchAsset(){return!1}inlineSwitchEthereumChain(){return!1}isStandalone(){return!1}}In.MobileRelayUI=Ud;Object.defineProperty(wn,"__esModule",{value:!0});wn.MobileRelay=void 0;const Wd=q,Vd=_n,zd=In;class qd extends Vd.WalletLinkRelay{constructor(t){var r;super(t),this._enableMobileWalletLink=(r=t.enableMobileWalletLink)!==null&&r!==void 0?r:!1}requestEthereumAccounts(){return this._enableMobileWalletLink?super.requestEthereumAccounts():{promise:new Promise(()=>{const t=(0,Wd.getLocation)();t.href=`https://go.cb-w.com/dapp?cb_url=${encodeURIComponent(t.href)}`}),cancel:()=>{}}}publishWeb3RequestEvent(t,r){if(super.publishWeb3RequestEvent(t,r),!(this._enableMobileWalletLink&&this.ui instanceof zd.MobileRelayUI))return;let n=!1;switch(r.method){case"requestEthereumAccounts":case"connectAndSignIn":n=!0,this.ui.openCoinbaseWalletDeeplink(this.getQRCodeUrl());break;case"switchEthereumChain":return;default:n=!0,this.ui.openCoinbaseWalletDeeplink();break}n&&window.addEventListener("blur",()=>{window.addEventListener("focus",()=>{this.connection.checkUnseenEvents()},{once:!0})},{once:!0})}handleWeb3ResponseMessage(t){super.handleWeb3ResponseMessage(t)}connectAndSignIn(t){if(!this._enableMobileWalletLink)throw new Error("connectAndSignIn is supported only when enableMobileWalletLink is on");return this.sendRequest({method:"connectAndSignIn",params:{appName:this.appName,appLogoUrl:this.appLogoUrl,domain:window.location.hostname,aud:window.location.href,version:"1",type:"eip4361",nonce:t.nonce,iat:new Date().toISOString(),chainId:`eip155:${this.dappDefaultChain}`,statement:t.statement,resources:t.resources}})}}wn.MobileRelay=qd;var $s={exports:{}},Dc=si.EventEmitter,ps,Ko;function Jd(){if(Ko)return ps;Ko=1;function e(x,B){var O=Object.keys(x);if(Object.getOwnPropertySymbols){var M=Object.getOwnPropertySymbols(x);B&&(M=M.filter(function(T){return Object.getOwnPropertyDescriptor(x,T).enumerable})),O.push.apply(O,M)}return O}function t(x){for(var B=1;B0?this.tail.next=M:this.head=M,this.tail=M,++this.length}},{key:"unshift",value:function(O){var M={data:O,next:this.head};this.length===0&&(this.tail=M),this.head=M,++this.length}},{key:"shift",value:function(){if(this.length!==0){var O=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,O}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(O){if(this.length===0)return"";for(var M=this.head,T=""+M.data;M=M.next;)T+=O+M.data;return T}},{key:"concat",value:function(O){if(this.length===0)return h.alloc(0);for(var M=h.allocUnsafe(O>>>0),T=this.head,N=0;T;)C(T.data,M,N),N+=T.data.length,T=T.next;return M}},{key:"consume",value:function(O,M){var T;return OD.length?D.length:O;if(L===D.length?N+=D:N+=D.slice(0,O),O-=L,O===0){L===D.length?(++T,M.next?this.head=M.next:this.head=this.tail=null):(this.head=M,M.data=D.slice(L));break}++T}return this.length-=T,N}},{key:"_getBuffer",value:function(O){var M=h.allocUnsafe(O),T=this.head,N=1;for(T.data.copy(M),O-=T.data.length;T=T.next;){var D=T.data,L=O>D.length?D.length:O;if(D.copy(M,M.length-O,0,L),O-=L,O===0){L===D.length?(++N,T.next?this.head=T.next:this.head=this.tail=null):(this.head=T,T.data=D.slice(L));break}++N}return this.length-=N,M}},{key:y,value:function(O,M){return R(this,t(t({},M),{},{depth:0,customInspect:!1}))}}]),x}(),ps}var or={env:{NODE_ENV:'"production"',VITE_WALLETCONNECT_PROJECT_ID:'"1d93edc21291f98e3bed6ff7617ff539"'},nextTick:"setImmediate",platform:'"browser"',version:'"v16.0.0"',browser:!0};function Gd(e,t){var r=this,n=this._readableState&&this._readableState.destroyed,i=this._writableState&&this._writableState.destroyed;return n||i?(t?t(e):e&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,or.nextTick(Bs,this,e)):or.nextTick(Bs,this,e)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(e||null,function(s){!t&&s?r._writableState?r._writableState.errorEmitted?or.nextTick(Xn,r):(r._writableState.errorEmitted=!0,or.nextTick(Qo,r,s)):or.nextTick(Qo,r,s):t?(or.nextTick(Xn,r),t(s)):or.nextTick(Xn,r)}),this)}function Qo(e,t){Bs(e,t),Xn(e)}function Xn(e){e._writableState&&!e._writableState.emitClose||e._readableState&&!e._readableState.emitClose||e.emit("close")}function Zd(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}function Bs(e,t){e.emit("error",t)}function Kd(e,t){var r=e._readableState,n=e._writableState;r&&r.autoDestroy||n&&n.autoDestroy?e.destroy(t):e.emit("error",t)}var Fc={destroy:Gd,undestroy:Zd,errorOrDestroy:Kd},mr={};function Qd(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t}var jc={};function pt(e,t,r){r||(r=Error);function n(s,a,l){return typeof t=="string"?t:t(s,a,l)}var i=function(s){Qd(a,s);function a(l,d,h){return s.call(this,n(l,d,h))||this}return a}(r);i.prototype.name=r.name,i.prototype.code=e,jc[e]=i}function Yo(e,t){if(Array.isArray(e)){var r=e.length;return e=e.map(function(n){return String(n)}),r>2?"one of ".concat(t," ").concat(e.slice(0,r-1).join(", "),", or ")+e[r-1]:r===2?"one of ".concat(t," ").concat(e[0]," or ").concat(e[1]):"of ".concat(t," ").concat(e[0])}else return"of ".concat(t," ").concat(String(e))}function Yd(e,t,r){return e.substr(0,t.length)===t}function Xd(e,t,r){return(r===void 0||r>e.length)&&(r=e.length),e.substring(r-t.length,r)===t}function ef(e,t,r){return typeof r!="number"&&(r=0),r+t.length>e.length?!1:e.indexOf(t,r)!==-1}pt("ERR_INVALID_OPT_VALUE",function(e,t){return'The value "'+t+'" is invalid for option "'+e+'"'},TypeError);pt("ERR_INVALID_ARG_TYPE",function(e,t,r){var n;typeof t=="string"&&Yd(t,"not ")?(n="must not be",t=t.replace(/^not /,"")):n="must be";var i;if(Xd(e," argument"))i="The ".concat(e," ").concat(n," ").concat(Yo(t,"type"));else{var s=ef(e,".")?"property":"argument";i='The "'.concat(e,'" ').concat(s," ").concat(n," ").concat(Yo(t,"type"))}return i+=". Received type ".concat(typeof r),i},TypeError);pt("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF");pt("ERR_METHOD_NOT_IMPLEMENTED",function(e){return"The "+e+" method is not implemented"});pt("ERR_STREAM_PREMATURE_CLOSE","Premature close");pt("ERR_STREAM_DESTROYED",function(e){return"Cannot call "+e+" after a stream was destroyed"});pt("ERR_MULTIPLE_CALLBACK","Callback called multiple times");pt("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable");pt("ERR_STREAM_WRITE_AFTER_END","write after end");pt("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError);pt("ERR_UNKNOWN_ENCODING",function(e){return"Unknown encoding: "+e},TypeError);pt("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event");mr.codes=jc;var tf=mr.codes.ERR_INVALID_OPT_VALUE;function rf(e,t,r){return e.highWaterMark!=null?e.highWaterMark:t?e[r]:null}function nf(e,t,r,n){var i=rf(t,n,r);if(i!=null){if(!(isFinite(i)&&Math.floor(i)===i)||i<0){var s=n?r:"highWaterMark";throw new tf(s,i)}return Math.floor(i)}return e.objectMode?16:16*1024}var Hc={getHighWaterMark:nf},sf=of;function of(e,t){if(gs("noDeprecation"))return e;var r=!1;function n(){if(!r){if(gs("throwDeprecation"))throw new Error(t);gs("traceDeprecation")?console.trace(t):console.warn(t),r=!0}return e.apply(this,arguments)}return n}function gs(e){try{if(!globalThis.localStorage)return!1}catch{return!1}var t=globalThis.localStorage[e];return t==null?!1:String(t).toLowerCase()==="true"}var ms,Xo;function Uc(){if(Xo)return ms;Xo=1;var e={env:{NODE_ENV:'"production"',VITE_WALLETCONNECT_PROJECT_ID:'"1d93edc21291f98e3bed6ff7617ff539"'},nextTick:"setImmediate",platform:'"browser"',version:'"v16.0.0"',browser:!0};ms=Z;function t(A){var I=this;this.next=null,this.entry=null,this.finish=function(){V(I,A)}}var r;Z.WritableState=W;var n={deprecate:sf},i=Dc,s=ii.Buffer,a=(typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function l(A){return s.from(A)}function d(A){return s.isBuffer(A)||A instanceof a}var h=Fc,m=Hc,R=m.getHighWaterMark,y=mr.codes,C=y.ERR_INVALID_ARG_TYPE,x=y.ERR_METHOD_NOT_IMPLEMENTED,B=y.ERR_MULTIPLE_CALLBACK,O=y.ERR_STREAM_CANNOT_PIPE,M=y.ERR_STREAM_DESTROYED,T=y.ERR_STREAM_NULL_VALUES,N=y.ERR_STREAM_WRITE_AFTER_END,D=y.ERR_UNKNOWN_ENCODING,L=h.errorOrDestroy;vt(Z,i);function F(){}function W(A,I,$){r=r||zr(),A=A||{},typeof $!="boolean"&&($=I instanceof r),this.objectMode=!!A.objectMode,$&&(this.objectMode=this.objectMode||!!A.writableObjectMode),this.highWaterMark=R(this,A,"writableHighWaterMark",$),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var K=A.decodeStrings===!1;this.decodeStrings=!K,this.defaultEncoding=A.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(G){p(I,G)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=A.emitClose!==!1,this.autoDestroy=!!A.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new t(this)}W.prototype.getBuffer=function(){for(var I=this.bufferedRequest,$=[];I;)$.push(I),I=I.next;return $},function(){try{Object.defineProperty(W.prototype,"buffer",{get:n.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch{}}();var te;typeof Symbol=="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]=="function"?(te=Function.prototype[Symbol.hasInstance],Object.defineProperty(Z,Symbol.hasInstance,{value:function(I){return te.call(this,I)?!0:this!==Z?!1:I&&I._writableState instanceof W}})):te=function(I){return I instanceof this};function Z(A){r=r||zr();var I=this instanceof r;if(!I&&!te.call(Z,this))return new Z(A);this._writableState=new W(A,this,I),this.writable=!0,A&&(typeof A.write=="function"&&(this._write=A.write),typeof A.writev=="function"&&(this._writev=A.writev),typeof A.destroy=="function"&&(this._destroy=A.destroy),typeof A.final=="function"&&(this._final=A.final)),i.call(this)}Z.prototype.pipe=function(){L(this,new O)};function z(A,I){var $=new N;L(A,$),e.nextTick(I,$)}function X(A,I,$,K){var G;return $===null?G=new T:typeof $!="string"&&!I.objectMode&&(G=new C("chunk",["string","Buffer"],$)),G?(L(A,G),e.nextTick(K,G),!1):!0}Z.prototype.write=function(A,I,$){var K=this._writableState,G=!1,b=!K.objectMode&&d(A);return b&&!s.isBuffer(A)&&(A=l(A)),typeof I=="function"&&($=I,I=null),b?I="buffer":I||(I=K.defaultEncoding),typeof $!="function"&&($=F),K.ending?z(this,$):(b||X(this,K,A,$))&&(K.pendingcb++,G=S(this,K,b,A,I,$)),G},Z.prototype.cork=function(){this._writableState.corked++},Z.prototype.uncork=function(){var A=this._writableState;A.corked&&(A.corked--,!A.writing&&!A.corked&&!A.bufferProcessing&&A.bufferedRequest&&k(this,A))},Z.prototype.setDefaultEncoding=function(I){if(typeof I=="string"&&(I=I.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((I+"").toLowerCase())>-1))throw new D(I);return this._writableState.defaultEncoding=I,this},Object.defineProperty(Z.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}});function ne(A,I,$){return!A.objectMode&&A.decodeStrings!==!1&&typeof I=="string"&&(I=s.from(I,$)),I}Object.defineProperty(Z.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function S(A,I,$,K,G,b){if(!$){var _=ne(I,K,G);K!==_&&($=!0,G="buffer",K=_)}var P=I.objectMode?1:K.length;I.length+=P;var j=I.length>5===6?2:M>>4===14?3:M>>3===30?4:M>>6===2?-1:-2}function a(M,T,N){var D=T.length-1;if(D=0?(L>0&&(M.lastNeed=L-1),L):--D=0?(L>0&&(M.lastNeed=L-2),L):--D=0?(L>0&&(L===2?L=0:M.lastNeed=L-3),L):0))}function l(M,T,N){if((T[0]&192)!==128)return M.lastNeed=0,"�";if(M.lastNeed>1&&T.length>1){if((T[1]&192)!==128)return M.lastNeed=1,"�";if(M.lastNeed>2&&T.length>2&&(T[2]&192)!==128)return M.lastNeed=2,"�"}}function d(M){var T=this.lastTotal-this.lastNeed,N=l(this,M);if(N!==void 0)return N;if(this.lastNeed<=M.length)return M.copy(this.lastChar,T,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);M.copy(this.lastChar,T,0,M.length),this.lastNeed-=M.length}function h(M,T){var N=a(this,M,T);if(!this.lastNeed)return M.toString("utf8",T);this.lastTotal=N;var D=M.length-(N-this.lastNeed);return M.copy(this.lastChar,0,D),M.toString("utf8",T,D)}function m(M){var T=M&&M.length?this.write(M):"";return this.lastNeed?T+"�":T}function R(M,T){if((M.length-T)%2===0){var N=M.toString("utf16le",T);if(N){var D=N.charCodeAt(N.length-1);if(D>=55296&&D<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=M[M.length-2],this.lastChar[1]=M[M.length-1],N.slice(0,-1)}return N}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=M[M.length-1],M.toString("utf16le",T,M.length-1)}function y(M){var T=M&&M.length?this.write(M):"";if(this.lastNeed){var N=this.lastTotal-this.lastNeed;return T+this.lastChar.toString("utf16le",0,N)}return T}function C(M,T){var N=(M.length-T)%3;return N===0?M.toString("base64",T):(this.lastNeed=3-N,this.lastTotal=3,N===1?this.lastChar[0]=M[M.length-1]:(this.lastChar[0]=M[M.length-2],this.lastChar[1]=M[M.length-1]),M.toString("base64",T,M.length-N))}function x(M){var T=M&&M.length?this.write(M):"";return this.lastNeed?T+this.lastChar.toString("base64",0,3-this.lastNeed):T}function B(M){return M.toString(this.encoding)}function O(M){return M&&M.length?this.write(M):""}return bs}var na=mr.codes.ERR_STREAM_PREMATURE_CLOSE;function af(e){var t=!1;return function(){if(!t){t=!0;for(var r=arguments.length,n=new Array(r),i=0;i0)if(typeof _!="string"&&!J.objectMode&&Object.getPrototypeOf(_)!==i.prototype&&(_=a(_)),j)J.endEmitted?F(b,new T):ne(b,J,_,!0);else if(J.ended)F(b,new O);else{if(J.destroyed)return!1;J.reading=!1,J.decoder&&!P?(_=J.decoder.write(_),J.objectMode||_.length!==0?ne(b,J,_,!1):k(b,J)):ne(b,J,_,!1)}else j||(J.reading=!1,k(b,J))}return!J.ended&&(J.length=o?b=o:(b--,b|=b>>>1,b|=b>>>2,b|=b>>>4,b|=b>>>8,b|=b>>>16,b++),b}function f(b,_){return b<=0||_.length===0&&_.ended?0:_.objectMode?1:b!==b?_.flowing&&_.length?_.buffer.head.data.length:_.length:(b>_.highWaterMark&&(_.highWaterMark=u(b)),b<=_.length?b:_.ended?_.length:(_.needReadable=!0,0))}z.prototype.read=function(b){h("read",b),b=parseInt(b,10);var _=this._readableState,P=b;if(b!==0&&(_.emittedReadable=!1),b===0&&_.needReadable&&((_.highWaterMark!==0?_.length>=_.highWaterMark:_.length>0)||_.ended))return h("read: emitReadable",_.length,_.ended),_.length===0&&_.ended?$(this):v(this),null;if(b=f(b,_),b===0&&_.ended)return _.length===0&&$(this),null;var j=_.needReadable;h("need readable",j),(_.length===0||_.length-b<_.highWaterMark)&&(j=!0,h("length less than watermark",j)),_.ended||_.reading?(j=!1,h("reading or ended",j)):j&&(h("do read"),_.reading=!0,_.sync=!0,_.length===0&&(_.needReadable=!0),this._read(_.highWaterMark),_.sync=!1,_.reading||(b=f(P,_)));var ue;return b>0?ue=I(b,_):ue=null,ue===null?(_.needReadable=_.length<=_.highWaterMark,b=0):(_.length-=b,_.awaitDrain=0),_.length===0&&(_.ended||(_.needReadable=!0),P!==b&&_.ended&&$(this)),ue!==null&&this.emit("data",ue),ue};function p(b,_){if(h("onEofChunk"),!_.ended){if(_.decoder){var P=_.decoder.end();P&&P.length&&(_.buffer.push(P),_.length+=_.objectMode?1:P.length)}_.ended=!0,_.sync?v(b):(_.needReadable=!1,_.emittedReadable||(_.emittedReadable=!0,E(b)))}}function v(b){var _=b._readableState;h("emitReadable",_.needReadable,_.emittedReadable),_.needReadable=!1,_.emittedReadable||(h("emitReadable",_.flowing),_.emittedReadable=!0,e.nextTick(E,b))}function E(b){var _=b._readableState;h("emitReadable_",_.destroyed,_.length,_.ended),!_.destroyed&&(_.length||_.ended)&&(b.emit("readable"),_.emittedReadable=!1),_.needReadable=!_.flowing&&!_.ended&&_.length<=_.highWaterMark,A(b)}function k(b,_){_.readingMore||(_.readingMore=!0,e.nextTick(g,b,_))}function g(b,_){for(;!_.reading&&!_.ended&&(_.length<_.highWaterMark||_.flowing&&_.length===0);){var P=_.length;if(h("maybeReadMore read 0"),b.read(0),P===_.length)break}_.readingMore=!1}z.prototype._read=function(b){F(this,new M("_read()"))},z.prototype.pipe=function(b,_){var P=this,j=this._readableState;switch(j.pipesCount){case 0:j.pipes=b;break;case 1:j.pipes=[j.pipes,b];break;default:j.pipes.push(b);break}j.pipesCount+=1,h("pipe count=%d opts=%j",j.pipesCount,_);var ue=(!_||_.end!==!1)&&b!==e.stdout&&b!==e.stderr,J=ue?at:le;j.endEmitted?e.nextTick(J):P.once("end",J),b.on("unpipe",Y);function Y(nt,ce){h("onunpipe"),nt===P&&ce&&ce.hasUnpiped===!1&&(ce.hasUnpiped=!0,Ht())}function at(){h("onend"),b.end()}var he=c(P);b.on("drain",he);var pe=!1;function Ht(){h("cleanup"),b.removeListener("close",xt),b.removeListener("finish",fe),b.removeListener("drain",he),b.removeListener("error",de),b.removeListener("unpipe",Y),P.removeListener("end",at),P.removeListener("end",le),P.removeListener("data",ge),pe=!0,j.awaitDrain&&(!b._writableState||b._writableState.needDrain)&&he()}P.on("data",ge);function ge(nt){h("ondata");var ce=b.write(nt);h("dest.write",ce),ce===!1&&((j.pipesCount===1&&j.pipes===b||j.pipesCount>1&&G(j.pipes,b)!==-1)&&!pe&&(h("false write response, pause",j.awaitDrain),j.awaitDrain++),P.pause())}function de(nt){h("onerror",nt),le(),b.removeListener("error",de),r(b,"error")===0&&F(b,nt)}te(b,"error",de);function xt(){b.removeListener("finish",fe),le()}b.once("close",xt);function fe(){h("onfinish"),b.removeListener("close",xt),le()}b.once("finish",fe);function le(){h("unpipe"),P.unpipe(b)}return b.emit("pipe",P),j.flowing||(h("pipe resume"),P.resume()),b};function c(b){return function(){var P=b._readableState;h("pipeOnDrain",P.awaitDrain),P.awaitDrain&&P.awaitDrain--,P.awaitDrain===0&&r(b,"data")&&(P.flowing=!0,A(b))}}z.prototype.unpipe=function(b){var _=this._readableState,P={hasUnpiped:!1};if(_.pipesCount===0)return this;if(_.pipesCount===1)return b&&b!==_.pipes?this:(b||(b=_.pipes),_.pipes=null,_.pipesCount=0,_.flowing=!1,b&&b.emit("unpipe",this,P),this);if(!b){var j=_.pipes,ue=_.pipesCount;_.pipes=null,_.pipesCount=0,_.flowing=!1;for(var J=0;J0,j.flowing!==!1&&this.resume()):b==="readable"&&!j.endEmitted&&!j.readableListening&&(j.readableListening=j.needReadable=!0,j.flowing=!1,j.emittedReadable=!1,h("on readable",j.length,j.reading),j.length?v(this):j.reading||e.nextTick(U,this)),P},z.prototype.addListener=z.prototype.on,z.prototype.removeListener=function(b,_){var P=n.prototype.removeListener.call(this,b,_);return b==="readable"&&e.nextTick(w,this),P},z.prototype.removeAllListeners=function(b){var _=n.prototype.removeAllListeners.apply(this,arguments);return(b==="readable"||b===void 0)&&e.nextTick(w,this),_};function w(b){var _=b._readableState;_.readableListening=b.listenerCount("readable")>0,_.resumeScheduled&&!_.paused?_.flowing=!0:b.listenerCount("data")>0&&b.resume()}function U(b){h("readable nexttick read 0"),b.read(0)}z.prototype.resume=function(){var b=this._readableState;return b.flowing||(h("resume"),b.flowing=!b.readableListening,H(this,b)),b.paused=!1,this};function H(b,_){_.resumeScheduled||(_.resumeScheduled=!0,e.nextTick(V,b,_))}function V(b,_){h("resume",_.reading),_.reading||b.read(0),_.resumeScheduled=!1,b.emit("resume"),A(b),_.flowing&&!_.reading&&b.read(0)}z.prototype.pause=function(){return h("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(h("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this};function A(b){var _=b._readableState;for(h("flow",_.flowing);_.flowing&&b.read()!==null;);}z.prototype.wrap=function(b){var _=this,P=this._readableState,j=!1;b.on("end",function(){if(h("wrapped end"),P.decoder&&!P.ended){var Y=P.decoder.end();Y&&Y.length&&_.push(Y)}_.push(null)}),b.on("data",function(Y){if(h("wrapped data"),P.decoder&&(Y=P.decoder.write(Y)),!(P.objectMode&&Y==null)&&!(!P.objectMode&&(!Y||!Y.length))){var at=_.push(Y);at||(j=!0,b.pause())}});for(var ue in b)this[ue]===void 0&&typeof b[ue]=="function"&&(this[ue]=function(at){return function(){return b[at].apply(b,arguments)}}(ue));for(var J=0;J=_.length?(_.decoder?P=_.buffer.join(""):_.buffer.length===1?P=_.buffer.first():P=_.buffer.concat(_.length),_.buffer.clear()):P=_.buffer.consume(b,_.decoder),P}function $(b){var _=b._readableState;h("endReadable",_.endEmitted),_.endEmitted||(_.ended=!0,e.nextTick(K,_,b))}function K(b,_){if(h("endReadableNT",b.endEmitted,b.length),!b.endEmitted&&b.length===0&&(b.endEmitted=!0,_.readable=!1,_.emit("end"),b.autoDestroy)){var P=_._writableState;(!P||P.autoDestroy&&P.finished)&&_.destroy()}}typeof Symbol=="function"&&(z.from=function(b,_){return L===void 0&&(L=hf()),L(z,b,_)});function G(b,_){for(var P=0,j=b.length;P0;return Sf(a,d,h,function(m){i||(i=m),m&&s.forEach(la),!d&&(s.forEach(la),n(i))})});return t.reduce(Rf)}var Cf=kf;(function(e,t){t=e.exports=Vc(),t.Stream=t,t.Readable=t,t.Writable=Uc(),t.Duplex=zr(),t.Transform=zc,t.PassThrough=bf,t.finished=to,t.pipeline=Cf})($s,$s.exports);var Gc=$s.exports;const{Transform:If}=Gc;var xf=e=>class Zc extends If{constructor(r,n,i,s,a){super(a),this._rate=r,this._capacity=n,this._delimitedSuffix=i,this._hashBitLength=s,this._options=a,this._state=new e,this._state.initialize(r,n),this._finalized=!1}_transform(r,n,i){let s=null;try{this.update(r,n)}catch(a){s=a}i(s)}_flush(r){let n=null;try{this.push(this.digest())}catch(i){n=i}r(n)}update(r,n){if(!Buffer.isBuffer(r)&&typeof r!="string")throw new TypeError("Data must be a string or a buffer");if(this._finalized)throw new Error("Digest already called");return Buffer.isBuffer(r)||(r=Buffer.from(r,n)),this._state.absorb(r),this}digest(r){if(this._finalized)throw new Error("Digest already called");this._finalized=!0,this._delimitedSuffix&&this._state.absorbLastFewBits(this._delimitedSuffix);let n=this._state.squeeze(this._hashBitLength/8);return r!==void 0&&(n=n.toString(r)),this._resetState(),n}_resetState(){return this._state.initialize(this._rate,this._capacity),this}_clone(){const r=new Zc(this._rate,this._capacity,this._delimitedSuffix,this._hashBitLength,this._options);return this._state.copy(r._state),r._finalized=this._finalized,r}};const{Transform:Af}=Gc;var Tf=e=>class Kc extends Af{constructor(r,n,i,s){super(s),this._rate=r,this._capacity=n,this._delimitedSuffix=i,this._options=s,this._state=new e,this._state.initialize(r,n),this._finalized=!1}_transform(r,n,i){let s=null;try{this.update(r,n)}catch(a){s=a}i(s)}_flush(){}_read(r){this.push(this.squeeze(r))}update(r,n){if(!Buffer.isBuffer(r)&&typeof r!="string")throw new TypeError("Data must be a string or a buffer");if(this._finalized)throw new Error("Squeeze already called");return Buffer.isBuffer(r)||(r=Buffer.from(r,n)),this._state.absorb(r),this}squeeze(r,n){this._finalized||(this._finalized=!0,this._state.absorbLastFewBits(this._delimitedSuffix));let i=this._state.squeeze(r);return n!==void 0&&(i=i.toString(n)),i}_resetState(){return this._state.initialize(this._rate,this._capacity),this}_clone(){const r=new Kc(this._rate,this._capacity,this._delimitedSuffix,this._options);return this._state.copy(r._state),r._finalized=this._finalized,r}};const Nf=xf,Lf=Tf;var Of=function(e){const t=Nf(e),r=Lf(e);return function(n,i){switch(typeof n=="string"?n.toLowerCase():n){case"keccak224":return new t(1152,448,null,224,i);case"keccak256":return new t(1088,512,null,256,i);case"keccak384":return new t(832,768,null,384,i);case"keccak512":return new t(576,1024,null,512,i);case"sha3-224":return new t(1152,448,6,224,i);case"sha3-256":return new t(1088,512,6,256,i);case"sha3-384":return new t(832,768,6,384,i);case"sha3-512":return new t(576,1024,6,512,i);case"shake128":return new r(1344,256,31,i);case"shake256":return new r(1088,512,31,i);default:throw new Error("Invald algorithm: "+n)}}},Qc={};const ua=[1,0,32898,0,32906,2147483648,2147516416,2147483648,32907,0,2147483649,0,2147516545,2147483648,32777,2147483648,138,0,136,0,2147516425,0,2147483658,0,2147516555,0,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,2147483648,32778,0,2147483658,2147483648,2147516545,2147483648,32896,2147483648,2147483649,0,2147516424,2147483648];Qc.p1600=function(e){for(let t=0;t<24;++t){const r=e[0]^e[10]^e[20]^e[30]^e[40],n=e[1]^e[11]^e[21]^e[31]^e[41],i=e[2]^e[12]^e[22]^e[32]^e[42],s=e[3]^e[13]^e[23]^e[33]^e[43],a=e[4]^e[14]^e[24]^e[34]^e[44],l=e[5]^e[15]^e[25]^e[35]^e[45],d=e[6]^e[16]^e[26]^e[36]^e[46],h=e[7]^e[17]^e[27]^e[37]^e[47],m=e[8]^e[18]^e[28]^e[38]^e[48],R=e[9]^e[19]^e[29]^e[39]^e[49];let y=m^(i<<1|s>>>31),C=R^(s<<1|i>>>31);const x=e[0]^y,B=e[1]^C,O=e[10]^y,M=e[11]^C,T=e[20]^y,N=e[21]^C,D=e[30]^y,L=e[31]^C,F=e[40]^y,W=e[41]^C;y=r^(a<<1|l>>>31),C=n^(l<<1|a>>>31);const te=e[2]^y,Z=e[3]^C,z=e[12]^y,X=e[13]^C,ne=e[22]^y,S=e[23]^C,o=e[32]^y,u=e[33]^C,f=e[42]^y,p=e[43]^C;y=i^(d<<1|h>>>31),C=s^(h<<1|d>>>31);const v=e[4]^y,E=e[5]^C,k=e[14]^y,g=e[15]^C,c=e[24]^y,w=e[25]^C,U=e[34]^y,H=e[35]^C,V=e[44]^y,A=e[45]^C;y=a^(m<<1|R>>>31),C=l^(R<<1|m>>>31);const I=e[6]^y,$=e[7]^C,K=e[16]^y,G=e[17]^C,b=e[26]^y,_=e[27]^C,P=e[36]^y,j=e[37]^C,ue=e[46]^y,J=e[47]^C;y=d^(r<<1|n>>>31),C=h^(n<<1|r>>>31);const Y=e[8]^y,at=e[9]^C,he=e[18]^y,pe=e[19]^C,Ht=e[28]^y,ge=e[29]^C,de=e[38]^y,xt=e[39]^C,fe=e[48]^y,le=e[49]^C,nt=x,ce=B,me=M<<4|O>>>28,wr=O<<4|M>>>28,ve=T<<3|N>>>29,be=N<<3|T>>>29,_r=L<<9|D>>>23,we=D<<9|L>>>23,_e=F<<18|W>>>14,yr=W<<18|F>>>14,ye=te<<1|Z>>>31,Ee=Z<<1|te>>>31,Er=X<<12|z>>>20,Se=z<<12|X>>>20,Re=ne<<10|S>>>22,Sr=S<<10|ne>>>22,Me=u<<13|o>>>19,ke=o<<13|u>>>19,Rr=f<<2|p>>>30,Ce=p<<2|f>>>30,Ie=E<<30|v>>>2,Mr=v<<30|E>>>2,xe=k<<6|g>>>26,Ae=g<<6|k>>>26,kr=w<<11|c>>>21,Te=c<<11|w>>>21,Ne=U<<15|H>>>17,Cr=H<<15|U>>>17,Le=A<<29|V>>>3,Oe=V<<29|A>>>3,Ir=I<<28|$>>>4,Pe=$<<28|I>>>4,$e=G<<23|K>>>9,xr=K<<23|G>>>9,Be=b<<25|_>>>7,De=_<<25|b>>>7,Ut=P<<21|j>>>11,Wt=j<<21|P>>>11,Vt=J<<24|ue>>>8,zt=ue<<24|J>>>8,qt=Y<<27|at>>>5,Jt=at<<27|Y>>>5,Gt=he<<20|pe>>>12,Zt=pe<<20|he>>>12,Kt=ge<<7|Ht>>>25,Qt=Ht<<7|ge>>>25,Yt=de<<8|xt>>>24,Xt=xt<<8|de>>>24,er=fe<<14|le>>>18,tr=le<<14|fe>>>18;e[0]=nt^~Er&kr,e[1]=ce^~Se&Te,e[10]=Ir^~Gt&ve,e[11]=Pe^~Zt&be,e[20]=ye^~xe&Be,e[21]=Ee^~Ae&De,e[30]=qt^~me&Re,e[31]=Jt^~wr&Sr,e[40]=Ie^~$e&Kt,e[41]=Mr^~xr&Qt,e[2]=Er^~kr&Ut,e[3]=Se^~Te&Wt,e[12]=Gt^~ve&Me,e[13]=Zt^~be&ke,e[22]=xe^~Be&Yt,e[23]=Ae^~De&Xt,e[32]=me^~Re&Ne,e[33]=wr^~Sr&Cr,e[42]=$e^~Kt&_r,e[43]=xr^~Qt&we,e[4]=kr^~Ut&er,e[5]=Te^~Wt&tr,e[14]=ve^~Me&Le,e[15]=be^~ke&Oe,e[24]=Be^~Yt&_e,e[25]=De^~Xt&yr,e[34]=Re^~Ne&Vt,e[35]=Sr^~Cr&zt,e[44]=Kt^~_r&Rr,e[45]=Qt^~we&Ce,e[6]=Ut^~er&nt,e[7]=Wt^~tr&ce,e[16]=Me^~Le&Ir,e[17]=ke^~Oe&Pe,e[26]=Yt^~_e&ye,e[27]=Xt^~yr&Ee,e[36]=Ne^~Vt&qt,e[37]=Cr^~zt&Jt,e[46]=_r^~Rr&Ie,e[47]=we^~Ce&Mr,e[8]=er^~nt&Er,e[9]=tr^~ce&Se,e[18]=Le^~Ir&Gt,e[19]=Oe^~Pe&Zt,e[28]=_e^~ye&xe,e[29]=yr^~Ee&Ae,e[38]=Vt^~qt&me,e[39]=zt^~Jt&wr,e[48]=Rr^~Ie&$e,e[49]=Ce^~Mr&xr,e[0]^=ua[t*2],e[1]^=ua[t*2+1]}};const ti=Qc;function tn(){this.state=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],this.blockSize=null,this.count=0,this.squeezing=!1}tn.prototype.initialize=function(e,t){for(let r=0;r<50;++r)this.state[r]=0;this.blockSize=e/8,this.count=0,this.squeezing=!1};tn.prototype.absorb=function(e){for(let t=0;t>>8*(this.count%4)&255,this.count+=1,this.count===this.blockSize&&(ti.p1600(this.state),this.count=0);return t};tn.prototype.copy=function(e){for(let t=0;t<50;++t)e.state[t]=this.state[t];e.blockSize=this.blockSize,e.count=this.count,e.squeezing=this.squeezing};var Pf=tn,$f=Of(Pf);const Bf=$f,Df=ci;function Yc(e){return Buffer.allocUnsafe(e).fill(0)}function Xc(e,t,r){const n=Yc(t);return e=Pi(e),r?e.length"u")throw new Error("Not an array?");if(r=il(e),r!=="dynamic"&&r!==0&&t.length>r)throw new Error("Elements exceed array size: "+r);i=[],e=e.slice(0,e.lastIndexOf("[")),typeof t=="string"&&(t=JSON.parse(t));for(s in t)i.push(St(e,t[s]));if(r==="dynamic"){var a=St("uint256",t.length);i.unshift(a)}return Buffer.concat(i)}else{if(e==="bytes")return t=new Buffer(t),i=Buffer.concat([St("uint256",t.length),t]),t.length%32!==0&&(i=Buffer.concat([i,dr.zeros(32-t.length%32)])),i;if(e.startsWith("bytes")){if(r=Fr(e),r<1||r>32)throw new Error("Invalid bytes width: "+r);return dr.setLengthRight(t,32)}else if(e.startsWith("uint")){if(r=Fr(e),r%8||r<8||r>256)throw new Error("Invalid uint width: "+r);if(n=ar(t),n.bitLength()>r)throw new Error("Supplied uint exceeds width: "+r+" vs "+n.bitLength());if(n<0)throw new Error("Supplied uint is negative");return n.toArrayLike(Buffer,"be",32)}else if(e.startsWith("int")){if(r=Fr(e),r%8||r<8||r>256)throw new Error("Invalid int width: "+r);if(n=ar(t),n.bitLength()>r)throw new Error("Supplied int exceeds width: "+r+" vs "+n.bitLength());return n.toTwos(256).toArrayLike(Buffer,"be",32)}else if(e.startsWith("ufixed")){if(r=ha(e),n=ar(t),n<0)throw new Error("Supplied ufixed is negative");return St("uint256",n.mul(new lr(2).pow(new lr(r[1]))))}else if(e.startsWith("fixed"))return r=ha(e),St("int256",ar(t).mul(new lr(2).pow(new lr(r[1]))))}throw new Error("Unsupported or invalid type: "+e)}function Wf(e){return e==="string"||e==="bytes"||il(e)==="dynamic"}function Vf(e){return e.lastIndexOf("]")===e.length-1}function zf(e,t){var r=[],n=[],i=32*e.length;for(var s in e){var a=nl(e[s]),l=t[s],d=St(a,l);Wf(a)?(r.push(St("uint256",i)),n.push(d),i+=d.length):r.push(d)}return Buffer.concat(r.concat(n))}function sl(e,t){if(e.length!==t.length)throw new Error("Number of types are not matching the values");for(var r,n,i=[],s=0;s32)throw new Error("Invalid bytes width: "+r);i.push(dr.setLengthRight(l,r))}else if(a.startsWith("uint")){if(r=Fr(a),r%8||r<8||r>256)throw new Error("Invalid uint width: "+r);if(n=ar(l),n.bitLength()>r)throw new Error("Supplied uint exceeds width: "+r+" vs "+n.bitLength());i.push(n.toArrayLike(Buffer,"be",r/8))}else if(a.startsWith("int")){if(r=Fr(a),r%8||r<8||r>256)throw new Error("Invalid int width: "+r);if(n=ar(l),n.bitLength()>r)throw new Error("Supplied int exceeds width: "+r+" vs "+n.bitLength());i.push(n.toTwos(r).toArrayLike(Buffer,"be",r/8))}else throw new Error("Unsupported or invalid type: "+a)}return Buffer.concat(i)}function qf(e,t){return dr.keccak(sl(e,t))}var Jf={rawEncode:zf,solidityPack:sl,soliditySHA3:qf};const mt=rl,un=Jf,ol={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"]},Ss={encodeData(e,t,r,n=!0){const i=["bytes32"],s=[this.hashType(e,r)];if(n){const a=(l,d,h)=>{if(r[d]!==void 0)return["bytes32",h==null?"0x0000000000000000000000000000000000000000000000000000000000000000":mt.keccak(this.encodeData(d,h,r,n))];if(h===void 0)throw new Error(`missing value for field ${l} of type ${d}`);if(d==="bytes")return["bytes32",mt.keccak(h)];if(d==="string")return typeof h=="string"&&(h=Buffer.from(h,"utf8")),["bytes32",mt.keccak(h)];if(d.lastIndexOf("]")===d.length-1){const m=d.slice(0,d.lastIndexOf("[")),R=h.map(y=>a(l,m,y));return["bytes32",mt.keccak(un.rawEncode(R.map(([y])=>y),R.map(([,y])=>y)))]}return[d,h]};for(const l of r[e]){const[d,h]=a(l.name,l.type,t[l.name]);i.push(d),s.push(h)}}else for(const a of r[e]){let l=t[a.name];if(l!==void 0)if(a.type==="bytes")i.push("bytes32"),l=mt.keccak(l),s.push(l);else if(a.type==="string")i.push("bytes32"),typeof l=="string"&&(l=Buffer.from(l,"utf8")),l=mt.keccak(l),s.push(l);else if(r[a.type]!==void 0)i.push("bytes32"),l=mt.keccak(this.encodeData(a.type,l,r,n)),s.push(l);else{if(a.type.lastIndexOf("]")===a.type.length-1)throw new Error("Arrays currently unimplemented in encodeData");i.push(a.type),s.push(l)}}return un.rawEncode(i,s)},encodeType(e,t){let r="",n=this.findTypeDependencies(e,t).filter(i=>i!==e);n=[e].concat(n.sort());for(const i of n){if(!t[i])throw new Error("No type definition specified: "+i);r+=i+"("+t[i].map(({name:a,type:l})=>l+" "+a).join(",")+")"}return r},findTypeDependencies(e,t,r=[]){if(e=e.match(/^\w*/)[0],r.includes(e)||t[e]===void 0)return r;r.push(e);for(const n of t[e])for(const i of this.findTypeDependencies(n.type,t,r))!r.includes(i)&&r.push(i);return r},hashStruct(e,t,r,n=!0){return mt.keccak(this.encodeData(e,t,r,n))},hashType(e,t){return mt.keccak(this.encodeType(e,t))},sanitizeData(e){const t={};for(const r in ol.properties)e[r]&&(t[r]=e[r]);return t.types&&(t.types=Object.assign({EIP712Domain:[]},t.types)),t},hash(e,t=!0){const r=this.sanitizeData(e),n=[Buffer.from("1901","hex")];return n.push(this.hashStruct("EIP712Domain",r.domain,r.types,t)),r.primaryType!=="EIP712Domain"&&n.push(this.hashStruct(r.primaryType,r.message,r.types,t)),mt.keccak(Buffer.concat(n))}};var Gf={TYPED_MESSAGE_SCHEMA:ol,TypedDataUtils:Ss,hashForSignTypedDataLegacy:function(e){return Zf(e.data)},hashForSignTypedData_v3:function(e){return Ss.hash(e.data,!1)},hashForSignTypedData_v4:function(e){return Ss.hash(e.data)}};function Zf(e){const t=new Error("Expect argument to be non-empty array");if(typeof e!="object"||!e.length)throw t;const r=e.map(function(s){return s.type==="bytes"?mt.toBuffer(s.value):s.value}),n=e.map(function(s){return s.type}),i=e.map(function(s){if(!s.name)throw t;return s.type+" "+s.name});return un.soliditySHA3(["bytes32","bytes32"],[un.soliditySHA3(new Array(e.length).fill("string"),i),un.soliditySHA3(n,r)])}var qr={};Object.defineProperty(qr,"__esModule",{value:!0});qr.filterFromParam=qr.FilterPolyfill=void 0;const $r=Ve,Ye=q,Kf=5*60*1e3,cr={jsonrpc:"2.0",id:0};class Qf{constructor(t){this.logFilters=new Map,this.blockFilters=new Set,this.pendingTransactionFilters=new Set,this.cursors=new Map,this.timeouts=new Map,this.nextFilterId=(0,$r.IntNumber)(1),this.REQUEST_THROTTLE_INTERVAL=1e3,this.lastFetchTimestamp=new Date(0),this.resolvers=[],this.provider=t}async newFilter(t){const r=al(t),n=this.makeFilterId(),i=await this.setInitialCursorPosition(n,r.fromBlock);return console.info(`Installing new log filter(${n}):`,r,"initial cursor position:",i),this.logFilters.set(n,r),this.setFilterTimeout(n),(0,Ye.hexStringFromIntNumber)(n)}async newBlockFilter(){const t=this.makeFilterId(),r=await this.setInitialCursorPosition(t,"latest");return console.info(`Installing new block filter (${t}) with initial cursor position:`,r),this.blockFilters.add(t),this.setFilterTimeout(t),(0,Ye.hexStringFromIntNumber)(t)}async newPendingTransactionFilter(){const t=this.makeFilterId(),r=await this.setInitialCursorPosition(t,"latest");return console.info(`Installing new block filter (${t}) with initial cursor position:`,r),this.pendingTransactionFilters.add(t),this.setFilterTimeout(t),(0,Ye.hexStringFromIntNumber)(t)}uninstallFilter(t){const r=(0,Ye.intNumberFromHexString)(t);return console.info(`Uninstalling filter (${r})`),this.deleteFilter(r),!0}getFilterChanges(t){const r=(0,Ye.intNumberFromHexString)(t);return this.timeouts.has(r)&&this.setFilterTimeout(r),this.logFilters.has(r)?this.getLogFilterChanges(r):this.blockFilters.has(r)?this.getBlockFilterChanges(r):this.pendingTransactionFilters.has(r)?this.getPendingTransactionFilterChanges(r):Promise.resolve(Vn())}async getFilterLogs(t){const r=(0,Ye.intNumberFromHexString)(t),n=this.logFilters.get(r);return n?this.sendAsyncPromise(Object.assign(Object.assign({},cr),{method:"eth_getLogs",params:[da(n)]})):Vn()}makeFilterId(){return(0,$r.IntNumber)(++this.nextFilterId)}sendAsyncPromise(t){return new Promise((r,n)=>{this.provider.sendAsync(t,(i,s)=>{if(i)return n(i);if(Array.isArray(s)||s==null)return n(new Error(`unexpected response received: ${JSON.stringify(s)}`));r(s)})})}deleteFilter(t){console.info(`Deleting filter (${t})`),this.logFilters.delete(t),this.blockFilters.delete(t),this.pendingTransactionFilters.delete(t),this.cursors.delete(t),this.timeouts.delete(t)}async getLogFilterChanges(t){const r=this.logFilters.get(t),n=this.cursors.get(t);if(!n||!r)return Vn();const i=await this.getCurrentBlockHeight(),s=r.toBlock==="latest"?i:r.toBlock;if(n>i||n>Number(r.toBlock))return zn();console.info(`Fetching logs from ${n} to ${s} for filter ${t}`);const a=await this.sendAsyncPromise(Object.assign(Object.assign({},cr),{method:"eth_getLogs",params:[da(Object.assign(Object.assign({},r),{fromBlock:n,toBlock:s}))]}));if(Array.isArray(a.result)){const l=a.result.map(h=>(0,Ye.intNumberFromHexString)(h.blockNumber||"0x0")),d=Math.max(...l);if(d&&d>n){const h=(0,$r.IntNumber)(d+1);console.info(`Moving cursor position for filter (${t}) from ${n} to ${h}`),this.cursors.set(t,h)}}return a}async getBlockFilterChanges(t){const r=this.cursors.get(t);if(!r)return Vn();const n=await this.getCurrentBlockHeight();if(r>n)return zn();console.info(`Fetching blocks from ${r} to ${n} for filter (${t})`);const i=(await Promise.all((0,Ye.range)(r,n+1).map(a=>this.getBlockHashByNumber((0,$r.IntNumber)(a))))).filter(a=>!!a),s=(0,$r.IntNumber)(r+i.length);return console.info(`Moving cursor position for filter (${t}) from ${r} to ${s}`),this.cursors.set(t,s),Object.assign(Object.assign({},cr),{result:i})}async getPendingTransactionFilterChanges(t){return Promise.resolve(zn())}async setInitialCursorPosition(t,r){const n=await this.getCurrentBlockHeight(),i=typeof r=="number"&&r>n?r:n;return this.cursors.set(t,i),i}setFilterTimeout(t){const r=this.timeouts.get(t);r&&window.clearTimeout(r);const n=window.setTimeout(()=>{console.info(`Filter (${t}) timed out`),this.deleteFilter(t)},Kf);this.timeouts.set(t,n)}async getCurrentBlockHeight(){const t=new Date;if(t.getTime()-this.lastFetchTimestamp.getTime()>this.REQUEST_THROTTLE_INTERVAL){this.lastFetchTimestamp=t;const r=await this._getCurrentBlockHeight();this.currentBlockHeight=r,this.resolvers.forEach(n=>n(r)),this.resolvers=[]}return this.currentBlockHeight?this.currentBlockHeight:new Promise(r=>this.resolvers.push(r))}async _getCurrentBlockHeight(){const{result:t}=await this.sendAsyncPromise(Object.assign(Object.assign({},cr),{method:"eth_blockNumber",params:[]}));return(0,Ye.intNumberFromHexString)((0,Ye.ensureHexString)(t))}async getBlockHashByNumber(t){const r=await this.sendAsyncPromise(Object.assign(Object.assign({},cr),{method:"eth_getBlockByNumber",params:[(0,Ye.hexStringFromIntNumber)(t),!1]}));return r.result&&typeof r.result.hash=="string"?(0,Ye.ensureHexString)(r.result.hash):null}}qr.FilterPolyfill=Qf;function al(e){return{fromBlock:fa(e.fromBlock),toBlock:fa(e.toBlock),addresses:e.address===void 0?null:Array.isArray(e.address)?e.address:[e.address],topics:e.topics||[]}}qr.filterFromParam=al;function da(e){const t={fromBlock:pa(e.fromBlock),toBlock:pa(e.toBlock),topics:e.topics};return e.addresses!==null&&(t.address=e.addresses),t}function fa(e){if(e===void 0||e==="latest"||e==="pending")return"latest";if(e==="earliest")return(0,$r.IntNumber)(0);if((0,Ye.isHexString)(e))return(0,Ye.intNumberFromHexString)(e);throw new Error(`Invalid block option: ${String(e)}`)}function pa(e){return e==="latest"?e:(0,Ye.hexStringFromIntNumber)(e)}function Vn(){return Object.assign(Object.assign({},cr),{error:{code:-32e3,message:"filter not found"}})}function zn(){return Object.assign(Object.assign({},cr),{result:[]})}var $i={},cl={},Bi={},ro=Yf;function Yf(e){e=e||{};var t=e.max||Number.MAX_SAFE_INTEGER,r=typeof e.start<"u"?e.start:Math.floor(Math.random()*t);return function(){return r=r%t,r++}}const ga=(e,t)=>function(){const r=t.promiseModule,n=new Array(arguments.length);for(let i=0;i{t.errorFirst?n.push(function(a,l){if(t.multiArgs){const d=new Array(arguments.length-1);for(let h=1;h{t=Object.assign({exclude:[/.+(Sync|Stream)$/],errorFirst:!0,promiseModule:Promise},t);const r=i=>{const s=a=>typeof a=="string"?i===a:a.test(i);return t.include?t.include.some(s):!t.exclude.some(s)};let n;typeof e=="function"?n=function(){return t.excludeMain?e.apply(this,arguments):ga(e,t).apply(this,arguments)}:n=Object.create(Object.getPrototypeOf(e));for(const i in e){const s=e[i];n[i]=typeof s=="function"&&r(i)?ga(s,t):s}return n},xn={},An={};Object.defineProperty(An,"__esModule",{value:!0});const e0=si;function ma(e,t,r){try{Reflect.apply(e,t,r)}catch(n){setTimeout(()=>{throw n})}}function t0(e){const t=e.length,r=new Array(t);for(let n=0;n0&&([a]=r),a instanceof Error)throw a;const l=new Error(`Unhandled error.${a?` (${a.message})`:""}`);throw l.context=a,l}const s=i[t];if(s===void 0)return!1;if(typeof s=="function")ma(s,this,r);else{const a=s.length,l=t0(s);for(let d=0;de+t,va=["sync","latest"];class a0 extends i0.default{constructor(t){super(),this._blockResetDuration=t.blockResetDuration||20*s0,this._usePastBlocks=t.usePastBlocks||!1,this._currentBlock=null,this._isRunning=!1,this._onNewListener=this._onNewListener.bind(this),this._onRemoveListener=this._onRemoveListener.bind(this),this._resetCurrentBlock=this._resetCurrentBlock.bind(this),this._setupInternalEvents()}async destroy(){this._cancelBlockResetTimeout(),await this._maybeEnd(),super.removeAllListeners()}isRunning(){return this._isRunning}getCurrentBlock(){return this._currentBlock}async getLatestBlock(){return this._currentBlock?this._currentBlock:await new Promise(r=>this.once("latest",r))}removeAllListeners(t){return t?super.removeAllListeners(t):super.removeAllListeners(),this._setupInternalEvents(),this._onRemoveListener(),this}_setupInternalEvents(){this.removeListener("newListener",this._onNewListener),this.removeListener("removeListener",this._onRemoveListener),this.on("newListener",this._onNewListener),this.on("removeListener",this._onRemoveListener)}_onNewListener(t){va.includes(t)&&this._maybeStart()}_onRemoveListener(){this._getBlockTrackerEventCount()>0||this._maybeEnd()}async _maybeStart(){this._isRunning||(this._isRunning=!0,this._cancelBlockResetTimeout(),await this._start(),this.emit("_started"))}async _maybeEnd(){this._isRunning&&(this._isRunning=!1,this._setupBlockResetTimeout(),await this._end(),this.emit("_ended"))}_getBlockTrackerEventCount(){return va.map(t=>this.listenerCount(t)).reduce(o0)}_shouldUseNewBlock(t){const r=this._currentBlock;if(!r)return!0;const n=ba(t),i=ba(r);return this._usePastBlocks&&ni}_newPotentialLatest(t){this._shouldUseNewBlock(t)&&this._setCurrentBlock(t)}_setCurrentBlock(t){const r=this._currentBlock;this._currentBlock=t,this.emit("latest",t),this.emit("sync",{oldBlock:r,newBlock:t})}_setupBlockResetTimeout(){this._cancelBlockResetTimeout(),this._blockResetTimeout=setTimeout(this._resetCurrentBlock,this._blockResetDuration),this._blockResetTimeout.unref&&this._blockResetTimeout.unref()}_cancelBlockResetTimeout(){this._blockResetTimeout&&clearTimeout(this._blockResetTimeout)}_resetCurrentBlock(){this._currentBlock=null}}xn.BaseBlockTracker=a0;function ba(e){return Number.parseInt(e,16)}var ll={},ul={},Ke={};class hl extends TypeError{constructor(t,r){let n;const{message:i,explanation:s,...a}=t,{path:l}=t,d=l.length===0?i:`At path: ${l.join(".")} -- ${i}`;super(s??d),s!=null&&(this.cause=d),Object.assign(this,a),this.name=this.constructor.name,this.failures=()=>n??(n=[t,...r()])}}function c0(e){return ft(e)&&typeof e[Symbol.iterator]=="function"}function ft(e){return typeof e=="object"&&e!=null}function wa(e){if(Object.prototype.toString.call(e)!=="[object Object]")return!1;const t=Object.getPrototypeOf(e);return t===null||t===Object.prototype}function ze(e){return typeof e=="symbol"?e.toString():typeof e=="string"?JSON.stringify(e):`${e}`}function l0(e){const{done:t,value:r}=e.next();return t?void 0:r}function u0(e,t,r,n){if(e===!0)return;e===!1?e={}:typeof e=="string"&&(e={message:e});const{path:i,branch:s}=t,{type:a}=r,{refinement:l,message:d=`Expected a value of type \`${a}\`${l?` with refinement \`${l}\``:""}, but received: \`${ze(n)}\``}=e;return{value:n,type:a,refinement:l,key:i[i.length-1],path:i,branch:s,...e,message:d}}function*Ds(e,t,r,n){c0(e)||(e=[e]);for(const i of e){const s=u0(i,t,r,n);s&&(yield s)}}function*no(e,t,r={}){const{path:n=[],branch:i=[e],coerce:s=!1,mask:a=!1}=r,l={path:n,branch:i};if(s&&(e=t.coercer(e,l),a&&t.type!=="type"&&ft(t.schema)&&ft(e)&&!Array.isArray(e)))for(const h in e)t.schema[h]===void 0&&delete e[h];let d="valid";for(const h of t.validator(e,l))h.explanation=r.message,d="not_valid",yield[h,void 0];for(let[h,m,R]of t.entries(e,l)){const y=no(m,R,{path:h===void 0?n:[...n,h],branch:h===void 0?i:[...i,m],coerce:s,mask:a,message:r.message});for(const C of y)C[0]?(d=C[0].refinement!=null?"not_refined":"not_valid",yield[C[0],void 0]):s&&(m=C[1],h===void 0?e=m:e instanceof Map?e.set(h,m):e instanceof Set?e.add(m):ft(e)&&(m!==void 0||h in e)&&(e[h]=m))}if(d!=="not_valid")for(const h of t.refiner(e,l))h.explanation=r.message,d="not_refined",yield[h,void 0];d==="valid"&&(yield[void 0,e])}class Ue{constructor(t){const{type:r,schema:n,validator:i,refiner:s,coercer:a=d=>d,entries:l=function*(){}}=t;this.type=r,this.schema=n,this.entries=l,this.coercer=a,i?this.validator=(d,h)=>{const m=i(d,h);return Ds(m,h,this,d)}:this.validator=()=>[],s?this.refiner=(d,h)=>{const m=s(d,h);return Ds(m,h,this,d)}:this.refiner=()=>[]}assert(t,r){return dl(t,this,r)}create(t,r){return fl(t,this,r)}is(t){return io(t,this)}mask(t,r){return pl(t,this,r)}validate(t,r={}){return rn(t,this,r)}}function dl(e,t,r){const n=rn(e,t,{message:r});if(n[0])throw n[0]}function fl(e,t,r){const n=rn(e,t,{coerce:!0,message:r});if(n[0])throw n[0];return n[1]}function pl(e,t,r){const n=rn(e,t,{coerce:!0,mask:!0,message:r});if(n[0])throw n[0];return n[1]}function io(e,t){return!rn(e,t)[0]}function rn(e,t,r={}){const n=no(e,t,r),i=l0(n);return i[0]?[new hl(i[0],function*(){for(const a of n)a[0]&&(yield a[0])}),void 0]:[void 0,i[1]]}function h0(...e){const t=e[0].type==="type",r=e.map(i=>i.schema),n=Object.assign({},...r);return t?Nn(n):Tn(n)}function rt(e,t){return new Ue({type:e,schema:null,validator:t})}function d0(e,t){return new Ue({...e,refiner:(r,n)=>r===void 0||e.refiner(r,n),validator(r,n){return r===void 0?!0:(t(r,n),e.validator(r,n))}})}function f0(e){return new Ue({type:"dynamic",schema:null,*entries(t,r){yield*e(t,r).entries(t,r)},validator(t,r){return e(t,r).validator(t,r)},coercer(t,r){return e(t,r).coercer(t,r)},refiner(t,r){return e(t,r).refiner(t,r)}})}function p0(e){let t;return new Ue({type:"lazy",schema:null,*entries(r,n){t??(t=e()),yield*t.entries(r,n)},validator(r,n){return t??(t=e()),t.validator(r,n)},coercer(r,n){return t??(t=e()),t.coercer(r,n)},refiner(r,n){return t??(t=e()),t.refiner(r,n)}})}function g0(e,t){const{schema:r}=e,n={...r};for(const i of t)delete n[i];switch(e.type){case"type":return Nn(n);default:return Tn(n)}}function m0(e){const t=e instanceof Ue,r=t?{...e.schema}:{...e};for(const n in r)r[n]=gl(r[n]);return t&&e.type==="type"?Nn(r):Tn(r)}function v0(e,t){const{schema:r}=e,n={};for(const i of t)n[i]=r[i];switch(e.type){case"type":return Nn(n);default:return Tn(n)}}function b0(e,t){return console.warn("superstruct@0.11 - The `struct` helper has been renamed to `define`."),rt(e,t)}function w0(){return rt("any",()=>!0)}function _0(e){return new Ue({type:"array",schema:e,*entries(t){if(e&&Array.isArray(t))for(const[r,n]of t.entries())yield[r,n,e]},coercer(t){return Array.isArray(t)?t.slice():t},validator(t){return Array.isArray(t)||`Expected an array value, but received: ${ze(t)}`}})}function y0(){return rt("bigint",e=>typeof e=="bigint")}function E0(){return rt("boolean",e=>typeof e=="boolean")}function S0(){return rt("date",e=>e instanceof Date&&!isNaN(e.getTime())||`Expected a valid \`Date\` object, but received: ${ze(e)}`)}function R0(e){const t={},r=e.map(n=>ze(n)).join();for(const n of e)t[n]=n;return new Ue({type:"enums",schema:t,validator(n){return e.includes(n)||`Expected one of \`${r}\`, but received: ${ze(n)}`}})}function M0(){return rt("func",e=>typeof e=="function"||`Expected a function, but received: ${ze(e)}`)}function k0(e){return rt("instance",t=>t instanceof e||`Expected a \`${e.name}\` instance, but received: ${ze(t)}`)}function C0(){return rt("integer",e=>typeof e=="number"&&!isNaN(e)&&Number.isInteger(e)||`Expected an integer, but received: ${ze(e)}`)}function I0(e){return new Ue({type:"intersection",schema:null,*entries(t,r){for(const n of e)yield*n.entries(t,r)},*validator(t,r){for(const n of e)yield*n.validator(t,r)},*refiner(t,r){for(const n of e)yield*n.refiner(t,r)}})}function x0(e){const t=ze(e),r=typeof e;return new Ue({type:"literal",schema:r==="string"||r==="number"||r==="boolean"?e:null,validator(n){return n===e||`Expected the literal \`${t}\`, but received: ${ze(n)}`}})}function A0(e,t){return new Ue({type:"map",schema:null,*entries(r){if(e&&t&&r instanceof Map)for(const[n,i]of r.entries())yield[n,n,e],yield[n,i,t]},coercer(r){return r instanceof Map?new Map(r):r},validator(r){return r instanceof Map||`Expected a \`Map\` object, but received: ${ze(r)}`}})}function so(){return rt("never",()=>!1)}function T0(e){return new Ue({...e,validator:(t,r)=>t===null||e.validator(t,r),refiner:(t,r)=>t===null||e.refiner(t,r)})}function N0(){return rt("number",e=>typeof e=="number"&&!isNaN(e)||`Expected a number, but received: ${ze(e)}`)}function Tn(e){const t=e?Object.keys(e):[],r=so();return new Ue({type:"object",schema:e||null,*entries(n){if(e&&ft(n)){const i=new Set(Object.keys(n));for(const s of t)i.delete(s),yield[s,n[s],e[s]];for(const s of i)yield[s,n[s],r]}},validator(n){return ft(n)||`Expected an object, but received: ${ze(n)}`},coercer(n){return ft(n)?{...n}:n}})}function gl(e){return new Ue({...e,validator:(t,r)=>t===void 0||e.validator(t,r),refiner:(t,r)=>t===void 0||e.refiner(t,r)})}function L0(e,t){return new Ue({type:"record",schema:null,*entries(r){if(ft(r))for(const n in r){const i=r[n];yield[n,n,e],yield[n,i,t]}},validator(r){return ft(r)||`Expected an object, but received: ${ze(r)}`}})}function O0(){return rt("regexp",e=>e instanceof RegExp)}function P0(e){return new Ue({type:"set",schema:null,*entries(t){if(e&&t instanceof Set)for(const r of t)yield[r,r,e]},coercer(t){return t instanceof Set?new Set(t):t},validator(t){return t instanceof Set||`Expected a \`Set\` object, but received: ${ze(t)}`}})}function ml(){return rt("string",e=>typeof e=="string"||`Expected a string, but received: ${ze(e)}`)}function $0(e){const t=so();return new Ue({type:"tuple",schema:null,*entries(r){if(Array.isArray(r)){const n=Math.max(e.length,r.length);for(let i=0;ir.type).join(" | ");return new Ue({type:"union",schema:null,coercer(r){for(const n of e){const[i,s]=n.validate(r,{coerce:!0});if(!i)return s}return r},validator(r,n){const i=[];for(const s of e){const[...a]=no(r,s,n),[l]=a;if(l[0])for(const[d]of a)d&&i.push(d);else return[]}return[`Expected the value to satisfy a union of \`${t}\`, but received: ${ze(r)}`,...i]}})}function vl(){return rt("unknown",()=>!0)}function oo(e,t,r){return new Ue({...e,coercer:(n,i)=>io(n,t)?e.coercer(r(n,i),i):e.coercer(n,i)})}function D0(e,t,r={}){return oo(e,vl(),n=>{const i=typeof t=="function"?t():t;if(n===void 0)return i;if(!r.strict&&wa(n)&&wa(i)){const s={...n};let a=!1;for(const l in i)s[l]===void 0&&(s[l]=i[l],a=!0);if(a)return s}return n})}function F0(e){return oo(e,ml(),t=>t.trim())}function j0(e){return vr(e,"empty",t=>{const r=bl(t);return r===0||`Expected an empty ${e.type} but received one with a size of \`${r}\``})}function bl(e){return e instanceof Map||e instanceof Set?e.size:e.length}function H0(e,t,r={}){const{exclusive:n}=r;return vr(e,"max",i=>n?in?i>t:i>=t||`Expected a ${e.type} greater than ${n?"":"or equal to "}${t} but received \`${i}\``)}function W0(e){return vr(e,"nonempty",t=>bl(t)>0||`Expected a nonempty ${e.type} but received an empty one`)}function V0(e,t){return vr(e,"pattern",r=>t.test(r)||`Expected a ${e.type} matching \`/${t.source}/\` but received "${r}"`)}function z0(e,t,r=t){const n=`Expected a ${e.type}`,i=t===r?`of \`${t}\``:`between \`${t}\` and \`${r}\``;return vr(e,"size",s=>{if(typeof s=="number"||s instanceof Date)return t<=s&&s<=r||`${n} ${i} but received \`${s}\``;if(s instanceof Map||s instanceof Set){const{size:a}=s;return t<=a&&a<=r||`${n} with a size ${i} but received one with a size of \`${a}\``}else{const{length:a}=s;return t<=a&&a<=r||`${n} with a length ${i} but received one with a length of \`${a}\``}})}function vr(e,t,r){return new Ue({...e,*refiner(n,i){yield*e.refiner(n,i);const s=r(n,i),a=Ds(s,i,e,n);for(const l of a)yield{...l,refinement:t}}})}const q0=Object.freeze(Object.defineProperty({__proto__:null,Struct:Ue,StructError:hl,any:w0,array:_0,assert:dl,assign:h0,bigint:y0,boolean:E0,coerce:oo,create:fl,date:S0,defaulted:D0,define:rt,deprecated:d0,dynamic:f0,empty:j0,enums:R0,func:M0,instance:k0,integer:C0,intersection:I0,is:io,lazy:p0,literal:x0,map:A0,mask:pl,max:H0,min:U0,never:so,nonempty:W0,nullable:T0,number:N0,object:Tn,omit:g0,optional:gl,partial:m0,pattern:V0,pick:v0,record:L0,refine:vr,regexp:O0,set:P0,size:z0,string:ml,struct:b0,trimmed:F0,tuple:$0,type:Nn,union:B0,unknown:vl,validate:rn},Symbol.toStringTag,{value:"Module"})),br=Zr(q0);Object.defineProperty(Ke,"__esModule",{value:!0});Ke.assertExhaustive=Ke.assertStruct=Ke.assert=Ke.AssertionError=void 0;const J0=br;function G0(e){return typeof e=="object"&&e!==null&&"message"in e}function Z0(e){var t,r;return typeof((r=(t=e==null?void 0:e.prototype)===null||t===void 0?void 0:t.constructor)===null||r===void 0?void 0:r.name)=="string"}function K0(e){const t=G0(e)?e.message:String(e);return t.endsWith(".")?t.slice(0,-1):t}function wl(e,t){return Z0(e)?new e({message:t}):e({message:t})}class ao extends Error{constructor(t){super(t.message),this.code="ERR_ASSERTION"}}Ke.AssertionError=ao;function Q0(e,t="Assertion failed.",r=ao){if(!e)throw t instanceof Error?t:wl(r,t)}Ke.assert=Q0;function Y0(e,t,r="Assertion failed",n=ao){try{(0,J0.assert)(e,t)}catch(i){throw wl(n,`${r}: ${K0(i)}.`)}}Ke.assertStruct=Y0;function X0(e){throw new Error("Invalid branch reached. Should be detected during compilation.")}Ke.assertExhaustive=X0;var Ln={};Object.defineProperty(Ln,"__esModule",{value:!0});Ln.base64=void 0;const e1=br,t1=Ke,r1=(e,t={})=>{var r,n;const i=(r=t.paddingRequired)!==null&&r!==void 0?r:!1,s=(n=t.characterSet)!==null&&n!==void 0?n:"base64";let a;s==="base64"?a=String.raw`[A-Za-z0-9+\/]`:((0,t1.assert)(s==="base64url"),a=String.raw`[-_A-Za-z0-9]`);let l;return i?l=new RegExp(`^(?:${a}{4})*(?:${a}{3}=|${a}{2}==)?$`,"u"):l=new RegExp(`^(?:${a}{4})*(?:${a}{2,3}|${a}{3}=|${a}{2}==)?$`,"u"),(0,e1.pattern)(e,l)};Ln.base64=r1;var ae={},On={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.remove0x=e.add0x=e.assertIsStrictHexString=e.assertIsHexString=e.isStrictHexString=e.isHexString=e.StrictHexStruct=e.HexStruct=void 0;const t=br,r=Ke;e.HexStruct=(0,t.pattern)((0,t.string)(),/^(?:0x)?[0-9a-f]+$/iu),e.StrictHexStruct=(0,t.pattern)((0,t.string)(),/^0x[0-9a-f]+$/iu);function n(h){return(0,t.is)(h,e.HexStruct)}e.isHexString=n;function i(h){return(0,t.is)(h,e.StrictHexStruct)}e.isStrictHexString=i;function s(h){(0,r.assert)(n(h),"Value must be a hexadecimal string.")}e.assertIsHexString=s;function a(h){(0,r.assert)(i(h),'Value must be a hexadecimal string, starting with "0x".')}e.assertIsStrictHexString=a;function l(h){return h.startsWith("0x")?h:h.startsWith("0X")?`0x${h.substring(2)}`:`0x${h}`}e.add0x=l;function d(h){return h.startsWith("0x")||h.startsWith("0X")?h.substring(2):h}e.remove0x=d})(On);Object.defineProperty(ae,"__esModule",{value:!0});ae.createDataView=ae.concatBytes=ae.valueToBytes=ae.stringToBytes=ae.numberToBytes=ae.signedBigIntToBytes=ae.bigIntToBytes=ae.hexToBytes=ae.bytesToString=ae.bytesToNumber=ae.bytesToSignedBigInt=ae.bytesToBigInt=ae.bytesToHex=ae.assertIsBytes=ae.isBytes=void 0;const ot=Ke,Fs=On,_a=48,ya=58,Ea=87;function n1(){const e=[];return()=>{if(e.length===0)for(let t=0;t<256;t++)e.push(t.toString(16).padStart(2,"0"));return e}}const i1=n1();function co(e){return e instanceof Uint8Array}ae.isBytes=co;function nn(e){(0,ot.assert)(co(e),"Value must be a Uint8Array.")}ae.assertIsBytes=nn;function _l(e){if(nn(e),e.length===0)return"0x";const t=i1(),r=new Array(e.length);for(let n=0;n=BigInt(0),"Value must be a non-negative bigint.");const t=e.toString(16);return Di(t)}ae.bigIntToBytes=El;function c1(e,t){(0,ot.assert)(t>0);const r=e>>BigInt(31);return!((~e&r)+(e&~r)>>BigInt(t*8+-1))}function l1(e,t){(0,ot.assert)(typeof e=="bigint","Value must be a bigint."),(0,ot.assert)(typeof t=="number","Byte length must be a number."),(0,ot.assert)(t>0,"Byte length must be greater than 0."),(0,ot.assert)(c1(e,t),"Byte length is too small to represent the given value.");let r=e;const n=new Uint8Array(t);for(let i=0;i>=BigInt(8);return n.reverse()}ae.signedBigIntToBytes=l1;function Sl(e){(0,ot.assert)(typeof e=="number","Value must be a number."),(0,ot.assert)(e>=0,"Value must be a non-negative number."),(0,ot.assert)(Number.isSafeInteger(e),"Value is not a safe integer. Use `bigIntToBytes` instead.");const t=e.toString(16);return Di(t)}ae.numberToBytes=Sl;function Rl(e){return(0,ot.assert)(typeof e=="string","Value must be a string."),new TextEncoder().encode(e)}ae.stringToBytes=Rl;function Ml(e){if(typeof e=="bigint")return El(e);if(typeof e=="number")return Sl(e);if(typeof e=="string")return e.startsWith("0x")?Di(e):Rl(e);if(co(e))return e;throw new TypeError(`Unsupported value type: "${typeof e}".`)}ae.valueToBytes=Ml;function u1(e){const t=new Array(e.length);let r=0;for(let i=0;it.call(r,n,i,this))}get(t){return Xe(this,gt,"f").get(t)}has(t){return Xe(this,gt,"f").has(t)}keys(){return Xe(this,gt,"f").keys()}values(){return Xe(this,gt,"f").values()}toString(){return`FrozenMap(${this.size}) {${this.size>0?` ${[...this.entries()].map(([t,r])=>`${String(t)} => ${String(r)}`).join(", ")} `:""}}`}}Jr.FrozenMap=lo;class uo{constructor(t){yt.set(this,void 0),Il(this,yt,new Set(t),"f"),Object.freeze(this)}get size(){return Xe(this,yt,"f").size}[(yt=new WeakMap,Symbol.iterator)](){return Xe(this,yt,"f")[Symbol.iterator]()}entries(){return Xe(this,yt,"f").entries()}forEach(t,r){return Xe(this,yt,"f").forEach((n,i,s)=>t.call(r,n,i,this))}has(t){return Xe(this,yt,"f").has(t)}keys(){return Xe(this,yt,"f").keys()}values(){return Xe(this,yt,"f").values()}toString(){return`FrozenSet(${this.size}) {${this.size>0?` ${[...this.values()].map(t=>String(t)).join(", ")} `:""}}`}}Jr.FrozenSet=uo;Object.freeze(lo);Object.freeze(lo.prototype);Object.freeze(uo);Object.freeze(uo.prototype);var xl={};Object.defineProperty(xl,"__esModule",{value:!0});var Al={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.getJsonRpcIdValidator=e.assertIsJsonRpcError=e.isJsonRpcError=e.assertIsJsonRpcFailure=e.isJsonRpcFailure=e.assertIsJsonRpcSuccess=e.isJsonRpcSuccess=e.assertIsJsonRpcResponse=e.isJsonRpcResponse=e.assertIsPendingJsonRpcResponse=e.isPendingJsonRpcResponse=e.JsonRpcResponseStruct=e.JsonRpcFailureStruct=e.JsonRpcSuccessStruct=e.PendingJsonRpcResponseStruct=e.assertIsJsonRpcRequest=e.isJsonRpcRequest=e.assertIsJsonRpcNotification=e.isJsonRpcNotification=e.JsonRpcNotificationStruct=e.JsonRpcRequestStruct=e.JsonRpcParamsStruct=e.JsonRpcErrorStruct=e.JsonRpcIdStruct=e.JsonRpcVersionStruct=e.jsonrpc2=e.getJsonSize=e.isValidJson=e.JsonStruct=e.UnsafeJsonStruct=void 0;const t=br,r=Ke,n=()=>(0,t.define)("finite number",L=>(0,t.is)(L,(0,t.number)())&&Number.isFinite(L));e.UnsafeJsonStruct=(0,t.union)([(0,t.literal)(null),(0,t.boolean)(),n(),(0,t.string)(),(0,t.array)((0,t.lazy)(()=>e.UnsafeJsonStruct)),(0,t.record)((0,t.string)(),(0,t.lazy)(()=>e.UnsafeJsonStruct))]),e.JsonStruct=(0,t.define)("Json",(L,F)=>{function W(te,Z){const X=[...Z.validator(te,F)];return X.length>0?X:!0}try{const te=W(L,e.UnsafeJsonStruct);return te!==!0?te:W(JSON.parse(JSON.stringify(L)),e.UnsafeJsonStruct)}catch(te){return te instanceof RangeError?"Circular reference detected":!1}});function i(L){return(0,t.is)(L,e.JsonStruct)}e.isValidJson=i;function s(L){(0,r.assertStruct)(L,e.JsonStruct,"Invalid JSON value");const F=JSON.stringify(L);return new TextEncoder().encode(F).byteLength}e.getJsonSize=s,e.jsonrpc2="2.0",e.JsonRpcVersionStruct=(0,t.literal)(e.jsonrpc2),e.JsonRpcIdStruct=(0,t.nullable)((0,t.union)([(0,t.number)(),(0,t.string)()])),e.JsonRpcErrorStruct=(0,t.object)({code:(0,t.integer)(),message:(0,t.string)(),data:(0,t.optional)(e.JsonStruct),stack:(0,t.optional)((0,t.string)())}),e.JsonRpcParamsStruct=(0,t.optional)((0,t.union)([(0,t.record)((0,t.string)(),e.JsonStruct),(0,t.array)(e.JsonStruct)])),e.JsonRpcRequestStruct=(0,t.object)({id:e.JsonRpcIdStruct,jsonrpc:e.JsonRpcVersionStruct,method:(0,t.string)(),params:e.JsonRpcParamsStruct}),e.JsonRpcNotificationStruct=(0,t.omit)(e.JsonRpcRequestStruct,["id"]);function a(L){return(0,t.is)(L,e.JsonRpcNotificationStruct)}e.isJsonRpcNotification=a;function l(L,F){(0,r.assertStruct)(L,e.JsonRpcNotificationStruct,"Invalid JSON-RPC notification",F)}e.assertIsJsonRpcNotification=l;function d(L){return(0,t.is)(L,e.JsonRpcRequestStruct)}e.isJsonRpcRequest=d;function h(L,F){(0,r.assertStruct)(L,e.JsonRpcRequestStruct,"Invalid JSON-RPC request",F)}e.assertIsJsonRpcRequest=h,e.PendingJsonRpcResponseStruct=(0,t.object)({id:e.JsonRpcIdStruct,jsonrpc:e.JsonRpcVersionStruct,result:(0,t.optional)((0,t.unknown)()),error:(0,t.optional)(e.JsonRpcErrorStruct)}),e.JsonRpcSuccessStruct=(0,t.object)({id:e.JsonRpcIdStruct,jsonrpc:e.JsonRpcVersionStruct,result:e.JsonStruct}),e.JsonRpcFailureStruct=(0,t.object)({id:e.JsonRpcIdStruct,jsonrpc:e.JsonRpcVersionStruct,error:e.JsonRpcErrorStruct}),e.JsonRpcResponseStruct=(0,t.union)([e.JsonRpcSuccessStruct,e.JsonRpcFailureStruct]);function m(L){return(0,t.is)(L,e.PendingJsonRpcResponseStruct)}e.isPendingJsonRpcResponse=m;function R(L,F){(0,r.assertStruct)(L,e.PendingJsonRpcResponseStruct,"Invalid pending JSON-RPC response",F)}e.assertIsPendingJsonRpcResponse=R;function y(L){return(0,t.is)(L,e.JsonRpcResponseStruct)}e.isJsonRpcResponse=y;function C(L,F){(0,r.assertStruct)(L,e.JsonRpcResponseStruct,"Invalid JSON-RPC response",F)}e.assertIsJsonRpcResponse=C;function x(L){return(0,t.is)(L,e.JsonRpcSuccessStruct)}e.isJsonRpcSuccess=x;function B(L,F){(0,r.assertStruct)(L,e.JsonRpcSuccessStruct,"Invalid JSON-RPC success response",F)}e.assertIsJsonRpcSuccess=B;function O(L){return(0,t.is)(L,e.JsonRpcFailureStruct)}e.isJsonRpcFailure=O;function M(L,F){(0,r.assertStruct)(L,e.JsonRpcFailureStruct,"Invalid JSON-RPC failure response",F)}e.assertIsJsonRpcFailure=M;function T(L){return(0,t.is)(L,e.JsonRpcErrorStruct)}e.isJsonRpcError=T;function N(L,F){(0,r.assertStruct)(L,e.JsonRpcErrorStruct,"Invalid JSON-RPC error",F)}e.assertIsJsonRpcError=N;function D(L){const{permitEmptyString:F,permitFractions:W,permitNull:te}=Object.assign({permitEmptyString:!0,permitFractions:!1,permitNull:!0},L);return z=>!!(typeof z=="number"&&(W||Number.isInteger(z))||typeof z=="string"&&(F||z.length>0)||te&&z===null)}e.getJsonRpcIdValidator=D})(Al);var Tl={};Object.defineProperty(Tl,"__esModule",{value:!0});var Gr={},E1=Q&&Q.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Gr,"__esModule",{value:!0});Gr.createModuleLogger=Gr.createProjectLogger=void 0;const S1=E1(su),R1=(0,S1.default)("metamask");function M1(e){return R1.extend(e)}Gr.createProjectLogger=M1;function k1(e,t){return e.extend(t)}Gr.createModuleLogger=k1;var Nl={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.calculateNumberSize=e.calculateStringSize=e.isASCII=e.isPlainObject=e.ESCAPE_CHARACTERS_REGEXP=e.JsonSize=e.hasProperty=e.isObject=e.isNullOrUndefined=e.isNonEmptyArray=void 0;function t(h){return Array.isArray(h)&&h.length>0}e.isNonEmptyArray=t;function r(h){return h==null}e.isNullOrUndefined=r;function n(h){return!!h&&typeof h=="object"&&!Array.isArray(h)}e.isObject=n;const i=(h,m)=>Object.hasOwnProperty.call(h,m);e.hasProperty=i,function(h){h[h.Null=4]="Null",h[h.Comma=1]="Comma",h[h.Wrapper=1]="Wrapper",h[h.True=4]="True",h[h.False=5]="False",h[h.Quote=1]="Quote",h[h.Colon=1]="Colon",h[h.Date=24]="Date"}(e.JsonSize||(e.JsonSize={})),e.ESCAPE_CHARACTERS_REGEXP=/"|\\|\n|\r|\t/gu;function s(h){if(typeof h!="object"||h===null)return!1;try{let m=h;for(;Object.getPrototypeOf(m)!==null;)m=Object.getPrototypeOf(m);return Object.getPrototypeOf(h)===m}catch{return!1}}e.isPlainObject=s;function a(h){return h.charCodeAt(0)<=127}e.isASCII=a;function l(h){var m;return h.split("").reduce((y,C)=>a(C)?y+1:y+2,0)+((m=h.match(e.ESCAPE_CHARACTERS_REGEXP))!==null&&m!==void 0?m:[]).length}e.calculateStringSize=l;function d(h){return h.toString().length}e.calculateNumberSize=d})(Nl);var It={};Object.defineProperty(It,"__esModule",{value:!0});It.hexToBigInt=It.hexToNumber=It.bigIntToHex=It.numberToHex=void 0;const jr=Ke,fn=On,C1=e=>((0,jr.assert)(typeof e=="number","Value must be a number."),(0,jr.assert)(e>=0,"Value must be a non-negative number."),(0,jr.assert)(Number.isSafeInteger(e),"Value is not a safe integer. Use `bigIntToHex` instead."),(0,fn.add0x)(e.toString(16)));It.numberToHex=C1;const I1=e=>((0,jr.assert)(typeof e=="bigint","Value must be a bigint."),(0,jr.assert)(e>=0,"Value must be a non-negative bigint."),(0,fn.add0x)(e.toString(16)));It.bigIntToHex=I1;const x1=e=>{(0,fn.assertIsHexString)(e);const t=parseInt(e,16);return(0,jr.assert)(Number.isSafeInteger(t),"Value is not a safe integer. Use `hexToBigInt` instead."),t};It.hexToNumber=x1;const A1=e=>((0,fn.assertIsHexString)(e),BigInt((0,fn.add0x)(e)));It.hexToBigInt=A1;var Ll={};Object.defineProperty(Ll,"__esModule",{value:!0});var Ol={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.timeSince=e.inMilliseconds=e.Duration=void 0,function(s){s[s.Millisecond=1]="Millisecond",s[s.Second=1e3]="Second",s[s.Minute=6e4]="Minute",s[s.Hour=36e5]="Hour",s[s.Day=864e5]="Day",s[s.Week=6048e5]="Week",s[s.Year=31536e6]="Year"}(e.Duration||(e.Duration={}));const t=s=>Number.isInteger(s)&&s>=0,r=(s,a)=>{if(!t(s))throw new Error(`"${a}" must be a non-negative integer. Received: "${s}".`)};function n(s,a){return r(s,"count"),s*a}e.inMilliseconds=n;function i(s){return r(s,"timestamp"),Date.now()-s}e.timeSince=i})(Ol);var Pl={};Object.defineProperty(Pl,"__esModule",{value:!0});var $l={},js={exports:{}};const T1="2.0.0",Bl=256,N1=Number.MAX_SAFE_INTEGER||9007199254740991,L1=16,O1=Bl-6,P1=["major","premajor","minor","preminor","patch","prepatch","prerelease"];var Hi={MAX_LENGTH:Bl,MAX_SAFE_COMPONENT_LENGTH:L1,MAX_SAFE_BUILD_LENGTH:O1,MAX_SAFE_INTEGER:N1,RELEASE_TYPES:P1,SEMVER_SPEC_VERSION:T1,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2},$1={env:{NODE_ENV:'"production"',VITE_WALLETCONNECT_PROJECT_ID:'"1d93edc21291f98e3bed6ff7617ff539"'},nextTick:"setImmediate",platform:'"browser"',version:'"v16.0.0"',browser:!0},Rs={};const B1=typeof $1=="object"&&Rs&&Rs.NODE_DEBUG&&/\bsemver\b/i.test(Rs.NODE_DEBUG)?(...e)=>console.error("SEMVER",...e):()=>{};var Ui=B1;(function(e,t){const{MAX_SAFE_COMPONENT_LENGTH:r,MAX_SAFE_BUILD_LENGTH:n,MAX_LENGTH:i}=Hi,s=Ui;t=e.exports={};const a=t.re=[],l=t.safeRe=[],d=t.src=[],h=t.t={};let m=0;const R="[a-zA-Z0-9-]",y=[["\\s",1],["\\d",i],[R,n]],C=B=>{for(const[O,M]of y)B=B.split(`${O}*`).join(`${O}{0,${M}}`).split(`${O}+`).join(`${O}{1,${M}}`);return B},x=(B,O,M)=>{const T=C(O),N=m++;s(B,N,O),h[B]=N,d[N]=O,a[N]=new RegExp(O,M?"g":void 0),l[N]=new RegExp(T,M?"g":void 0)};x("NUMERICIDENTIFIER","0|[1-9]\\d*"),x("NUMERICIDENTIFIERLOOSE","\\d+"),x("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${R}*`),x("MAINVERSION",`(${d[h.NUMERICIDENTIFIER]})\\.(${d[h.NUMERICIDENTIFIER]})\\.(${d[h.NUMERICIDENTIFIER]})`),x("MAINVERSIONLOOSE",`(${d[h.NUMERICIDENTIFIERLOOSE]})\\.(${d[h.NUMERICIDENTIFIERLOOSE]})\\.(${d[h.NUMERICIDENTIFIERLOOSE]})`),x("PRERELEASEIDENTIFIER",`(?:${d[h.NUMERICIDENTIFIER]}|${d[h.NONNUMERICIDENTIFIER]})`),x("PRERELEASEIDENTIFIERLOOSE",`(?:${d[h.NUMERICIDENTIFIERLOOSE]}|${d[h.NONNUMERICIDENTIFIER]})`),x("PRERELEASE",`(?:-(${d[h.PRERELEASEIDENTIFIER]}(?:\\.${d[h.PRERELEASEIDENTIFIER]})*))`),x("PRERELEASELOOSE",`(?:-?(${d[h.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${d[h.PRERELEASEIDENTIFIERLOOSE]})*))`),x("BUILDIDENTIFIER",`${R}+`),x("BUILD",`(?:\\+(${d[h.BUILDIDENTIFIER]}(?:\\.${d[h.BUILDIDENTIFIER]})*))`),x("FULLPLAIN",`v?${d[h.MAINVERSION]}${d[h.PRERELEASE]}?${d[h.BUILD]}?`),x("FULL",`^${d[h.FULLPLAIN]}$`),x("LOOSEPLAIN",`[v=\\s]*${d[h.MAINVERSIONLOOSE]}${d[h.PRERELEASELOOSE]}?${d[h.BUILD]}?`),x("LOOSE",`^${d[h.LOOSEPLAIN]}$`),x("GTLT","((?:<|>)?=?)"),x("XRANGEIDENTIFIERLOOSE",`${d[h.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`),x("XRANGEIDENTIFIER",`${d[h.NUMERICIDENTIFIER]}|x|X|\\*`),x("XRANGEPLAIN",`[v=\\s]*(${d[h.XRANGEIDENTIFIER]})(?:\\.(${d[h.XRANGEIDENTIFIER]})(?:\\.(${d[h.XRANGEIDENTIFIER]})(?:${d[h.PRERELEASE]})?${d[h.BUILD]}?)?)?`),x("XRANGEPLAINLOOSE",`[v=\\s]*(${d[h.XRANGEIDENTIFIERLOOSE]})(?:\\.(${d[h.XRANGEIDENTIFIERLOOSE]})(?:\\.(${d[h.XRANGEIDENTIFIERLOOSE]})(?:${d[h.PRERELEASELOOSE]})?${d[h.BUILD]}?)?)?`),x("XRANGE",`^${d[h.GTLT]}\\s*${d[h.XRANGEPLAIN]}$`),x("XRANGELOOSE",`^${d[h.GTLT]}\\s*${d[h.XRANGEPLAINLOOSE]}$`),x("COERCEPLAIN",`(^|[^\\d])(\\d{1,${r}})(?:\\.(\\d{1,${r}}))?(?:\\.(\\d{1,${r}}))?`),x("COERCE",`${d[h.COERCEPLAIN]}(?:$|[^\\d])`),x("COERCEFULL",d[h.COERCEPLAIN]+`(?:${d[h.PRERELEASE]})?(?:${d[h.BUILD]})?(?:$|[^\\d])`),x("COERCERTL",d[h.COERCE],!0),x("COERCERTLFULL",d[h.COERCEFULL],!0),x("LONETILDE","(?:~>?)"),x("TILDETRIM",`(\\s*)${d[h.LONETILDE]}\\s+`,!0),t.tildeTrimReplace="$1~",x("TILDE",`^${d[h.LONETILDE]}${d[h.XRANGEPLAIN]}$`),x("TILDELOOSE",`^${d[h.LONETILDE]}${d[h.XRANGEPLAINLOOSE]}$`),x("LONECARET","(?:\\^)"),x("CARETTRIM",`(\\s*)${d[h.LONECARET]}\\s+`,!0),t.caretTrimReplace="$1^",x("CARET",`^${d[h.LONECARET]}${d[h.XRANGEPLAIN]}$`),x("CARETLOOSE",`^${d[h.LONECARET]}${d[h.XRANGEPLAINLOOSE]}$`),x("COMPARATORLOOSE",`^${d[h.GTLT]}\\s*(${d[h.LOOSEPLAIN]})$|^$`),x("COMPARATOR",`^${d[h.GTLT]}\\s*(${d[h.FULLPLAIN]})$|^$`),x("COMPARATORTRIM",`(\\s*)${d[h.GTLT]}\\s*(${d[h.LOOSEPLAIN]}|${d[h.XRANGEPLAIN]})`,!0),t.comparatorTrimReplace="$1$2$3",x("HYPHENRANGE",`^\\s*(${d[h.XRANGEPLAIN]})\\s+-\\s+(${d[h.XRANGEPLAIN]})\\s*$`),x("HYPHENRANGELOOSE",`^\\s*(${d[h.XRANGEPLAINLOOSE]})\\s+-\\s+(${d[h.XRANGEPLAINLOOSE]})\\s*$`),x("STAR","(<|>)?=?\\s*\\*"),x("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$"),x("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")})(js,js.exports);var Pn=js.exports;const D1=Object.freeze({loose:!0}),F1=Object.freeze({}),j1=e=>e?typeof e!="object"?D1:e:F1;var ho=j1;const Ra=/^[0-9]+$/,Dl=(e,t)=>{const r=Ra.test(e),n=Ra.test(t);return r&&n&&(e=+e,t=+t),e===t?0:r&&!n?-1:n&&!r?1:eDl(t,e);var Fl={compareIdentifiers:Dl,rcompareIdentifiers:H1};const qn=Ui,{MAX_LENGTH:Ma,MAX_SAFE_INTEGER:Jn}=Hi,{safeRe:ka,t:Ca}=Pn,U1=ho,{compareIdentifiers:Or}=Fl;let W1=class Et{constructor(t,r){if(r=U1(r),t instanceof Et){if(t.loose===!!r.loose&&t.includePrerelease===!!r.includePrerelease)return t;t=t.version}else if(typeof t!="string")throw new TypeError(`Invalid version. Must be a string. Got type "${typeof t}".`);if(t.length>Ma)throw new TypeError(`version is longer than ${Ma} characters`);qn("SemVer",t,r),this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease;const n=t.trim().match(r.loose?ka[Ca.LOOSE]:ka[Ca.FULL]);if(!n)throw new TypeError(`Invalid Version: ${t}`);if(this.raw=t,this.major=+n[1],this.minor=+n[2],this.patch=+n[3],this.major>Jn||this.major<0)throw new TypeError("Invalid major version");if(this.minor>Jn||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>Jn||this.patch<0)throw new TypeError("Invalid patch version");n[4]?this.prerelease=n[4].split(".").map(i=>{if(/^[0-9]+$/.test(i)){const s=+i;if(s>=0&&s=0;)typeof this.prerelease[s]=="number"&&(this.prerelease[s]++,s=-2);if(s===-1){if(r===this.prerelease.join(".")&&n===!1)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(i)}}if(r){let s=[r,i];n===!1&&(s=[r]),Or(this.prerelease[0],r)===0?isNaN(this.prerelease[1])&&(this.prerelease=s):this.prerelease=s}break}default:throw new Error(`invalid increment argument: ${t}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}};var et=W1;const Ia=et,V1=(e,t,r=!1)=>{if(e instanceof Ia)return e;try{return new Ia(e,t)}catch(n){if(!r)return null;throw n}};var sn=V1;const z1=sn,q1=(e,t)=>{const r=z1(e,t);return r?r.version:null};var J1=q1;const G1=sn,Z1=(e,t)=>{const r=G1(e.trim().replace(/^[=v]+/,""),t);return r?r.version:null};var K1=Z1;const xa=et,Q1=(e,t,r,n,i)=>{typeof r=="string"&&(i=n,n=r,r=void 0);try{return new xa(e instanceof xa?e.version:e,r).inc(t,n,i).version}catch{return null}};var Y1=Q1;const Aa=sn,X1=(e,t)=>{const r=Aa(e,null,!0),n=Aa(t,null,!0),i=r.compare(n);if(i===0)return null;const s=i>0,a=s?r:n,l=s?n:r,d=!!a.prerelease.length;if(!!l.prerelease.length&&!d)return!l.patch&&!l.minor?"major":a.patch?"patch":a.minor?"minor":"major";const m=d?"pre":"";return r.major!==n.major?m+"major":r.minor!==n.minor?m+"minor":r.patch!==n.patch?m+"patch":"prerelease"};var ep=X1;const tp=et,rp=(e,t)=>new tp(e,t).major;var np=rp;const ip=et,sp=(e,t)=>new ip(e,t).minor;var op=sp;const ap=et,cp=(e,t)=>new ap(e,t).patch;var lp=cp;const up=sn,hp=(e,t)=>{const r=up(e,t);return r&&r.prerelease.length?r.prerelease:null};var dp=hp;const Ta=et,fp=(e,t,r)=>new Ta(e,r).compare(new Ta(t,r));var bt=fp;const pp=bt,gp=(e,t,r)=>pp(t,e,r);var mp=gp;const vp=bt,bp=(e,t)=>vp(e,t,!0);var wp=bp;const Na=et,_p=(e,t,r)=>{const n=new Na(e,r),i=new Na(t,r);return n.compare(i)||n.compareBuild(i)};var fo=_p;const yp=fo,Ep=(e,t)=>e.sort((r,n)=>yp(r,n,t));var Sp=Ep;const Rp=fo,Mp=(e,t)=>e.sort((r,n)=>Rp(n,r,t));var kp=Mp;const Cp=bt,Ip=(e,t,r)=>Cp(e,t,r)>0;var Wi=Ip;const xp=bt,Ap=(e,t,r)=>xp(e,t,r)<0;var po=Ap;const Tp=bt,Np=(e,t,r)=>Tp(e,t,r)===0;var jl=Np;const Lp=bt,Op=(e,t,r)=>Lp(e,t,r)!==0;var Hl=Op;const Pp=bt,$p=(e,t,r)=>Pp(e,t,r)>=0;var go=$p;const Bp=bt,Dp=(e,t,r)=>Bp(e,t,r)<=0;var mo=Dp;const Fp=jl,jp=Hl,Hp=Wi,Up=go,Wp=po,Vp=mo,zp=(e,t,r,n)=>{switch(t){case"===":return typeof e=="object"&&(e=e.version),typeof r=="object"&&(r=r.version),e===r;case"!==":return typeof e=="object"&&(e=e.version),typeof r=="object"&&(r=r.version),e!==r;case"":case"=":case"==":return Fp(e,r,n);case"!=":return jp(e,r,n);case">":return Hp(e,r,n);case">=":return Up(e,r,n);case"<":return Wp(e,r,n);case"<=":return Vp(e,r,n);default:throw new TypeError(`Invalid operator: ${t}`)}};var Ul=zp;const qp=et,Jp=sn,{safeRe:Gn,t:Zn}=Pn,Gp=(e,t)=>{if(e instanceof qp)return e;if(typeof e=="number"&&(e=String(e)),typeof e!="string")return null;t=t||{};let r=null;if(!t.rtl)r=e.match(t.includePrerelease?Gn[Zn.COERCEFULL]:Gn[Zn.COERCE]);else{const d=t.includePrerelease?Gn[Zn.COERCERTLFULL]:Gn[Zn.COERCERTL];let h;for(;(h=d.exec(e))&&(!r||r.index+r[0].length!==e.length);)(!r||h.index+h[0].length!==r.index+r[0].length)&&(r=h),d.lastIndex=h.index+h[1].length+h[2].length;d.lastIndex=-1}if(r===null)return null;const n=r[2],i=r[3]||"0",s=r[4]||"0",a=t.includePrerelease&&r[5]?`-${r[5]}`:"",l=t.includePrerelease&&r[6]?`+${r[6]}`:"";return Jp(`${n}.${i}.${s}${a}${l}`,t)};var Zp=Gp;class Kp{constructor(){this.max=1e3,this.map=new Map}get(t){const r=this.map.get(t);if(r!==void 0)return this.map.delete(t),this.map.set(t,r),r}delete(t){return this.map.delete(t)}set(t,r){if(!this.delete(t)&&r!==void 0){if(this.map.size>=this.max){const i=this.map.keys().next().value;this.delete(i)}this.map.set(t,r)}return this}}var Qp=Kp,Ms,La;function wt(){if(La)return Ms;La=1;const e=/\s+/g;class t{constructor(u,f){if(f=i(f),u instanceof t)return u.loose===!!f.loose&&u.includePrerelease===!!f.includePrerelease?u:new t(u.raw,f);if(u instanceof s)return this.raw=u.value,this.set=[[u]],this.formatted=void 0,this;if(this.options=f,this.loose=!!f.loose,this.includePrerelease=!!f.includePrerelease,this.raw=u.trim().replace(e," "),this.set=this.raw.split("||").map(p=>this.parseRange(p.trim())).filter(p=>p.length),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){const p=this.set[0];if(this.set=this.set.filter(v=>!B(v[0])),this.set.length===0)this.set=[p];else if(this.set.length>1){for(const v of this.set)if(v.length===1&&O(v[0])){this.set=[v];break}}}this.formatted=void 0}get range(){if(this.formatted===void 0){this.formatted="";for(let u=0;u0&&(this.formatted+="||");const f=this.set[u];for(let p=0;p0&&(this.formatted+=" "),this.formatted+=f[p].toString().trim()}}return this.formatted}format(){return this.range}toString(){return this.range}parseRange(u){const p=((this.options.includePrerelease&&C)|(this.options.loose&&x))+":"+u,v=n.get(p);if(v)return v;const E=this.options.loose,k=E?d[h.HYPHENRANGELOOSE]:d[h.HYPHENRANGE];u=u.replace(k,ne(this.options.includePrerelease)),a("hyphen replace",u),u=u.replace(d[h.COMPARATORTRIM],m),a("comparator trim",u),u=u.replace(d[h.TILDETRIM],R),a("tilde trim",u),u=u.replace(d[h.CARETTRIM],y),a("caret trim",u);let g=u.split(" ").map(H=>T(H,this.options)).join(" ").split(/\s+/).map(H=>X(H,this.options));E&&(g=g.filter(H=>(a("loose invalid filter",H,this.options),!!H.match(d[h.COMPARATORLOOSE])))),a("range list",g);const c=new Map,w=g.map(H=>new s(H,this.options));for(const H of w){if(B(H))return[H];c.set(H.value,H)}c.size>1&&c.has("")&&c.delete("");const U=[...c.values()];return n.set(p,U),U}intersects(u,f){if(!(u instanceof t))throw new TypeError("a Range is required");return this.set.some(p=>M(p,f)&&u.set.some(v=>M(v,f)&&p.every(E=>v.every(k=>E.intersects(k,f)))))}test(u){if(!u)return!1;if(typeof u=="string")try{u=new l(u,this.options)}catch{return!1}for(let f=0;fo.value==="<0.0.0-0",O=o=>o.value==="",M=(o,u)=>{let f=!0;const p=o.slice();let v=p.pop();for(;f&&p.length;)f=p.every(E=>v.intersects(E,u)),v=p.pop();return f},T=(o,u)=>(a("comp",o,u),o=F(o,u),a("caret",o),o=D(o,u),a("tildes",o),o=te(o,u),a("xrange",o),o=z(o,u),a("stars",o),o),N=o=>!o||o.toLowerCase()==="x"||o==="*",D=(o,u)=>o.trim().split(/\s+/).map(f=>L(f,u)).join(" "),L=(o,u)=>{const f=u.loose?d[h.TILDELOOSE]:d[h.TILDE];return o.replace(f,(p,v,E,k,g)=>{a("tilde",o,p,v,E,k,g);let c;return N(v)?c="":N(E)?c=`>=${v}.0.0 <${+v+1}.0.0-0`:N(k)?c=`>=${v}.${E}.0 <${v}.${+E+1}.0-0`:g?(a("replaceTilde pr",g),c=`>=${v}.${E}.${k}-${g} <${v}.${+E+1}.0-0`):c=`>=${v}.${E}.${k} <${v}.${+E+1}.0-0`,a("tilde return",c),c})},F=(o,u)=>o.trim().split(/\s+/).map(f=>W(f,u)).join(" "),W=(o,u)=>{a("caret",o,u);const f=u.loose?d[h.CARETLOOSE]:d[h.CARET],p=u.includePrerelease?"-0":"";return o.replace(f,(v,E,k,g,c)=>{a("caret",o,v,E,k,g,c);let w;return N(E)?w="":N(k)?w=`>=${E}.0.0${p} <${+E+1}.0.0-0`:N(g)?E==="0"?w=`>=${E}.${k}.0${p} <${E}.${+k+1}.0-0`:w=`>=${E}.${k}.0${p} <${+E+1}.0.0-0`:c?(a("replaceCaret pr",c),E==="0"?k==="0"?w=`>=${E}.${k}.${g}-${c} <${E}.${k}.${+g+1}-0`:w=`>=${E}.${k}.${g}-${c} <${E}.${+k+1}.0-0`:w=`>=${E}.${k}.${g}-${c} <${+E+1}.0.0-0`):(a("no pr"),E==="0"?k==="0"?w=`>=${E}.${k}.${g}${p} <${E}.${k}.${+g+1}-0`:w=`>=${E}.${k}.${g}${p} <${E}.${+k+1}.0-0`:w=`>=${E}.${k}.${g} <${+E+1}.0.0-0`),a("caret return",w),w})},te=(o,u)=>(a("replaceXRanges",o,u),o.split(/\s+/).map(f=>Z(f,u)).join(" ")),Z=(o,u)=>{o=o.trim();const f=u.loose?d[h.XRANGELOOSE]:d[h.XRANGE];return o.replace(f,(p,v,E,k,g,c)=>{a("xRange",o,p,v,E,k,g,c);const w=N(E),U=w||N(k),H=U||N(g),V=H;return v==="="&&V&&(v=""),c=u.includePrerelease?"-0":"",w?v===">"||v==="<"?p="<0.0.0-0":p="*":v&&V?(U&&(k=0),g=0,v===">"?(v=">=",U?(E=+E+1,k=0,g=0):(k=+k+1,g=0)):v==="<="&&(v="<",U?E=+E+1:k=+k+1),v==="<"&&(c="-0"),p=`${v+E}.${k}.${g}${c}`):U?p=`>=${E}.0.0${c} <${+E+1}.0.0-0`:H&&(p=`>=${E}.${k}.0${c} <${E}.${+k+1}.0-0`),a("xRange return",p),p})},z=(o,u)=>(a("replaceStars",o,u),o.trim().replace(d[h.STAR],"")),X=(o,u)=>(a("replaceGTE0",o,u),o.trim().replace(d[u.includePrerelease?h.GTE0PRE:h.GTE0],"")),ne=o=>(u,f,p,v,E,k,g,c,w,U,H,V)=>(N(p)?f="":N(v)?f=`>=${p}.0.0${o?"-0":""}`:N(E)?f=`>=${p}.${v}.0${o?"-0":""}`:k?f=`>=${f}`:f=`>=${f}${o?"-0":""}`,N(w)?c="":N(U)?c=`<${+w+1}.0.0-0`:N(H)?c=`<${w}.${+U+1}.0-0`:V?c=`<=${w}.${U}.${H}-${V}`:o?c=`<${w}.${U}.${+H+1}-0`:c=`<=${c}`,`${f} ${c}`.trim()),S=(o,u,f)=>{for(let p=0;p0){const v=o[p].semver;if(v.major===u.major&&v.minor===u.minor&&v.patch===u.patch)return!0}return!1}return!0};return Ms}var ks,Oa;function Vi(){if(Oa)return ks;Oa=1;const e=Symbol("SemVer ANY");class t{static get ANY(){return e}constructor(m,R){if(R=r(R),m instanceof t){if(m.loose===!!R.loose)return m;m=m.value}m=m.trim().split(/\s+/).join(" "),a("comparator",m,R),this.options=R,this.loose=!!R.loose,this.parse(m),this.semver===e?this.value="":this.value=this.operator+this.semver.version,a("comp",this)}parse(m){const R=this.options.loose?n[i.COMPARATORLOOSE]:n[i.COMPARATOR],y=m.match(R);if(!y)throw new TypeError(`Invalid comparator: ${m}`);this.operator=y[1]!==void 0?y[1]:"",this.operator==="="&&(this.operator=""),y[2]?this.semver=new l(y[2],this.options.loose):this.semver=e}toString(){return this.value}test(m){if(a("Comparator.test",m,this.options.loose),this.semver===e||m===e)return!0;if(typeof m=="string")try{m=new l(m,this.options)}catch{return!1}return s(m,this.operator,this.semver,this.options)}intersects(m,R){if(!(m instanceof t))throw new TypeError("a Comparator is required");return this.operator===""?this.value===""?!0:new d(m.value,R).test(this.value):m.operator===""?m.value===""?!0:new d(this.value,R).test(m.semver):(R=r(R),R.includePrerelease&&(this.value==="<0.0.0-0"||m.value==="<0.0.0-0")||!R.includePrerelease&&(this.value.startsWith("<0.0.0")||m.value.startsWith("<0.0.0"))?!1:!!(this.operator.startsWith(">")&&m.operator.startsWith(">")||this.operator.startsWith("<")&&m.operator.startsWith("<")||this.semver.version===m.semver.version&&this.operator.includes("=")&&m.operator.includes("=")||s(this.semver,"<",m.semver,R)&&this.operator.startsWith(">")&&m.operator.startsWith("<")||s(this.semver,">",m.semver,R)&&this.operator.startsWith("<")&&m.operator.startsWith(">")))}}ks=t;const r=ho,{safeRe:n,t:i}=Pn,s=Ul,a=Ui,l=et,d=wt();return ks}const Yp=wt(),Xp=(e,t,r)=>{try{t=new Yp(t,r)}catch{return!1}return t.test(e)};var zi=Xp;const eg=wt(),tg=(e,t)=>new eg(e,t).set.map(r=>r.map(n=>n.value).join(" ").trim().split(" "));var rg=tg;const ng=et,ig=wt(),sg=(e,t,r)=>{let n=null,i=null,s=null;try{s=new ig(t,r)}catch{return null}return e.forEach(a=>{s.test(a)&&(!n||i.compare(a)===-1)&&(n=a,i=new ng(n,r))}),n};var og=sg;const ag=et,cg=wt(),lg=(e,t,r)=>{let n=null,i=null,s=null;try{s=new cg(t,r)}catch{return null}return e.forEach(a=>{s.test(a)&&(!n||i.compare(a)===1)&&(n=a,i=new ag(n,r))}),n};var ug=lg;const Cs=et,hg=wt(),Pa=Wi,dg=(e,t)=>{e=new hg(e,t);let r=new Cs("0.0.0");if(e.test(r)||(r=new Cs("0.0.0-0"),e.test(r)))return r;r=null;for(let n=0;n{const l=new Cs(a.semver.version);switch(a.operator){case">":l.prerelease.length===0?l.patch++:l.prerelease.push(0),l.raw=l.format();case"":case">=":(!s||Pa(l,s))&&(s=l);break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${a.operator}`)}}),s&&(!r||Pa(r,s))&&(r=s)}return r&&e.test(r)?r:null};var fg=dg;const pg=wt(),gg=(e,t)=>{try{return new pg(e,t).range||"*"}catch{return null}};var mg=gg;const vg=et,Wl=Vi(),{ANY:bg}=Wl,wg=wt(),_g=zi,$a=Wi,Ba=po,yg=mo,Eg=go,Sg=(e,t,r,n)=>{e=new vg(e,n),t=new wg(t,n);let i,s,a,l,d;switch(r){case">":i=$a,s=yg,a=Ba,l=">",d=">=";break;case"<":i=Ba,s=Eg,a=$a,l="<",d="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(_g(e,t,n))return!1;for(let h=0;h{C.semver===bg&&(C=new Wl(">=0.0.0")),R=R||C,y=y||C,i(C.semver,R.semver,n)?R=C:a(C.semver,y.semver,n)&&(y=C)}),R.operator===l||R.operator===d||(!y.operator||y.operator===l)&&s(e,y.semver))return!1;if(y.operator===d&&a(e,y.semver))return!1}return!0};var vo=Sg;const Rg=vo,Mg=(e,t,r)=>Rg(e,t,">",r);var kg=Mg;const Cg=vo,Ig=(e,t,r)=>Cg(e,t,"<",r);var xg=Ig;const Da=wt(),Ag=(e,t,r)=>(e=new Da(e,r),t=new Da(t,r),e.intersects(t,r));var Tg=Ag;const Ng=zi,Lg=bt;var Og=(e,t,r)=>{const n=[];let i=null,s=null;const a=e.sort((m,R)=>Lg(m,R,r));for(const m of a)Ng(m,t,r)?(s=m,i||(i=m)):(s&&n.push([i,s]),s=null,i=null);i&&n.push([i,null]);const l=[];for(const[m,R]of n)m===R?l.push(m):!R&&m===a[0]?l.push("*"):R?m===a[0]?l.push(`<=${R}`):l.push(`${m} - ${R}`):l.push(`>=${m}`);const d=l.join(" || "),h=typeof t.raw=="string"?t.raw:String(t);return d.length{if(e===t)return!0;e=new Fa(e,r),t=new Fa(t,r);let n=!1;e:for(const i of e.set){for(const s of t.set){const a=Bg(i,s,r);if(n=n||a!==null,a)continue e}if(n)return!1}return!0},$g=[new bo(">=0.0.0-0")],ja=[new bo(">=0.0.0")],Bg=(e,t,r)=>{if(e===t)return!0;if(e.length===1&&e[0].semver===Is){if(t.length===1&&t[0].semver===Is)return!0;r.includePrerelease?e=$g:e=ja}if(t.length===1&&t[0].semver===Is){if(r.includePrerelease)return!0;t=ja}const n=new Set;let i,s;for(const C of e)C.operator===">"||C.operator===">="?i=Ha(i,C,r):C.operator==="<"||C.operator==="<="?s=Ua(s,C,r):n.add(C.semver);if(n.size>1)return null;let a;if(i&&s){if(a=wo(i.semver,s.semver,r),a>0)return null;if(a===0&&(i.operator!==">="||s.operator!=="<="))return null}for(const C of n){if(i&&!an(C,String(i),r)||s&&!an(C,String(s),r))return null;for(const x of t)if(!an(C,String(x),r))return!1;return!0}let l,d,h,m,R=s&&!r.includePrerelease&&s.semver.prerelease.length?s.semver:!1,y=i&&!r.includePrerelease&&i.semver.prerelease.length?i.semver:!1;R&&R.prerelease.length===1&&s.operator==="<"&&R.prerelease[0]===0&&(R=!1);for(const C of t){if(m=m||C.operator===">"||C.operator===">=",h=h||C.operator==="<"||C.operator==="<=",i){if(y&&C.semver.prerelease&&C.semver.prerelease.length&&C.semver.major===y.major&&C.semver.minor===y.minor&&C.semver.patch===y.patch&&(y=!1),C.operator===">"||C.operator===">="){if(l=Ha(i,C,r),l===C&&l!==i)return!1}else if(i.operator===">="&&!an(i.semver,String(C),r))return!1}if(s){if(R&&C.semver.prerelease&&C.semver.prerelease.length&&C.semver.major===R.major&&C.semver.minor===R.minor&&C.semver.patch===R.patch&&(R=!1),C.operator==="<"||C.operator==="<="){if(d=Ua(s,C,r),d===C&&d!==s)return!1}else if(s.operator==="<="&&!an(s.semver,String(C),r))return!1}if(!C.operator&&(s||i)&&a!==0)return!1}return!(i&&h&&!s&&a!==0||s&&m&&!i&&a!==0||y||R)},Ha=(e,t,r)=>{if(!e)return t;const n=wo(e.semver,t.semver,r);return n>0?e:n<0||t.operator===">"&&e.operator===">="?t:e},Ua=(e,t,r)=>{if(!e)return t;const n=wo(e.semver,t.semver,r);return n<0?e:n>0||t.operator==="<"&&e.operator==="<="?t:e};var Dg=Pg;const xs=Pn,Wa=Hi,Fg=et,Va=Fl,jg=sn,Hg=J1,Ug=K1,Wg=Y1,Vg=ep,zg=np,qg=op,Jg=lp,Gg=dp,Zg=bt,Kg=mp,Qg=wp,Yg=fo,Xg=Sp,em=kp,tm=Wi,rm=po,nm=jl,im=Hl,sm=go,om=mo,am=Ul,cm=Zp,lm=Vi(),um=wt(),hm=zi,dm=rg,fm=og,pm=ug,gm=fg,mm=mg,vm=vo,bm=kg,wm=xg,_m=Tg,ym=Og,Em=Dg;var Sm={parse:jg,valid:Hg,clean:Ug,inc:Wg,diff:Vg,major:zg,minor:qg,patch:Jg,prerelease:Gg,compare:Zg,rcompare:Kg,compareLoose:Qg,compareBuild:Yg,sort:Xg,rsort:em,gt:tm,lt:rm,eq:nm,neq:im,gte:sm,lte:om,cmp:am,coerce:cm,Comparator:lm,Range:um,satisfies:hm,toComparators:dm,maxSatisfying:fm,minSatisfying:pm,minVersion:gm,validRange:mm,outside:vm,gtr:bm,ltr:wm,intersects:_m,simplifyRange:ym,subset:Em,SemVer:Fg,re:xs.re,src:xs.src,tokens:xs.t,SEMVER_SPEC_VERSION:Wa.SEMVER_SPEC_VERSION,RELEASE_TYPES:Wa.RELEASE_TYPES,compareIdentifiers:Va.compareIdentifiers,rcompareIdentifiers:Va.rcompareIdentifiers};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.satisfiesVersionRange=e.gtRange=e.gtVersion=e.assertIsSemVerRange=e.assertIsSemVerVersion=e.isValidSemVerRange=e.isValidSemVerVersion=e.VersionRangeStruct=e.VersionStruct=void 0;const t=Sm,r=br,n=Ke;e.VersionStruct=(0,r.refine)((0,r.string)(),"Version",R=>(0,t.valid)(R)===null?`Expected SemVer version, got "${R}"`:!0),e.VersionRangeStruct=(0,r.refine)((0,r.string)(),"Version range",R=>(0,t.validRange)(R)===null?`Expected SemVer range, got "${R}"`:!0);function i(R){return(0,r.is)(R,e.VersionStruct)}e.isValidSemVerVersion=i;function s(R){return(0,r.is)(R,e.VersionRangeStruct)}e.isValidSemVerRange=s;function a(R){(0,n.assertStruct)(R,e.VersionStruct)}e.assertIsSemVerVersion=a;function l(R){(0,n.assertStruct)(R,e.VersionRangeStruct)}e.assertIsSemVerRange=l;function d(R,y){return(0,t.gt)(R,y)}e.gtVersion=d;function h(R,y){return(0,t.gtr)(R,y)}e.gtRange=h;function m(R,y){return(0,t.satisfies)(R,y,{includePrerelease:!0})}e.satisfiesVersionRange=m})($l);(function(e){var t=Q&&Q.__createBinding||(Object.create?function(n,i,s,a){a===void 0&&(a=s);var l=Object.getOwnPropertyDescriptor(i,s);(!l||("get"in l?!i.__esModule:l.writable||l.configurable))&&(l={enumerable:!0,get:function(){return i[s]}}),Object.defineProperty(n,a,l)}:function(n,i,s,a){a===void 0&&(a=s),n[a]=i[s]}),r=Q&&Q.__exportStar||function(n,i){for(var s in n)s!=="default"&&!Object.prototype.hasOwnProperty.call(i,s)&&t(i,n,s)};Object.defineProperty(e,"__esModule",{value:!0}),r(Ke,e),r(Ln,e),r(ae,e),r(Fi,e),r(Ct,e),r(Jr,e),r(xl,e),r(On,e),r(Al,e),r(Tl,e),r(Gr,e),r(Nl,e),r(It,e),r(Ll,e),r(Ol,e),r(Pl,e),r($l,e)})(ul);(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.createModuleLogger=e.projectLogger=void 0;const t=ul;Object.defineProperty(e,"createModuleLogger",{enumerable:!0,get:function(){return t.createModuleLogger}}),e.projectLogger=(0,t.createProjectLogger)("eth-block-tracker")})(ll);var Vl=Q&&Q.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Bi,"__esModule",{value:!0});Bi.PollingBlockTracker=void 0;const Rm=Vl(ro),Mm=Vl(Xf),km=xn,za=ll,qa=(0,za.createModuleLogger)(za.projectLogger,"polling-block-tracker"),Cm=(0,Rm.default)(),Im=1e3;class xm extends km.BaseBlockTracker{constructor(t={}){var r;if(!t.provider)throw new Error("PollingBlockTracker - no provider specified.");super(Object.assign(Object.assign({},t),{blockResetDuration:(r=t.blockResetDuration)!==null&&r!==void 0?r:t.pollingInterval})),this._provider=t.provider,this._pollingInterval=t.pollingInterval||20*Im,this._retryTimeout=t.retryTimeout||this._pollingInterval/10,this._keepEventLoopActive=t.keepEventLoopActive===void 0?!0:t.keepEventLoopActive,this._setSkipCacheFlag=t.setSkipCacheFlag||!1}async checkForLatestBlock(){return await this._updateLatestBlock(),await this.getLatestBlock()}async _start(){this._synchronize()}async _end(){}async _synchronize(){for(var t;this._isRunning;)try{await this._updateLatestBlock();const r=Ja(this._pollingInterval,!this._keepEventLoopActive);this.emit("_waitingForNextIteration"),await r}catch(r){const n=new Error(`PollingBlockTracker - encountered an error while attempting to update latest block: ${(t=r.stack)!==null&&t!==void 0?t:r}`);try{this.emit("error",n)}catch{console.error(n)}const i=Ja(this._retryTimeout,!this._keepEventLoopActive);this.emit("_waitingForNextIteration"),await i}}async _updateLatestBlock(){const t=await this._fetchLatestBlock();this._newPotentialLatest(t)}async _fetchLatestBlock(){const t={jsonrpc:"2.0",id:Cm(),method:"eth_blockNumber",params:[]};this._setSkipCacheFlag&&(t.skipCache=!0),qa("Making request",t);const r=await(0,Mm.default)(n=>this._provider.sendAsync(t,n))();if(qa("Got response",r),r.error)throw new Error(`PollingBlockTracker - encountered error fetching block: ${r.error.message}`);return r.result}}Bi.PollingBlockTracker=xm;function Ja(e,t){return new Promise(r=>{const n=setTimeout(r,e);n.unref&&t&&n.unref()})}var qi={},Am=Q&&Q.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(qi,"__esModule",{value:!0});qi.SubscribeBlockTracker=void 0;const Tm=Am(ro),Nm=xn,Lm=(0,Tm.default)();class Om extends Nm.BaseBlockTracker{constructor(t={}){if(!t.provider)throw new Error("SubscribeBlockTracker - no provider specified.");super(t),this._provider=t.provider,this._subscriptionId=null}async checkForLatestBlock(){return await this.getLatestBlock()}async _start(){if(this._subscriptionId===void 0||this._subscriptionId===null)try{const t=await this._call("eth_blockNumber");this._subscriptionId=await this._call("eth_subscribe","newHeads"),this._provider.on("data",this._handleSubData.bind(this)),this._newPotentialLatest(t)}catch(t){this.emit("error",t)}}async _end(){if(this._subscriptionId!==null&&this._subscriptionId!==void 0)try{await this._call("eth_unsubscribe",this._subscriptionId),this._subscriptionId=null}catch(t){this.emit("error",t)}}_call(t,...r){return new Promise((n,i)=>{this._provider.sendAsync({id:Lm(),method:t,params:r,jsonrpc:"2.0"},(s,a)=>{s?i(s):n(a.result)})})}_handleSubData(t,r){var n;r.method==="eth_subscription"&&((n=r.params)===null||n===void 0?void 0:n.subscription)===this._subscriptionId&&this._newPotentialLatest(r.params.result.number)}}qi.SubscribeBlockTracker=Om;(function(e){var t=Q&&Q.__createBinding||(Object.create?function(n,i,s,a){a===void 0&&(a=s),Object.defineProperty(n,a,{enumerable:!0,get:function(){return i[s]}})}:function(n,i,s,a){a===void 0&&(a=s),n[a]=i[s]}),r=Q&&Q.__exportStar||function(n,i){for(var s in n)s!=="default"&&!Object.prototype.hasOwnProperty.call(i,s)&&t(i,n,s)};Object.defineProperty(e,"__esModule",{value:!0}),r(Bi,e),r(qi,e)})(cl);var _o={},Ji={},$n={};Object.defineProperty($n,"__esModule",{value:!0});$n.getUniqueId=void 0;const zl=4294967295;let As=Math.floor(Math.random()*zl);function Pm(){return As=(As+1)%zl,As}$n.getUniqueId=Pm;Object.defineProperty(Ji,"__esModule",{value:!0});Ji.createIdRemapMiddleware=void 0;const $m=$n;function Bm(){return(e,t,r,n)=>{const i=e.id,s=$m.getUniqueId();e.id=s,t.id=s,r(a=>{e.id=i,t.id=i,a()})}}Ji.createIdRemapMiddleware=Bm;var Gi={};Object.defineProperty(Gi,"__esModule",{value:!0});Gi.createAsyncMiddleware=void 0;function Dm(e){return async(t,r,n,i)=>{let s;const a=new Promise(m=>{s=m});let l=null,d=!1;const h=async()=>{d=!0,n(m=>{l=m,s()}),await a};try{await e(t,r,h),d?(await a,l(null)):i(null)}catch(m){l?l(m):i(m)}}}Gi.createAsyncMiddleware=Dm;var Zi={};Object.defineProperty(Zi,"__esModule",{value:!0});Zi.createScaffoldMiddleware=void 0;function Fm(e){return(t,r,n,i)=>{const s=e[t.method];return s===void 0?n():typeof s=="function"?s(t,r,n,i):(r.result=s,i())}}Zi.createScaffoldMiddleware=Fm;var Bn={},yo={};Object.defineProperty(yo,"__esModule",{value:!0});const jm=si;function Ga(e,t,r){try{Reflect.apply(e,t,r)}catch(n){setTimeout(()=>{throw n})}}function Hm(e){const t=e.length,r=new Array(t);for(let n=0;n0&&([a]=r),a instanceof Error)throw a;const l=new Error(`Unhandled error.${a?` (${a.message})`:""}`);throw l.context=a,l}const s=i[t];if(s===void 0)return!1;if(typeof s=="function")Ga(s,this,r);else{const a=s.length,l=Hm(s);for(let d=0;d"u"&&(n=Gl()),Hs(e,"",0,[],void 0,0,n);var i;try{ur.length===0?i=JSON.stringify(e,t,r):i=JSON.stringify(e,Kl(t),r)}catch{return JSON.stringify("[unable to serialize, circular reference is too complex to analyze]")}finally{for(;fr.length!==0;){var s=fr.pop();s.length===4?Object.defineProperty(s[0],s[1],s[3]):s[0][s[1]]=s[2]}}return i}function Hr(e,t,r,n){var i=Object.getOwnPropertyDescriptor(n,r);i.get!==void 0?i.configurable?(Object.defineProperty(n,r,{value:e}),fr.push([n,r,t,i])):ur.push([t,r,e]):(n[r]=e,fr.push([n,r,t]))}function Hs(e,t,r,n,i,s,a){s+=1;var l;if(typeof e=="object"&&e!==null){for(l=0;la.depthLimit){Hr(ri,e,t,i);return}if(typeof a.edgesLimit<"u"&&r+1>a.edgesLimit){Hr(ri,e,t,i);return}if(n.push(e),Array.isArray(e))for(l=0;lt?1:0}function Zl(e,t,r,n){typeof n>"u"&&(n=Gl());var i=Us(e,"",0,[],void 0,0,n)||e,s;try{ur.length===0?s=JSON.stringify(i,t,r):s=JSON.stringify(i,Kl(t),r)}catch{return JSON.stringify("[unable to serialize, circular reference is too complex to analyze]")}finally{for(;fr.length!==0;){var a=fr.pop();a.length===4?Object.defineProperty(a[0],a[1],a[3]):a[0][a[1]]=a[2]}}return s}function Us(e,t,r,n,i,s,a){s+=1;var l;if(typeof e=="object"&&e!==null){for(l=0;la.depthLimit){Hr(ri,e,t,i);return}if(typeof a.edgesLimit<"u"&&r+1>a.edgesLimit){Hr(ri,e,t,i);return}if(n.push(e),Array.isArray(e))for(l=0;l0)for(var n=0;n=1e3&&e<=4999}function Gm(e,t){if(t!=="[Circular]")return t}var Eo={},Ft={};Object.defineProperty(Ft,"__esModule",{value:!0});Ft.errorValues=Ft.errorCodes=void 0;Ft.errorCodes={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}};Ft.errorValues={"-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."}};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.serializeError=e.isValidCode=e.getMessageFromCode=e.JSON_RPC_SERVER_ERROR_MESSAGE=void 0;const t=Ft,r=Dt,n=t.errorCodes.rpc.internal,i="Unspecified error message. This is a bug, please report it.",s={code:n,message:a(n)};e.JSON_RPC_SERVER_ERROR_MESSAGE="Unspecified server error.";function a(y,C=i){if(Number.isInteger(y)){const x=y.toString();if(R(t.errorValues,x))return t.errorValues[x].message;if(h(y))return e.JSON_RPC_SERVER_ERROR_MESSAGE}return C}e.getMessageFromCode=a;function l(y){if(!Number.isInteger(y))return!1;const C=y.toString();return!!(t.errorValues[C]||h(y))}e.isValidCode=l;function d(y,{fallbackError:C=s,shouldIncludeStack:x=!1}={}){var B,O;if(!C||!Number.isInteger(C.code)||typeof C.message!="string")throw new Error("Must provide fallback error with integer number code and string message.");if(y instanceof r.EthereumRpcError)return y.serialize();const M={};if(y&&typeof y=="object"&&!Array.isArray(y)&&R(y,"code")&&l(y.code)){const N=y;M.code=N.code,N.message&&typeof N.message=="string"?(M.message=N.message,R(N,"data")&&(M.data=N.data)):(M.message=a(M.code),M.data={originalError:m(y)})}else{M.code=C.code;const N=(B=y)===null||B===void 0?void 0:B.message;M.message=N&&typeof N=="string"?N:C.message,M.data={originalError:m(y)}}const T=(O=y)===null||O===void 0?void 0:O.stack;return x&&y&&T&&typeof T=="string"&&(M.stack=T),M}e.serializeError=d;function h(y){return y>=-32099&&y<=-32e3}function m(y){return y&&typeof y=="object"&&!Array.isArray(y)?Object.assign({},y):y}function R(y,C){return Object.prototype.hasOwnProperty.call(y,C)}})(Eo);var Ki={};Object.defineProperty(Ki,"__esModule",{value:!0});Ki.ethErrors=void 0;const So=Dt,Yl=Eo,Qe=Ft;Ki.ethErrors={rpc:{parse:e=>lt(Qe.errorCodes.rpc.parse,e),invalidRequest:e=>lt(Qe.errorCodes.rpc.invalidRequest,e),invalidParams:e=>lt(Qe.errorCodes.rpc.invalidParams,e),methodNotFound:e=>lt(Qe.errorCodes.rpc.methodNotFound,e),internal:e=>lt(Qe.errorCodes.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 lt(t,e)},invalidInput:e=>lt(Qe.errorCodes.rpc.invalidInput,e),resourceNotFound:e=>lt(Qe.errorCodes.rpc.resourceNotFound,e),resourceUnavailable:e=>lt(Qe.errorCodes.rpc.resourceUnavailable,e),transactionRejected:e=>lt(Qe.errorCodes.rpc.transactionRejected,e),methodNotSupported:e=>lt(Qe.errorCodes.rpc.methodNotSupported,e),limitExceeded:e=>lt(Qe.errorCodes.rpc.limitExceeded,e)},provider:{userRejectedRequest:e=>cn(Qe.errorCodes.provider.userRejectedRequest,e),unauthorized:e=>cn(Qe.errorCodes.provider.unauthorized,e),unsupportedMethod:e=>cn(Qe.errorCodes.provider.unsupportedMethod,e),disconnected:e=>cn(Qe.errorCodes.provider.disconnected,e),chainDisconnected:e=>cn(Qe.errorCodes.provider.chainDisconnected,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:r,data:n}=e;if(!r||typeof r!="string")throw new Error('"message" must be a nonempty string');return new So.EthereumProviderError(t,r,n)}}};function lt(e,t){const[r,n]=Xl(t);return new So.EthereumRpcError(e,r||Yl.getMessageFromCode(e),n)}function cn(e,t){const[r,n]=Xl(t);return new So.EthereumProviderError(e,r||Yl.getMessageFromCode(e),n)}function Xl(e){if(e){if(typeof e=="string")return[e];if(typeof e=="object"&&!Array.isArray(e)){const{message:t,data:r}=e;if(t&&typeof t!="string")throw new Error("Must specify string message.");return[t||void 0,r]}}return[]}(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.getMessageFromCode=e.serializeError=e.EthereumProviderError=e.EthereumRpcError=e.ethErrors=e.errorCodes=void 0;const t=Dt;Object.defineProperty(e,"EthereumRpcError",{enumerable:!0,get:function(){return t.EthereumRpcError}}),Object.defineProperty(e,"EthereumProviderError",{enumerable:!0,get:function(){return t.EthereumProviderError}});const r=Eo;Object.defineProperty(e,"serializeError",{enumerable:!0,get:function(){return r.serializeError}}),Object.defineProperty(e,"getMessageFromCode",{enumerable:!0,get:function(){return r.getMessageFromCode}});const n=Ki;Object.defineProperty(e,"ethErrors",{enumerable:!0,get:function(){return n.ethErrors}});const i=Ft;Object.defineProperty(e,"errorCodes",{enumerable:!0,get:function(){return i.errorCodes}})})(ql);var Zm=Q&&Q.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Bn,"__esModule",{value:!0});Bn.JsonRpcEngine=void 0;const Km=Zm(yo),ut=ql;class At extends Km.default{constructor(){super(),this._middleware=[]}push(t){this._middleware.push(t)}handle(t,r){if(r&&typeof r!="function")throw new Error('"callback" must be a function if provided.');return Array.isArray(t)?r?this._handleBatch(t,r):this._handleBatch(t):r?this._handle(t,r):this._promiseHandle(t)}asMiddleware(){return async(t,r,n,i)=>{try{const[s,a,l]=await At._runAllMiddleware(t,r,this._middleware);return a?(await At._runReturnHandlers(l),i(s)):n(async d=>{try{await At._runReturnHandlers(l)}catch(h){return d(h)}return d()})}catch(s){return i(s)}}}async _handleBatch(t,r){try{const n=await Promise.all(t.map(this._promiseHandle.bind(this)));return r?r(null,n):n}catch(n){if(r)return r(n);throw n}}_promiseHandle(t){return new Promise(r=>{this._handle(t,(n,i)=>{r(i)})})}async _handle(t,r){if(!t||Array.isArray(t)||typeof t!="object"){const a=new ut.EthereumRpcError(ut.errorCodes.rpc.invalidRequest,`Requests must be plain objects. Received: ${typeof t}`,{request:t});return r(a,{id:void 0,jsonrpc:"2.0",error:a})}if(typeof t.method!="string"){const a=new ut.EthereumRpcError(ut.errorCodes.rpc.invalidRequest,`Must specify a string method. Received: ${typeof t.method}`,{request:t});return r(a,{id:t.id,jsonrpc:"2.0",error:a})}const n=Object.assign({},t),i={id:n.id,jsonrpc:n.jsonrpc};let s=null;try{await this._processRequest(n,i)}catch(a){s=a}return s&&(delete i.result,i.error||(i.error=ut.serializeError(s))),r(s,i)}async _processRequest(t,r){const[n,i,s]=await At._runAllMiddleware(t,r,this._middleware);if(At._checkForCompletion(t,r,i),await At._runReturnHandlers(s),n)throw n}static async _runAllMiddleware(t,r,n){const i=[];let s=null,a=!1;for(const l of n)if([s,a]=await At._runMiddleware(t,r,l,i),a)break;return[s,a,i.reverse()]}static _runMiddleware(t,r,n,i){return new Promise(s=>{const a=d=>{const h=d||r.error;h&&(r.error=ut.serializeError(h)),s([h,!0])},l=d=>{r.error?a(r.error):(d&&(typeof d!="function"&&a(new ut.EthereumRpcError(ut.errorCodes.rpc.internal,`JsonRpcEngine: "next" return handlers must be functions. Received "${typeof d}" for request: diff --git a/buddybook/assets/index-BhswOEW5.js b/buddybook/assets/index-DOzQxzSO.js similarity index 99% rename from buddybook/assets/index-BhswOEW5.js rename to buddybook/assets/index-DOzQxzSO.js index cf2d19a..76bd215 100644 --- a/buddybook/assets/index-BhswOEW5.js +++ b/buddybook/assets/index-DOzQxzSO.js @@ -1,4 +1,4 @@ -import{T as $t,M as re,R as N,E as k,C as $,a as X,b as Bo,O as Z,c as ht}from"./index-C91wHTLi.js";import{C as Wo}from"./index-Cye4tEiE.js";class Uo{setAnimation(t){this.animation=t,t==null||t.finished.then(()=>this.clearAnimation()).catch(()=>{})}clearAnimation(){this.animation=this.generator=void 0}}function jo(e,t){e.indexOf(t)===-1&&e.push(t)}const Gr=(e,t,r)=>Math.min(Math.max(r,e),t),V={duration:.3,delay:0,endDelay:0,repeat:0,easing:"ease"},ne=e=>typeof e=="number",bt=e=>Array.isArray(e)&&!ne(e[0]),ko=(e,t,r)=>{const n=t-e;return((r-e)%n+n)%n+e};function Ho(e,t){return bt(e)?e[ko(0,e.length,t)]:e}const Jr=(e,t,r)=>-r*e+r*t+e,Qr=()=>{},et=e=>e,ur=(e,t,r)=>t-e===0?1:(r-e)/(t-e);function Xr(e,t){const r=e[e.length-1];for(let n=1;n<=t;n++){const o=ur(0,t,n);e.push(Jr(r,1,o))}}function zo(e){const t=[0];return Xr(t,e-1),t}function Fo(e,t=zo(e.length),r=et){const n=e.length,o=n-t.length;return o>0&&Xr(t,o),i=>{let s=0;for(;sArray.isArray(e)&&ne(e[0]),ke=e=>typeof e=="object"&&!!e.createAnimation,xt=e=>typeof e=="function",Vo=e=>typeof e=="string",Nt={ms:e=>e*1e3,s:e=>e/1e3},eo=(e,t,r)=>(((1-3*r+3*t)*e+(3*r-6*t))*e+3*t)*e,Zo=1e-7,Ko=12;function qo(e,t,r,n,o){let i,s,l=0;do s=t+(r-t)/2,i=eo(s,n,o)-e,i>0?r=s:t=s;while(Math.abs(i)>Zo&&++lqo(i,0,1,e,r);return i=>i===0||i===1?i:eo(o(i),t,n)}const Yo=(e,t="end")=>r=>{r=t==="end"?Math.min(r,.999):Math.max(r,.001);const n=r*e,o=t==="end"?Math.floor(n):Math.ceil(n);return Gr(0,1,o/e)},Go={ease:Lt(.25,.1,.25,1),"ease-in":Lt(.42,0,1,1),"ease-in-out":Lt(.42,0,.58,1),"ease-out":Lt(0,0,.58,1)},Jo=/\((.*?)\)/;function Er(e){if(xt(e))return e;if(to(e))return Lt(...e);const t=Go[e];if(t)return t;if(e.startsWith("steps")){const r=Jo.exec(e);if(r){const n=r[1].split(",");return Yo(parseFloat(n[0]),n[1].trim())}}return et}class ro{constructor(t,r=[0,1],{easing:n,duration:o=V.duration,delay:i=V.delay,endDelay:s=V.endDelay,repeat:l=V.repeat,offset:a,direction:c="normal",autoplay:d=!0}={}){if(this.startTime=null,this.rate=1,this.t=0,this.cancelTimestamp=null,this.easing=et,this.duration=0,this.totalDuration=0,this.repeat=0,this.playState="idle",this.finished=new Promise((h,p)=>{this.resolve=h,this.reject=p}),n=n||V.easing,ke(n)){const h=n.createAnimation(r);n=h.easing,r=h.keyframes||r,o=h.duration||o}this.repeat=l,this.easing=bt(n)?et:Er(n),this.updateDuration(o);const y=Fo(r,a,bt(n)?n.map(Er):et);this.tick=h=>{var p;i=i;let g=0;this.pauseTime!==void 0?g=this.pauseTime:g=(h-this.startTime)*this.rate,this.t=g,g/=1e3,g=Math.max(g-i,0),this.playState==="finished"&&this.pauseTime===void 0&&(g=this.totalDuration);const f=g/this.duration;let O=Math.floor(f),m=f%1;!m&&f>=1&&(m=1),m===1&&O--;const b=O%2;(c==="reverse"||c==="alternate"&&b||c==="alternate-reverse"&&!b)&&(m=1-m);const w=g>=this.totalDuration?1:Math.min(m,1),v=y(this.easing(w));t(v),this.pauseTime===void 0&&(this.playState==="finished"||g>=this.totalDuration+s)?(this.playState="finished",(p=this.resolve)===null||p===void 0||p.call(this,v)):this.playState!=="idle"&&(this.frameRequestId=requestAnimationFrame(this.tick))},d&&this.play()}play(){const t=performance.now();this.playState="running",this.pauseTime!==void 0?this.startTime=t-this.pauseTime:this.startTime||(this.startTime=t),this.cancelTimestamp=this.startTime,this.pauseTime=void 0,this.frameRequestId=requestAnimationFrame(this.tick)}pause(){this.playState="paused",this.pauseTime=this.t}finish(){this.playState="finished",this.tick(0)}stop(){var t;this.playState="idle",this.frameRequestId!==void 0&&cancelAnimationFrame(this.frameRequestId),(t=this.reject)===null||t===void 0||t.call(this,!1)}cancel(){this.stop(),this.tick(this.cancelTimestamp)}reverse(){this.rate*=-1}commitStyles(){}updateDuration(t){this.duration=t,this.totalDuration=t*(this.repeat+1)}get currentTime(){return this.t}set currentTime(t){this.pauseTime!==void 0||this.rate===0?this.pauseTime=t:this.startTime=performance.now()-t/this.rate}get playbackRate(){return this.rate}set playbackRate(t){this.rate=t}}/** +import{T as $t,M as re,R as N,E as k,C as $,a as X,b as Bo,O as Z,c as ht}from"./index-Dzj92ueM.js";import{C as Wo}from"./index-uonIXzgQ.js";class Uo{setAnimation(t){this.animation=t,t==null||t.finished.then(()=>this.clearAnimation()).catch(()=>{})}clearAnimation(){this.animation=this.generator=void 0}}function jo(e,t){e.indexOf(t)===-1&&e.push(t)}const Gr=(e,t,r)=>Math.min(Math.max(r,e),t),V={duration:.3,delay:0,endDelay:0,repeat:0,easing:"ease"},ne=e=>typeof e=="number",bt=e=>Array.isArray(e)&&!ne(e[0]),ko=(e,t,r)=>{const n=t-e;return((r-e)%n+n)%n+e};function Ho(e,t){return bt(e)?e[ko(0,e.length,t)]:e}const Jr=(e,t,r)=>-r*e+r*t+e,Qr=()=>{},et=e=>e,ur=(e,t,r)=>t-e===0?1:(r-e)/(t-e);function Xr(e,t){const r=e[e.length-1];for(let n=1;n<=t;n++){const o=ur(0,t,n);e.push(Jr(r,1,o))}}function zo(e){const t=[0];return Xr(t,e-1),t}function Fo(e,t=zo(e.length),r=et){const n=e.length,o=n-t.length;return o>0&&Xr(t,o),i=>{let s=0;for(;sArray.isArray(e)&&ne(e[0]),ke=e=>typeof e=="object"&&!!e.createAnimation,xt=e=>typeof e=="function",Vo=e=>typeof e=="string",Nt={ms:e=>e*1e3,s:e=>e/1e3},eo=(e,t,r)=>(((1-3*r+3*t)*e+(3*r-6*t))*e+3*t)*e,Zo=1e-7,Ko=12;function qo(e,t,r,n,o){let i,s,l=0;do s=t+(r-t)/2,i=eo(s,n,o)-e,i>0?r=s:t=s;while(Math.abs(i)>Zo&&++lqo(i,0,1,e,r);return i=>i===0||i===1?i:eo(o(i),t,n)}const Yo=(e,t="end")=>r=>{r=t==="end"?Math.min(r,.999):Math.max(r,.001);const n=r*e,o=t==="end"?Math.floor(n):Math.ceil(n);return Gr(0,1,o/e)},Go={ease:Lt(.25,.1,.25,1),"ease-in":Lt(.42,0,1,1),"ease-in-out":Lt(.42,0,.58,1),"ease-out":Lt(0,0,.58,1)},Jo=/\((.*?)\)/;function Er(e){if(xt(e))return e;if(to(e))return Lt(...e);const t=Go[e];if(t)return t;if(e.startsWith("steps")){const r=Jo.exec(e);if(r){const n=r[1].split(",");return Yo(parseFloat(n[0]),n[1].trim())}}return et}class ro{constructor(t,r=[0,1],{easing:n,duration:o=V.duration,delay:i=V.delay,endDelay:s=V.endDelay,repeat:l=V.repeat,offset:a,direction:c="normal",autoplay:d=!0}={}){if(this.startTime=null,this.rate=1,this.t=0,this.cancelTimestamp=null,this.easing=et,this.duration=0,this.totalDuration=0,this.repeat=0,this.playState="idle",this.finished=new Promise((h,p)=>{this.resolve=h,this.reject=p}),n=n||V.easing,ke(n)){const h=n.createAnimation(r);n=h.easing,r=h.keyframes||r,o=h.duration||o}this.repeat=l,this.easing=bt(n)?et:Er(n),this.updateDuration(o);const y=Fo(r,a,bt(n)?n.map(Er):et);this.tick=h=>{var p;i=i;let g=0;this.pauseTime!==void 0?g=this.pauseTime:g=(h-this.startTime)*this.rate,this.t=g,g/=1e3,g=Math.max(g-i,0),this.playState==="finished"&&this.pauseTime===void 0&&(g=this.totalDuration);const f=g/this.duration;let O=Math.floor(f),m=f%1;!m&&f>=1&&(m=1),m===1&&O--;const b=O%2;(c==="reverse"||c==="alternate"&&b||c==="alternate-reverse"&&!b)&&(m=1-m);const w=g>=this.totalDuration?1:Math.min(m,1),v=y(this.easing(w));t(v),this.pauseTime===void 0&&(this.playState==="finished"||g>=this.totalDuration+s)?(this.playState="finished",(p=this.resolve)===null||p===void 0||p.call(this,v)):this.playState!=="idle"&&(this.frameRequestId=requestAnimationFrame(this.tick))},d&&this.play()}play(){const t=performance.now();this.playState="running",this.pauseTime!==void 0?this.startTime=t-this.pauseTime:this.startTime||(this.startTime=t),this.cancelTimestamp=this.startTime,this.pauseTime=void 0,this.frameRequestId=requestAnimationFrame(this.tick)}pause(){this.playState="paused",this.pauseTime=this.t}finish(){this.playState="finished",this.tick(0)}stop(){var t;this.playState="idle",this.frameRequestId!==void 0&&cancelAnimationFrame(this.frameRequestId),(t=this.reject)===null||t===void 0||t.call(this,!1)}cancel(){this.stop(),this.tick(this.cancelTimestamp)}reverse(){this.rate*=-1}commitStyles(){}updateDuration(t){this.duration=t,this.totalDuration=t*(this.repeat+1)}get currentTime(){return this.t}set currentTime(t){this.pauseTime!==void 0||this.rate===0?this.pauseTime=t:this.startTime=performance.now()-t/this.rate}get playbackRate(){return this.rate}set playbackRate(t){this.rate=t}}/** * @license * Copyright 2019 Google LLC * SPDX-License-Identifier: BSD-3-Clause diff --git a/buddybook/assets/index-CwoEHhxw.css b/buddybook/assets/index-Dd5JfyyB.css similarity index 54% rename from buddybook/assets/index-CwoEHhxw.css rename to buddybook/assets/index-Dd5JfyyB.css index 3d3edc7..5369935 100644 --- a/buddybook/assets/index-CwoEHhxw.css +++ b/buddybook/assets/index-Dd5JfyyB.css @@ -1 +1 @@ -#root{max-width:1280px;margin:0 auto;padding:2rem;text-align:center}.logo{height:6em;padding:1.5em;will-change:filter;transition:filter .3s}.logo:hover{filter:drop-shadow(0 0 2em #646cffaa)}.logo.react:hover{filter:drop-shadow(0 0 2em #61dafbaa)}@keyframes logo-spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}@media (prefers-reduced-motion: no-preference){a:nth-of-type(2) .logo{animation:logo-spin infinite 20s linear}}.card{padding:2em}.read-the-docs{color:#888}*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content: ""}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]:where(:not([hidden=until-found])){display:none}:root{--background: 0 0% 100%;--foreground: 0 0% 3.9%;--card: 0 0% 100%;--card-foreground: 0 0% 3.9%;--popover: 0 0% 100%;--popover-foreground: 0 0% 3.9%;--primary: 0 0% 9%;--primary-foreground: 0 0% 98%;--secondary: 0 0% 96.1%;--secondary-foreground: 0 0% 9%;--muted: 0 0% 96.1%;--muted-foreground: 0 0% 45.1%;--accent: 0 0% 96.1%;--accent-foreground: 0 0% 9%;--destructive: 0 84.2% 60.2%;--destructive-foreground: 0 0% 98%;--border: 0 0% 89.8%;--input: 0 0% 89.8%;--ring: 0 0% 3.9%;--chart-1: 12 76% 61%;--chart-2: 173 58% 39%;--chart-3: 197 37% 24%;--chart-4: 43 74% 66%;--chart-5: 27 87% 67%;--radius: .5rem}*{border-color:hsl(var(--border))}html{-webkit-tap-highlight-color:transparent}body{background-color:hsl(var(--background));color:hsl(var(--foreground));overscroll-behavior-y:none}button,a{cursor:pointer;touch-action:manipulation}.container{padding-left:1rem;padding-right:1rem}@media (min-width: 768px){.container{padding-left:1.5rem;padding-right:1.5rem}}@media (min-width: 1024px){.container{padding-left:2rem;padding-right:2rem}}h1{font-size:1.5rem;line-height:2rem;font-weight:700}@media (min-width: 768px){h1{font-size:2.25rem;line-height:2.5rem}}h2{font-size:1.25rem;line-height:1.75rem;font-weight:600}@media (min-width: 768px){h2{font-size:1.875rem;line-height:2.25rem}}h3{font-size:1.125rem;line-height:1.75rem;font-weight:600}@media (min-width: 768px){h3{font-size:1.5rem;line-height:2rem}}.container{width:100%}@media (min-width: 640px){.container{max-width:640px}}@media (min-width: 768px){.container{max-width:768px}}@media (min-width: 1024px){.container{max-width:1024px}}@media (min-width: 1280px){.container{max-width:1280px}}@media (min-width: 1536px){.container{max-width:1536px}}.prose{color:var(--tw-prose-body);max-width:65ch}.prose :where(p):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:1.25em;margin-bottom:1.25em}.prose :where([class~=lead]):not(:where([class~=not-prose],[class~=not-prose] *)){color:var(--tw-prose-lead);font-size:1.25em;line-height:1.6;margin-top:1.2em;margin-bottom:1.2em}.prose :where(a):not(:where([class~=not-prose],[class~=not-prose] *)){color:var(--tw-prose-links);text-decoration:underline;font-weight:500}.prose :where(strong):not(:where([class~=not-prose],[class~=not-prose] *)){color:var(--tw-prose-bold);font-weight:600}.prose :where(a strong):not(:where([class~=not-prose],[class~=not-prose] *)){color:inherit}.prose :where(blockquote strong):not(:where([class~=not-prose],[class~=not-prose] *)){color:inherit}.prose :where(thead th strong):not(:where([class~=not-prose],[class~=not-prose] *)){color:inherit}.prose :where(ol):not(:where([class~=not-prose],[class~=not-prose] *)){list-style-type:decimal;margin-top:1.25em;margin-bottom:1.25em;padding-inline-start:1.625em}.prose :where(ol[type=A]):not(:where([class~=not-prose],[class~=not-prose] *)){list-style-type:upper-alpha}.prose :where(ol[type=a]):not(:where([class~=not-prose],[class~=not-prose] *)){list-style-type:lower-alpha}.prose :where(ol[type=A s]):not(:where([class~=not-prose],[class~=not-prose] *)){list-style-type:upper-alpha}.prose :where(ol[type=a s]):not(:where([class~=not-prose],[class~=not-prose] *)){list-style-type:lower-alpha}.prose :where(ol[type=I]):not(:where([class~=not-prose],[class~=not-prose] *)){list-style-type:upper-roman}.prose :where(ol[type=i]):not(:where([class~=not-prose],[class~=not-prose] *)){list-style-type:lower-roman}.prose :where(ol[type=I s]):not(:where([class~=not-prose],[class~=not-prose] *)){list-style-type:upper-roman}.prose :where(ol[type=i s]):not(:where([class~=not-prose],[class~=not-prose] *)){list-style-type:lower-roman}.prose :where(ol[type="1"]):not(:where([class~=not-prose],[class~=not-prose] *)){list-style-type:decimal}.prose :where(ul):not(:where([class~=not-prose],[class~=not-prose] *)){list-style-type:disc;margin-top:1.25em;margin-bottom:1.25em;padding-inline-start:1.625em}.prose :where(ol>li):not(:where([class~=not-prose],[class~=not-prose] *))::marker{font-weight:400;color:var(--tw-prose-counters)}.prose :where(ul>li):not(:where([class~=not-prose],[class~=not-prose] *))::marker{color:var(--tw-prose-bullets)}.prose :where(dt):not(:where([class~=not-prose],[class~=not-prose] *)){color:var(--tw-prose-headings);font-weight:600;margin-top:1.25em}.prose :where(hr):not(:where([class~=not-prose],[class~=not-prose] *)){border-color:var(--tw-prose-hr);border-top-width:1px;margin-top:3em;margin-bottom:3em}.prose :where(blockquote):not(:where([class~=not-prose],[class~=not-prose] *)){font-weight:500;font-style:italic;color:var(--tw-prose-quotes);border-inline-start-width:.25rem;border-inline-start-color:var(--tw-prose-quote-borders);quotes:"“""”""‘""’";margin-top:1.6em;margin-bottom:1.6em;padding-inline-start:1em}.prose :where(blockquote p:first-of-type):not(:where([class~=not-prose],[class~=not-prose] *)):before{content:open-quote}.prose :where(blockquote p:last-of-type):not(:where([class~=not-prose],[class~=not-prose] *)):after{content:close-quote}.prose :where(h1):not(:where([class~=not-prose],[class~=not-prose] *)){color:var(--tw-prose-headings);font-weight:800;font-size:2.25em;margin-top:0;margin-bottom:.8888889em;line-height:1.1111111}.prose :where(h1 strong):not(:where([class~=not-prose],[class~=not-prose] *)){font-weight:900;color:inherit}.prose :where(h2):not(:where([class~=not-prose],[class~=not-prose] *)){color:var(--tw-prose-headings);font-weight:700;font-size:1.5em;margin-top:2em;margin-bottom:1em;line-height:1.3333333}.prose :where(h2 strong):not(:where([class~=not-prose],[class~=not-prose] *)){font-weight:800;color:inherit}.prose :where(h3):not(:where([class~=not-prose],[class~=not-prose] *)){color:var(--tw-prose-headings);font-weight:600;font-size:1.25em;margin-top:1.6em;margin-bottom:.6em;line-height:1.6}.prose :where(h3 strong):not(:where([class~=not-prose],[class~=not-prose] *)){font-weight:700;color:inherit}.prose :where(h4):not(:where([class~=not-prose],[class~=not-prose] *)){color:var(--tw-prose-headings);font-weight:600;margin-top:1.5em;margin-bottom:.5em;line-height:1.5}.prose :where(h4 strong):not(:where([class~=not-prose],[class~=not-prose] *)){font-weight:700;color:inherit}.prose :where(img):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:2em;margin-bottom:2em}.prose :where(picture):not(:where([class~=not-prose],[class~=not-prose] *)){display:block;margin-top:2em;margin-bottom:2em}.prose :where(video):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:2em;margin-bottom:2em}.prose :where(kbd):not(:where([class~=not-prose],[class~=not-prose] *)){font-weight:500;font-family:inherit;color:var(--tw-prose-kbd);box-shadow:0 0 0 1px rgb(var(--tw-prose-kbd-shadows) / 10%),0 3px rgb(var(--tw-prose-kbd-shadows) / 10%);font-size:.875em;border-radius:.3125rem;padding-top:.1875em;padding-inline-end:.375em;padding-bottom:.1875em;padding-inline-start:.375em}.prose :where(code):not(:where([class~=not-prose],[class~=not-prose] *)){color:var(--tw-prose-code);font-weight:600;font-size:.875em}.prose :where(code):not(:where([class~=not-prose],[class~=not-prose] *)):before{content:"`"}.prose :where(code):not(:where([class~=not-prose],[class~=not-prose] *)):after{content:"`"}.prose :where(a code):not(:where([class~=not-prose],[class~=not-prose] *)){color:inherit}.prose :where(h1 code):not(:where([class~=not-prose],[class~=not-prose] *)){color:inherit}.prose :where(h2 code):not(:where([class~=not-prose],[class~=not-prose] *)){color:inherit;font-size:.875em}.prose :where(h3 code):not(:where([class~=not-prose],[class~=not-prose] *)){color:inherit;font-size:.9em}.prose :where(h4 code):not(:where([class~=not-prose],[class~=not-prose] *)){color:inherit}.prose :where(blockquote code):not(:where([class~=not-prose],[class~=not-prose] *)){color:inherit}.prose :where(thead th code):not(:where([class~=not-prose],[class~=not-prose] *)){color:inherit}.prose :where(pre):not(:where([class~=not-prose],[class~=not-prose] *)){color:var(--tw-prose-pre-code);background-color:var(--tw-prose-pre-bg);overflow-x:auto;font-weight:400;font-size:.875em;line-height:1.7142857;margin-top:1.7142857em;margin-bottom:1.7142857em;border-radius:.375rem;padding-top:.8571429em;padding-inline-end:1.1428571em;padding-bottom:.8571429em;padding-inline-start:1.1428571em}.prose :where(pre code):not(:where([class~=not-prose],[class~=not-prose] *)){background-color:transparent;border-width:0;border-radius:0;padding:0;font-weight:inherit;color:inherit;font-size:inherit;font-family:inherit;line-height:inherit}.prose :where(pre code):not(:where([class~=not-prose],[class~=not-prose] *)):before{content:none}.prose :where(pre code):not(:where([class~=not-prose],[class~=not-prose] *)):after{content:none}.prose :where(table):not(:where([class~=not-prose],[class~=not-prose] *)){width:100%;table-layout:auto;margin-top:2em;margin-bottom:2em;font-size:.875em;line-height:1.7142857}.prose :where(thead):not(:where([class~=not-prose],[class~=not-prose] *)){border-bottom-width:1px;border-bottom-color:var(--tw-prose-th-borders)}.prose :where(thead th):not(:where([class~=not-prose],[class~=not-prose] *)){color:var(--tw-prose-headings);font-weight:600;vertical-align:bottom;padding-inline-end:.5714286em;padding-bottom:.5714286em;padding-inline-start:.5714286em}.prose :where(tbody tr):not(:where([class~=not-prose],[class~=not-prose] *)){border-bottom-width:1px;border-bottom-color:var(--tw-prose-td-borders)}.prose :where(tbody tr:last-child):not(:where([class~=not-prose],[class~=not-prose] *)){border-bottom-width:0}.prose :where(tbody td):not(:where([class~=not-prose],[class~=not-prose] *)){vertical-align:baseline}.prose :where(tfoot):not(:where([class~=not-prose],[class~=not-prose] *)){border-top-width:1px;border-top-color:var(--tw-prose-th-borders)}.prose :where(tfoot td):not(:where([class~=not-prose],[class~=not-prose] *)){vertical-align:top}.prose :where(th,td):not(:where([class~=not-prose],[class~=not-prose] *)){text-align:start}.prose :where(figure>*):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:0;margin-bottom:0}.prose :where(figcaption):not(:where([class~=not-prose],[class~=not-prose] *)){color:var(--tw-prose-captions);font-size:.875em;line-height:1.4285714;margin-top:.8571429em}.prose{--tw-prose-body: #374151;--tw-prose-headings: #111827;--tw-prose-lead: #4b5563;--tw-prose-links: #111827;--tw-prose-bold: #111827;--tw-prose-counters: #6b7280;--tw-prose-bullets: #d1d5db;--tw-prose-hr: #e5e7eb;--tw-prose-quotes: #111827;--tw-prose-quote-borders: #e5e7eb;--tw-prose-captions: #6b7280;--tw-prose-kbd: #111827;--tw-prose-kbd-shadows: 17 24 39;--tw-prose-code: #111827;--tw-prose-pre-code: #e5e7eb;--tw-prose-pre-bg: #1f2937;--tw-prose-th-borders: #d1d5db;--tw-prose-td-borders: #e5e7eb;--tw-prose-invert-body: #d1d5db;--tw-prose-invert-headings: #fff;--tw-prose-invert-lead: #9ca3af;--tw-prose-invert-links: #fff;--tw-prose-invert-bold: #fff;--tw-prose-invert-counters: #9ca3af;--tw-prose-invert-bullets: #4b5563;--tw-prose-invert-hr: #374151;--tw-prose-invert-quotes: #f3f4f6;--tw-prose-invert-quote-borders: #374151;--tw-prose-invert-captions: #9ca3af;--tw-prose-invert-kbd: #fff;--tw-prose-invert-kbd-shadows: 255 255 255;--tw-prose-invert-code: #fff;--tw-prose-invert-pre-code: #d1d5db;--tw-prose-invert-pre-bg: rgb(0 0 0 / 50%);--tw-prose-invert-th-borders: #4b5563;--tw-prose-invert-td-borders: #374151;font-size:1rem;line-height:1.75}.prose :where(picture>img):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:0;margin-bottom:0}.prose :where(li):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:.5em;margin-bottom:.5em}.prose :where(ol>li):not(:where([class~=not-prose],[class~=not-prose] *)){padding-inline-start:.375em}.prose :where(ul>li):not(:where([class~=not-prose],[class~=not-prose] *)){padding-inline-start:.375em}.prose :where(.prose>ul>li p):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:.75em;margin-bottom:.75em}.prose :where(.prose>ul>li>p:first-child):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:1.25em}.prose :where(.prose>ul>li>p:last-child):not(:where([class~=not-prose],[class~=not-prose] *)){margin-bottom:1.25em}.prose :where(.prose>ol>li>p:first-child):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:1.25em}.prose :where(.prose>ol>li>p:last-child):not(:where([class~=not-prose],[class~=not-prose] *)){margin-bottom:1.25em}.prose :where(ul ul,ul ol,ol ul,ol ol):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:.75em;margin-bottom:.75em}.prose :where(dl):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:1.25em;margin-bottom:1.25em}.prose :where(dd):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:.5em;padding-inline-start:1.625em}.prose :where(hr+*):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:0}.prose :where(h2+*):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:0}.prose :where(h3+*):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:0}.prose :where(h4+*):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:0}.prose :where(thead th:first-child):not(:where([class~=not-prose],[class~=not-prose] *)){padding-inline-start:0}.prose :where(thead th:last-child):not(:where([class~=not-prose],[class~=not-prose] *)){padding-inline-end:0}.prose :where(tbody td,tfoot td):not(:where([class~=not-prose],[class~=not-prose] *)){padding-top:.5714286em;padding-inline-end:.5714286em;padding-bottom:.5714286em;padding-inline-start:.5714286em}.prose :where(tbody td:first-child,tfoot td:first-child):not(:where([class~=not-prose],[class~=not-prose] *)){padding-inline-start:0}.prose :where(tbody td:last-child,tfoot td:last-child):not(:where([class~=not-prose],[class~=not-prose] *)){padding-inline-end:0}.prose :where(figure):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:2em;margin-bottom:2em}.prose :where(.prose>:first-child):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:0}.prose :where(.prose>:last-child):not(:where([class~=not-prose],[class~=not-prose] *)){margin-bottom:0}.fixed{position:fixed}.relative{position:relative}.sticky{position:sticky}.inset-0{top:0;right:0;bottom:0;left:0}.left-\[50\%\]{left:50%}.top-0{top:0}.top-\[50\%\]{top:50%}.z-50{z-index:50}.mx-auto{margin-left:auto;margin-right:auto}.mb-2{margin-bottom:.5rem}.mb-4{margin-bottom:1rem}.ml-2{margin-left:.5rem}.ml-8{margin-left:2rem}.mr-2{margin-right:.5rem}.mr-4{margin-right:1rem}.mt-2{margin-top:.5rem}.mt-4{margin-top:1rem}.\!block{display:block!important}.block{display:block}.flex{display:flex}.inline-flex{display:inline-flex}.grid{display:grid}.hidden{display:none}.h-10{height:2.5rem}.h-14{height:3.5rem}.h-2{height:.5rem}.h-2\.5{height:.625rem}.h-4{height:1rem}.h-6{height:1.5rem}.h-8{height:2rem}.h-9{height:2.25rem}.h-\[50vh\]{height:50vh}.h-full{height:100%}.max-h-\[85vh\]{max-height:85vh}.max-h-\[90vh\]{max-height:90vh}.min-h-\[100px\]{min-height:100px}.min-h-\[44px\]{min-height:44px}.min-h-\[80px\]{min-height:80px}.min-h-screen{min-height:100vh}.w-2{width:.5rem}.w-2\.5{width:.625rem}.w-4{width:1rem}.w-6{width:1.5rem}.w-8{width:2rem}.w-9{width:2.25rem}.w-\[95vw\]{width:95vw}.w-full{width:100%}.max-w-2xl{max-width:42rem}.max-w-4xl{max-width:56rem}.max-w-7xl{max-width:80rem}.max-w-\[300px\]{max-width:300px}.max-w-\[80px\]{max-width:80px}.max-w-\[95vw\]{max-width:95vw}.max-w-md{max-width:28rem}.max-w-none{max-width:none}.max-w-sm{max-width:24rem}.flex-1{flex:1 1 0%}.shrink-0{flex-shrink:0}.flex-grow{flex-grow:1}.translate-x-\[-50\%\]{--tw-translate-x: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-y-\[-50\%\]{--tw-translate-y: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}@keyframes spin{to{transform:rotate(360deg)}}.animate-spin{animation:spin 1s linear infinite}.touch-none{touch-action:none}.touch-manipulation{touch-action:manipulation}.select-none{-webkit-user-select:none;-moz-user-select:none;user-select:none}.resize-y{resize:vertical}.flex-col{flex-direction:column}.flex-col-reverse{flex-direction:column-reverse}.items-start{align-items:flex-start}.items-center{align-items:center}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.gap-2{gap:.5rem}.gap-3{gap:.75rem}.gap-4{gap:1rem}.space-x-1>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(.25rem * var(--tw-space-x-reverse));margin-left:calc(.25rem * calc(1 - var(--tw-space-x-reverse)))}.space-x-2>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(.5rem * var(--tw-space-x-reverse));margin-left:calc(.5rem * calc(1 - var(--tw-space-x-reverse)))}.space-y-1\.5>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.375rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.375rem * var(--tw-space-y-reverse))}.space-y-2>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.5rem * var(--tw-space-y-reverse))}.space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1rem * var(--tw-space-y-reverse))}.space-y-6>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.5rem * var(--tw-space-y-reverse))}.overflow-hidden{overflow:hidden}.overflow-y-auto{overflow-y:auto}.truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.whitespace-nowrap{white-space:nowrap}.break-all{word-break:break-all}.rounded-\[inherit\]{border-radius:inherit}.rounded-full{border-radius:9999px}.rounded-lg{border-radius:var(--radius)}.rounded-md{border-radius:calc(var(--radius) - 2px)}.border{border-width:1px}.border-b{border-bottom-width:1px}.border-b-2{border-bottom-width:2px}.border-l{border-left-width:1px}.border-l-2{border-left-width:2px}.border-t{border-top-width:1px}.border-gray-300{--tw-border-opacity: 1;border-color:rgb(209 213 219 / var(--tw-border-opacity))}.border-input{border-color:hsl(var(--input))}.border-l-transparent{border-left-color:transparent}.border-t-transparent{border-top-color:transparent}.bg-background{background-color:hsl(var(--background))}.bg-background\/95{background-color:hsl(var(--background) / .95)}.bg-black\/80{background-color:#000c}.bg-border{background-color:hsl(var(--border))}.bg-card{background-color:hsl(var(--card))}.bg-destructive{background-color:hsl(var(--destructive))}.bg-green-500{--tw-bg-opacity: 1;background-color:rgb(34 197 94 / var(--tw-bg-opacity))}.bg-muted{background-color:hsl(var(--muted))}.bg-primary{background-color:hsl(var(--primary))}.bg-red-500{--tw-bg-opacity: 1;background-color:rgb(239 68 68 / var(--tw-bg-opacity))}.bg-secondary{background-color:hsl(var(--secondary))}.bg-transparent{background-color:transparent}.bg-yellow-500{--tw-bg-opacity: 1;background-color:rgb(234 179 8 / var(--tw-bg-opacity))}.p-2{padding:.5rem}.p-4{padding:1rem}.p-6{padding:1.5rem}.p-\[1px\]{padding:1px}.px-0{padding-left:0;padding-right:0}.px-3{padding-left:.75rem;padding-right:.75rem}.px-4{padding-left:1rem;padding-right:1rem}.px-8{padding-left:2rem;padding-right:2rem}.py-16{padding-top:4rem;padding-bottom:4rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.py-4{padding-top:1rem;padding-bottom:1rem}.py-6{padding-top:1.5rem;padding-bottom:1.5rem}.py-8{padding-top:2rem;padding-bottom:2rem}.pt-0{padding-top:0}.text-center{text-align:center}.text-2xl{font-size:1.5rem;line-height:2rem}.text-base{font-size:1rem;line-height:1.5rem}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xl{font-size:1.25rem;line-height:1.75rem}.text-xs{font-size:.75rem;line-height:1rem}.font-bold{font-weight:700}.font-medium{font-weight:500}.font-normal{font-weight:400}.font-semibold{font-weight:600}.leading-none{line-height:1}.tracking-tight{letter-spacing:-.025em}.text-card-foreground{color:hsl(var(--card-foreground))}.text-destructive{color:hsl(var(--destructive))}.text-destructive-foreground{color:hsl(var(--destructive-foreground))}.text-foreground{color:hsl(var(--foreground))}.text-muted-foreground{color:hsl(var(--muted-foreground))}.text-primary{color:hsl(var(--primary))}.text-primary-foreground{color:hsl(var(--primary-foreground))}.text-red-500{--tw-text-opacity: 1;color:rgb(239 68 68 / var(--tw-text-opacity))}.text-secondary-foreground{color:hsl(var(--secondary-foreground))}.underline-offset-4{text-underline-offset:4px}.shadow{--tw-shadow: 0 1px 3px 0 rgb(0 0 0 / .1), 0 1px 2px -1px rgb(0 0 0 / .1);--tw-shadow-colored: 0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-lg{--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-md{--tw-shadow: 0 4px 6px -1px rgb(0 0 0 / .1), 0 2px 4px -2px rgb(0 0 0 / .1);--tw-shadow-colored: 0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-sm{--tw-shadow: 0 1px 2px 0 rgb(0 0 0 / .05);--tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.outline{outline-style:solid}.ring-offset-background{--tw-ring-offset-color: hsl(var(--background))}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.backdrop-blur{--tw-backdrop-blur: blur(8px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.backdrop-filter{-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.transition-colors{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.duration-200{transition-duration:.2s}@keyframes enter{0%{opacity:var(--tw-enter-opacity, 1);transform:translate3d(var(--tw-enter-translate-x, 0),var(--tw-enter-translate-y, 0),0) scale3d(var(--tw-enter-scale, 1),var(--tw-enter-scale, 1),var(--tw-enter-scale, 1)) rotate(var(--tw-enter-rotate, 0))}}@keyframes exit{to{opacity:var(--tw-exit-opacity, 1);transform:translate3d(var(--tw-exit-translate-x, 0),var(--tw-exit-translate-y, 0),0) scale3d(var(--tw-exit-scale, 1),var(--tw-exit-scale, 1),var(--tw-exit-scale, 1)) rotate(var(--tw-exit-rotate, 0))}}.duration-200{animation-duration:.2s}.dark\:prose-invert:is(.dark *){--tw-prose-body: var(--tw-prose-invert-body);--tw-prose-headings: var(--tw-prose-invert-headings);--tw-prose-lead: var(--tw-prose-invert-lead);--tw-prose-links: var(--tw-prose-invert-links);--tw-prose-bold: var(--tw-prose-invert-bold);--tw-prose-counters: var(--tw-prose-invert-counters);--tw-prose-bullets: var(--tw-prose-invert-bullets);--tw-prose-hr: var(--tw-prose-invert-hr);--tw-prose-quotes: var(--tw-prose-invert-quotes);--tw-prose-quote-borders: var(--tw-prose-invert-quote-borders);--tw-prose-captions: var(--tw-prose-invert-captions);--tw-prose-kbd: var(--tw-prose-invert-kbd);--tw-prose-kbd-shadows: var(--tw-prose-invert-kbd-shadows);--tw-prose-code: var(--tw-prose-invert-code);--tw-prose-pre-code: var(--tw-prose-invert-pre-code);--tw-prose-pre-bg: var(--tw-prose-invert-pre-bg);--tw-prose-th-borders: var(--tw-prose-invert-th-borders);--tw-prose-td-borders: var(--tw-prose-invert-td-borders)}.file\:border-0::file-selector-button{border-width:0px}.file\:bg-transparent::file-selector-button{background-color:transparent}.file\:text-sm::file-selector-button{font-size:.875rem;line-height:1.25rem}.file\:font-medium::file-selector-button{font-weight:500}.placeholder\:text-muted-foreground::-moz-placeholder{color:hsl(var(--muted-foreground))}.placeholder\:text-muted-foreground::placeholder{color:hsl(var(--muted-foreground))}.hover\:bg-accent:hover{background-color:hsl(var(--accent))}.hover\:bg-destructive\/90:hover{background-color:hsl(var(--destructive) / .9)}.hover\:bg-primary\/90:hover{background-color:hsl(var(--primary) / .9)}.hover\:bg-secondary\/80:hover{background-color:hsl(var(--secondary) / .8)}.hover\:text-accent-foreground:hover{color:hsl(var(--accent-foreground))}.hover\:underline:hover{text-decoration-line:underline}.focus-visible\:outline-none:focus-visible{outline:2px solid transparent;outline-offset:2px}.focus-visible\:ring-1:focus-visible{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus-visible\:ring-2:focus-visible{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus-visible\:ring-ring:focus-visible{--tw-ring-color: hsl(var(--ring))}.focus-visible\:ring-offset-2:focus-visible{--tw-ring-offset-width: 2px}.disabled\:pointer-events-none:disabled{pointer-events:none}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:opacity-50:disabled{opacity:.5}.peer:disabled~.peer-disabled\:cursor-not-allowed{cursor:not-allowed}.peer:disabled~.peer-disabled\:opacity-70{opacity:.7}.data-\[state\=open\]\:animate-in[data-state=open]{animation-name:enter;animation-duration:.15s;--tw-enter-opacity: initial;--tw-enter-scale: initial;--tw-enter-rotate: initial;--tw-enter-translate-x: initial;--tw-enter-translate-y: initial}.data-\[state\=closed\]\:animate-out[data-state=closed]{animation-name:exit;animation-duration:.15s;--tw-exit-opacity: initial;--tw-exit-scale: initial;--tw-exit-rotate: initial;--tw-exit-translate-x: initial;--tw-exit-translate-y: initial}.data-\[state\=closed\]\:fade-out-0[data-state=closed]{--tw-exit-opacity: 0}.data-\[state\=open\]\:fade-in-0[data-state=open]{--tw-enter-opacity: 0}@supports ((-webkit-backdrop-filter: var(--tw)) or (backdrop-filter: var(--tw))){.supports-\[backdrop-filter\]\:bg-background\/60{background-color:hsl(var(--background) / .6)}}@media (min-width: 640px){.sm\:h-\[60vh\]{height:60vh}.sm\:w-auto{width:auto}.sm\:max-w-md{max-width:28rem}.sm\:flex-row{flex-direction:row}.sm\:items-center{align-items:center}.sm\:justify-start{justify-content:flex-start}.sm\:justify-end{justify-content:flex-end}.sm\:justify-between{justify-content:space-between}.sm\:gap-4{gap:1rem}.sm\:space-x-2>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(.5rem * var(--tw-space-x-reverse));margin-left:calc(.5rem * calc(1 - var(--tw-space-x-reverse)))}.sm\:space-y-8>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(2rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(2rem * var(--tw-space-y-reverse))}.sm\:p-4{padding:1rem}.sm\:p-6{padding:1.5rem}.sm\:py-2{padding-top:.5rem;padding-bottom:.5rem}.sm\:text-left{text-align:left}.sm\:text-2xl{font-size:1.5rem;line-height:2rem}.sm\:text-3xl{font-size:1.875rem;line-height:2.25rem}.sm\:text-base{font-size:1rem;line-height:1.5rem}.sm\:text-sm{font-size:.875rem;line-height:1.25rem}.sm\:text-xl{font-size:1.25rem;line-height:1.75rem}}@media (min-width: 768px){.md\:inline{display:inline}.md\:flex{display:flex}.md\:hidden{display:none}.md\:h-3{height:.75rem}.md\:min-h-\[36px\]{min-height:36px}.md\:w-3{width:.75rem}.md\:max-w-\[120px\]{max-width:120px}.md\:gap-4{gap:1rem}.md\:space-y-6>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.5rem * var(--tw-space-y-reverse))}.md\:p-6{padding:1.5rem}.md\:px-3{padding-left:.75rem;padding-right:.75rem}.md\:py-1\.5{padding-top:.375rem;padding-bottom:.375rem}.md\:py-8{padding-top:2rem;padding-bottom:2rem}.md\:text-4xl{font-size:2.25rem;line-height:2.5rem}.md\:text-base{font-size:1rem;line-height:1.5rem}.md\:text-sm{font-size:.875rem;line-height:1.25rem}}.\[\&_svg\]\:pointer-events-none svg{pointer-events:none}.\[\&_svg\]\:size-4 svg{width:1rem;height:1rem}.\[\&_svg\]\:shrink-0 svg{flex-shrink:0} +#root{max-width:1280px;margin:0 auto;padding:2rem;text-align:center}.logo{height:6em;padding:1.5em;will-change:filter;transition:filter .3s}.logo:hover{filter:drop-shadow(0 0 2em #646cffaa)}.logo.react:hover{filter:drop-shadow(0 0 2em #61dafbaa)}@keyframes logo-spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}@media (prefers-reduced-motion: no-preference){a:nth-of-type(2) .logo{animation:logo-spin infinite 20s linear}}.card{padding:2em}.read-the-docs{color:#888}*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:#e5e7eb}:before,:after{--tw-content: ""}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]:where(:not([hidden=until-found])){display:none}:root{--background: 0 0% 100%;--foreground: 0 0% 3.9%;--card: 0 0% 100%;--card-foreground: 0 0% 3.9%;--popover: 0 0% 100%;--popover-foreground: 0 0% 3.9%;--primary: 0 0% 9%;--primary-foreground: 0 0% 98%;--secondary: 0 0% 96.1%;--secondary-foreground: 0 0% 9%;--muted: 0 0% 96.1%;--muted-foreground: 0 0% 45.1%;--accent: 0 0% 96.1%;--accent-foreground: 0 0% 9%;--destructive: 0 84.2% 60.2%;--destructive-foreground: 0 0% 98%;--border: 0 0% 89.8%;--input: 0 0% 89.8%;--ring: 0 0% 3.9%;--chart-1: 12 76% 61%;--chart-2: 173 58% 39%;--chart-3: 197 37% 24%;--chart-4: 43 74% 66%;--chart-5: 27 87% 67%;--radius: .5rem}*{border-color:hsl(var(--border))}html{-webkit-tap-highlight-color:transparent}body{background-color:hsl(var(--background));color:hsl(var(--foreground));overscroll-behavior-y:none}button,a{cursor:pointer;touch-action:manipulation}.container{padding-left:1rem;padding-right:1rem}@media (min-width: 768px){.container{padding-left:1.5rem;padding-right:1.5rem}}@media (min-width: 1024px){.container{padding-left:2rem;padding-right:2rem}}h1{font-size:1.5rem;line-height:2rem;font-weight:700}@media (min-width: 768px){h1{font-size:2.25rem;line-height:2.5rem}}h2{font-size:1.25rem;line-height:1.75rem;font-weight:600}@media (min-width: 768px){h2{font-size:1.875rem;line-height:2.25rem}}h3{font-size:1.125rem;line-height:1.75rem;font-weight:600}@media (min-width: 768px){h3{font-size:1.5rem;line-height:2rem}}.container{width:100%}@media (min-width: 640px){.container{max-width:640px}}@media (min-width: 768px){.container{max-width:768px}}@media (min-width: 1024px){.container{max-width:1024px}}@media (min-width: 1280px){.container{max-width:1280px}}@media (min-width: 1536px){.container{max-width:1536px}}.prose{color:var(--tw-prose-body);max-width:65ch}.prose :where(p):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:1.25em;margin-bottom:1.25em}.prose :where([class~=lead]):not(:where([class~=not-prose],[class~=not-prose] *)){color:var(--tw-prose-lead);font-size:1.25em;line-height:1.6;margin-top:1.2em;margin-bottom:1.2em}.prose :where(a):not(:where([class~=not-prose],[class~=not-prose] *)){color:var(--tw-prose-links);text-decoration:underline;font-weight:500}.prose :where(strong):not(:where([class~=not-prose],[class~=not-prose] *)){color:var(--tw-prose-bold);font-weight:600}.prose :where(a strong):not(:where([class~=not-prose],[class~=not-prose] *)){color:inherit}.prose :where(blockquote strong):not(:where([class~=not-prose],[class~=not-prose] *)){color:inherit}.prose :where(thead th strong):not(:where([class~=not-prose],[class~=not-prose] *)){color:inherit}.prose :where(ol):not(:where([class~=not-prose],[class~=not-prose] *)){list-style-type:decimal;margin-top:1.25em;margin-bottom:1.25em;padding-inline-start:1.625em}.prose :where(ol[type=A]):not(:where([class~=not-prose],[class~=not-prose] *)){list-style-type:upper-alpha}.prose :where(ol[type=a]):not(:where([class~=not-prose],[class~=not-prose] *)){list-style-type:lower-alpha}.prose :where(ol[type=A s]):not(:where([class~=not-prose],[class~=not-prose] *)){list-style-type:upper-alpha}.prose :where(ol[type=a s]):not(:where([class~=not-prose],[class~=not-prose] *)){list-style-type:lower-alpha}.prose :where(ol[type=I]):not(:where([class~=not-prose],[class~=not-prose] *)){list-style-type:upper-roman}.prose :where(ol[type=i]):not(:where([class~=not-prose],[class~=not-prose] *)){list-style-type:lower-roman}.prose :where(ol[type=I s]):not(:where([class~=not-prose],[class~=not-prose] *)){list-style-type:upper-roman}.prose :where(ol[type=i s]):not(:where([class~=not-prose],[class~=not-prose] *)){list-style-type:lower-roman}.prose :where(ol[type="1"]):not(:where([class~=not-prose],[class~=not-prose] *)){list-style-type:decimal}.prose :where(ul):not(:where([class~=not-prose],[class~=not-prose] *)){list-style-type:disc;margin-top:1.25em;margin-bottom:1.25em;padding-inline-start:1.625em}.prose :where(ol>li):not(:where([class~=not-prose],[class~=not-prose] *))::marker{font-weight:400;color:var(--tw-prose-counters)}.prose :where(ul>li):not(:where([class~=not-prose],[class~=not-prose] *))::marker{color:var(--tw-prose-bullets)}.prose :where(dt):not(:where([class~=not-prose],[class~=not-prose] *)){color:var(--tw-prose-headings);font-weight:600;margin-top:1.25em}.prose :where(hr):not(:where([class~=not-prose],[class~=not-prose] *)){border-color:var(--tw-prose-hr);border-top-width:1px;margin-top:3em;margin-bottom:3em}.prose :where(blockquote):not(:where([class~=not-prose],[class~=not-prose] *)){font-weight:500;font-style:italic;color:var(--tw-prose-quotes);border-inline-start-width:.25rem;border-inline-start-color:var(--tw-prose-quote-borders);quotes:"“""”""‘""’";margin-top:1.6em;margin-bottom:1.6em;padding-inline-start:1em}.prose :where(blockquote p:first-of-type):not(:where([class~=not-prose],[class~=not-prose] *)):before{content:open-quote}.prose :where(blockquote p:last-of-type):not(:where([class~=not-prose],[class~=not-prose] *)):after{content:close-quote}.prose :where(h1):not(:where([class~=not-prose],[class~=not-prose] *)){color:var(--tw-prose-headings);font-weight:800;font-size:2.25em;margin-top:0;margin-bottom:.8888889em;line-height:1.1111111}.prose :where(h1 strong):not(:where([class~=not-prose],[class~=not-prose] *)){font-weight:900;color:inherit}.prose :where(h2):not(:where([class~=not-prose],[class~=not-prose] *)){color:var(--tw-prose-headings);font-weight:700;font-size:1.5em;margin-top:2em;margin-bottom:1em;line-height:1.3333333}.prose :where(h2 strong):not(:where([class~=not-prose],[class~=not-prose] *)){font-weight:800;color:inherit}.prose :where(h3):not(:where([class~=not-prose],[class~=not-prose] *)){color:var(--tw-prose-headings);font-weight:600;font-size:1.25em;margin-top:1.6em;margin-bottom:.6em;line-height:1.6}.prose :where(h3 strong):not(:where([class~=not-prose],[class~=not-prose] *)){font-weight:700;color:inherit}.prose :where(h4):not(:where([class~=not-prose],[class~=not-prose] *)){color:var(--tw-prose-headings);font-weight:600;margin-top:1.5em;margin-bottom:.5em;line-height:1.5}.prose :where(h4 strong):not(:where([class~=not-prose],[class~=not-prose] *)){font-weight:700;color:inherit}.prose :where(img):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:2em;margin-bottom:2em}.prose :where(picture):not(:where([class~=not-prose],[class~=not-prose] *)){display:block;margin-top:2em;margin-bottom:2em}.prose :where(video):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:2em;margin-bottom:2em}.prose :where(kbd):not(:where([class~=not-prose],[class~=not-prose] *)){font-weight:500;font-family:inherit;color:var(--tw-prose-kbd);box-shadow:0 0 0 1px rgb(var(--tw-prose-kbd-shadows) / 10%),0 3px rgb(var(--tw-prose-kbd-shadows) / 10%);font-size:.875em;border-radius:.3125rem;padding-top:.1875em;padding-inline-end:.375em;padding-bottom:.1875em;padding-inline-start:.375em}.prose :where(code):not(:where([class~=not-prose],[class~=not-prose] *)){color:var(--tw-prose-code);font-weight:600;font-size:.875em}.prose :where(code):not(:where([class~=not-prose],[class~=not-prose] *)):before{content:"`"}.prose :where(code):not(:where([class~=not-prose],[class~=not-prose] *)):after{content:"`"}.prose :where(a code):not(:where([class~=not-prose],[class~=not-prose] *)){color:inherit}.prose :where(h1 code):not(:where([class~=not-prose],[class~=not-prose] *)){color:inherit}.prose :where(h2 code):not(:where([class~=not-prose],[class~=not-prose] *)){color:inherit;font-size:.875em}.prose :where(h3 code):not(:where([class~=not-prose],[class~=not-prose] *)){color:inherit;font-size:.9em}.prose :where(h4 code):not(:where([class~=not-prose],[class~=not-prose] *)){color:inherit}.prose :where(blockquote code):not(:where([class~=not-prose],[class~=not-prose] *)){color:inherit}.prose :where(thead th code):not(:where([class~=not-prose],[class~=not-prose] *)){color:inherit}.prose :where(pre):not(:where([class~=not-prose],[class~=not-prose] *)){color:var(--tw-prose-pre-code);background-color:var(--tw-prose-pre-bg);overflow-x:auto;font-weight:400;font-size:.875em;line-height:1.7142857;margin-top:1.7142857em;margin-bottom:1.7142857em;border-radius:.375rem;padding-top:.8571429em;padding-inline-end:1.1428571em;padding-bottom:.8571429em;padding-inline-start:1.1428571em}.prose :where(pre code):not(:where([class~=not-prose],[class~=not-prose] *)){background-color:transparent;border-width:0;border-radius:0;padding:0;font-weight:inherit;color:inherit;font-size:inherit;font-family:inherit;line-height:inherit}.prose :where(pre code):not(:where([class~=not-prose],[class~=not-prose] *)):before{content:none}.prose :where(pre code):not(:where([class~=not-prose],[class~=not-prose] *)):after{content:none}.prose :where(table):not(:where([class~=not-prose],[class~=not-prose] *)){width:100%;table-layout:auto;margin-top:2em;margin-bottom:2em;font-size:.875em;line-height:1.7142857}.prose :where(thead):not(:where([class~=not-prose],[class~=not-prose] *)){border-bottom-width:1px;border-bottom-color:var(--tw-prose-th-borders)}.prose :where(thead th):not(:where([class~=not-prose],[class~=not-prose] *)){color:var(--tw-prose-headings);font-weight:600;vertical-align:bottom;padding-inline-end:.5714286em;padding-bottom:.5714286em;padding-inline-start:.5714286em}.prose :where(tbody tr):not(:where([class~=not-prose],[class~=not-prose] *)){border-bottom-width:1px;border-bottom-color:var(--tw-prose-td-borders)}.prose :where(tbody tr:last-child):not(:where([class~=not-prose],[class~=not-prose] *)){border-bottom-width:0}.prose :where(tbody td):not(:where([class~=not-prose],[class~=not-prose] *)){vertical-align:baseline}.prose :where(tfoot):not(:where([class~=not-prose],[class~=not-prose] *)){border-top-width:1px;border-top-color:var(--tw-prose-th-borders)}.prose :where(tfoot td):not(:where([class~=not-prose],[class~=not-prose] *)){vertical-align:top}.prose :where(th,td):not(:where([class~=not-prose],[class~=not-prose] *)){text-align:start}.prose :where(figure>*):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:0;margin-bottom:0}.prose :where(figcaption):not(:where([class~=not-prose],[class~=not-prose] *)){color:var(--tw-prose-captions);font-size:.875em;line-height:1.4285714;margin-top:.8571429em}.prose{--tw-prose-body: #374151;--tw-prose-headings: #111827;--tw-prose-lead: #4b5563;--tw-prose-links: #111827;--tw-prose-bold: #111827;--tw-prose-counters: #6b7280;--tw-prose-bullets: #d1d5db;--tw-prose-hr: #e5e7eb;--tw-prose-quotes: #111827;--tw-prose-quote-borders: #e5e7eb;--tw-prose-captions: #6b7280;--tw-prose-kbd: #111827;--tw-prose-kbd-shadows: 17 24 39;--tw-prose-code: #111827;--tw-prose-pre-code: #e5e7eb;--tw-prose-pre-bg: #1f2937;--tw-prose-th-borders: #d1d5db;--tw-prose-td-borders: #e5e7eb;--tw-prose-invert-body: #d1d5db;--tw-prose-invert-headings: #fff;--tw-prose-invert-lead: #9ca3af;--tw-prose-invert-links: #fff;--tw-prose-invert-bold: #fff;--tw-prose-invert-counters: #9ca3af;--tw-prose-invert-bullets: #4b5563;--tw-prose-invert-hr: #374151;--tw-prose-invert-quotes: #f3f4f6;--tw-prose-invert-quote-borders: #374151;--tw-prose-invert-captions: #9ca3af;--tw-prose-invert-kbd: #fff;--tw-prose-invert-kbd-shadows: 255 255 255;--tw-prose-invert-code: #fff;--tw-prose-invert-pre-code: #d1d5db;--tw-prose-invert-pre-bg: rgb(0 0 0 / 50%);--tw-prose-invert-th-borders: #4b5563;--tw-prose-invert-td-borders: #374151;font-size:1rem;line-height:1.75}.prose :where(picture>img):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:0;margin-bottom:0}.prose :where(li):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:.5em;margin-bottom:.5em}.prose :where(ol>li):not(:where([class~=not-prose],[class~=not-prose] *)){padding-inline-start:.375em}.prose :where(ul>li):not(:where([class~=not-prose],[class~=not-prose] *)){padding-inline-start:.375em}.prose :where(.prose>ul>li p):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:.75em;margin-bottom:.75em}.prose :where(.prose>ul>li>p:first-child):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:1.25em}.prose :where(.prose>ul>li>p:last-child):not(:where([class~=not-prose],[class~=not-prose] *)){margin-bottom:1.25em}.prose :where(.prose>ol>li>p:first-child):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:1.25em}.prose :where(.prose>ol>li>p:last-child):not(:where([class~=not-prose],[class~=not-prose] *)){margin-bottom:1.25em}.prose :where(ul ul,ul ol,ol ul,ol ol):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:.75em;margin-bottom:.75em}.prose :where(dl):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:1.25em;margin-bottom:1.25em}.prose :where(dd):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:.5em;padding-inline-start:1.625em}.prose :where(hr+*):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:0}.prose :where(h2+*):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:0}.prose :where(h3+*):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:0}.prose :where(h4+*):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:0}.prose :where(thead th:first-child):not(:where([class~=not-prose],[class~=not-prose] *)){padding-inline-start:0}.prose :where(thead th:last-child):not(:where([class~=not-prose],[class~=not-prose] *)){padding-inline-end:0}.prose :where(tbody td,tfoot td):not(:where([class~=not-prose],[class~=not-prose] *)){padding-top:.5714286em;padding-inline-end:.5714286em;padding-bottom:.5714286em;padding-inline-start:.5714286em}.prose :where(tbody td:first-child,tfoot td:first-child):not(:where([class~=not-prose],[class~=not-prose] *)){padding-inline-start:0}.prose :where(tbody td:last-child,tfoot td:last-child):not(:where([class~=not-prose],[class~=not-prose] *)){padding-inline-end:0}.prose :where(figure):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:2em;margin-bottom:2em}.prose :where(.prose>:first-child):not(:where([class~=not-prose],[class~=not-prose] *)){margin-top:0}.prose :where(.prose>:last-child):not(:where([class~=not-prose],[class~=not-prose] *)){margin-bottom:0}.fixed{position:fixed}.relative{position:relative}.sticky{position:sticky}.inset-0{top:0;right:0;bottom:0;left:0}.bottom-0{bottom:0}.bottom-4{bottom:1rem}.left-4{left:1rem}.right-4{right:1rem}.top-0{top:0}.z-50{z-index:50}.mx-auto{margin-left:auto;margin-right:auto}.mb-2{margin-bottom:.5rem}.mb-4{margin-bottom:1rem}.ml-2{margin-left:.5rem}.ml-8{margin-left:2rem}.mr-2{margin-right:.5rem}.mr-4{margin-right:1rem}.mt-1{margin-top:.25rem}.mt-2{margin-top:.5rem}.mt-4{margin-top:1rem}.\!block{display:block!important}.block{display:block}.flex{display:flex}.inline-flex{display:inline-flex}.hidden{display:none}.h-10{height:2.5rem}.h-14{height:3.5rem}.h-2{height:.5rem}.h-2\.5{height:.625rem}.h-4{height:1rem}.h-6{height:1.5rem}.h-8{height:2rem}.h-9{height:2.25rem}.h-\[50vh\]{height:50vh}.h-full{height:100%}.max-h-\[90vh\]{max-height:90vh}.min-h-\[100px\]{min-height:100px}.min-h-\[44px\]{min-height:44px}.min-h-\[80px\]{min-height:80px}.min-h-screen{min-height:100vh}.w-2{width:.5rem}.w-2\.5{width:.625rem}.w-4{width:1rem}.w-6{width:1.5rem}.w-8{width:2rem}.w-9{width:2.25rem}.w-\[95vw\]{width:95vw}.w-full{width:100%}.max-w-2xl{max-width:42rem}.max-w-4xl{max-width:56rem}.max-w-7xl{max-width:80rem}.max-w-\[80px\]{max-width:80px}.max-w-\[95vw\]{max-width:95vw}.max-w-full{max-width:100%}.max-w-md{max-width:28rem}.max-w-none{max-width:none}.max-w-sm{max-width:24rem}.flex-1{flex:1 1 0%}.shrink-0{flex-shrink:0}.flex-grow{flex-grow:1}@keyframes spin{to{transform:rotate(360deg)}}.animate-spin{animation:spin 1s linear infinite}.touch-none{touch-action:none}.touch-manipulation{touch-action:manipulation}.select-none{-webkit-user-select:none;-moz-user-select:none;user-select:none}.resize-y{resize:vertical}.resize{resize:both}.flex-row{flex-direction:row}.flex-col{flex-direction:column}.flex-col-reverse{flex-direction:column-reverse}.items-start{align-items:flex-start}.items-center{align-items:center}.justify-center{justify-content:center}.justify-between{justify-content:space-between}.justify-around{justify-content:space-around}.gap-2{gap:.5rem}.gap-3{gap:.75rem}.gap-4{gap:1rem}.space-x-1>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(.25rem * var(--tw-space-x-reverse));margin-left:calc(.25rem * calc(1 - var(--tw-space-x-reverse)))}.space-x-2>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(.5rem * var(--tw-space-x-reverse));margin-left:calc(.5rem * calc(1 - var(--tw-space-x-reverse)))}.space-y-1\.5>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.375rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.375rem * var(--tw-space-y-reverse))}.space-y-2>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(.5rem * var(--tw-space-y-reverse))}.space-y-4>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1rem * var(--tw-space-y-reverse))}.space-y-6>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.5rem * var(--tw-space-y-reverse))}.overflow-hidden{overflow:hidden}.truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.whitespace-nowrap{white-space:nowrap}.break-all{word-break:break-all}.rounded-\[inherit\]{border-radius:inherit}.rounded-full{border-radius:9999px}.rounded-lg{border-radius:var(--radius)}.rounded-md{border-radius:calc(var(--radius) - 2px)}.rounded-t-lg{border-top-left-radius:var(--radius);border-top-right-radius:var(--radius)}.border{border-width:1px}.border-b{border-bottom-width:1px}.border-b-2{border-bottom-width:2px}.border-l{border-left-width:1px}.border-l-2{border-left-width:2px}.border-t{border-top-width:1px}.border-gray-300{--tw-border-opacity: 1;border-color:rgb(209 213 219 / var(--tw-border-opacity))}.border-input{border-color:hsl(var(--input))}.border-l-transparent{border-left-color:transparent}.border-t-transparent{border-top-color:transparent}.bg-background{background-color:hsl(var(--background))}.bg-background\/80{background-color:hsl(var(--background) / .8)}.bg-background\/95{background-color:hsl(var(--background) / .95)}.bg-black\/80{background-color:#000c}.bg-blue-50{--tw-bg-opacity: 1;background-color:rgb(239 246 255 / var(--tw-bg-opacity))}.bg-border{background-color:hsl(var(--border))}.bg-card{background-color:hsl(var(--card))}.bg-destructive{background-color:hsl(var(--destructive))}.bg-green-500{--tw-bg-opacity: 1;background-color:rgb(34 197 94 / var(--tw-bg-opacity))}.bg-green-500\/10{background-color:#22c55e1a}.bg-muted{background-color:hsl(var(--muted))}.bg-primary{background-color:hsl(var(--primary))}.bg-red-500{--tw-bg-opacity: 1;background-color:rgb(239 68 68 / var(--tw-bg-opacity))}.bg-red-500\/10{background-color:#ef44441a}.bg-secondary{background-color:hsl(var(--secondary))}.bg-transparent{background-color:transparent}.bg-yellow-500{--tw-bg-opacity: 1;background-color:rgb(234 179 8 / var(--tw-bg-opacity))}.bg-yellow-500\/10{background-color:#eab3081a}.p-2{padding:.5rem}.p-4{padding:1rem}.p-6{padding:1.5rem}.p-\[1px\]{padding:1px}.px-0{padding-left:0;padding-right:0}.px-2{padding-left:.5rem;padding-right:.5rem}.px-3{padding-left:.75rem;padding-right:.75rem}.px-4{padding-left:1rem;padding-right:1rem}.px-8{padding-left:2rem;padding-right:2rem}.py-1{padding-top:.25rem;padding-bottom:.25rem}.py-16{padding-top:4rem;padding-bottom:4rem}.py-2{padding-top:.5rem;padding-bottom:.5rem}.py-4{padding-top:1rem;padding-bottom:1rem}.py-6{padding-top:1.5rem;padding-bottom:1.5rem}.py-8{padding-top:2rem;padding-bottom:2rem}.pt-0{padding-top:0}.text-center{text-align:center}.text-2xl{font-size:1.5rem;line-height:2rem}.text-base{font-size:1rem;line-height:1.5rem}.text-lg{font-size:1.125rem;line-height:1.75rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xl{font-size:1.25rem;line-height:1.75rem}.text-xs{font-size:.75rem;line-height:1rem}.font-bold{font-weight:700}.font-medium{font-weight:500}.font-normal{font-weight:400}.font-semibold{font-weight:600}.leading-none{line-height:1}.tracking-tight{letter-spacing:-.025em}.text-blue-600{--tw-text-opacity: 1;color:rgb(37 99 235 / var(--tw-text-opacity))}.text-blue-700{--tw-text-opacity: 1;color:rgb(29 78 216 / var(--tw-text-opacity))}.text-card-foreground{color:hsl(var(--card-foreground))}.text-destructive{color:hsl(var(--destructive))}.text-destructive-foreground{color:hsl(var(--destructive-foreground))}.text-foreground{color:hsl(var(--foreground))}.text-green-500{--tw-text-opacity: 1;color:rgb(34 197 94 / var(--tw-text-opacity))}.text-muted-foreground{color:hsl(var(--muted-foreground))}.text-primary{color:hsl(var(--primary))}.text-primary-foreground{color:hsl(var(--primary-foreground))}.text-red-500{--tw-text-opacity: 1;color:rgb(239 68 68 / var(--tw-text-opacity))}.text-secondary-foreground{color:hsl(var(--secondary-foreground))}.text-yellow-500{--tw-text-opacity: 1;color:rgb(234 179 8 / var(--tw-text-opacity))}.underline-offset-4{text-underline-offset:4px}.shadow{--tw-shadow: 0 1px 3px 0 rgb(0 0 0 / .1), 0 1px 2px -1px rgb(0 0 0 / .1);--tw-shadow-colored: 0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-lg{--tw-shadow: 0 10px 15px -3px rgb(0 0 0 / .1), 0 4px 6px -4px rgb(0 0 0 / .1);--tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-md{--tw-shadow: 0 4px 6px -1px rgb(0 0 0 / .1), 0 2px 4px -2px rgb(0 0 0 / .1);--tw-shadow-colored: 0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-sm{--tw-shadow: 0 1px 2px 0 rgb(0 0 0 / .05);--tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.outline{outline-style:solid}.ring-offset-background{--tw-ring-offset-color: hsl(var(--background))}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.backdrop-blur{--tw-backdrop-blur: blur(8px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.backdrop-blur-sm{--tw-backdrop-blur: blur(4px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.backdrop-filter{-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.transition-colors{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.duration-200{transition-duration:.2s}@keyframes enter{0%{opacity:var(--tw-enter-opacity, 1);transform:translate3d(var(--tw-enter-translate-x, 0),var(--tw-enter-translate-y, 0),0) scale3d(var(--tw-enter-scale, 1),var(--tw-enter-scale, 1),var(--tw-enter-scale, 1)) rotate(var(--tw-enter-rotate, 0))}}@keyframes exit{to{opacity:var(--tw-exit-opacity, 1);transform:translate3d(var(--tw-exit-translate-x, 0),var(--tw-exit-translate-y, 0),0) scale3d(var(--tw-exit-scale, 1),var(--tw-exit-scale, 1),var(--tw-exit-scale, 1)) rotate(var(--tw-exit-rotate, 0))}}.duration-200{animation-duration:.2s}.dark\:prose-invert:is(.dark *){--tw-prose-body: var(--tw-prose-invert-body);--tw-prose-headings: var(--tw-prose-invert-headings);--tw-prose-lead: var(--tw-prose-invert-lead);--tw-prose-links: var(--tw-prose-invert-links);--tw-prose-bold: var(--tw-prose-invert-bold);--tw-prose-counters: var(--tw-prose-invert-counters);--tw-prose-bullets: var(--tw-prose-invert-bullets);--tw-prose-hr: var(--tw-prose-invert-hr);--tw-prose-quotes: var(--tw-prose-invert-quotes);--tw-prose-quote-borders: var(--tw-prose-invert-quote-borders);--tw-prose-captions: var(--tw-prose-invert-captions);--tw-prose-kbd: var(--tw-prose-invert-kbd);--tw-prose-kbd-shadows: var(--tw-prose-invert-kbd-shadows);--tw-prose-code: var(--tw-prose-invert-code);--tw-prose-pre-code: var(--tw-prose-invert-pre-code);--tw-prose-pre-bg: var(--tw-prose-invert-pre-bg);--tw-prose-th-borders: var(--tw-prose-invert-th-borders);--tw-prose-td-borders: var(--tw-prose-invert-td-borders)}.file\:border-0::file-selector-button{border-width:0px}.file\:bg-transparent::file-selector-button{background-color:transparent}.file\:text-sm::file-selector-button{font-size:.875rem;line-height:1.25rem}.file\:font-medium::file-selector-button{font-weight:500}.placeholder\:text-muted-foreground::-moz-placeholder{color:hsl(var(--muted-foreground))}.placeholder\:text-muted-foreground::placeholder{color:hsl(var(--muted-foreground))}.hover\:bg-accent:hover{background-color:hsl(var(--accent))}.hover\:bg-destructive\/90:hover{background-color:hsl(var(--destructive) / .9)}.hover\:bg-primary\/90:hover{background-color:hsl(var(--primary) / .9)}.hover\:bg-secondary\/80:hover{background-color:hsl(var(--secondary) / .8)}.hover\:text-accent-foreground:hover{color:hsl(var(--accent-foreground))}.hover\:underline:hover{text-decoration-line:underline}.focus\:outline-none:focus{outline:2px solid transparent;outline-offset:2px}.focus-visible\:outline-none:focus-visible{outline:2px solid transparent;outline-offset:2px}.focus-visible\:ring-1:focus-visible{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus-visible\:ring-2:focus-visible{--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.focus-visible\:ring-accent:focus-visible{--tw-ring-color: hsl(var(--accent))}.focus-visible\:ring-ring:focus-visible{--tw-ring-color: hsl(var(--ring))}.focus-visible\:ring-offset-2:focus-visible{--tw-ring-offset-width: 2px}.disabled\:pointer-events-none:disabled{pointer-events:none}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:opacity-50:disabled{opacity:.5}.peer:disabled~.peer-disabled\:cursor-not-allowed{cursor:not-allowed}.peer:disabled~.peer-disabled\:opacity-70{opacity:.7}.data-\[state\=open\]\:animate-in[data-state=open]{animation-name:enter;animation-duration:.15s;--tw-enter-opacity: initial;--tw-enter-scale: initial;--tw-enter-rotate: initial;--tw-enter-translate-x: initial;--tw-enter-translate-y: initial}.data-\[state\=closed\]\:animate-out[data-state=closed]{animation-name:exit;animation-duration:.15s;--tw-exit-opacity: initial;--tw-exit-scale: initial;--tw-exit-rotate: initial;--tw-exit-translate-x: initial;--tw-exit-translate-y: initial}.data-\[state\=closed\]\:fade-out-0[data-state=closed]{--tw-exit-opacity: 0}.data-\[state\=open\]\:fade-in-0[data-state=open]{--tw-enter-opacity: 0}@supports ((-webkit-backdrop-filter: var(--tw)) or (backdrop-filter: var(--tw))){.supports-\[backdrop-filter\]\:bg-background\/60{background-color:hsl(var(--background) / .6)}}@media (min-width: 640px){.sm\:h-\[60vh\]{height:60vh}.sm\:w-auto{width:auto}.sm\:max-w-md{max-width:28rem}.sm\:flex-row{flex-direction:row}.sm\:items-center{align-items:center}.sm\:justify-start{justify-content:flex-start}.sm\:justify-end{justify-content:flex-end}.sm\:justify-between{justify-content:space-between}.sm\:gap-4{gap:1rem}.sm\:space-x-2>:not([hidden])~:not([hidden]){--tw-space-x-reverse: 0;margin-right:calc(.5rem * var(--tw-space-x-reverse));margin-left:calc(.5rem * calc(1 - var(--tw-space-x-reverse)))}.sm\:space-y-8>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(2rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(2rem * var(--tw-space-y-reverse))}.sm\:p-4{padding:1rem}.sm\:p-6{padding:1.5rem}.sm\:py-2{padding-top:.5rem;padding-bottom:.5rem}.sm\:text-left{text-align:left}.sm\:text-2xl{font-size:1.5rem;line-height:2rem}.sm\:text-3xl{font-size:1.875rem;line-height:2.25rem}.sm\:text-base{font-size:1rem;line-height:1.5rem}.sm\:text-sm{font-size:.875rem;line-height:1.25rem}.sm\:text-xl{font-size:1.25rem;line-height:1.75rem}}@media (min-width: 768px){.md\:static{position:static}.md\:bottom-auto{bottom:auto}.md\:left-\[50\%\]{left:50%}.md\:left-auto{left:auto}.md\:top-\[50\%\]{top:50%}.md\:z-auto{z-index:auto}.md\:inline{display:inline}.md\:hidden{display:none}.md\:h-3{height:.75rem}.md\:min-h-\[36px\]{min-height:36px}.md\:w-3{width:.75rem}.md\:w-\[calc\(100\%-2rem\)\]{width:calc(100% - 2rem)}.md\:max-w-\[120px\]{max-width:120px}.md\:max-w-lg{max-width:32rem}.md\:translate-x-\[-50\%\]{--tw-translate-x: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.md\:translate-y-\[-50\%\]{--tw-translate-y: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.md\:justify-start{justify-content:flex-start}.md\:gap-4{gap:1rem}.md\:space-y-6>:not([hidden])~:not([hidden]){--tw-space-y-reverse: 0;margin-top:calc(1.5rem * calc(1 - var(--tw-space-y-reverse)));margin-bottom:calc(1.5rem * var(--tw-space-y-reverse))}.md\:rounded-lg{border-radius:var(--radius)}.md\:p-6{padding:1.5rem}.md\:px-3{padding-left:.75rem;padding-right:.75rem}.md\:py-1\.5{padding-top:.375rem;padding-bottom:.375rem}.md\:py-8{padding-top:2rem;padding-bottom:2rem}.md\:text-4xl{font-size:2.25rem;line-height:2.5rem}.md\:text-base{font-size:1rem;line-height:1.5rem}.md\:text-sm{font-size:.875rem;line-height:1.25rem}}.\[\&_svg\]\:pointer-events-none svg{pointer-events:none}.\[\&_svg\]\:size-4 svg{width:1rem;height:1rem}.\[\&_svg\]\:shrink-0 svg{flex-shrink:0} diff --git a/buddybook/assets/index-BA4zS8rk.js b/buddybook/assets/index-DlENImLn.js similarity index 99% rename from buddybook/assets/index-BA4zS8rk.js rename to buddybook/assets/index-DlENImLn.js index 742294f..3b0f9f7 100644 --- a/buddybook/assets/index-BA4zS8rk.js +++ b/buddybook/assets/index-DlENImLn.js @@ -1,2 +1,2 @@ -import{B as k,k as m,c as q,e as F,t as $,n as Ye,i as Ze,I as xe,s as B,a as et,b as G,d as tt,f as p,g as W}from"./index-Cye4tEiE.js";const nt=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,st=/^(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)?$/;class it extends k{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 at extends k{constructor({type:t}){super(`Struct type "${t}" is invalid.`,{metaMessages:["Struct type must not be a Solidity type."],name:"InvalidStructTypeError"})}}function ct(e){const{domain:t={},message:n,primaryType:s}=e,r={EIP712Domain:lt({domain:t}),...e.types};dt({domain:t,message:n,primaryType:s,types:r});const i=["0x1901"];return t&&i.push(rt({domain:t,types:r})),s!=="EIP712Domain"&&i.push(K({data:n,primaryType:s,types:r})),m(q(i))}function rt({domain:e,types:t}){return K({data:e,primaryType:"EIP712Domain",types:t})}function K({data:e,primaryType:t,types:n}){const s=X({data:e,primaryType:t,types:n});return m(s)}function X({data:e,primaryType:t,types:n}){const s=[{type:"bytes32"}],r=[ot({primaryType:t,types:n})];for(const i of n[t]){const[u,l]=z({types:n,name:i.name,type:i.type,value:e[i.name]});s.push(u),r.push(l)}return F(s,r)}function ot({primaryType:e,types:t}){const n=$(ut({primaryType:e,types:t}));return m(n)}function ut({primaryType:e,types:t}){let n="";const s=Q({primaryType:e,types:t});s.delete(e);const r=[e,...Array.from(s).sort()];for(const i of r)n+=`${i}(${t[i].map(({name:u,type:l})=>`${l} ${u}`).join(",")})`;return n}function Q({primaryType:e,types:t},n=new Set){const s=e.match(/^\w*/u),r=s==null?void 0:s[0];if(n.has(r)||t[r]===void 0)return n;n.add(r);for(const i of t[r])Q({primaryType:i.type,types:t},n);return n}function z({types:e,name:t,type:n,value:s}){if(e[n]!==void 0)return[{type:"bytes32"},m(X({data:s,primaryType:n,types:e}))];if(n==="bytes")return s=`0x${(s.length%2?"0":"")+s.slice(2)}`,[{type:"bytes32"},m(s)];if(n==="string")return[{type:"bytes32"},m($(s))];if(n.lastIndexOf("]")===n.length-1){const r=n.slice(0,n.lastIndexOf("[")),i=s.map(u=>z({name:t,type:r,types:e,value:u}));return[{type:"bytes32"},m(F(i.map(([u])=>u),i.map(([,u])=>u)))]}return[{type:n},s]}function dt(e){const{domain:t,message:n,primaryType:s,types:r}=e,i=(u,l)=>{for(const g of u){const{name:v,type:f}=g,h=l[v],N=f.match(st);if(N&&(typeof h=="number"||typeof h=="bigint")){const[M,S,L]=N;Ye(h,{signed:S==="int",size:Number.parseInt(L)/8})}if(f==="address"&&typeof h=="string"&&!Ze(h))throw new xe({address:h});const C=f.match(nt);if(C){const[M,S]=C;if(S&&B(h)!==Number.parseInt(S))throw new et({expectedSize:Number.parseInt(S),givenSize:B(h)})}const D=r[f];D&&(ft(f),i(D,h))}};if(r.EIP712Domain&&t&&i(r.EIP712Domain,t),s!=="EIP712Domain")if(r[s])i(r[s],n);else throw new it({primaryType:s,types:r})}function lt({domain:e}){return[typeof(e==null?void 0:e.name)=="string"&&{name:"name",type:"string"},(e==null?void 0:e.version)&&{name:"version",type:"string"},typeof(e==null?void 0:e.chainId)=="number"&&{name:"chainId",type:"uint256"},(e==null?void 0:e.verifyingContract)&&{name:"verifyingContract",type:"address"},(e==null?void 0:e.salt)&&{name:"salt",type:"bytes32"}].filter(Boolean)}function ft(e){if(e==="address"||e==="bool"||e==="string"||e.startsWith("bytes")||e.startsWith("uint")||e.startsWith("int"))throw new at({type:e})}const gt=`Ethereum Signed Message: +import{B as k,k as m,c as q,e as F,t as $,n as Ye,i as Ze,I as xe,s as B,a as et,b as G,d as tt,f as p,g as W}from"./index-uonIXzgQ.js";const nt=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,st=/^(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)?$/;class it extends k{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 at extends k{constructor({type:t}){super(`Struct type "${t}" is invalid.`,{metaMessages:["Struct type must not be a Solidity type."],name:"InvalidStructTypeError"})}}function ct(e){const{domain:t={},message:n,primaryType:s}=e,r={EIP712Domain:lt({domain:t}),...e.types};dt({domain:t,message:n,primaryType:s,types:r});const i=["0x1901"];return t&&i.push(rt({domain:t,types:r})),s!=="EIP712Domain"&&i.push(K({data:n,primaryType:s,types:r})),m(q(i))}function rt({domain:e,types:t}){return K({data:e,primaryType:"EIP712Domain",types:t})}function K({data:e,primaryType:t,types:n}){const s=X({data:e,primaryType:t,types:n});return m(s)}function X({data:e,primaryType:t,types:n}){const s=[{type:"bytes32"}],r=[ot({primaryType:t,types:n})];for(const i of n[t]){const[u,l]=z({types:n,name:i.name,type:i.type,value:e[i.name]});s.push(u),r.push(l)}return F(s,r)}function ot({primaryType:e,types:t}){const n=$(ut({primaryType:e,types:t}));return m(n)}function ut({primaryType:e,types:t}){let n="";const s=Q({primaryType:e,types:t});s.delete(e);const r=[e,...Array.from(s).sort()];for(const i of r)n+=`${i}(${t[i].map(({name:u,type:l})=>`${l} ${u}`).join(",")})`;return n}function Q({primaryType:e,types:t},n=new Set){const s=e.match(/^\w*/u),r=s==null?void 0:s[0];if(n.has(r)||t[r]===void 0)return n;n.add(r);for(const i of t[r])Q({primaryType:i.type,types:t},n);return n}function z({types:e,name:t,type:n,value:s}){if(e[n]!==void 0)return[{type:"bytes32"},m(X({data:s,primaryType:n,types:e}))];if(n==="bytes")return s=`0x${(s.length%2?"0":"")+s.slice(2)}`,[{type:"bytes32"},m(s)];if(n==="string")return[{type:"bytes32"},m($(s))];if(n.lastIndexOf("]")===n.length-1){const r=n.slice(0,n.lastIndexOf("[")),i=s.map(u=>z({name:t,type:r,types:e,value:u}));return[{type:"bytes32"},m(F(i.map(([u])=>u),i.map(([,u])=>u)))]}return[{type:n},s]}function dt(e){const{domain:t,message:n,primaryType:s,types:r}=e,i=(u,l)=>{for(const g of u){const{name:v,type:f}=g,h=l[v],N=f.match(st);if(N&&(typeof h=="number"||typeof h=="bigint")){const[M,S,L]=N;Ye(h,{signed:S==="int",size:Number.parseInt(L)/8})}if(f==="address"&&typeof h=="string"&&!Ze(h))throw new xe({address:h});const C=f.match(nt);if(C){const[M,S]=C;if(S&&B(h)!==Number.parseInt(S))throw new et({expectedSize:Number.parseInt(S),givenSize:B(h)})}const D=r[f];D&&(ft(f),i(D,h))}};if(r.EIP712Domain&&t&&i(r.EIP712Domain,t),s!=="EIP712Domain")if(r[s])i(r[s],n);else throw new it({primaryType:s,types:r})}function lt({domain:e}){return[typeof(e==null?void 0:e.name)=="string"&&{name:"name",type:"string"},(e==null?void 0:e.version)&&{name:"version",type:"string"},typeof(e==null?void 0:e.chainId)=="number"&&{name:"chainId",type:"uint256"},(e==null?void 0:e.verifyingContract)&&{name:"verifyingContract",type:"address"},(e==null?void 0:e.salt)&&{name:"salt",type:"bytes32"}].filter(Boolean)}function ft(e){if(e==="address"||e==="bool"||e==="string"||e.startsWith("bytes")||e.startsWith("uint")||e.startsWith("int"))throw new at({type:e})}const gt=`Ethereum Signed Message: `;function ht(e){const t=typeof e=="string"?G(e):typeof e.raw=="string"?e.raw:tt(e.raw),n=G(`${gt}${B(t)}`);return q([n,t])}function Et(e,t){return m(ht(e),t)}const yt=()=>"9.1.0",_t=e=>e.toString(16).padStart(2,"0"),Tt=e=>{const t=new Uint8Array(e/2);return window.crypto.getRandomValues(t),Array.from(t,_t).join("")},vt=()=>typeof window<"u"?Tt(10):new Date().getTime().toString(36);class w{}w.makeRequest=(e,t)=>({id:vt(),method:e,params:t,env:{sdkVersion:yt()}});w.makeResponse=(e,t,n)=>({id:e,success:!0,version:n,data:t});w.makeErrorResponse=(e,t,n)=>({id:e,success:!1,error:t,version:n});var E;(function(e){e.sendTransactions="sendTransactions",e.rpcCall="rpcCall",e.getChainInfo="getChainInfo",e.getSafeInfo="getSafeInfo",e.getTxBySafeTxHash="getTxBySafeTxHash",e.getSafeBalances="getSafeBalances",e.signMessage="signMessage",e.signTypedMessage="signTypedMessage",e.getEnvironmentInfo="getEnvironmentInfo",e.getOffChainSignature="getOffChainSignature",e.requestAddressBook="requestAddressBook",e.wallet_getPermissions="wallet_getPermissions",e.wallet_requestPermissions="wallet_requestPermissions"})(E||(E={}));var H;(function(e){e.requestAddressBook="requestAddressBook"})(H||(H={}));class It{constructor(t=null,n=!1){this.allowedOrigins=null,this.callbacks=new Map,this.debugMode=!1,this.isServer=typeof window>"u",this.isValidMessage=({origin:s,data:r,source:i})=>{const u=!r,l=!this.isServer&&i===window.parent,g=typeof r.version<"u"&&parseInt(r.version.split(".")[0]),v=typeof g=="number"&&g>=1;let f=!0;return Array.isArray(this.allowedOrigins)&&(f=this.allowedOrigins.find(h=>h.test(s))!==void 0),!u&&l&&v&&f},this.logIncomingMessage=s=>{console.info(`Safe Apps SDK v1: A message was received from origin ${s.origin}. `,s.data)},this.onParentMessage=s=>{this.isValidMessage(s)&&(this.debugMode&&this.logIncomingMessage(s),this.handleIncomingMessage(s.data))},this.handleIncomingMessage=s=>{const{id:r}=s,i=this.callbacks.get(r);i&&(i(s),this.callbacks.delete(r))},this.send=(s,r)=>{const i=w.makeRequest(s,r);if(this.isServer)throw new Error("Window doesn't exist");return window.parent.postMessage(i,"*"),new Promise((u,l)=>{this.callbacks.set(i.id,g=>{if(!g.success){l(new Error(g.error));return}u(g)})})},this.allowedOrigins=t,this.debugMode=n,this.isServer||window.addEventListener("message",this.onParentMessage)}}const J=e=>typeof e=="object"&&e!=null&&"domain"in e&&"types"in e&&"message"in e;var At={},_={},T={},j=p&&p.__awaiter||function(e,t,n,s){function r(i){return i instanceof n?i:new n(function(u){u(i)})}return new(n||(n=Promise))(function(i,u){function l(f){try{v(s.next(f))}catch(h){u(h)}}function g(f){try{v(s.throw(f))}catch(h){u(h)}}function v(f){f.done?i(f.value):r(f.value).then(l,g)}v((s=s.apply(e,t||[])).next())})};Object.defineProperty(T,"__esModule",{value:!0});T.getData=T.fetchData=T.stringifyQuery=T.insertParams=void 0;const mt=e=>typeof e=="object"&&e!==null&&"code"in e&&"message"in e;function St(e,t,n){return e.replace(new RegExp(`\\{${t}\\}`,"g"),n)}function Ot(e,t){return t?Object.keys(t).reduce((n,s)=>St(n,s,String(t[s])),e):e}T.insertParams=Ot;function pt(e){if(!e)return"";const t=new URLSearchParams;Object.keys(e).forEach(s=>{e[s]!=null&&t.append(s,String(e[s]))});const n=t.toString();return n?`?${n}`:""}T.stringifyQuery=pt;function Y(e){return j(this,void 0,void 0,function*(){let t;try{t=yield e.json()}catch{t={}}if(!e.ok){const n=mt(t)?`CGW error - ${t.code}: ${t.message}`:`CGW error - status ${e.statusText}`;throw new Error(n)}return t})}function bt(e,t,n,s,r){return j(this,void 0,void 0,function*(){const i=Object.assign({"Content-Type":"application/json"},s),u={method:t??"POST",headers:i};r&&(u.credentials=r),n!=null&&(u.body=typeof n=="string"?n:JSON.stringify(n));const l=yield fetch(e,u);return Y(l)})}T.fetchData=bt;function Nt(e,t,n){return j(this,void 0,void 0,function*(){const s={method:"GET"};t&&(s.headers=Object.assign(Object.assign({},t),{"Content-Type":"application/json"})),n&&(s.credentials=n);const r=yield fetch(e,s);return Y(r)})}T.getData=Nt;Object.defineProperty(_,"__esModule",{value:!0});_.getEndpoint=_.deleteEndpoint=_.putEndpoint=_.postEndpoint=void 0;const O=T;function P(e,t,n,s){const r=(0,O.insertParams)(t,n),i=(0,O.stringifyQuery)(s);return`${e}${r}${i}`}function Ct(e,t,n){const s=P(e,t,n==null?void 0:n.path,n==null?void 0:n.query);return(0,O.fetchData)(s,"POST",n==null?void 0:n.body,n==null?void 0:n.headers,n==null?void 0:n.credentials)}_.postEndpoint=Ct;function Dt(e,t,n){const s=P(e,t,n==null?void 0:n.path,n==null?void 0:n.query);return(0,O.fetchData)(s,"PUT",n==null?void 0:n.body,n==null?void 0:n.headers,n==null?void 0:n.credentials)}_.putEndpoint=Dt;function wt(e,t,n){const s=P(e,t,n==null?void 0:n.path,n==null?void 0:n.query);return(0,O.fetchData)(s,"DELETE",n==null?void 0:n.body,n==null?void 0:n.headers,n==null?void 0:n.credentials)}_.deleteEndpoint=wt;function Pt(e,t,n,s){if(s)return(0,O.getData)(s,void 0,n==null?void 0:n.credentials);const r=P(e,t,n==null?void 0:n.path,n==null?void 0:n.query);return(0,O.getData)(r,n==null?void 0:n.headers,n==null?void 0:n.credentials)}_.getEndpoint=Pt;var R={};Object.defineProperty(R,"__esModule",{value:!0});R.DEFAULT_BASE_URL=void 0;R.DEFAULT_BASE_URL="https://safe-client.safe.global";var Z={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.ImplementationVersionState=void 0,function(t){t.UP_TO_DATE="UP_TO_DATE",t.OUTDATED="OUTDATED",t.UNKNOWN="UNKNOWN"}(e.ImplementationVersionState||(e.ImplementationVersionState={}))})(Z);var x={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.SafeAppSocialPlatforms=e.SafeAppFeatures=e.SafeAppAccessPolicyTypes=void 0,function(t){t.NoRestrictions="NO_RESTRICTIONS",t.DomainAllowlist="DOMAIN_ALLOWLIST"}(e.SafeAppAccessPolicyTypes||(e.SafeAppAccessPolicyTypes={})),function(t){t.BATCHED_TRANSACTIONS="BATCHED_TRANSACTIONS"}(e.SafeAppFeatures||(e.SafeAppFeatures={})),function(t){t.TWITTER="TWITTER",t.GITHUB="GITHUB",t.DISCORD="DISCORD"}(e.SafeAppSocialPlatforms||(e.SafeAppSocialPlatforms={}))})(x);var ee={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.LabelValue=e.StartTimeValue=e.DurationType=e.DetailedExecutionInfoType=e.TransactionListItemType=e.ConflictType=e.TransactionInfoType=e.SettingsInfoType=e.TransactionTokenType=e.TransferDirection=e.TransactionStatus=e.Operation=void 0,function(t){t[t.CALL=0]="CALL",t[t.DELEGATE=1]="DELEGATE"}(e.Operation||(e.Operation={})),function(t){t.AWAITING_CONFIRMATIONS="AWAITING_CONFIRMATIONS",t.AWAITING_EXECUTION="AWAITING_EXECUTION",t.CANCELLED="CANCELLED",t.FAILED="FAILED",t.SUCCESS="SUCCESS"}(e.TransactionStatus||(e.TransactionStatus={})),function(t){t.INCOMING="INCOMING",t.OUTGOING="OUTGOING",t.UNKNOWN="UNKNOWN"}(e.TransferDirection||(e.TransferDirection={})),function(t){t.ERC20="ERC20",t.ERC721="ERC721",t.NATIVE_COIN="NATIVE_COIN"}(e.TransactionTokenType||(e.TransactionTokenType={})),function(t){t.SET_FALLBACK_HANDLER="SET_FALLBACK_HANDLER",t.ADD_OWNER="ADD_OWNER",t.REMOVE_OWNER="REMOVE_OWNER",t.SWAP_OWNER="SWAP_OWNER",t.CHANGE_THRESHOLD="CHANGE_THRESHOLD",t.CHANGE_IMPLEMENTATION="CHANGE_IMPLEMENTATION",t.ENABLE_MODULE="ENABLE_MODULE",t.DISABLE_MODULE="DISABLE_MODULE",t.SET_GUARD="SET_GUARD",t.DELETE_GUARD="DELETE_GUARD"}(e.SettingsInfoType||(e.SettingsInfoType={})),function(t){t.TRANSFER="Transfer",t.SETTINGS_CHANGE="SettingsChange",t.CUSTOM="Custom",t.CREATION="Creation",t.SWAP_ORDER="SwapOrder",t.TWAP_ORDER="TwapOrder",t.SWAP_TRANSFER="SwapTransfer"}(e.TransactionInfoType||(e.TransactionInfoType={})),function(t){t.NONE="None",t.HAS_NEXT="HasNext",t.END="End"}(e.ConflictType||(e.ConflictType={})),function(t){t.TRANSACTION="TRANSACTION",t.LABEL="LABEL",t.CONFLICT_HEADER="CONFLICT_HEADER",t.DATE_LABEL="DATE_LABEL"}(e.TransactionListItemType||(e.TransactionListItemType={})),function(t){t.MULTISIG="MULTISIG",t.MODULE="MODULE"}(e.DetailedExecutionInfoType||(e.DetailedExecutionInfoType={})),function(t){t.AUTO="AUTO",t.LIMIT_DURATION="LIMIT_DURATION"}(e.DurationType||(e.DurationType={})),function(t){t.AT_MINING_TIME="AT_MINING_TIME",t.AT_EPOCH="AT_EPOCH"}(e.StartTimeValue||(e.StartTimeValue={})),function(t){t.Queued="Queued",t.Next="Next"}(e.LabelValue||(e.LabelValue={}))})(ee);var te={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.FEATURES=e.GAS_PRICE_TYPE=e.RPC_AUTHENTICATION=void 0,function(t){t.API_KEY_PATH="API_KEY_PATH",t.NO_AUTHENTICATION="NO_AUTHENTICATION",t.UNKNOWN="UNKNOWN"}(e.RPC_AUTHENTICATION||(e.RPC_AUTHENTICATION={})),function(t){t.ORACLE="ORACLE",t.FIXED="FIXED",t.FIXED_1559="FIXED1559",t.UNKNOWN="UNKNOWN"}(e.GAS_PRICE_TYPE||(e.GAS_PRICE_TYPE={})),function(t){t.ERC721="ERC721",t.SAFE_APPS="SAFE_APPS",t.CONTRACT_INTERACTION="CONTRACT_INTERACTION",t.DOMAIN_LOOKUP="DOMAIN_LOOKUP",t.SPENDING_LIMIT="SPENDING_LIMIT",t.EIP1559="EIP1559",t.SAFE_TX_GAS_OPTIONAL="SAFE_TX_GAS_OPTIONAL",t.TX_SIMULATION="TX_SIMULATION",t.EIP1271="EIP1271"}(e.FEATURES||(e.FEATURES={}))})(te);var ne={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.TokenType=void 0,function(t){t.ERC20="ERC20",t.ERC721="ERC721",t.NATIVE_TOKEN="NATIVE_TOKEN"}(e.TokenType||(e.TokenType={}))})(ne);var se={};Object.defineProperty(se,"__esModule",{value:!0});var ie={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.ConfirmationViewTypes=void 0,function(t){t.COW_SWAP_ORDER="COW_SWAP_ORDER",t.COW_SWAP_TWAP_ORDER="COW_SWAP_TWAP_ORDER"}(e.ConfirmationViewTypes||(e.ConfirmationViewTypes={}))})(ie);var ae={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.SafeMessageStatus=e.SafeMessageListItemType=void 0,function(t){t.DATE_LABEL="DATE_LABEL",t.MESSAGE="MESSAGE"}(e.SafeMessageListItemType||(e.SafeMessageListItemType={})),function(t){t.NEEDS_CONFIRMATION="NEEDS_CONFIRMATION",t.CONFIRMED="CONFIRMED"}(e.SafeMessageStatus||(e.SafeMessageStatus={}))})(ae);var ce={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.DeviceType=void 0,function(t){t.ANDROID="ANDROID",t.IOS="IOS",t.WEB="WEB"}(e.DeviceType||(e.DeviceType={}))})(ce);var re={};Object.defineProperty(re,"__esModule",{value:!0});(function(e){var t=p&&p.__createBinding||(Object.create?function(a,c,o,d){d===void 0&&(d=o);var A=Object.getOwnPropertyDescriptor(c,o);(!A||("get"in A?!c.__esModule:A.writable||A.configurable))&&(A={enumerable:!0,get:function(){return c[o]}}),Object.defineProperty(a,d,A)}:function(a,c,o,d){d===void 0&&(d=o),a[d]=c[o]}),n=p&&p.__exportStar||function(a,c){for(var o in a)o!=="default"&&!Object.prototype.hasOwnProperty.call(c,o)&&t(c,a,o)};Object.defineProperty(e,"__esModule",{value:!0}),e.deleteAccount=e.getAccount=e.createAccount=e.verifyAuth=e.getAuthNonce=e.getContract=e.getSafeOverviews=e.unsubscribeAll=e.unsubscribeSingle=e.registerRecoveryModule=e.deleteRegisteredEmail=e.getRegisteredEmail=e.verifyEmail=e.resendEmailVerificationCode=e.changeEmail=e.registerEmail=e.unregisterDevice=e.unregisterSafe=e.registerDevice=e.getDelegates=e.confirmSafeMessage=e.proposeSafeMessage=e.getSafeMessage=e.getSafeMessages=e.getDecodedData=e.getMasterCopies=e.getSafeApps=e.getChainConfig=e.getChainsConfig=e.getConfirmationView=e.proposeTransaction=e.getNonces=e.postSafeGasEstimation=e.deleteTransaction=e.getTransactionDetails=e.getTransactionQueue=e.getTransactionHistory=e.getCollectiblesPage=e.getCollectibles=e.getAllOwnedSafes=e.getOwnedSafes=e.getFiatCurrencies=e.getBalances=e.getMultisigTransactions=e.getModuleTransactions=e.getIncomingTransfers=e.getSafeInfo=e.getRelayCount=e.relayTransaction=e.setBaseUrl=void 0,e.putAccountDataSettings=e.getAccountDataSettings=e.getAccountDataTypes=void 0;const s=_,r=R;n(Z,e),n(x,e),n(ee,e),n(te,e),n(ne,e),n(se,e),n(ie,e),n(ae,e),n(ce,e),n(re,e);let i=r.DEFAULT_BASE_URL;const u=a=>{i=a};e.setBaseUrl=u;function l(a,c){return(0,s.postEndpoint)(i,"/v1/chains/{chainId}/relay",{path:{chainId:a},body:c})}e.relayTransaction=l;function g(a,c){return(0,s.getEndpoint)(i,"/v1/chains/{chainId}/relay/{address}",{path:{chainId:a,address:c}})}e.getRelayCount=g;function v(a,c){return(0,s.getEndpoint)(i,"/v1/chains/{chainId}/safes/{address}",{path:{chainId:a,address:c}})}e.getSafeInfo=v;function f(a,c,o,d){return(0,s.getEndpoint)(i,"/v1/chains/{chainId}/safes/{address}/incoming-transfers/",{path:{chainId:a,address:c},query:o},d)}e.getIncomingTransfers=f;function h(a,c,o,d){return(0,s.getEndpoint)(i,"/v1/chains/{chainId}/safes/{address}/module-transactions/",{path:{chainId:a,address:c},query:o},d)}e.getModuleTransactions=h;function N(a,c,o,d){return(0,s.getEndpoint)(i,"/v1/chains/{chainId}/safes/{address}/multisig-transactions/",{path:{chainId:a,address:c},query:o},d)}e.getMultisigTransactions=N;function C(a,c,o="usd",d={}){return(0,s.getEndpoint)(i,"/v1/chains/{chainId}/safes/{address}/balances/{currency}",{path:{chainId:a,address:c,currency:o},query:d})}e.getBalances=C;function D(){return(0,s.getEndpoint)(i,"/v1/balances/supported-fiat-codes")}e.getFiatCurrencies=D;function M(a,c){return(0,s.getEndpoint)(i,"/v1/chains/{chainId}/owners/{address}/safes",{path:{chainId:a,address:c}})}e.getOwnedSafes=M;function S(a){return(0,s.getEndpoint)(i,"/v1/owners/{address}/safes",{path:{address:a}})}e.getAllOwnedSafes=S;function L(a,c,o={}){return(0,s.getEndpoint)(i,"/v1/chains/{chainId}/safes/{address}/collectibles",{path:{chainId:a,address:c},query:o})}e.getCollectibles=L;function de(a,c,o={},d){return(0,s.getEndpoint)(i,"/v2/chains/{chainId}/safes/{address}/collectibles",{path:{chainId:a,address:c},query:o},d)}e.getCollectiblesPage=de;function le(a,c,o={},d){return(0,s.getEndpoint)(i,"/v1/chains/{chainId}/safes/{safe_address}/transactions/history",{path:{chainId:a,safe_address:c},query:o},d)}e.getTransactionHistory=le;function fe(a,c,o={},d){return(0,s.getEndpoint)(i,"/v1/chains/{chainId}/safes/{safe_address}/transactions/queued",{path:{chainId:a,safe_address:c},query:o},d)}e.getTransactionQueue=fe;function ge(a,c){return(0,s.getEndpoint)(i,"/v1/chains/{chainId}/transactions/{transactionId}",{path:{chainId:a,transactionId:c}})}e.getTransactionDetails=ge;function he(a,c,o){return(0,s.deleteEndpoint)(i,"/v1/chains/{chainId}/transactions/{safeTxHash}",{path:{chainId:a,safeTxHash:c},body:{signature:o}})}e.deleteTransaction=he;function Ee(a,c,o){return(0,s.postEndpoint)(i,"/v2/chains/{chainId}/safes/{safe_address}/multisig-transactions/estimations",{path:{chainId:a,safe_address:c},body:o})}e.postSafeGasEstimation=Ee;function ye(a,c){return(0,s.getEndpoint)(i,"/v1/chains/{chainId}/safes/{safe_address}/nonces",{path:{chainId:a,safe_address:c}})}e.getNonces=ye;function _e(a,c,o){return(0,s.postEndpoint)(i,"/v1/chains/{chainId}/transactions/{safe_address}/propose",{path:{chainId:a,safe_address:c},body:o})}e.proposeTransaction=_e;function Te(a,c,o,d){return(0,s.postEndpoint)(i,"/v1/chains/{chainId}/safes/{safe_address}/views/transaction-confirmation",{path:{chainId:a,safe_address:c},body:{data:o,to:d}})}e.getConfirmationView=Te;function ve(a){return(0,s.getEndpoint)(i,"/v1/chains",{query:a})}e.getChainsConfig=ve;function Ie(a){return(0,s.getEndpoint)(i,"/v1/chains/{chainId}",{path:{chainId:a}})}e.getChainConfig=Ie;function Ae(a,c={}){return(0,s.getEndpoint)(i,"/v1/chains/{chainId}/safe-apps",{path:{chainId:a},query:c})}e.getSafeApps=Ae;function me(a){return(0,s.getEndpoint)(i,"/v1/chains/{chainId}/about/master-copies",{path:{chainId:a}})}e.getMasterCopies=me;function Se(a,c,o){return(0,s.postEndpoint)(i,"/v1/chains/{chainId}/data-decoder",{path:{chainId:a},body:{data:c,to:o}})}e.getDecodedData=Se;function Oe(a,c,o){return(0,s.getEndpoint)(i,"/v1/chains/{chainId}/safes/{safe_address}/messages",{path:{chainId:a,safe_address:c},query:{}},o)}e.getSafeMessages=Oe;function pe(a,c){return(0,s.getEndpoint)(i,"/v1/chains/{chainId}/messages/{message_hash}",{path:{chainId:a,message_hash:c}})}e.getSafeMessage=pe;function be(a,c,o){return(0,s.postEndpoint)(i,"/v1/chains/{chainId}/safes/{safe_address}/messages",{path:{chainId:a,safe_address:c},body:o})}e.proposeSafeMessage=be;function Ne(a,c,o){return(0,s.postEndpoint)(i,"/v1/chains/{chainId}/messages/{message_hash}/signatures",{path:{chainId:a,message_hash:c},body:o})}e.confirmSafeMessage=Ne;function Ce(a,c={}){return(0,s.getEndpoint)(i,"/v2/chains/{chainId}/delegates",{path:{chainId:a},query:c})}e.getDelegates=Ce;function De(a){return(0,s.postEndpoint)(i,"/v1/register/notifications",{body:a})}e.registerDevice=De;function we(a,c,o){return(0,s.deleteEndpoint)(i,"/v1/chains/{chainId}/notifications/devices/{uuid}/safes/{safe_address}",{path:{chainId:a,safe_address:c,uuid:o}})}e.unregisterSafe=we;function Pe(a,c){return(0,s.deleteEndpoint)(i,"/v1/chains/{chainId}/notifications/devices/{uuid}",{path:{chainId:a,uuid:c}})}e.unregisterDevice=Pe;function Re(a,c,o,d){return(0,s.postEndpoint)(i,"/v1/chains/{chainId}/safes/{safe_address}/emails",{path:{chainId:a,safe_address:c},body:o,headers:d})}e.registerEmail=Re;function Me(a,c,o,d,A){return(0,s.putEndpoint)(i,"/v1/chains/{chainId}/safes/{safe_address}/emails/{signer}",{path:{chainId:a,safe_address:c,signer:o},body:d,headers:A})}e.changeEmail=Me;function Le(a,c,o){return(0,s.postEndpoint)(i,"/v1/chains/{chainId}/safes/{safe_address}/emails/{signer}/verify-resend",{path:{chainId:a,safe_address:c,signer:o},body:""})}e.resendEmailVerificationCode=Le;function Be(a,c,o,d){return(0,s.putEndpoint)(i,"/v1/chains/{chainId}/safes/{safe_address}/emails/{signer}/verify",{path:{chainId:a,safe_address:c,signer:o},body:d})}e.verifyEmail=Be;function He(a,c,o,d){return(0,s.getEndpoint)(i,"/v1/chains/{chainId}/safes/{safe_address}/emails/{signer}",{path:{chainId:a,safe_address:c,signer:o},headers:d})}e.getRegisteredEmail=He;function Ue(a,c,o,d){return(0,s.deleteEndpoint)(i,"/v1/chains/{chainId}/safes/{safe_address}/emails/{signer}",{path:{chainId:a,safe_address:c,signer:o},headers:d})}e.deleteRegisteredEmail=Ue;function je(a,c,o){return(0,s.postEndpoint)(i,"/v1/chains/{chainId}/safes/{safe_address}/recovery",{path:{chainId:a,safe_address:c},body:o})}e.registerRecoveryModule=je;function Ge(a){return(0,s.deleteEndpoint)(i,"/v1/subscriptions",{query:a})}e.unsubscribeSingle=Ge;function We(a){return(0,s.deleteEndpoint)(i,"/v1/subscriptions/all",{query:a})}e.unsubscribeAll=We;function Ve(a,c){return(0,s.getEndpoint)(i,"/v1/safes",{query:Object.assign(Object.assign({},c),{safes:a.join(",")})})}e.getSafeOverviews=Ve;function ke(a,c){return(0,s.getEndpoint)(i,"/v1/chains/{chainId}/contracts/{contractAddress}",{path:{chainId:a,contractAddress:c}})}e.getContract=ke;function qe(){return(0,s.getEndpoint)(i,"/v1/auth/nonce",{credentials:"include"})}e.getAuthNonce=qe;function Fe(a){return(0,s.postEndpoint)(i,"/v1/auth/verify",{body:a,credentials:"include"})}e.verifyAuth=Fe;function $e(a){return(0,s.postEndpoint)(i,"/v1/accounts",{body:a,credentials:"include"})}e.createAccount=$e;function Ke(a){return(0,s.getEndpoint)(i,"/v1/accounts/{address}",{path:{address:a},credentials:"include"})}e.getAccount=Ke;function Xe(a){return(0,s.deleteEndpoint)(i,"/v1/accounts/{address}",{path:{address:a},credentials:"include"})}e.deleteAccount=Xe;function Qe(){return(0,s.getEndpoint)(i,"/v1/accounts/data-types")}e.getAccountDataTypes=Qe;function ze(a){return(0,s.getEndpoint)(i,"/v1/accounts/{address}/data-settings",{path:{address:a},credentials:"include"})}e.getAccountDataSettings=ze;function Je(a,c){return(0,s.putEndpoint)(i,"/v1/accounts/{address}/data-settings",{path:{address:a},body:c,credentials:"include"})}e.putAccountDataSettings=Je})(At);class Rt{constructor(t){this.communicator=t}async getBySafeTxHash(t){if(!t)throw new Error("Invalid safeTxHash");return(await this.communicator.send(E.getTxBySafeTxHash,{safeTxHash:t})).data}async signMessage(t){const n={message:t};return(await this.communicator.send(E.signMessage,n)).data}async signTypedMessage(t){if(!J(t))throw new Error("Invalid typed data");return(await this.communicator.send(E.signTypedMessage,{typedData:t})).data}async send({txs:t,params:n}){if(!t||!t.length)throw new Error("No transactions were passed");const s={txs:t,params:n};return(await this.communicator.send(E.sendTransactions,s)).data}}const y={eth_call:"eth_call",eth_gasPrice:"eth_gasPrice",eth_getLogs:"eth_getLogs",eth_getBalance:"eth_getBalance",eth_getCode:"eth_getCode",eth_getBlockByHash:"eth_getBlockByHash",eth_getBlockByNumber:"eth_getBlockByNumber",eth_getStorageAt:"eth_getStorageAt",eth_getTransactionByHash:"eth_getTransactionByHash",eth_getTransactionReceipt:"eth_getTransactionReceipt",eth_getTransactionCount:"eth_getTransactionCount",eth_estimateGas:"eth_estimateGas",safe_setSettings:"safe_setSettings"},I={defaultBlockParam:(e="latest")=>e,returnFullTxObjectParam:(e=!1)=>e,blockNumberToHex:e=>Number.isInteger(e)?`0x${e.toString(16)}`:e};class Mt{constructor(t){this.communicator=t,this.call=this.buildRequest({call:y.eth_call,formatters:[null,I.defaultBlockParam]}),this.getBalance=this.buildRequest({call:y.eth_getBalance,formatters:[null,I.defaultBlockParam]}),this.getCode=this.buildRequest({call:y.eth_getCode,formatters:[null,I.defaultBlockParam]}),this.getStorageAt=this.buildRequest({call:y.eth_getStorageAt,formatters:[null,I.blockNumberToHex,I.defaultBlockParam]}),this.getPastLogs=this.buildRequest({call:y.eth_getLogs}),this.getBlockByHash=this.buildRequest({call:y.eth_getBlockByHash,formatters:[null,I.returnFullTxObjectParam]}),this.getBlockByNumber=this.buildRequest({call:y.eth_getBlockByNumber,formatters:[I.blockNumberToHex,I.returnFullTxObjectParam]}),this.getTransactionByHash=this.buildRequest({call:y.eth_getTransactionByHash}),this.getTransactionReceipt=this.buildRequest({call:y.eth_getTransactionReceipt}),this.getTransactionCount=this.buildRequest({call:y.eth_getTransactionCount,formatters:[null,I.defaultBlockParam]}),this.getGasPrice=this.buildRequest({call:y.eth_gasPrice}),this.getEstimateGas=n=>this.buildRequest({call:y.eth_estimateGas})([n]),this.setSafeSettings=this.buildRequest({call:y.safe_setSettings})}buildRequest(t){const{call:n,formatters:s}=t;return async r=>{s&&Array.isArray(r)&&s.forEach((l,g)=>{l&&(r[g]=l(r[g]))});const i={call:n,params:r||[]};return(await this.communicator.send(E.rpcCall,i)).data}}}const Lt="0x1626ba7e",Bt="0x20c13b0b",U=4001;class b extends Error{constructor(t,n,s){super(t),this.code=n,this.data=s,Object.setPrototypeOf(this,b.prototype)}}class oe{constructor(t){this.communicator=t}async getPermissions(){return(await this.communicator.send(E.wallet_getPermissions,void 0)).data}async requestPermissions(t){if(!this.isPermissionRequestValid(t))throw new b("Permissions request is invalid",U);try{return(await this.communicator.send(E.wallet_requestPermissions,t)).data}catch{throw new b("Permissions rejected",U)}}isPermissionRequestValid(t){return t.every(n=>typeof n=="object"?Object.keys(n).every(s=>!!Object.values(H).includes(s)):!1)}}const V=(e,t)=>t.some(n=>n.parentCapability===e),Ht=()=>(e,t,n)=>{const s=n.value;return n.value=async function(){const r=new oe(this.communicator);let i=await r.getPermissions();if(V(t,i)||(i=await r.requestPermissions([{[t]:{}}])),!V(t,i))throw new b("Permissions rejected",U);return s.apply(this)},n};var Ut=function(e,t,n,s){var r=arguments.length,i=r<3?t:s===null?s=Object.getOwnPropertyDescriptor(t,n):s,u;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(e,t,n,s);else for(var l=e.length-1;l>=0;l--)(u=e[l])&&(i=(r<3?u(i):r>3?u(t,n,i):u(t,n))||i);return r>3&&i&&Object.defineProperty(t,n,i),i};class ue{constructor(t){this.communicator=t}async getChainInfo(){return(await this.communicator.send(E.getChainInfo,void 0)).data}async getInfo(){return(await this.communicator.send(E.getSafeInfo,void 0)).data}async experimental_getBalances({currency:t="usd"}={}){return(await this.communicator.send(E.getSafeBalances,{currency:t})).data}async check1271Signature(t,n="0x"){const s=await this.getInfo(),r=W({abi:[{constant:!1,inputs:[{name:"_dataHash",type:"bytes32"},{name:"_signature",type:"bytes"}],name:"isValidSignature",outputs:[{name:"",type:"bytes4"}],payable:!1,stateMutability:"nonpayable",type:"function"}],functionName:"isValidSignature",args:[t,n]}),i={call:y.eth_call,params:[{to:s.safeAddress,data:r},"latest"]};try{return(await this.communicator.send(E.rpcCall,i)).data.slice(0,10).toLowerCase()===Lt}catch{return!1}}async check1271SignatureBytes(t,n="0x"){const s=await this.getInfo(),r=W({abi:[{constant:!1,inputs:[{name:"_data",type:"bytes"},{name:"_signature",type:"bytes"}],name:"isValidSignature",outputs:[{name:"",type:"bytes4"}],payable:!1,stateMutability:"nonpayable",type:"function"}],functionName:"isValidSignature",args:[t,n]}),i={call:y.eth_call,params:[{to:s.safeAddress,data:r},"latest"]};try{return(await this.communicator.send(E.rpcCall,i)).data.slice(0,10).toLowerCase()===Bt}catch{return!1}}calculateMessageHash(t){return Et(t)}calculateTypedMessageHash(t){const n=typeof t.domain.chainId=="object"?t.domain.chainId.toNumber():Number(t.domain.chainId);let s=t.primaryType;if(!s){const r=Object.values(t.types),i=Object.keys(t.types).filter(u=>r.every(l=>l.every(({type:g})=>g.replace("[","").replace("]","")!==u)));if(i.length===0||i.length>1)throw new Error("Please specify primaryType");s=i[0]}return ct({message:t.message,domain:{...t.domain,chainId:n,verifyingContract:t.domain.verifyingContract,salt:t.domain.salt},types:t.types,primaryType:s})}async getOffChainSignature(t){return(await this.communicator.send(E.getOffChainSignature,t)).data}async isMessageSigned(t,n="0x"){let s;if(typeof t=="string"&&(s=async()=>{const r=this.calculateMessageHash(t);return await this.isMessageHashSigned(r,n)}),J(t)&&(s=async()=>{const r=this.calculateTypedMessageHash(t);return await this.isMessageHashSigned(r,n)}),s)return await s();throw new Error("Invalid message type")}async isMessageHashSigned(t,n="0x"){const s=[this.check1271Signature.bind(this),this.check1271SignatureBytes.bind(this)];for(const r of s)if(await r(t,n))return!0;return!1}async getEnvironmentInfo(){return(await this.communicator.send(E.getEnvironmentInfo,void 0)).data}async requestAddressBook(){return(await this.communicator.send(E.requestAddressBook,void 0)).data}}Ut([Ht()],ue.prototype,"requestAddressBook",null);class Gt{constructor(t={}){const{allowedDomains:n=null,debug:s=!1}=t;this.communicator=new It(n,s),this.eth=new Mt(this.communicator),this.txs=new Rt(this.communicator),this.safe=new ue(this.communicator),this.wallet=new oe(this.communicator)}}export{w as MessageFormatter,E as Methods,y as RPC_CALLS,H as RestrictedMethods,Gt as default,yt as getSDKVersion,J as isObjectEIP712TypedData}; diff --git a/buddybook/assets/index-C91wHTLi.js b/buddybook/assets/index-Dzj92ueM.js similarity index 97% rename from buddybook/assets/index-C91wHTLi.js rename to buddybook/assets/index-Dzj92ueM.js index 1a5e4f1..a49590d 100644 --- a/buddybook/assets/index-C91wHTLi.js +++ b/buddybook/assets/index-Dzj92ueM.js @@ -1,2 +1,2 @@ -const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-BhswOEW5.js","assets/index-Cye4tEiE.js","assets/index-CwoEHhxw.css"])))=>i.map(i=>d[i]); -import{_ as pe}from"./index-Cye4tEiE.js";const me=Symbol(),ee=Object.getPrototypeOf,Y=new WeakMap,he=e=>e&&(Y.has(e)?Y.get(e):ee(e)===Object.prototype||ee(e)===Array.prototype),ge=e=>he(e)&&e[me]||null,te=(e,t=!0)=>{Y.set(e,t)},z={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1,VITE_WALLETCONNECT_PROJECT_ID:"1d93edc21291f98e3bed6ff7617ff539"},J=e=>typeof e=="object"&&e!==null,L=new WeakMap,x=new WeakSet,ye=(e=Object.is,t=(o,g)=>new Proxy(o,g),s=o=>J(o)&&!x.has(o)&&(Array.isArray(o)||!(Symbol.iterator in o))&&!(o instanceof WeakMap)&&!(o instanceof WeakSet)&&!(o instanceof Error)&&!(o instanceof Number)&&!(o instanceof Date)&&!(o instanceof String)&&!(o instanceof RegExp)&&!(o instanceof ArrayBuffer),n=o=>{switch(o.status){case"fulfilled":return o.value;case"rejected":throw o.reason;default:throw o}},l=new WeakMap,c=(o,g,I=n)=>{const v=l.get(o);if((v==null?void 0:v[0])===g)return v[1];const b=Array.isArray(o)?[]:Object.create(Object.getPrototypeOf(o));return te(b,!0),l.set(o,[g,b]),Reflect.ownKeys(o).forEach(j=>{if(Object.getOwnPropertyDescriptor(b,j))return;const O=Reflect.get(o,j),A={value:O,enumerable:!0,configurable:!0};if(x.has(O))te(O,!1);else if(O instanceof Promise)delete A.value,A.get=()=>I(O);else if(L.has(O)){const[y,H]=L.get(O);A.value=c(y,H(),I)}Object.defineProperty(b,j,A)}),Object.preventExtensions(b)},d=new WeakMap,f=[1,1],W=o=>{if(!J(o))throw new Error("object required");const g=d.get(o);if(g)return g;let I=f[0];const v=new Set,b=(i,a=++f[0])=>{I!==a&&(I=a,v.forEach(r=>r(i,a)))};let j=f[1];const O=(i=++f[1])=>(j!==i&&!v.size&&(j=i,y.forEach(([a])=>{const r=a[1](i);r>I&&(I=r)})),I),A=i=>(a,r)=>{const h=[...a];h[1]=[i,...h[1]],b(h,r)},y=new Map,H=(i,a)=>{if((z?"production":void 0)!=="production"&&y.has(i))throw new Error("prop listener already exists");if(v.size){const r=a[3](A(i));y.set(i,[a,r])}else y.set(i,[a])},Z=i=>{var a;const r=y.get(i);r&&(y.delete(i),(a=r[1])==null||a.call(r))},ue=i=>(v.add(i),v.size===1&&y.forEach(([r,h],U)=>{if((z?"production":void 0)!=="production"&&h)throw new Error("remove already exists");const N=r[3](A(U));y.set(U,[r,N])}),()=>{v.delete(i),v.size===0&&y.forEach(([r,h],U)=>{h&&(h(),y.set(U,[r]))})}),q=Array.isArray(o)?[]:Object.create(Object.getPrototypeOf(o)),R=t(q,{deleteProperty(i,a){const r=Reflect.get(i,a);Z(a);const h=Reflect.deleteProperty(i,a);return h&&b(["delete",[a],r]),h},set(i,a,r,h){const U=Reflect.has(i,a),N=Reflect.get(i,a,h);if(U&&(e(N,r)||d.has(r)&&e(N,d.get(r))))return!0;Z(a),J(r)&&(r=ge(r)||r);let V=r;if(r instanceof Promise)r.then(C=>{r.status="fulfilled",r.value=C,b(["resolve",[a],C])}).catch(C=>{r.status="rejected",r.reason=C,b(["reject",[a],C])});else{!L.has(r)&&s(r)&&(V=W(r));const C=!x.has(V)&&L.get(V);C&&H(a,C)}return Reflect.set(i,a,V,h),b(["set",[a],r,N]),!0}});d.set(o,R);const fe=[q,O,c,ue];return L.set(R,fe),Reflect.ownKeys(o).forEach(i=>{const a=Object.getOwnPropertyDescriptor(o,i);"value"in a&&(R[i]=o[i],delete a.value,delete a.writable),Object.defineProperty(q,i,a)}),R})=>[W,L,x,e,t,s,n,l,c,d,f],[ve]=ye();function P(e={}){return ve(e)}function D(e,t,s){const n=L.get(e);(z?"production":void 0)!=="production"&&!n&&console.warn("Please use proxy object");let l;const c=[],d=n[3];let f=!1;const o=d(g=>{c.push(g),l||(l=Promise.resolve().then(()=>{l=void 0,f&&t(c.splice(0))}))});return f=!0,()=>{f=!1,o()}}function be(e,t){const s=L.get(e);(z?"production":void 0)!=="production"&&!s&&console.warn("Please use proxy object");const[n,l,c]=s;return c(n,l(),t)}const u=P({history:["ConnectWallet"],view:"ConnectWallet",data:void 0}),de={state:u,subscribe(e){return D(u,()=>e(u))},push(e,t){e!==u.view&&(u.view=e,t&&(u.data=t),u.history.push(e))},reset(e){u.view=e,u.history=[e]},replace(e){u.history.length>1&&(u.history[u.history.length-1]=e,u.view=e)},goBack(){if(u.history.length>1){u.history.pop();const[e]=u.history.slice(-1);u.view=e}},setData(e){u.data=e}},m={WALLETCONNECT_DEEPLINK_CHOICE:"WALLETCONNECT_DEEPLINK_CHOICE",WCM_VERSION:"WCM_VERSION",RECOMMENDED_WALLET_AMOUNT:9,isMobile(){return typeof window<"u"?!!(window.matchMedia("(pointer:coarse)").matches||/Android|webOS|iPhone|iPad|iPod|BlackBerry|Opera Mini/u.test(navigator.userAgent)):!1},isAndroid(){return m.isMobile()&&navigator.userAgent.toLowerCase().includes("android")},isIos(){const e=navigator.userAgent.toLowerCase();return m.isMobile()&&(e.includes("iphone")||e.includes("ipad"))},isHttpUrl(e){return e.startsWith("http://")||e.startsWith("https://")},isArray(e){return Array.isArray(e)&&e.length>0},isTelegram(){return typeof window<"u"&&(!!window.TelegramWebviewProxy||!!window.Telegram||!!window.TelegramWebviewProxyProto)},formatNativeUrl(e,t,s){if(m.isHttpUrl(e))return this.formatUniversalUrl(e,t,s);let n=e;n.includes("://")||(n=e.replaceAll("/","").replaceAll(":",""),n=`${n}://`),n.endsWith("/")||(n=`${n}/`),this.setWalletConnectDeepLink(n,s);const l=encodeURIComponent(t);return`${n}wc?uri=${l}`},formatUniversalUrl(e,t,s){if(!m.isHttpUrl(e))return this.formatNativeUrl(e,t,s);let n=e;if(n.startsWith("https://t.me")){const c=Buffer.from(t).toString("base64").replace(/[=]/g,"");n.endsWith("/")&&(n=n.slice(0,-1)),this.setWalletConnectDeepLink(n,s);const d=new URL(n);return d.searchParams.set("startapp",c),d.toString()}n.endsWith("/")||(n=`${n}/`),this.setWalletConnectDeepLink(n,s);const l=encodeURIComponent(t);return`${n}wc?uri=${l}`},async wait(e){return new Promise(t=>{setTimeout(t,e)})},openHref(e,t){const s=this.isTelegram()?"_blank":t;window.open(e,s,"noreferrer noopener")},setWalletConnectDeepLink(e,t){try{localStorage.setItem(m.WALLETCONNECT_DEEPLINK_CHOICE,JSON.stringify({href:e,name:t}))}catch{console.info("Unable to set WalletConnect deep link")}},setWalletConnectAndroidDeepLink(e){try{const[t]=e.split("?");localStorage.setItem(m.WALLETCONNECT_DEEPLINK_CHOICE,JSON.stringify({href:t,name:"Android"}))}catch{console.info("Unable to set WalletConnect android deep link")}},removeWalletConnectDeepLink(){try{localStorage.removeItem(m.WALLETCONNECT_DEEPLINK_CHOICE)}catch{console.info("Unable to remove WalletConnect deep link")}},setModalVersionInStorage(){try{typeof localStorage<"u"&&localStorage.setItem(m.WCM_VERSION,"2.7.0")}catch{console.info("Unable to set Web3Modal version in storage")}},getWalletRouterData(){var e;const t=(e=de.state.data)==null?void 0:e.Wallet;if(!t)throw new Error('Missing "Wallet" view data');return t}},we=typeof location<"u"&&(location.hostname.includes("localhost")||location.protocol.includes("https")),p=P({enabled:we,userSessionId:"",events:[],connectedWalletId:void 0}),Ie={state:p,subscribe(e){return D(p.events,()=>e(be(p.events[p.events.length-1])))},initialize(){p.enabled&&typeof(crypto==null?void 0:crypto.randomUUID)<"u"&&(p.userSessionId=crypto.randomUUID())},setConnectedWalletId(e){p.connectedWalletId=e},click(e){if(p.enabled){const t={type:"CLICK",name:e.name,userSessionId:p.userSessionId,timestamp:Date.now(),data:e};p.events.push(t)}},track(e){if(p.enabled){const t={type:"TRACK",name:e.name,userSessionId:p.userSessionId,timestamp:Date.now(),data:e};p.events.push(t)}},view(e){if(p.enabled){const t={type:"VIEW",name:e.name,userSessionId:p.userSessionId,timestamp:Date.now(),data:e};p.events.push(t)}}},_=P({chains:void 0,walletConnectUri:void 0,isAuth:!1,isCustomDesktop:!1,isCustomMobile:!1,isDataLoaded:!1,isUiLoaded:!1}),w={state:_,subscribe(e){return D(_,()=>e(_))},setChains(e){_.chains=e},setWalletConnectUri(e){_.walletConnectUri=e},setIsCustomDesktop(e){_.isCustomDesktop=e},setIsCustomMobile(e){_.isCustomMobile=e},setIsDataLoaded(e){_.isDataLoaded=e},setIsUiLoaded(e){_.isUiLoaded=e},setIsAuth(e){_.isAuth=e}},B=P({projectId:"",mobileWallets:void 0,desktopWallets:void 0,walletImages:void 0,chains:void 0,enableAuthMode:!1,enableExplorer:!0,explorerExcludedWalletIds:void 0,explorerRecommendedWalletIds:void 0,termsOfServiceUrl:void 0,privacyPolicyUrl:void 0}),$={state:B,subscribe(e){return D(B,()=>e(B))},setConfig(e){var t,s;Ie.initialize(),w.setChains(e.chains),w.setIsAuth(!!e.enableAuthMode),w.setIsCustomMobile(!!((t=e.mobileWallets)!=null&&t.length)),w.setIsCustomDesktop(!!((s=e.desktopWallets)!=null&&s.length)),m.setModalVersionInStorage(),Object.assign(B,e)}};var _e=Object.defineProperty,se=Object.getOwnPropertySymbols,Ee=Object.prototype.hasOwnProperty,Oe=Object.prototype.propertyIsEnumerable,ne=(e,t,s)=>t in e?_e(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,We=(e,t)=>{for(var s in t||(t={}))Ee.call(t,s)&&ne(e,s,t[s]);if(se)for(var s of se(t))Oe.call(t,s)&&ne(e,s,t[s]);return e};const G="https://explorer-api.walletconnect.com",Q="wcm",X="js-2.7.0";async function K(e,t){const s=We({sdkType:Q,sdkVersion:X},t),n=new URL(e,G);return n.searchParams.append("projectId",$.state.projectId),Object.entries(s).forEach(([c,d])=>{d&&n.searchParams.append(c,String(d))}),(await fetch(n)).json()}const M={async getDesktopListings(e){return K("/w3m/v1/getDesktopListings",e)},async getMobileListings(e){return K("/w3m/v1/getMobileListings",e)},async getInjectedListings(e){return K("/w3m/v1/getInjectedListings",e)},async getAllListings(e){return K("/w3m/v1/getAllListings",e)},getWalletImageUrl(e){return`${G}/w3m/v1/getWalletImage/${e}?projectId=${$.state.projectId}&sdkType=${Q}&sdkVersion=${X}`},getAssetImageUrl(e){return`${G}/w3m/v1/getAssetImage/${e}?projectId=${$.state.projectId}&sdkType=${Q}&sdkVersion=${X}`}};var Ce=Object.defineProperty,oe=Object.getOwnPropertySymbols,Le=Object.prototype.hasOwnProperty,Pe=Object.prototype.propertyIsEnumerable,re=(e,t,s)=>t in e?Ce(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,Ae=(e,t)=>{for(var s in t||(t={}))Le.call(t,s)&&re(e,s,t[s]);if(oe)for(var s of oe(t))Pe.call(t,s)&&re(e,s,t[s]);return e};const ae=m.isMobile(),E=P({wallets:{listings:[],total:0,page:1},search:{listings:[],total:0,page:1},recomendedWallets:[]}),ke={state:E,async getRecomendedWallets(){const{explorerRecommendedWalletIds:e,explorerExcludedWalletIds:t}=$.state;if(e==="NONE"||t==="ALL"&&!e)return E.recomendedWallets;if(m.isArray(e)){const n={recommendedIds:e.join(",")},{listings:l}=await M.getAllListings(n),c=Object.values(l);c.sort((d,f)=>{const W=e.indexOf(d.id),o=e.indexOf(f.id);return W-o}),E.recomendedWallets=c}else{const{chains:s,isAuth:n}=w.state,l=s==null?void 0:s.join(","),c=m.isArray(t),d={page:1,sdks:n?"auth_v1":void 0,entries:m.RECOMMENDED_WALLET_AMOUNT,chains:l,version:2,excludedIds:c?t.join(","):void 0},{listings:f}=ae?await M.getMobileListings(d):await M.getDesktopListings(d);E.recomendedWallets=Object.values(f)}return E.recomendedWallets},async getWallets(e){const t=Ae({},e),{explorerRecommendedWalletIds:s,explorerExcludedWalletIds:n}=$.state,{recomendedWallets:l}=E;if(n==="ALL")return E.wallets;l.length?t.excludedIds=l.map(I=>I.id).join(","):m.isArray(s)&&(t.excludedIds=s.join(",")),m.isArray(n)&&(t.excludedIds=[t.excludedIds,n].filter(Boolean).join(",")),w.state.isAuth&&(t.sdks="auth_v1");const{page:c,search:d}=e,{listings:f,total:W}=ae?await M.getMobileListings(t):await M.getDesktopListings(t),o=Object.values(f),g=d?"search":"wallets";return E[g]={listings:[...E[g].listings,...o],total:W,page:c??1},{listings:o,total:W}},getWalletImageUrl(e){return M.getWalletImageUrl(e)},getAssetImageUrl(e){return M.getAssetImageUrl(e)},resetSearch(){E.search={listings:[],total:0,page:1}}},T=P({open:!1}),F={state:T,subscribe(e){return D(T,()=>e(T))},async open(e){return new Promise(t=>{const{isUiLoaded:s,isDataLoaded:n}=w.state;if(m.removeWalletConnectDeepLink(),w.setWalletConnectUri(e==null?void 0:e.uri),w.setChains(e==null?void 0:e.chains),de.reset("ConnectWallet"),s&&n)T.open=!0,t();else{const l=setInterval(()=>{const c=w.state;c.isUiLoaded&&c.isDataLoaded&&(clearInterval(l),T.open=!0,t())},200)}})},close(){T.open=!1}};var Me=Object.defineProperty,ie=Object.getOwnPropertySymbols,Se=Object.prototype.hasOwnProperty,De=Object.prototype.propertyIsEnumerable,le=(e,t,s)=>t in e?Me(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,je=(e,t)=>{for(var s in t||(t={}))Se.call(t,s)&&le(e,s,t[s]);if(ie)for(var s of ie(t))De.call(t,s)&&le(e,s,t[s]);return e};function Ue(){return typeof matchMedia<"u"&&matchMedia("(prefers-color-scheme: dark)").matches}const k=P({themeMode:Ue()?"dark":"light"}),ce={state:k,subscribe(e){return D(k,()=>e(k))},setThemeConfig(e){const{themeMode:t,themeVariables:s}=e;t&&(k.themeMode=t),s&&(k.themeVariables=je({},s))}},S=P({open:!1,message:"",variant:"success"}),Re={state:S,subscribe(e){return D(S,()=>e(S))},openToast(e,t){S.open=!0,S.message=e,S.variant=t},closeToast(){S.open=!1}};class Te{constructor(t){this.openModal=F.open,this.closeModal=F.close,this.subscribeModal=F.subscribe,this.setTheme=ce.setThemeConfig,ce.setThemeConfig(t),$.setConfig(t),this.initUi()}async initUi(){if(typeof window<"u"){await pe(()=>import("./index-BhswOEW5.js"),__vite__mapDeps([0,1,2]));const t=document.createElement("wcm-modal");document.body.insertAdjacentElement("beforeend",t),w.setIsUiLoaded(!0)}}}const Ve=Object.freeze(Object.defineProperty({__proto__:null,WalletConnectModal:Te},Symbol.toStringTag,{value:"Module"}));export{m as C,ke as E,F as M,w as O,de as R,ce as T,Re as a,Ie as b,$ as c,Ve as i}; +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-DOzQxzSO.js","assets/index-uonIXzgQ.js","assets/index-Dd5JfyyB.css"])))=>i.map(i=>d[i]); +import{_ as pe}from"./index-uonIXzgQ.js";const me=Symbol(),ee=Object.getPrototypeOf,Y=new WeakMap,he=e=>e&&(Y.has(e)?Y.get(e):ee(e)===Object.prototype||ee(e)===Array.prototype),ge=e=>he(e)&&e[me]||null,te=(e,t=!0)=>{Y.set(e,t)},z={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1,VITE_WALLETCONNECT_PROJECT_ID:"1d93edc21291f98e3bed6ff7617ff539"},J=e=>typeof e=="object"&&e!==null,L=new WeakMap,x=new WeakSet,ye=(e=Object.is,t=(o,g)=>new Proxy(o,g),s=o=>J(o)&&!x.has(o)&&(Array.isArray(o)||!(Symbol.iterator in o))&&!(o instanceof WeakMap)&&!(o instanceof WeakSet)&&!(o instanceof Error)&&!(o instanceof Number)&&!(o instanceof Date)&&!(o instanceof String)&&!(o instanceof RegExp)&&!(o instanceof ArrayBuffer),n=o=>{switch(o.status){case"fulfilled":return o.value;case"rejected":throw o.reason;default:throw o}},l=new WeakMap,c=(o,g,I=n)=>{const v=l.get(o);if((v==null?void 0:v[0])===g)return v[1];const b=Array.isArray(o)?[]:Object.create(Object.getPrototypeOf(o));return te(b,!0),l.set(o,[g,b]),Reflect.ownKeys(o).forEach(j=>{if(Object.getOwnPropertyDescriptor(b,j))return;const O=Reflect.get(o,j),A={value:O,enumerable:!0,configurable:!0};if(x.has(O))te(O,!1);else if(O instanceof Promise)delete A.value,A.get=()=>I(O);else if(L.has(O)){const[y,H]=L.get(O);A.value=c(y,H(),I)}Object.defineProperty(b,j,A)}),Object.preventExtensions(b)},d=new WeakMap,f=[1,1],W=o=>{if(!J(o))throw new Error("object required");const g=d.get(o);if(g)return g;let I=f[0];const v=new Set,b=(i,a=++f[0])=>{I!==a&&(I=a,v.forEach(r=>r(i,a)))};let j=f[1];const O=(i=++f[1])=>(j!==i&&!v.size&&(j=i,y.forEach(([a])=>{const r=a[1](i);r>I&&(I=r)})),I),A=i=>(a,r)=>{const h=[...a];h[1]=[i,...h[1]],b(h,r)},y=new Map,H=(i,a)=>{if((z?"production":void 0)!=="production"&&y.has(i))throw new Error("prop listener already exists");if(v.size){const r=a[3](A(i));y.set(i,[a,r])}else y.set(i,[a])},Z=i=>{var a;const r=y.get(i);r&&(y.delete(i),(a=r[1])==null||a.call(r))},ue=i=>(v.add(i),v.size===1&&y.forEach(([r,h],U)=>{if((z?"production":void 0)!=="production"&&h)throw new Error("remove already exists");const N=r[3](A(U));y.set(U,[r,N])}),()=>{v.delete(i),v.size===0&&y.forEach(([r,h],U)=>{h&&(h(),y.set(U,[r]))})}),q=Array.isArray(o)?[]:Object.create(Object.getPrototypeOf(o)),R=t(q,{deleteProperty(i,a){const r=Reflect.get(i,a);Z(a);const h=Reflect.deleteProperty(i,a);return h&&b(["delete",[a],r]),h},set(i,a,r,h){const U=Reflect.has(i,a),N=Reflect.get(i,a,h);if(U&&(e(N,r)||d.has(r)&&e(N,d.get(r))))return!0;Z(a),J(r)&&(r=ge(r)||r);let V=r;if(r instanceof Promise)r.then(C=>{r.status="fulfilled",r.value=C,b(["resolve",[a],C])}).catch(C=>{r.status="rejected",r.reason=C,b(["reject",[a],C])});else{!L.has(r)&&s(r)&&(V=W(r));const C=!x.has(V)&&L.get(V);C&&H(a,C)}return Reflect.set(i,a,V,h),b(["set",[a],r,N]),!0}});d.set(o,R);const fe=[q,O,c,ue];return L.set(R,fe),Reflect.ownKeys(o).forEach(i=>{const a=Object.getOwnPropertyDescriptor(o,i);"value"in a&&(R[i]=o[i],delete a.value,delete a.writable),Object.defineProperty(q,i,a)}),R})=>[W,L,x,e,t,s,n,l,c,d,f],[ve]=ye();function P(e={}){return ve(e)}function D(e,t,s){const n=L.get(e);(z?"production":void 0)!=="production"&&!n&&console.warn("Please use proxy object");let l;const c=[],d=n[3];let f=!1;const o=d(g=>{c.push(g),l||(l=Promise.resolve().then(()=>{l=void 0,f&&t(c.splice(0))}))});return f=!0,()=>{f=!1,o()}}function be(e,t){const s=L.get(e);(z?"production":void 0)!=="production"&&!s&&console.warn("Please use proxy object");const[n,l,c]=s;return c(n,l(),t)}const u=P({history:["ConnectWallet"],view:"ConnectWallet",data:void 0}),de={state:u,subscribe(e){return D(u,()=>e(u))},push(e,t){e!==u.view&&(u.view=e,t&&(u.data=t),u.history.push(e))},reset(e){u.view=e,u.history=[e]},replace(e){u.history.length>1&&(u.history[u.history.length-1]=e,u.view=e)},goBack(){if(u.history.length>1){u.history.pop();const[e]=u.history.slice(-1);u.view=e}},setData(e){u.data=e}},m={WALLETCONNECT_DEEPLINK_CHOICE:"WALLETCONNECT_DEEPLINK_CHOICE",WCM_VERSION:"WCM_VERSION",RECOMMENDED_WALLET_AMOUNT:9,isMobile(){return typeof window<"u"?!!(window.matchMedia("(pointer:coarse)").matches||/Android|webOS|iPhone|iPad|iPod|BlackBerry|Opera Mini/u.test(navigator.userAgent)):!1},isAndroid(){return m.isMobile()&&navigator.userAgent.toLowerCase().includes("android")},isIos(){const e=navigator.userAgent.toLowerCase();return m.isMobile()&&(e.includes("iphone")||e.includes("ipad"))},isHttpUrl(e){return e.startsWith("http://")||e.startsWith("https://")},isArray(e){return Array.isArray(e)&&e.length>0},isTelegram(){return typeof window<"u"&&(!!window.TelegramWebviewProxy||!!window.Telegram||!!window.TelegramWebviewProxyProto)},formatNativeUrl(e,t,s){if(m.isHttpUrl(e))return this.formatUniversalUrl(e,t,s);let n=e;n.includes("://")||(n=e.replaceAll("/","").replaceAll(":",""),n=`${n}://`),n.endsWith("/")||(n=`${n}/`),this.setWalletConnectDeepLink(n,s);const l=encodeURIComponent(t);return`${n}wc?uri=${l}`},formatUniversalUrl(e,t,s){if(!m.isHttpUrl(e))return this.formatNativeUrl(e,t,s);let n=e;if(n.startsWith("https://t.me")){const c=Buffer.from(t).toString("base64").replace(/[=]/g,"");n.endsWith("/")&&(n=n.slice(0,-1)),this.setWalletConnectDeepLink(n,s);const d=new URL(n);return d.searchParams.set("startapp",c),d.toString()}n.endsWith("/")||(n=`${n}/`),this.setWalletConnectDeepLink(n,s);const l=encodeURIComponent(t);return`${n}wc?uri=${l}`},async wait(e){return new Promise(t=>{setTimeout(t,e)})},openHref(e,t){const s=this.isTelegram()?"_blank":t;window.open(e,s,"noreferrer noopener")},setWalletConnectDeepLink(e,t){try{localStorage.setItem(m.WALLETCONNECT_DEEPLINK_CHOICE,JSON.stringify({href:e,name:t}))}catch{console.info("Unable to set WalletConnect deep link")}},setWalletConnectAndroidDeepLink(e){try{const[t]=e.split("?");localStorage.setItem(m.WALLETCONNECT_DEEPLINK_CHOICE,JSON.stringify({href:t,name:"Android"}))}catch{console.info("Unable to set WalletConnect android deep link")}},removeWalletConnectDeepLink(){try{localStorage.removeItem(m.WALLETCONNECT_DEEPLINK_CHOICE)}catch{console.info("Unable to remove WalletConnect deep link")}},setModalVersionInStorage(){try{typeof localStorage<"u"&&localStorage.setItem(m.WCM_VERSION,"2.7.0")}catch{console.info("Unable to set Web3Modal version in storage")}},getWalletRouterData(){var e;const t=(e=de.state.data)==null?void 0:e.Wallet;if(!t)throw new Error('Missing "Wallet" view data');return t}},we=typeof location<"u"&&(location.hostname.includes("localhost")||location.protocol.includes("https")),p=P({enabled:we,userSessionId:"",events:[],connectedWalletId:void 0}),Ie={state:p,subscribe(e){return D(p.events,()=>e(be(p.events[p.events.length-1])))},initialize(){p.enabled&&typeof(crypto==null?void 0:crypto.randomUUID)<"u"&&(p.userSessionId=crypto.randomUUID())},setConnectedWalletId(e){p.connectedWalletId=e},click(e){if(p.enabled){const t={type:"CLICK",name:e.name,userSessionId:p.userSessionId,timestamp:Date.now(),data:e};p.events.push(t)}},track(e){if(p.enabled){const t={type:"TRACK",name:e.name,userSessionId:p.userSessionId,timestamp:Date.now(),data:e};p.events.push(t)}},view(e){if(p.enabled){const t={type:"VIEW",name:e.name,userSessionId:p.userSessionId,timestamp:Date.now(),data:e};p.events.push(t)}}},_=P({chains:void 0,walletConnectUri:void 0,isAuth:!1,isCustomDesktop:!1,isCustomMobile:!1,isDataLoaded:!1,isUiLoaded:!1}),w={state:_,subscribe(e){return D(_,()=>e(_))},setChains(e){_.chains=e},setWalletConnectUri(e){_.walletConnectUri=e},setIsCustomDesktop(e){_.isCustomDesktop=e},setIsCustomMobile(e){_.isCustomMobile=e},setIsDataLoaded(e){_.isDataLoaded=e},setIsUiLoaded(e){_.isUiLoaded=e},setIsAuth(e){_.isAuth=e}},B=P({projectId:"",mobileWallets:void 0,desktopWallets:void 0,walletImages:void 0,chains:void 0,enableAuthMode:!1,enableExplorer:!0,explorerExcludedWalletIds:void 0,explorerRecommendedWalletIds:void 0,termsOfServiceUrl:void 0,privacyPolicyUrl:void 0}),$={state:B,subscribe(e){return D(B,()=>e(B))},setConfig(e){var t,s;Ie.initialize(),w.setChains(e.chains),w.setIsAuth(!!e.enableAuthMode),w.setIsCustomMobile(!!((t=e.mobileWallets)!=null&&t.length)),w.setIsCustomDesktop(!!((s=e.desktopWallets)!=null&&s.length)),m.setModalVersionInStorage(),Object.assign(B,e)}};var _e=Object.defineProperty,se=Object.getOwnPropertySymbols,Ee=Object.prototype.hasOwnProperty,Oe=Object.prototype.propertyIsEnumerable,ne=(e,t,s)=>t in e?_e(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,We=(e,t)=>{for(var s in t||(t={}))Ee.call(t,s)&&ne(e,s,t[s]);if(se)for(var s of se(t))Oe.call(t,s)&&ne(e,s,t[s]);return e};const G="https://explorer-api.walletconnect.com",Q="wcm",X="js-2.7.0";async function K(e,t){const s=We({sdkType:Q,sdkVersion:X},t),n=new URL(e,G);return n.searchParams.append("projectId",$.state.projectId),Object.entries(s).forEach(([c,d])=>{d&&n.searchParams.append(c,String(d))}),(await fetch(n)).json()}const M={async getDesktopListings(e){return K("/w3m/v1/getDesktopListings",e)},async getMobileListings(e){return K("/w3m/v1/getMobileListings",e)},async getInjectedListings(e){return K("/w3m/v1/getInjectedListings",e)},async getAllListings(e){return K("/w3m/v1/getAllListings",e)},getWalletImageUrl(e){return`${G}/w3m/v1/getWalletImage/${e}?projectId=${$.state.projectId}&sdkType=${Q}&sdkVersion=${X}`},getAssetImageUrl(e){return`${G}/w3m/v1/getAssetImage/${e}?projectId=${$.state.projectId}&sdkType=${Q}&sdkVersion=${X}`}};var Ce=Object.defineProperty,oe=Object.getOwnPropertySymbols,Le=Object.prototype.hasOwnProperty,Pe=Object.prototype.propertyIsEnumerable,re=(e,t,s)=>t in e?Ce(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,Ae=(e,t)=>{for(var s in t||(t={}))Le.call(t,s)&&re(e,s,t[s]);if(oe)for(var s of oe(t))Pe.call(t,s)&&re(e,s,t[s]);return e};const ae=m.isMobile(),E=P({wallets:{listings:[],total:0,page:1},search:{listings:[],total:0,page:1},recomendedWallets:[]}),ke={state:E,async getRecomendedWallets(){const{explorerRecommendedWalletIds:e,explorerExcludedWalletIds:t}=$.state;if(e==="NONE"||t==="ALL"&&!e)return E.recomendedWallets;if(m.isArray(e)){const n={recommendedIds:e.join(",")},{listings:l}=await M.getAllListings(n),c=Object.values(l);c.sort((d,f)=>{const W=e.indexOf(d.id),o=e.indexOf(f.id);return W-o}),E.recomendedWallets=c}else{const{chains:s,isAuth:n}=w.state,l=s==null?void 0:s.join(","),c=m.isArray(t),d={page:1,sdks:n?"auth_v1":void 0,entries:m.RECOMMENDED_WALLET_AMOUNT,chains:l,version:2,excludedIds:c?t.join(","):void 0},{listings:f}=ae?await M.getMobileListings(d):await M.getDesktopListings(d);E.recomendedWallets=Object.values(f)}return E.recomendedWallets},async getWallets(e){const t=Ae({},e),{explorerRecommendedWalletIds:s,explorerExcludedWalletIds:n}=$.state,{recomendedWallets:l}=E;if(n==="ALL")return E.wallets;l.length?t.excludedIds=l.map(I=>I.id).join(","):m.isArray(s)&&(t.excludedIds=s.join(",")),m.isArray(n)&&(t.excludedIds=[t.excludedIds,n].filter(Boolean).join(",")),w.state.isAuth&&(t.sdks="auth_v1");const{page:c,search:d}=e,{listings:f,total:W}=ae?await M.getMobileListings(t):await M.getDesktopListings(t),o=Object.values(f),g=d?"search":"wallets";return E[g]={listings:[...E[g].listings,...o],total:W,page:c??1},{listings:o,total:W}},getWalletImageUrl(e){return M.getWalletImageUrl(e)},getAssetImageUrl(e){return M.getAssetImageUrl(e)},resetSearch(){E.search={listings:[],total:0,page:1}}},T=P({open:!1}),F={state:T,subscribe(e){return D(T,()=>e(T))},async open(e){return new Promise(t=>{const{isUiLoaded:s,isDataLoaded:n}=w.state;if(m.removeWalletConnectDeepLink(),w.setWalletConnectUri(e==null?void 0:e.uri),w.setChains(e==null?void 0:e.chains),de.reset("ConnectWallet"),s&&n)T.open=!0,t();else{const l=setInterval(()=>{const c=w.state;c.isUiLoaded&&c.isDataLoaded&&(clearInterval(l),T.open=!0,t())},200)}})},close(){T.open=!1}};var Me=Object.defineProperty,ie=Object.getOwnPropertySymbols,Se=Object.prototype.hasOwnProperty,De=Object.prototype.propertyIsEnumerable,le=(e,t,s)=>t in e?Me(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,je=(e,t)=>{for(var s in t||(t={}))Se.call(t,s)&&le(e,s,t[s]);if(ie)for(var s of ie(t))De.call(t,s)&&le(e,s,t[s]);return e};function Ue(){return typeof matchMedia<"u"&&matchMedia("(prefers-color-scheme: dark)").matches}const k=P({themeMode:Ue()?"dark":"light"}),ce={state:k,subscribe(e){return D(k,()=>e(k))},setThemeConfig(e){const{themeMode:t,themeVariables:s}=e;t&&(k.themeMode=t),s&&(k.themeVariables=je({},s))}},S=P({open:!1,message:"",variant:"success"}),Re={state:S,subscribe(e){return D(S,()=>e(S))},openToast(e,t){S.open=!0,S.message=e,S.variant=t},closeToast(){S.open=!1}};class Te{constructor(t){this.openModal=F.open,this.closeModal=F.close,this.subscribeModal=F.subscribe,this.setTheme=ce.setThemeConfig,ce.setThemeConfig(t),$.setConfig(t),this.initUi()}async initUi(){if(typeof window<"u"){await pe(()=>import("./index-DOzQxzSO.js"),__vite__mapDeps([0,1,2]));const t=document.createElement("wcm-modal");document.body.insertAdjacentElement("beforeend",t),w.setIsUiLoaded(!0)}}}const Ve=Object.freeze(Object.defineProperty({__proto__:null,WalletConnectModal:Te},Symbol.toStringTag,{value:"Module"}));export{m as C,ke as E,F as M,w as O,de as R,ce as T,Re as a,Ie as b,$ as c,Ve as i}; diff --git a/buddybook/assets/index-Cye4tEiE.js b/buddybook/assets/index-uonIXzgQ.js similarity index 95% rename from buddybook/assets/index-Cye4tEiE.js rename to buddybook/assets/index-uonIXzgQ.js index 4b9c0ae..9cf3ebc 100644 --- a/buddybook/assets/index-Cye4tEiE.js +++ b/buddybook/assets/index-uonIXzgQ.js @@ -1,4 +1,4 @@ -const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-B6MMxlAs.js","assets/hooks.module-D0gf0yJl.js","assets/index-CRce2FXR.js","assets/inherits_browser-DKXdsDax.js","assets/events-EbrwmdBG.js","assets/index-c_vQ90mY.js","assets/index.es-BocJIoGE.js"])))=>i.map(i=>d[i]); +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-xz6stGwY.js","assets/hooks.module-D0gf0yJl.js","assets/index-Cu6T4rb4.js","assets/inherits_browser-Bb3-ajt6.js","assets/events-xQ4utD7e.js","assets/index-BpmIcSNW.js","assets/index.es-C5jEvyUt.js"])))=>i.map(i=>d[i]); var nu=Object.defineProperty;var Bs=o=>{throw TypeError(o)};var ru=(o,et,tt)=>et in o?nu(o,et,{enumerable:!0,configurable:!0,writable:!0,value:tt}):o[et]=tt;var Ct=(o,et,tt)=>ru(o,typeof et!="symbol"?et+"":et,tt),is=(o,et,tt)=>et.has(o)||Bs("Cannot "+tt);var Mt=(o,et,tt)=>(is(o,et,"read from private field"),tt?tt.call(o):et.get(o)),fn=(o,et,tt)=>et.has(o)?Bs("Cannot add the same private member more than once"):et instanceof WeakSet?et.add(o):et.set(o,tt),un=(o,et,tt,nt)=>(is(o,et,"write to private field"),nt?nt.call(o,tt):et.set(o,tt),tt),gn=(o,et,tt)=>(is(o,et,"access private method"),tt);var br=(o,et,tt,nt)=>({set _(rt){un(o,et,rt,tt)},get _(){return Mt(o,et,nt)}});function _mergeNamespaces(o,et){for(var tt=0;ttnt[rt]})}}}return Object.freeze(Object.defineProperty(o,Symbol.toStringTag,{value:"Module"}))}(function(){const et=document.createElement("link").relList;if(et&&et.supports&&et.supports("modulepreload"))return;for(const rt of document.querySelectorAll('link[rel="modulepreload"]'))nt(rt);new MutationObserver(rt=>{for(const ot of rt)if(ot.type==="childList")for(const it of ot.addedNodes)it.tagName==="LINK"&&it.rel==="modulepreload"&&nt(it)}).observe(document,{childList:!0,subtree:!0});function tt(rt){const ot={};return rt.integrity&&(ot.integrity=rt.integrity),rt.referrerPolicy&&(ot.referrerPolicy=rt.referrerPolicy),rt.crossOrigin==="use-credentials"?ot.credentials="include":rt.crossOrigin==="anonymous"?ot.credentials="omit":ot.credentials="same-origin",ot}function nt(rt){if(rt.ep)return;rt.ep=!0;const ot=tt(rt);fetch(rt.href,ot)}})();var commonjsGlobal=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{};function getDefaultExportFromCjs(o){return o&&o.__esModule&&Object.prototype.hasOwnProperty.call(o,"default")?o.default:o}function getAugmentedNamespace(o){if(o.__esModule)return o;var et=o.default;if(typeof et=="function"){var tt=function nt(){return this instanceof nt?Reflect.construct(et,arguments,this.constructor):et.apply(this,arguments)};tt.prototype=et.prototype}else tt={};return Object.defineProperty(tt,"__esModule",{value:!0}),Object.keys(o).forEach(function(nt){var rt=Object.getOwnPropertyDescriptor(o,nt);Object.defineProperty(tt,nt,rt.get?rt:{enumerable:!0,get:function(){return o[nt]}})}),tt}var jsxRuntime={exports:{}},reactJsxRuntime_production_min={},react={exports:{}},react_production_min={};/** * @license React * react.production.min.js @@ -20,7 +20,7 @@ var nu=Object.defineProperty;var Bs=o=>{throw TypeError(o)};var ru=(o,et,tt)=>et * * @author Feross Aboukhadijeh * @license MIT - */(function(o){const et=base64Js,tt=ieee754,nt=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;o.Buffer=st,o.SlowBuffer=xt,o.INSPECT_MAX_BYTES=50;const rt=2147483647;o.kMaxLength=rt,st.TYPED_ARRAY_SUPPORT=ot(),!st.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function ot(){try{const It=new Uint8Array(1),St={foo:function(){return 42}};return Object.setPrototypeOf(St,Uint8Array.prototype),Object.setPrototypeOf(It,St),It.foo()===42}catch{return!1}}Object.defineProperty(st.prototype,"parent",{enumerable:!0,get:function(){if(st.isBuffer(this))return this.buffer}}),Object.defineProperty(st.prototype,"offset",{enumerable:!0,get:function(){if(st.isBuffer(this))return this.byteOffset}});function it(It){if(It>rt)throw new RangeError('The value "'+It+'" is invalid for option "size"');const St=new Uint8Array(It);return Object.setPrototypeOf(St,st.prototype),St}function st(It,St,At){if(typeof It=="number"){if(typeof St=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return dt(It)}return at(It,St,At)}st.poolSize=8192;function at(It,St,At){if(typeof It=="string")return ht(It,St);if(ArrayBuffer.isView(It))return mt(It);if(It==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof It);if(In(It,ArrayBuffer)||It&&In(It.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(In(It,SharedArrayBuffer)||It&&In(It.buffer,SharedArrayBuffer)))return ft(It,St,At);if(typeof It=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');const jt=It.valueOf&&It.valueOf();if(jt!=null&&jt!==It)return st.from(jt,St,At);const Kt=yt(It);if(Kt)return Kt;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof It[Symbol.toPrimitive]=="function")return st.from(It[Symbol.toPrimitive]("string"),St,At);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof It)}st.from=function(It,St,At){return at(It,St,At)},Object.setPrototypeOf(st.prototype,Uint8Array.prototype),Object.setPrototypeOf(st,Uint8Array);function ct(It){if(typeof It!="number")throw new TypeError('"size" argument must be of type number');if(It<0)throw new RangeError('The value "'+It+'" is invalid for option "size"')}function lt(It,St,At){return ct(It),It<=0?it(It):St!==void 0?typeof At=="string"?it(It).fill(St,At):it(It).fill(St):it(It)}st.alloc=function(It,St,At){return lt(It,St,At)};function dt(It){return ct(It),it(It<0?0:gt(It)|0)}st.allocUnsafe=function(It){return dt(It)},st.allocUnsafeSlow=function(It){return dt(It)};function ht(It,St){if((typeof St!="string"||St==="")&&(St="utf8"),!st.isEncoding(St))throw new TypeError("Unknown encoding: "+St);const At=vt(It,St)|0;let jt=it(At);const Kt=jt.write(It,St);return Kt!==At&&(jt=jt.slice(0,Kt)),jt}function pt(It){const St=It.length<0?0:gt(It.length)|0,At=it(St);for(let jt=0;jt=rt)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+rt.toString(16)+" bytes");return It|0}function xt(It){return+It!=It&&(It=0),st.alloc(+It)}st.isBuffer=function(St){return St!=null&&St._isBuffer===!0&&St!==st.prototype},st.compare=function(St,At){if(In(St,Uint8Array)&&(St=st.from(St,St.offset,St.byteLength)),In(At,Uint8Array)&&(At=st.from(At,At.offset,At.byteLength)),!st.isBuffer(St)||!st.isBuffer(At))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(St===At)return 0;let jt=St.length,Kt=At.length;for(let rn=0,sn=Math.min(jt,Kt);rnKt.length?(st.isBuffer(sn)||(sn=st.from(sn)),sn.copy(Kt,rn)):Uint8Array.prototype.set.call(Kt,sn,rn);else if(st.isBuffer(sn))sn.copy(Kt,rn);else throw new TypeError('"list" argument must be an Array of Buffers');rn+=sn.length}return Kt};function vt(It,St){if(st.isBuffer(It))return It.length;if(ArrayBuffer.isView(It)||In(It,ArrayBuffer))return It.byteLength;if(typeof It!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof It);const At=It.length,jt=arguments.length>2&&arguments[2]===!0;if(!jt&&At===0)return 0;let Kt=!1;for(;;)switch(St){case"ascii":case"latin1":case"binary":return At;case"utf8":case"utf-8":return ln(It).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return At*2;case"hex":return At>>>1;case"base64":return mn(It).length;default:if(Kt)return jt?-1:ln(It).length;St=(""+St).toLowerCase(),Kt=!0}}st.byteLength=vt;function bt(It,St,At){let jt=!1;if((St===void 0||St<0)&&(St=0),St>this.length||((At===void 0||At>this.length)&&(At=this.length),At<=0)||(At>>>=0,St>>>=0,At<=St))return"";for(It||(It="utf8");;)switch(It){case"hex":return qt(this,St,At);case"utf8":case"utf-8":return zt(this,St,At);case"ascii":return Ht(this,St,At);case"latin1":case"binary":return Ut(this,St,At);case"base64":return Bt(this,St,At);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Lt(this,St,At);default:if(jt)throw new TypeError("Unknown encoding: "+It);It=(It+"").toLowerCase(),jt=!0}}st.prototype._isBuffer=!0;function Et(It,St,At){const jt=It[St];It[St]=It[At],It[At]=jt}st.prototype.swap16=function(){const St=this.length;if(St%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let At=0;AtAt&&(St+=" ... "),""},nt&&(st.prototype[nt]=st.prototype.inspect),st.prototype.compare=function(St,At,jt,Kt,rn){if(In(St,Uint8Array)&&(St=st.from(St,St.offset,St.byteLength)),!st.isBuffer(St))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof St);if(At===void 0&&(At=0),jt===void 0&&(jt=St?St.length:0),Kt===void 0&&(Kt=0),rn===void 0&&(rn=this.length),At<0||jt>St.length||Kt<0||rn>this.length)throw new RangeError("out of range index");if(Kt>=rn&&At>=jt)return 0;if(Kt>=rn)return-1;if(At>=jt)return 1;if(At>>>=0,jt>>>=0,Kt>>>=0,rn>>>=0,this===St)return 0;let sn=rn-Kt,xn=jt-At;const Rn=Math.min(sn,xn),vn=this.slice(Kt,rn),An=St.slice(At,jt);for(let bn=0;bn2147483647?At=2147483647:At<-2147483648&&(At=-2147483648),At=+At,Pn(At)&&(At=Kt?0:It.length-1),At<0&&(At=It.length+At),At>=It.length){if(Kt)return-1;At=It.length-1}else if(At<0)if(Kt)At=0;else return-1;if(typeof St=="string"&&(St=st.from(St,jt)),st.isBuffer(St))return St.length===0?-1:kt(It,St,At,jt,Kt);if(typeof St=="number")return St=St&255,typeof Uint8Array.prototype.indexOf=="function"?Kt?Uint8Array.prototype.indexOf.call(It,St,At):Uint8Array.prototype.lastIndexOf.call(It,St,At):kt(It,[St],At,jt,Kt);throw new TypeError("val must be string, number or Buffer")}function kt(It,St,At,jt,Kt){let rn=1,sn=It.length,xn=St.length;if(jt!==void 0&&(jt=String(jt).toLowerCase(),jt==="ucs2"||jt==="ucs-2"||jt==="utf16le"||jt==="utf-16le")){if(It.length<2||St.length<2)return-1;rn=2,sn/=2,xn/=2,At/=2}function Rn(An,bn){return rn===1?An[bn]:An.readUInt16BE(bn*rn)}let vn;if(Kt){let An=-1;for(vn=At;vnsn&&(At=sn-xn),vn=At;vn>=0;vn--){let An=!0;for(let bn=0;bnKt&&(jt=Kt)):jt=Kt;const rn=St.length;jt>rn/2&&(jt=rn/2);let sn;for(sn=0;sn>>0,isFinite(jt)?(jt=jt>>>0,Kt===void 0&&(Kt="utf8")):(Kt=jt,jt=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");const rn=this.length-At;if((jt===void 0||jt>rn)&&(jt=rn),St.length>0&&(jt<0||At<0)||At>this.length)throw new RangeError("Attempt to write outside buffer bounds");Kt||(Kt="utf8");let sn=!1;for(;;)switch(Kt){case"hex":return Tt(this,St,At,jt);case"utf8":case"utf-8":return Rt(this,St,At,jt);case"ascii":case"latin1":case"binary":return Pt(this,St,At,jt);case"base64":return $t(this,St,At,jt);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Ot(this,St,At,jt);default:if(sn)throw new TypeError("Unknown encoding: "+Kt);Kt=(""+Kt).toLowerCase(),sn=!0}},st.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function Bt(It,St,At){return St===0&&At===It.length?et.fromByteArray(It):et.fromByteArray(It.slice(St,At))}function zt(It,St,At){At=Math.min(It.length,At);const jt=[];let Kt=St;for(;Kt239?4:rn>223?3:rn>191?2:1;if(Kt+xn<=At){let Rn,vn,An,bn;switch(xn){case 1:rn<128&&(sn=rn);break;case 2:Rn=It[Kt+1],(Rn&192)===128&&(bn=(rn&31)<<6|Rn&63,bn>127&&(sn=bn));break;case 3:Rn=It[Kt+1],vn=It[Kt+2],(Rn&192)===128&&(vn&192)===128&&(bn=(rn&15)<<12|(Rn&63)<<6|vn&63,bn>2047&&(bn<55296||bn>57343)&&(sn=bn));break;case 4:Rn=It[Kt+1],vn=It[Kt+2],An=It[Kt+3],(Rn&192)===128&&(vn&192)===128&&(An&192)===128&&(bn=(rn&15)<<18|(Rn&63)<<12|(vn&63)<<6|An&63,bn>65535&&bn<1114112&&(sn=bn))}}sn===null?(sn=65533,xn=1):sn>65535&&(sn-=65536,jt.push(sn>>>10&1023|55296),sn=56320|sn&1023),jt.push(sn),Kt+=xn}return Yt(jt)}const Ft=4096;function Yt(It){const St=It.length;if(St<=Ft)return String.fromCharCode.apply(String,It);let At="",jt=0;for(;jtjt)&&(At=jt);let Kt="";for(let rn=St;rnjt&&(St=jt),At<0?(At+=jt,At<0&&(At=0)):At>jt&&(At=jt),AtAt)throw new RangeError("Trying to access beyond buffer length")}st.prototype.readUintLE=st.prototype.readUIntLE=function(St,At,jt){St=St>>>0,At=At>>>0,jt||Zt(St,At,this.length);let Kt=this[St],rn=1,sn=0;for(;++sn>>0,At=At>>>0,jt||Zt(St,At,this.length);let Kt=this[St+--At],rn=1;for(;At>0&&(rn*=256);)Kt+=this[St+--At]*rn;return Kt},st.prototype.readUint8=st.prototype.readUInt8=function(St,At){return St=St>>>0,At||Zt(St,1,this.length),this[St]},st.prototype.readUint16LE=st.prototype.readUInt16LE=function(St,At){return St=St>>>0,At||Zt(St,2,this.length),this[St]|this[St+1]<<8},st.prototype.readUint16BE=st.prototype.readUInt16BE=function(St,At){return St=St>>>0,At||Zt(St,2,this.length),this[St]<<8|this[St+1]},st.prototype.readUint32LE=st.prototype.readUInt32LE=function(St,At){return St=St>>>0,At||Zt(St,4,this.length),(this[St]|this[St+1]<<8|this[St+2]<<16)+this[St+3]*16777216},st.prototype.readUint32BE=st.prototype.readUInt32BE=function(St,At){return St=St>>>0,At||Zt(St,4,this.length),this[St]*16777216+(this[St+1]<<16|this[St+2]<<8|this[St+3])},st.prototype.readBigUInt64LE=En(function(St){St=St>>>0,Vt(St,"offset");const At=this[St],jt=this[St+7];(At===void 0||jt===void 0)&&en(St,this.length-8);const Kt=At+this[++St]*2**8+this[++St]*2**16+this[++St]*2**24,rn=this[++St]+this[++St]*2**8+this[++St]*2**16+jt*2**24;return BigInt(Kt)+(BigInt(rn)<>>0,Vt(St,"offset");const At=this[St],jt=this[St+7];(At===void 0||jt===void 0)&&en(St,this.length-8);const Kt=At*2**24+this[++St]*2**16+this[++St]*2**8+this[++St],rn=this[++St]*2**24+this[++St]*2**16+this[++St]*2**8+jt;return(BigInt(Kt)<>>0,At=At>>>0,jt||Zt(St,At,this.length);let Kt=this[St],rn=1,sn=0;for(;++sn=rn&&(Kt-=Math.pow(2,8*At)),Kt},st.prototype.readIntBE=function(St,At,jt){St=St>>>0,At=At>>>0,jt||Zt(St,At,this.length);let Kt=At,rn=1,sn=this[St+--Kt];for(;Kt>0&&(rn*=256);)sn+=this[St+--Kt]*rn;return rn*=128,sn>=rn&&(sn-=Math.pow(2,8*At)),sn},st.prototype.readInt8=function(St,At){return St=St>>>0,At||Zt(St,1,this.length),this[St]&128?(255-this[St]+1)*-1:this[St]},st.prototype.readInt16LE=function(St,At){St=St>>>0,At||Zt(St,2,this.length);const jt=this[St]|this[St+1]<<8;return jt&32768?jt|4294901760:jt},st.prototype.readInt16BE=function(St,At){St=St>>>0,At||Zt(St,2,this.length);const jt=this[St+1]|this[St]<<8;return jt&32768?jt|4294901760:jt},st.prototype.readInt32LE=function(St,At){return St=St>>>0,At||Zt(St,4,this.length),this[St]|this[St+1]<<8|this[St+2]<<16|this[St+3]<<24},st.prototype.readInt32BE=function(St,At){return St=St>>>0,At||Zt(St,4,this.length),this[St]<<24|this[St+1]<<16|this[St+2]<<8|this[St+3]},st.prototype.readBigInt64LE=En(function(St){St=St>>>0,Vt(St,"offset");const At=this[St],jt=this[St+7];(At===void 0||jt===void 0)&&en(St,this.length-8);const Kt=this[St+4]+this[St+5]*2**8+this[St+6]*2**16+(jt<<24);return(BigInt(Kt)<>>0,Vt(St,"offset");const At=this[St],jt=this[St+7];(At===void 0||jt===void 0)&&en(St,this.length-8);const Kt=(At<<24)+this[++St]*2**16+this[++St]*2**8+this[++St];return(BigInt(Kt)<>>0,At||Zt(St,4,this.length),tt.read(this,St,!0,23,4)},st.prototype.readFloatBE=function(St,At){return St=St>>>0,At||Zt(St,4,this.length),tt.read(this,St,!1,23,4)},st.prototype.readDoubleLE=function(St,At){return St=St>>>0,At||Zt(St,8,this.length),tt.read(this,St,!0,52,8)},st.prototype.readDoubleBE=function(St,At){return St=St>>>0,At||Zt(St,8,this.length),tt.read(this,St,!1,52,8)};function Qt(It,St,At,jt,Kt,rn){if(!st.isBuffer(It))throw new TypeError('"buffer" argument must be a Buffer instance');if(St>Kt||StIt.length)throw new RangeError("Index out of range")}st.prototype.writeUintLE=st.prototype.writeUIntLE=function(St,At,jt,Kt){if(St=+St,At=At>>>0,jt=jt>>>0,!Kt){const xn=Math.pow(2,8*jt)-1;Qt(this,St,At,jt,xn,0)}let rn=1,sn=0;for(this[At]=St&255;++sn>>0,jt=jt>>>0,!Kt){const xn=Math.pow(2,8*jt)-1;Qt(this,St,At,jt,xn,0)}let rn=jt-1,sn=1;for(this[At+rn]=St&255;--rn>=0&&(sn*=256);)this[At+rn]=St/sn&255;return At+jt},st.prototype.writeUint8=st.prototype.writeUInt8=function(St,At,jt){return St=+St,At=At>>>0,jt||Qt(this,St,At,1,255,0),this[At]=St&255,At+1},st.prototype.writeUint16LE=st.prototype.writeUInt16LE=function(St,At,jt){return St=+St,At=At>>>0,jt||Qt(this,St,At,2,65535,0),this[At]=St&255,this[At+1]=St>>>8,At+2},st.prototype.writeUint16BE=st.prototype.writeUInt16BE=function(St,At,jt){return St=+St,At=At>>>0,jt||Qt(this,St,At,2,65535,0),this[At]=St>>>8,this[At+1]=St&255,At+2},st.prototype.writeUint32LE=st.prototype.writeUInt32LE=function(St,At,jt){return St=+St,At=At>>>0,jt||Qt(this,St,At,4,4294967295,0),this[At+3]=St>>>24,this[At+2]=St>>>16,this[At+1]=St>>>8,this[At]=St&255,At+4},st.prototype.writeUint32BE=st.prototype.writeUInt32BE=function(St,At,jt){return St=+St,At=At>>>0,jt||Qt(this,St,At,4,4294967295,0),this[At]=St>>>24,this[At+1]=St>>>16,this[At+2]=St>>>8,this[At+3]=St&255,At+4};function Nt(It,St,At,jt,Kt){Dt(St,jt,Kt,It,At,7);let rn=Number(St&BigInt(4294967295));It[At++]=rn,rn=rn>>8,It[At++]=rn,rn=rn>>8,It[At++]=rn,rn=rn>>8,It[At++]=rn;let sn=Number(St>>BigInt(32)&BigInt(4294967295));return It[At++]=sn,sn=sn>>8,It[At++]=sn,sn=sn>>8,It[At++]=sn,sn=sn>>8,It[At++]=sn,At}function Gt(It,St,At,jt,Kt){Dt(St,jt,Kt,It,At,7);let rn=Number(St&BigInt(4294967295));It[At+7]=rn,rn=rn>>8,It[At+6]=rn,rn=rn>>8,It[At+5]=rn,rn=rn>>8,It[At+4]=rn;let sn=Number(St>>BigInt(32)&BigInt(4294967295));return It[At+3]=sn,sn=sn>>8,It[At+2]=sn,sn=sn>>8,It[At+1]=sn,sn=sn>>8,It[At]=sn,At+8}st.prototype.writeBigUInt64LE=En(function(St,At=0){return Nt(this,St,At,BigInt(0),BigInt("0xffffffffffffffff"))}),st.prototype.writeBigUInt64BE=En(function(St,At=0){return Gt(this,St,At,BigInt(0),BigInt("0xffffffffffffffff"))}),st.prototype.writeIntLE=function(St,At,jt,Kt){if(St=+St,At=At>>>0,!Kt){const Rn=Math.pow(2,8*jt-1);Qt(this,St,At,jt,Rn-1,-Rn)}let rn=0,sn=1,xn=0;for(this[At]=St&255;++rn>0)-xn&255;return At+jt},st.prototype.writeIntBE=function(St,At,jt,Kt){if(St=+St,At=At>>>0,!Kt){const Rn=Math.pow(2,8*jt-1);Qt(this,St,At,jt,Rn-1,-Rn)}let rn=jt-1,sn=1,xn=0;for(this[At+rn]=St&255;--rn>=0&&(sn*=256);)St<0&&xn===0&&this[At+rn+1]!==0&&(xn=1),this[At+rn]=(St/sn>>0)-xn&255;return At+jt},st.prototype.writeInt8=function(St,At,jt){return St=+St,At=At>>>0,jt||Qt(this,St,At,1,127,-128),St<0&&(St=255+St+1),this[At]=St&255,At+1},st.prototype.writeInt16LE=function(St,At,jt){return St=+St,At=At>>>0,jt||Qt(this,St,At,2,32767,-32768),this[At]=St&255,this[At+1]=St>>>8,At+2},st.prototype.writeInt16BE=function(St,At,jt){return St=+St,At=At>>>0,jt||Qt(this,St,At,2,32767,-32768),this[At]=St>>>8,this[At+1]=St&255,At+2},st.prototype.writeInt32LE=function(St,At,jt){return St=+St,At=At>>>0,jt||Qt(this,St,At,4,2147483647,-2147483648),this[At]=St&255,this[At+1]=St>>>8,this[At+2]=St>>>16,this[At+3]=St>>>24,At+4},st.prototype.writeInt32BE=function(St,At,jt){return St=+St,At=At>>>0,jt||Qt(this,St,At,4,2147483647,-2147483648),St<0&&(St=4294967295+St+1),this[At]=St>>>24,this[At+1]=St>>>16,this[At+2]=St>>>8,this[At+3]=St&255,At+4},st.prototype.writeBigInt64LE=En(function(St,At=0){return Nt(this,St,At,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),st.prototype.writeBigInt64BE=En(function(St,At=0){return Gt(this,St,At,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function nn(It,St,At,jt,Kt,rn){if(At+jt>It.length)throw new RangeError("Index out of range");if(At<0)throw new RangeError("Index out of range")}function Wt(It,St,At,jt,Kt){return St=+St,At=At>>>0,Kt||nn(It,St,At,4),tt.write(It,St,At,jt,23,4),At+4}st.prototype.writeFloatLE=function(St,At,jt){return Wt(this,St,At,!0,jt)},st.prototype.writeFloatBE=function(St,At,jt){return Wt(this,St,At,!1,jt)};function hn(It,St,At,jt,Kt){return St=+St,At=At>>>0,Kt||nn(It,St,At,8),tt.write(It,St,At,jt,52,8),At+8}st.prototype.writeDoubleLE=function(St,At,jt){return hn(this,St,At,!0,jt)},st.prototype.writeDoubleBE=function(St,At,jt){return hn(this,St,At,!1,jt)},st.prototype.copy=function(St,At,jt,Kt){if(!st.isBuffer(St))throw new TypeError("argument should be a Buffer");if(jt||(jt=0),!Kt&&Kt!==0&&(Kt=this.length),At>=St.length&&(At=St.length),At||(At=0),Kt>0&&Kt=this.length)throw new RangeError("Index out of range");if(Kt<0)throw new RangeError("sourceEnd out of bounds");Kt>this.length&&(Kt=this.length),St.length-At>>0,jt=jt===void 0?this.length:jt>>>0,St||(St=0);let rn;if(typeof St=="number")for(rn=At;rn2**32?Kt=tn(String(At)):typeof At=="bigint"&&(Kt=String(At),(At>BigInt(2)**BigInt(32)||At<-(BigInt(2)**BigInt(32)))&&(Kt=tn(Kt)),Kt+="n"),jt+=` It must be ${St}. Received ${Kt}`,jt},RangeError);function tn(It){let St="",At=It.length;const jt=It[0]==="-"?1:0;for(;At>=jt+4;At-=3)St=`_${It.slice(At-3,At)}${St}`;return`${It.slice(0,At)}${St}`}function _t(It,St,At){Vt(St,"offset"),(It[St]===void 0||It[St+At]===void 0)&&en(St,It.length-(At+1))}function Dt(It,St,At,jt,Kt,rn){if(It>At||It= 0${sn} and < 2${sn} ** ${(rn+1)*8}${sn}`:xn=`>= -(2${sn} ** ${(rn+1)*8-1}${sn}) and < 2 ** ${(rn+1)*8-1}${sn}`,new Xt.ERR_OUT_OF_RANGE("value",xn,It)}_t(jt,Kt,rn)}function Vt(It,St){if(typeof It!="number")throw new Xt.ERR_INVALID_ARG_TYPE(St,"number",It)}function en(It,St,At){throw Math.floor(It)!==It?(Vt(It,At),new Xt.ERR_OUT_OF_RANGE("offset","an integer",It)):St<0?new Xt.ERR_BUFFER_OUT_OF_BOUNDS:new Xt.ERR_OUT_OF_RANGE("offset",`>= 0 and <= ${St}`,It)}const an=/[^+/0-9A-Za-z-_]/g;function dn(It){if(It=It.split("=")[0],It=It.trim().replace(an,""),It.length<2)return"";for(;It.length%4!==0;)It=It+"=";return It}function ln(It,St){St=St||1/0;let At;const jt=It.length;let Kt=null;const rn=[];for(let sn=0;sn55295&&At<57344){if(!Kt){if(At>56319){(St-=3)>-1&&rn.push(239,191,189);continue}else if(sn+1===jt){(St-=3)>-1&&rn.push(239,191,189);continue}Kt=At;continue}if(At<56320){(St-=3)>-1&&rn.push(239,191,189),Kt=At;continue}At=(Kt-55296<<10|At-56320)+65536}else Kt&&(St-=3)>-1&&rn.push(239,191,189);if(Kt=null,At<128){if((St-=1)<0)break;rn.push(At)}else if(At<2048){if((St-=2)<0)break;rn.push(At>>6|192,At&63|128)}else if(At<65536){if((St-=3)<0)break;rn.push(At>>12|224,At>>6&63|128,At&63|128)}else if(At<1114112){if((St-=4)<0)break;rn.push(At>>18|240,At>>12&63|128,At>>6&63|128,At&63|128)}else throw new Error("Invalid code point")}return rn}function pn(It){const St=[];for(let At=0;At>8,Kt=At%256,rn.push(Kt),rn.push(jt);return rn}function mn(It){return et.toByteArray(dn(It))}function wn(It,St,At,jt){let Kt;for(Kt=0;Kt=St.length||Kt>=It.length);++Kt)St[Kt+At]=It[Kt];return Kt}function In(It,St){return It instanceof St||It!=null&&It.constructor!=null&&It.constructor.name!=null&&It.constructor.name===St.name}function Pn(It){return It!==It}const yn=function(){const It="0123456789abcdef",St=new Array(256);for(let At=0;At<16;++At){const jt=At*16;for(let Kt=0;Kt<16;++Kt)St[jt+Kt]=It[At]+It[Kt]}return St}();function En(It){return typeof BigInt>"u"?on:It}function on(){throw new Error("BigInt not supported")}})(buffer$2);var reactDom={exports:{}},reactDom_production_min={},scheduler={exports:{}},scheduler_production_min={};/** + */(function(o){const et=base64Js,tt=ieee754,nt=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;o.Buffer=st,o.SlowBuffer=xt,o.INSPECT_MAX_BYTES=50;const rt=2147483647;o.kMaxLength=rt,st.TYPED_ARRAY_SUPPORT=ot(),!st.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function ot(){try{const Tt=new Uint8Array(1),St={foo:function(){return 42}};return Object.setPrototypeOf(St,Uint8Array.prototype),Object.setPrototypeOf(Tt,St),Tt.foo()===42}catch{return!1}}Object.defineProperty(st.prototype,"parent",{enumerable:!0,get:function(){if(st.isBuffer(this))return this.buffer}}),Object.defineProperty(st.prototype,"offset",{enumerable:!0,get:function(){if(st.isBuffer(this))return this.byteOffset}});function it(Tt){if(Tt>rt)throw new RangeError('The value "'+Tt+'" is invalid for option "size"');const St=new Uint8Array(Tt);return Object.setPrototypeOf(St,st.prototype),St}function st(Tt,St,At){if(typeof Tt=="number"){if(typeof St=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return dt(Tt)}return at(Tt,St,At)}st.poolSize=8192;function at(Tt,St,At){if(typeof Tt=="string")return ht(Tt,St);if(ArrayBuffer.isView(Tt))return mt(Tt);if(Tt==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof Tt);if(Tn(Tt,ArrayBuffer)||Tt&&Tn(Tt.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(Tn(Tt,SharedArrayBuffer)||Tt&&Tn(Tt.buffer,SharedArrayBuffer)))return ft(Tt,St,At);if(typeof Tt=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');const $t=Tt.valueOf&&Tt.valueOf();if($t!=null&&$t!==Tt)return st.from($t,St,At);const Kt=yt(Tt);if(Kt)return Kt;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof Tt[Symbol.toPrimitive]=="function")return st.from(Tt[Symbol.toPrimitive]("string"),St,At);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof Tt)}st.from=function(Tt,St,At){return at(Tt,St,At)},Object.setPrototypeOf(st.prototype,Uint8Array.prototype),Object.setPrototypeOf(st,Uint8Array);function ct(Tt){if(typeof Tt!="number")throw new TypeError('"size" argument must be of type number');if(Tt<0)throw new RangeError('The value "'+Tt+'" is invalid for option "size"')}function lt(Tt,St,At){return ct(Tt),Tt<=0?it(Tt):St!==void 0?typeof At=="string"?it(Tt).fill(St,At):it(Tt).fill(St):it(Tt)}st.alloc=function(Tt,St,At){return lt(Tt,St,At)};function dt(Tt){return ct(Tt),it(Tt<0?0:gt(Tt)|0)}st.allocUnsafe=function(Tt){return dt(Tt)},st.allocUnsafeSlow=function(Tt){return dt(Tt)};function ht(Tt,St){if((typeof St!="string"||St==="")&&(St="utf8"),!st.isEncoding(St))throw new TypeError("Unknown encoding: "+St);const At=vt(Tt,St)|0;let $t=it(At);const Kt=$t.write(Tt,St);return Kt!==At&&($t=$t.slice(0,Kt)),$t}function pt(Tt){const St=Tt.length<0?0:gt(Tt.length)|0,At=it(St);for(let $t=0;$t=rt)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+rt.toString(16)+" bytes");return Tt|0}function xt(Tt){return+Tt!=Tt&&(Tt=0),st.alloc(+Tt)}st.isBuffer=function(St){return St!=null&&St._isBuffer===!0&&St!==st.prototype},st.compare=function(St,At){if(Tn(St,Uint8Array)&&(St=st.from(St,St.offset,St.byteLength)),Tn(At,Uint8Array)&&(At=st.from(At,At.offset,At.byteLength)),!st.isBuffer(St)||!st.isBuffer(At))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(St===At)return 0;let $t=St.length,Kt=At.length;for(let rn=0,sn=Math.min($t,Kt);rnKt.length?(st.isBuffer(sn)||(sn=st.from(sn)),sn.copy(Kt,rn)):Uint8Array.prototype.set.call(Kt,sn,rn);else if(st.isBuffer(sn))sn.copy(Kt,rn);else throw new TypeError('"list" argument must be an Array of Buffers');rn+=sn.length}return Kt};function vt(Tt,St){if(st.isBuffer(Tt))return Tt.length;if(ArrayBuffer.isView(Tt)||Tn(Tt,ArrayBuffer))return Tt.byteLength;if(typeof Tt!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof Tt);const At=Tt.length,$t=arguments.length>2&&arguments[2]===!0;if(!$t&&At===0)return 0;let Kt=!1;for(;;)switch(St){case"ascii":case"latin1":case"binary":return At;case"utf8":case"utf-8":return ln(Tt).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return At*2;case"hex":return At>>>1;case"base64":return mn(Tt).length;default:if(Kt)return $t?-1:ln(Tt).length;St=(""+St).toLowerCase(),Kt=!0}}st.byteLength=vt;function bt(Tt,St,At){let $t=!1;if((St===void 0||St<0)&&(St=0),St>this.length||((At===void 0||At>this.length)&&(At=this.length),At<=0)||(At>>>=0,St>>>=0,At<=St))return"";for(Tt||(Tt="utf8");;)switch(Tt){case"hex":return qt(this,St,At);case"utf8":case"utf-8":return zt(this,St,At);case"ascii":return Ht(this,St,At);case"latin1":case"binary":return Ut(this,St,At);case"base64":return Bt(this,St,At);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Lt(this,St,At);default:if($t)throw new TypeError("Unknown encoding: "+Tt);Tt=(Tt+"").toLowerCase(),$t=!0}}st.prototype._isBuffer=!0;function Et(Tt,St,At){const $t=Tt[St];Tt[St]=Tt[At],Tt[At]=$t}st.prototype.swap16=function(){const St=this.length;if(St%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let At=0;AtAt&&(St+=" ... "),""},nt&&(st.prototype[nt]=st.prototype.inspect),st.prototype.compare=function(St,At,$t,Kt,rn){if(Tn(St,Uint8Array)&&(St=st.from(St,St.offset,St.byteLength)),!st.isBuffer(St))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof St);if(At===void 0&&(At=0),$t===void 0&&($t=St?St.length:0),Kt===void 0&&(Kt=0),rn===void 0&&(rn=this.length),At<0||$t>St.length||Kt<0||rn>this.length)throw new RangeError("out of range index");if(Kt>=rn&&At>=$t)return 0;if(Kt>=rn)return-1;if(At>=$t)return 1;if(At>>>=0,$t>>>=0,Kt>>>=0,rn>>>=0,this===St)return 0;let sn=rn-Kt,xn=$t-At;const Rn=Math.min(sn,xn),vn=this.slice(Kt,rn),An=St.slice(At,$t);for(let bn=0;bn2147483647?At=2147483647:At<-2147483648&&(At=-2147483648),At=+At,Pn(At)&&(At=Kt?0:Tt.length-1),At<0&&(At=Tt.length+At),At>=Tt.length){if(Kt)return-1;At=Tt.length-1}else if(At<0)if(Kt)At=0;else return-1;if(typeof St=="string"&&(St=st.from(St,$t)),st.isBuffer(St))return St.length===0?-1:kt(Tt,St,At,$t,Kt);if(typeof St=="number")return St=St&255,typeof Uint8Array.prototype.indexOf=="function"?Kt?Uint8Array.prototype.indexOf.call(Tt,St,At):Uint8Array.prototype.lastIndexOf.call(Tt,St,At):kt(Tt,[St],At,$t,Kt);throw new TypeError("val must be string, number or Buffer")}function kt(Tt,St,At,$t,Kt){let rn=1,sn=Tt.length,xn=St.length;if($t!==void 0&&($t=String($t).toLowerCase(),$t==="ucs2"||$t==="ucs-2"||$t==="utf16le"||$t==="utf-16le")){if(Tt.length<2||St.length<2)return-1;rn=2,sn/=2,xn/=2,At/=2}function Rn(An,bn){return rn===1?An[bn]:An.readUInt16BE(bn*rn)}let vn;if(Kt){let An=-1;for(vn=At;vnsn&&(At=sn-xn),vn=At;vn>=0;vn--){let An=!0;for(let bn=0;bnKt&&($t=Kt)):$t=Kt;const rn=St.length;$t>rn/2&&($t=rn/2);let sn;for(sn=0;sn<$t;++sn){const xn=parseInt(St.substr(sn*2,2),16);if(Pn(xn))return sn;Tt[At+sn]=xn}return sn}function Rt(Tt,St,At,$t){return wn(ln(St,Tt.length-At),Tt,At,$t)}function Pt(Tt,St,At,$t){return wn(pn(St),Tt,At,$t)}function jt(Tt,St,At,$t){return wn(mn(St),Tt,At,$t)}function Ot(Tt,St,At,$t){return wn(kn(St,Tt.length-At),Tt,At,$t)}st.prototype.write=function(St,At,$t,Kt){if(At===void 0)Kt="utf8",$t=this.length,At=0;else if($t===void 0&&typeof At=="string")Kt=At,$t=this.length,At=0;else if(isFinite(At))At=At>>>0,isFinite($t)?($t=$t>>>0,Kt===void 0&&(Kt="utf8")):(Kt=$t,$t=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");const rn=this.length-At;if(($t===void 0||$t>rn)&&($t=rn),St.length>0&&($t<0||At<0)||At>this.length)throw new RangeError("Attempt to write outside buffer bounds");Kt||(Kt="utf8");let sn=!1;for(;;)switch(Kt){case"hex":return It(this,St,At,$t);case"utf8":case"utf-8":return Rt(this,St,At,$t);case"ascii":case"latin1":case"binary":return Pt(this,St,At,$t);case"base64":return jt(this,St,At,$t);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Ot(this,St,At,$t);default:if(sn)throw new TypeError("Unknown encoding: "+Kt);Kt=(""+Kt).toLowerCase(),sn=!0}},st.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function Bt(Tt,St,At){return St===0&&At===Tt.length?et.fromByteArray(Tt):et.fromByteArray(Tt.slice(St,At))}function zt(Tt,St,At){At=Math.min(Tt.length,At);const $t=[];let Kt=St;for(;Kt239?4:rn>223?3:rn>191?2:1;if(Kt+xn<=At){let Rn,vn,An,bn;switch(xn){case 1:rn<128&&(sn=rn);break;case 2:Rn=Tt[Kt+1],(Rn&192)===128&&(bn=(rn&31)<<6|Rn&63,bn>127&&(sn=bn));break;case 3:Rn=Tt[Kt+1],vn=Tt[Kt+2],(Rn&192)===128&&(vn&192)===128&&(bn=(rn&15)<<12|(Rn&63)<<6|vn&63,bn>2047&&(bn<55296||bn>57343)&&(sn=bn));break;case 4:Rn=Tt[Kt+1],vn=Tt[Kt+2],An=Tt[Kt+3],(Rn&192)===128&&(vn&192)===128&&(An&192)===128&&(bn=(rn&15)<<18|(Rn&63)<<12|(vn&63)<<6|An&63,bn>65535&&bn<1114112&&(sn=bn))}}sn===null?(sn=65533,xn=1):sn>65535&&(sn-=65536,$t.push(sn>>>10&1023|55296),sn=56320|sn&1023),$t.push(sn),Kt+=xn}return Yt($t)}const Ft=4096;function Yt(Tt){const St=Tt.length;if(St<=Ft)return String.fromCharCode.apply(String,Tt);let At="",$t=0;for(;$t$t)&&(At=$t);let Kt="";for(let rn=St;rn$t&&(St=$t),At<0?(At+=$t,At<0&&(At=0)):At>$t&&(At=$t),AtAt)throw new RangeError("Trying to access beyond buffer length")}st.prototype.readUintLE=st.prototype.readUIntLE=function(St,At,$t){St=St>>>0,At=At>>>0,$t||Zt(St,At,this.length);let Kt=this[St],rn=1,sn=0;for(;++sn>>0,At=At>>>0,$t||Zt(St,At,this.length);let Kt=this[St+--At],rn=1;for(;At>0&&(rn*=256);)Kt+=this[St+--At]*rn;return Kt},st.prototype.readUint8=st.prototype.readUInt8=function(St,At){return St=St>>>0,At||Zt(St,1,this.length),this[St]},st.prototype.readUint16LE=st.prototype.readUInt16LE=function(St,At){return St=St>>>0,At||Zt(St,2,this.length),this[St]|this[St+1]<<8},st.prototype.readUint16BE=st.prototype.readUInt16BE=function(St,At){return St=St>>>0,At||Zt(St,2,this.length),this[St]<<8|this[St+1]},st.prototype.readUint32LE=st.prototype.readUInt32LE=function(St,At){return St=St>>>0,At||Zt(St,4,this.length),(this[St]|this[St+1]<<8|this[St+2]<<16)+this[St+3]*16777216},st.prototype.readUint32BE=st.prototype.readUInt32BE=function(St,At){return St=St>>>0,At||Zt(St,4,this.length),this[St]*16777216+(this[St+1]<<16|this[St+2]<<8|this[St+3])},st.prototype.readBigUInt64LE=En(function(St){St=St>>>0,Vt(St,"offset");const At=this[St],$t=this[St+7];(At===void 0||$t===void 0)&&en(St,this.length-8);const Kt=At+this[++St]*2**8+this[++St]*2**16+this[++St]*2**24,rn=this[++St]+this[++St]*2**8+this[++St]*2**16+$t*2**24;return BigInt(Kt)+(BigInt(rn)<>>0,Vt(St,"offset");const At=this[St],$t=this[St+7];(At===void 0||$t===void 0)&&en(St,this.length-8);const Kt=At*2**24+this[++St]*2**16+this[++St]*2**8+this[++St],rn=this[++St]*2**24+this[++St]*2**16+this[++St]*2**8+$t;return(BigInt(Kt)<>>0,At=At>>>0,$t||Zt(St,At,this.length);let Kt=this[St],rn=1,sn=0;for(;++sn=rn&&(Kt-=Math.pow(2,8*At)),Kt},st.prototype.readIntBE=function(St,At,$t){St=St>>>0,At=At>>>0,$t||Zt(St,At,this.length);let Kt=At,rn=1,sn=this[St+--Kt];for(;Kt>0&&(rn*=256);)sn+=this[St+--Kt]*rn;return rn*=128,sn>=rn&&(sn-=Math.pow(2,8*At)),sn},st.prototype.readInt8=function(St,At){return St=St>>>0,At||Zt(St,1,this.length),this[St]&128?(255-this[St]+1)*-1:this[St]},st.prototype.readInt16LE=function(St,At){St=St>>>0,At||Zt(St,2,this.length);const $t=this[St]|this[St+1]<<8;return $t&32768?$t|4294901760:$t},st.prototype.readInt16BE=function(St,At){St=St>>>0,At||Zt(St,2,this.length);const $t=this[St+1]|this[St]<<8;return $t&32768?$t|4294901760:$t},st.prototype.readInt32LE=function(St,At){return St=St>>>0,At||Zt(St,4,this.length),this[St]|this[St+1]<<8|this[St+2]<<16|this[St+3]<<24},st.prototype.readInt32BE=function(St,At){return St=St>>>0,At||Zt(St,4,this.length),this[St]<<24|this[St+1]<<16|this[St+2]<<8|this[St+3]},st.prototype.readBigInt64LE=En(function(St){St=St>>>0,Vt(St,"offset");const At=this[St],$t=this[St+7];(At===void 0||$t===void 0)&&en(St,this.length-8);const Kt=this[St+4]+this[St+5]*2**8+this[St+6]*2**16+($t<<24);return(BigInt(Kt)<>>0,Vt(St,"offset");const At=this[St],$t=this[St+7];(At===void 0||$t===void 0)&&en(St,this.length-8);const Kt=(At<<24)+this[++St]*2**16+this[++St]*2**8+this[++St];return(BigInt(Kt)<>>0,At||Zt(St,4,this.length),tt.read(this,St,!0,23,4)},st.prototype.readFloatBE=function(St,At){return St=St>>>0,At||Zt(St,4,this.length),tt.read(this,St,!1,23,4)},st.prototype.readDoubleLE=function(St,At){return St=St>>>0,At||Zt(St,8,this.length),tt.read(this,St,!0,52,8)},st.prototype.readDoubleBE=function(St,At){return St=St>>>0,At||Zt(St,8,this.length),tt.read(this,St,!1,52,8)};function Qt(Tt,St,At,$t,Kt,rn){if(!st.isBuffer(Tt))throw new TypeError('"buffer" argument must be a Buffer instance');if(St>Kt||StTt.length)throw new RangeError("Index out of range")}st.prototype.writeUintLE=st.prototype.writeUIntLE=function(St,At,$t,Kt){if(St=+St,At=At>>>0,$t=$t>>>0,!Kt){const xn=Math.pow(2,8*$t)-1;Qt(this,St,At,$t,xn,0)}let rn=1,sn=0;for(this[At]=St&255;++sn<$t&&(rn*=256);)this[At+sn]=St/rn&255;return At+$t},st.prototype.writeUintBE=st.prototype.writeUIntBE=function(St,At,$t,Kt){if(St=+St,At=At>>>0,$t=$t>>>0,!Kt){const xn=Math.pow(2,8*$t)-1;Qt(this,St,At,$t,xn,0)}let rn=$t-1,sn=1;for(this[At+rn]=St&255;--rn>=0&&(sn*=256);)this[At+rn]=St/sn&255;return At+$t},st.prototype.writeUint8=st.prototype.writeUInt8=function(St,At,$t){return St=+St,At=At>>>0,$t||Qt(this,St,At,1,255,0),this[At]=St&255,At+1},st.prototype.writeUint16LE=st.prototype.writeUInt16LE=function(St,At,$t){return St=+St,At=At>>>0,$t||Qt(this,St,At,2,65535,0),this[At]=St&255,this[At+1]=St>>>8,At+2},st.prototype.writeUint16BE=st.prototype.writeUInt16BE=function(St,At,$t){return St=+St,At=At>>>0,$t||Qt(this,St,At,2,65535,0),this[At]=St>>>8,this[At+1]=St&255,At+2},st.prototype.writeUint32LE=st.prototype.writeUInt32LE=function(St,At,$t){return St=+St,At=At>>>0,$t||Qt(this,St,At,4,4294967295,0),this[At+3]=St>>>24,this[At+2]=St>>>16,this[At+1]=St>>>8,this[At]=St&255,At+4},st.prototype.writeUint32BE=st.prototype.writeUInt32BE=function(St,At,$t){return St=+St,At=At>>>0,$t||Qt(this,St,At,4,4294967295,0),this[At]=St>>>24,this[At+1]=St>>>16,this[At+2]=St>>>8,this[At+3]=St&255,At+4};function Nt(Tt,St,At,$t,Kt){Dt(St,$t,Kt,Tt,At,7);let rn=Number(St&BigInt(4294967295));Tt[At++]=rn,rn=rn>>8,Tt[At++]=rn,rn=rn>>8,Tt[At++]=rn,rn=rn>>8,Tt[At++]=rn;let sn=Number(St>>BigInt(32)&BigInt(4294967295));return Tt[At++]=sn,sn=sn>>8,Tt[At++]=sn,sn=sn>>8,Tt[At++]=sn,sn=sn>>8,Tt[At++]=sn,At}function Gt(Tt,St,At,$t,Kt){Dt(St,$t,Kt,Tt,At,7);let rn=Number(St&BigInt(4294967295));Tt[At+7]=rn,rn=rn>>8,Tt[At+6]=rn,rn=rn>>8,Tt[At+5]=rn,rn=rn>>8,Tt[At+4]=rn;let sn=Number(St>>BigInt(32)&BigInt(4294967295));return Tt[At+3]=sn,sn=sn>>8,Tt[At+2]=sn,sn=sn>>8,Tt[At+1]=sn,sn=sn>>8,Tt[At]=sn,At+8}st.prototype.writeBigUInt64LE=En(function(St,At=0){return Nt(this,St,At,BigInt(0),BigInt("0xffffffffffffffff"))}),st.prototype.writeBigUInt64BE=En(function(St,At=0){return Gt(this,St,At,BigInt(0),BigInt("0xffffffffffffffff"))}),st.prototype.writeIntLE=function(St,At,$t,Kt){if(St=+St,At=At>>>0,!Kt){const Rn=Math.pow(2,8*$t-1);Qt(this,St,At,$t,Rn-1,-Rn)}let rn=0,sn=1,xn=0;for(this[At]=St&255;++rn<$t&&(sn*=256);)St<0&&xn===0&&this[At+rn-1]!==0&&(xn=1),this[At+rn]=(St/sn>>0)-xn&255;return At+$t},st.prototype.writeIntBE=function(St,At,$t,Kt){if(St=+St,At=At>>>0,!Kt){const Rn=Math.pow(2,8*$t-1);Qt(this,St,At,$t,Rn-1,-Rn)}let rn=$t-1,sn=1,xn=0;for(this[At+rn]=St&255;--rn>=0&&(sn*=256);)St<0&&xn===0&&this[At+rn+1]!==0&&(xn=1),this[At+rn]=(St/sn>>0)-xn&255;return At+$t},st.prototype.writeInt8=function(St,At,$t){return St=+St,At=At>>>0,$t||Qt(this,St,At,1,127,-128),St<0&&(St=255+St+1),this[At]=St&255,At+1},st.prototype.writeInt16LE=function(St,At,$t){return St=+St,At=At>>>0,$t||Qt(this,St,At,2,32767,-32768),this[At]=St&255,this[At+1]=St>>>8,At+2},st.prototype.writeInt16BE=function(St,At,$t){return St=+St,At=At>>>0,$t||Qt(this,St,At,2,32767,-32768),this[At]=St>>>8,this[At+1]=St&255,At+2},st.prototype.writeInt32LE=function(St,At,$t){return St=+St,At=At>>>0,$t||Qt(this,St,At,4,2147483647,-2147483648),this[At]=St&255,this[At+1]=St>>>8,this[At+2]=St>>>16,this[At+3]=St>>>24,At+4},st.prototype.writeInt32BE=function(St,At,$t){return St=+St,At=At>>>0,$t||Qt(this,St,At,4,2147483647,-2147483648),St<0&&(St=4294967295+St+1),this[At]=St>>>24,this[At+1]=St>>>16,this[At+2]=St>>>8,this[At+3]=St&255,At+4},st.prototype.writeBigInt64LE=En(function(St,At=0){return Nt(this,St,At,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),st.prototype.writeBigInt64BE=En(function(St,At=0){return Gt(this,St,At,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function nn(Tt,St,At,$t,Kt,rn){if(At+$t>Tt.length)throw new RangeError("Index out of range");if(At<0)throw new RangeError("Index out of range")}function Wt(Tt,St,At,$t,Kt){return St=+St,At=At>>>0,Kt||nn(Tt,St,At,4),tt.write(Tt,St,At,$t,23,4),At+4}st.prototype.writeFloatLE=function(St,At,$t){return Wt(this,St,At,!0,$t)},st.prototype.writeFloatBE=function(St,At,$t){return Wt(this,St,At,!1,$t)};function hn(Tt,St,At,$t,Kt){return St=+St,At=At>>>0,Kt||nn(Tt,St,At,8),tt.write(Tt,St,At,$t,52,8),At+8}st.prototype.writeDoubleLE=function(St,At,$t){return hn(this,St,At,!0,$t)},st.prototype.writeDoubleBE=function(St,At,$t){return hn(this,St,At,!1,$t)},st.prototype.copy=function(St,At,$t,Kt){if(!st.isBuffer(St))throw new TypeError("argument should be a Buffer");if($t||($t=0),!Kt&&Kt!==0&&(Kt=this.length),At>=St.length&&(At=St.length),At||(At=0),Kt>0&&Kt<$t&&(Kt=$t),Kt===$t||St.length===0||this.length===0)return 0;if(At<0)throw new RangeError("targetStart out of bounds");if($t<0||$t>=this.length)throw new RangeError("Index out of range");if(Kt<0)throw new RangeError("sourceEnd out of bounds");Kt>this.length&&(Kt=this.length),St.length-At>>0,$t=$t===void 0?this.length:$t>>>0,St||(St=0);let rn;if(typeof St=="number")for(rn=At;rn<$t;++rn)this[rn]=St;else{const sn=st.isBuffer(St)?St:st.from(St,Kt),xn=sn.length;if(xn===0)throw new TypeError('The value "'+St+'" is invalid for argument "value"');for(rn=0;rn<$t-At;++rn)this[rn+At]=sn[rn%xn]}return this};const Xt={};function Jt(Tt,St,At){Xt[Tt]=class extends At{constructor(){super(),Object.defineProperty(this,"message",{value:St.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${Tt}]`,this.stack,delete this.name}get code(){return Tt}set code(Kt){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:Kt,writable:!0})}toString(){return`${this.name} [${Tt}]: ${this.message}`}}}Jt("ERR_BUFFER_OUT_OF_BOUNDS",function(Tt){return Tt?`${Tt} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),Jt("ERR_INVALID_ARG_TYPE",function(Tt,St){return`The "${Tt}" argument must be of type number. Received type ${typeof St}`},TypeError),Jt("ERR_OUT_OF_RANGE",function(Tt,St,At){let $t=`The value of "${Tt}" is out of range.`,Kt=At;return Number.isInteger(At)&&Math.abs(At)>2**32?Kt=tn(String(At)):typeof At=="bigint"&&(Kt=String(At),(At>BigInt(2)**BigInt(32)||At<-(BigInt(2)**BigInt(32)))&&(Kt=tn(Kt)),Kt+="n"),$t+=` It must be ${St}. Received ${Kt}`,$t},RangeError);function tn(Tt){let St="",At=Tt.length;const $t=Tt[0]==="-"?1:0;for(;At>=$t+4;At-=3)St=`_${Tt.slice(At-3,At)}${St}`;return`${Tt.slice(0,At)}${St}`}function _t(Tt,St,At){Vt(St,"offset"),(Tt[St]===void 0||Tt[St+At]===void 0)&&en(St,Tt.length-(At+1))}function Dt(Tt,St,At,$t,Kt,rn){if(Tt>At||Tt= 0${sn} and < 2${sn} ** ${(rn+1)*8}${sn}`:xn=`>= -(2${sn} ** ${(rn+1)*8-1}${sn}) and < 2 ** ${(rn+1)*8-1}${sn}`,new Xt.ERR_OUT_OF_RANGE("value",xn,Tt)}_t($t,Kt,rn)}function Vt(Tt,St){if(typeof Tt!="number")throw new Xt.ERR_INVALID_ARG_TYPE(St,"number",Tt)}function en(Tt,St,At){throw Math.floor(Tt)!==Tt?(Vt(Tt,At),new Xt.ERR_OUT_OF_RANGE("offset","an integer",Tt)):St<0?new Xt.ERR_BUFFER_OUT_OF_BOUNDS:new Xt.ERR_OUT_OF_RANGE("offset",`>= 0 and <= ${St}`,Tt)}const an=/[^+/0-9A-Za-z-_]/g;function dn(Tt){if(Tt=Tt.split("=")[0],Tt=Tt.trim().replace(an,""),Tt.length<2)return"";for(;Tt.length%4!==0;)Tt=Tt+"=";return Tt}function ln(Tt,St){St=St||1/0;let At;const $t=Tt.length;let Kt=null;const rn=[];for(let sn=0;sn<$t;++sn){if(At=Tt.charCodeAt(sn),At>55295&&At<57344){if(!Kt){if(At>56319){(St-=3)>-1&&rn.push(239,191,189);continue}else if(sn+1===$t){(St-=3)>-1&&rn.push(239,191,189);continue}Kt=At;continue}if(At<56320){(St-=3)>-1&&rn.push(239,191,189),Kt=At;continue}At=(Kt-55296<<10|At-56320)+65536}else Kt&&(St-=3)>-1&&rn.push(239,191,189);if(Kt=null,At<128){if((St-=1)<0)break;rn.push(At)}else if(At<2048){if((St-=2)<0)break;rn.push(At>>6|192,At&63|128)}else if(At<65536){if((St-=3)<0)break;rn.push(At>>12|224,At>>6&63|128,At&63|128)}else if(At<1114112){if((St-=4)<0)break;rn.push(At>>18|240,At>>12&63|128,At>>6&63|128,At&63|128)}else throw new Error("Invalid code point")}return rn}function pn(Tt){const St=[];for(let At=0;At>8,Kt=At%256,rn.push(Kt),rn.push($t);return rn}function mn(Tt){return et.toByteArray(dn(Tt))}function wn(Tt,St,At,$t){let Kt;for(Kt=0;Kt<$t&&!(Kt+At>=St.length||Kt>=Tt.length);++Kt)St[Kt+At]=Tt[Kt];return Kt}function Tn(Tt,St){return Tt instanceof St||Tt!=null&&Tt.constructor!=null&&Tt.constructor.name!=null&&Tt.constructor.name===St.name}function Pn(Tt){return Tt!==Tt}const yn=function(){const Tt="0123456789abcdef",St=new Array(256);for(let At=0;At<16;++At){const $t=At*16;for(let Kt=0;Kt<16;++Kt)St[$t+Kt]=Tt[At]+Tt[Kt]}return St}();function En(Tt){return typeof BigInt>"u"?on:Tt}function on(){throw new Error("BigInt not supported")}})(buffer$2);var reactDom={exports:{}},reactDom_production_min={},scheduler={exports:{}},scheduler_production_min={};/** * @license React * scheduler.production.min.js * @@ -28,7 +28,7 @@ var nu=Object.defineProperty;var Bs=o=>{throw TypeError(o)};var ru=(o,et,tt)=>et * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */(function(o){function et(Ut,qt){var Lt=Ut.length;Ut.push(qt);e:for(;0>>1,Qt=Ut[Zt];if(0>>1;Ztrt(nn,Lt))Wtrt(hn,nn)?(Ut[Zt]=hn,Ut[Wt]=Lt,Zt=Wt):(Ut[Zt]=nn,Ut[Gt]=Lt,Zt=Gt);else if(Wtrt(hn,Lt))Ut[Zt]=hn,Ut[Wt]=Lt,Zt=Wt;else break e}}return qt}function rt(Ut,qt){var Lt=Ut.sortIndex-qt.sortIndex;return Lt!==0?Lt:Ut.id-qt.id}if(typeof performance=="object"&&typeof performance.now=="function"){var ot=performance;o.unstable_now=function(){return ot.now()}}else{var it=Date,st=it.now();o.unstable_now=function(){return it.now()-st}}var at=[],ct=[],lt=1,dt=null,ht=3,pt=!1,mt=!1,ft=!1,yt=typeof setTimeout=="function"?setTimeout:null,gt=typeof clearTimeout=="function"?clearTimeout:null,xt=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function vt(Ut){for(var qt=tt(ct);qt!==null;){if(qt.callback===null)nt(ct);else if(qt.startTime<=Ut)nt(ct),qt.sortIndex=qt.expirationTime,et(at,qt);else break;qt=tt(ct)}}function bt(Ut){if(ft=!1,vt(Ut),!mt)if(tt(at)!==null)mt=!0,Yt(Et);else{var qt=tt(ct);qt!==null&&Ht(bt,qt.startTime-Ut)}}function Et(Ut,qt){mt=!1,ft&&(ft=!1,gt(Tt),Tt=-1),pt=!0;var Lt=ht;try{for(vt(qt),dt=tt(at);dt!==null&&(!(dt.expirationTime>qt)||Ut&&!$t());){var Zt=dt.callback;if(typeof Zt=="function"){dt.callback=null,ht=dt.priorityLevel;var Qt=Zt(dt.expirationTime<=qt);qt=o.unstable_now(),typeof Qt=="function"?dt.callback=Qt:dt===tt(at)&&nt(at),vt(qt)}else nt(at);dt=tt(at)}if(dt!==null)var Nt=!0;else{var Gt=tt(ct);Gt!==null&&Ht(bt,Gt.startTime-qt),Nt=!1}return Nt}finally{dt=null,ht=Lt,pt=!1}}var wt=!1,kt=null,Tt=-1,Rt=5,Pt=-1;function $t(){return!(o.unstable_now()-PtUt||125Zt?(Ut.sortIndex=Lt,et(ct,Ut),tt(at)===null&&Ut===tt(ct)&&(ft?(gt(Tt),Tt=-1):ft=!0,Ht(bt,Lt-Zt))):(Ut.sortIndex=Qt,et(at,Ut),mt||pt||(mt=!0,Yt(Et))),Ut},o.unstable_shouldYield=$t,o.unstable_wrapCallback=function(Ut){var qt=ht;return function(){var Lt=ht;ht=qt;try{return Ut.apply(this,arguments)}finally{ht=Lt}}}})(scheduler_production_min);scheduler.exports=scheduler_production_min;var schedulerExports=scheduler.exports;/** + */(function(o){function et(Ut,qt){var Lt=Ut.length;Ut.push(qt);e:for(;0>>1,Qt=Ut[Zt];if(0>>1;Ztrt(nn,Lt))Wtrt(hn,nn)?(Ut[Zt]=hn,Ut[Wt]=Lt,Zt=Wt):(Ut[Zt]=nn,Ut[Gt]=Lt,Zt=Gt);else if(Wtrt(hn,Lt))Ut[Zt]=hn,Ut[Wt]=Lt,Zt=Wt;else break e}}return qt}function rt(Ut,qt){var Lt=Ut.sortIndex-qt.sortIndex;return Lt!==0?Lt:Ut.id-qt.id}if(typeof performance=="object"&&typeof performance.now=="function"){var ot=performance;o.unstable_now=function(){return ot.now()}}else{var it=Date,st=it.now();o.unstable_now=function(){return it.now()-st}}var at=[],ct=[],lt=1,dt=null,ht=3,pt=!1,mt=!1,ft=!1,yt=typeof setTimeout=="function"?setTimeout:null,gt=typeof clearTimeout=="function"?clearTimeout:null,xt=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function vt(Ut){for(var qt=tt(ct);qt!==null;){if(qt.callback===null)nt(ct);else if(qt.startTime<=Ut)nt(ct),qt.sortIndex=qt.expirationTime,et(at,qt);else break;qt=tt(ct)}}function bt(Ut){if(ft=!1,vt(Ut),!mt)if(tt(at)!==null)mt=!0,Yt(Et);else{var qt=tt(ct);qt!==null&&Ht(bt,qt.startTime-Ut)}}function Et(Ut,qt){mt=!1,ft&&(ft=!1,gt(It),It=-1),pt=!0;var Lt=ht;try{for(vt(qt),dt=tt(at);dt!==null&&(!(dt.expirationTime>qt)||Ut&&!jt());){var Zt=dt.callback;if(typeof Zt=="function"){dt.callback=null,ht=dt.priorityLevel;var Qt=Zt(dt.expirationTime<=qt);qt=o.unstable_now(),typeof Qt=="function"?dt.callback=Qt:dt===tt(at)&&nt(at),vt(qt)}else nt(at);dt=tt(at)}if(dt!==null)var Nt=!0;else{var Gt=tt(ct);Gt!==null&&Ht(bt,Gt.startTime-qt),Nt=!1}return Nt}finally{dt=null,ht=Lt,pt=!1}}var wt=!1,kt=null,It=-1,Rt=5,Pt=-1;function jt(){return!(o.unstable_now()-PtUt||125Zt?(Ut.sortIndex=Lt,et(ct,Ut),tt(at)===null&&Ut===tt(ct)&&(ft?(gt(It),It=-1):ft=!0,Ht(bt,Lt-Zt))):(Ut.sortIndex=Qt,et(at,Ut),mt||pt||(mt=!0,Yt(Et))),Ut},o.unstable_shouldYield=jt,o.unstable_wrapCallback=function(Ut){var qt=ht;return function(){var Lt=ht;ht=qt;try{return Ut.apply(this,arguments)}finally{ht=Lt}}}})(scheduler_production_min);scheduler.exports=scheduler_production_min;var schedulerExports=scheduler.exports;/** * @license React * react-dom.production.min.js * @@ -40,8 +40,8 @@ var nu=Object.defineProperty;var Bs=o=>{throw TypeError(o)};var ru=(o,et,tt)=>et `+La+o}var Na=!1;function Oa(o,et){if(!o||Na)return"";Na=!0;var tt=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(et)if(et=function(){throw Error()},Object.defineProperty(et.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(et,[])}catch(ct){var nt=ct}Reflect.construct(o,[],et)}else{try{et.call()}catch(ct){nt=ct}o.call(et.prototype)}else{try{throw Error()}catch(ct){nt=ct}o()}}catch(ct){if(ct&&nt&&typeof ct.stack=="string"){for(var rt=ct.stack.split(` `),ot=nt.stack.split(` `),it=rt.length-1,st=ot.length-1;1<=it&&0<=st&&rt[it]!==ot[st];)st--;for(;1<=it&&0<=st;it--,st--)if(rt[it]!==ot[st]){if(it!==1||st!==1)do if(it--,st--,0>st||rt[it]!==ot[st]){var at=` -`+rt[it].replace(" at new "," at ");return o.displayName&&at.includes("")&&(at=at.replace("",o.displayName)),at}while(1<=it&&0<=st);break}}}finally{Na=!1,Error.prepareStackTrace=tt}return(o=o?o.displayName||o.name:"")?Ma(o):""}function Pa(o){switch(o.tag){case 5:return Ma(o.type);case 16:return Ma("Lazy");case 13:return Ma("Suspense");case 19:return Ma("SuspenseList");case 0:case 2:case 15:return o=Oa(o.type,!1),o;case 11:return o=Oa(o.type.render,!1),o;case 1:return o=Oa(o.type,!0),o;default:return""}}function Qa(o){if(o==null)return null;if(typeof o=="function")return o.displayName||o.name||null;if(typeof o=="string")return o;switch(o){case ya:return"Fragment";case wa:return"Portal";case Aa:return"Profiler";case za:return"StrictMode";case Ea:return"Suspense";case Fa:return"SuspenseList"}if(typeof o=="object")switch(o.$$typeof){case Ca:return(o.displayName||"Context")+".Consumer";case Ba:return(o._context.displayName||"Context")+".Provider";case Da:var et=o.render;return o=o.displayName,o||(o=et.displayName||et.name||"",o=o!==""?"ForwardRef("+o+")":"ForwardRef"),o;case Ga:return et=o.displayName||null,et!==null?et:Qa(o.type)||"Memo";case Ha:et=o._payload,o=o._init;try{return Qa(o(et))}catch{}}return null}function Ra(o){var et=o.type;switch(o.tag){case 24:return"Cache";case 9:return(et.displayName||"Context")+".Consumer";case 10:return(et._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return o=et.render,o=o.displayName||o.name||"",et.displayName||(o!==""?"ForwardRef("+o+")":"ForwardRef");case 7:return"Fragment";case 5:return et;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return Qa(et);case 8:return et===za?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof et=="function")return et.displayName||et.name||null;if(typeof et=="string")return et}return null}function Sa(o){switch(typeof o){case"boolean":case"number":case"string":case"undefined":return o;case"object":return o;default:return""}}function Ta(o){var et=o.type;return(o=o.nodeName)&&o.toLowerCase()==="input"&&(et==="checkbox"||et==="radio")}function Ua(o){var et=Ta(o)?"checked":"value",tt=Object.getOwnPropertyDescriptor(o.constructor.prototype,et),nt=""+o[et];if(!o.hasOwnProperty(et)&&typeof tt<"u"&&typeof tt.get=="function"&&typeof tt.set=="function"){var rt=tt.get,ot=tt.set;return Object.defineProperty(o,et,{configurable:!0,get:function(){return rt.call(this)},set:function(it){nt=""+it,ot.call(this,it)}}),Object.defineProperty(o,et,{enumerable:tt.enumerable}),{getValue:function(){return nt},setValue:function(it){nt=""+it},stopTracking:function(){o._valueTracker=null,delete o[et]}}}}function Va(o){o._valueTracker||(o._valueTracker=Ua(o))}function Wa(o){if(!o)return!1;var et=o._valueTracker;if(!et)return!0;var tt=et.getValue(),nt="";return o&&(nt=Ta(o)?o.checked?"true":"false":o.value),o=nt,o!==tt?(et.setValue(o),!0):!1}function Xa(o){if(o=o||(typeof document<"u"?document:void 0),typeof o>"u")return null;try{return o.activeElement||o.body}catch{return o.body}}function Ya(o,et){var tt=et.checked;return A$1({},et,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:tt??o._wrapperState.initialChecked})}function Za(o,et){var tt=et.defaultValue==null?"":et.defaultValue,nt=et.checked!=null?et.checked:et.defaultChecked;tt=Sa(et.value!=null?et.value:tt),o._wrapperState={initialChecked:nt,initialValue:tt,controlled:et.type==="checkbox"||et.type==="radio"?et.checked!=null:et.value!=null}}function ab(o,et){et=et.checked,et!=null&&ta(o,"checked",et,!1)}function bb(o,et){ab(o,et);var tt=Sa(et.value),nt=et.type;if(tt!=null)nt==="number"?(tt===0&&o.value===""||o.value!=tt)&&(o.value=""+tt):o.value!==""+tt&&(o.value=""+tt);else if(nt==="submit"||nt==="reset"){o.removeAttribute("value");return}et.hasOwnProperty("value")?cb$1(o,et.type,tt):et.hasOwnProperty("defaultValue")&&cb$1(o,et.type,Sa(et.defaultValue)),et.checked==null&&et.defaultChecked!=null&&(o.defaultChecked=!!et.defaultChecked)}function db(o,et,tt){if(et.hasOwnProperty("value")||et.hasOwnProperty("defaultValue")){var nt=et.type;if(!(nt!=="submit"&&nt!=="reset"||et.value!==void 0&&et.value!==null))return;et=""+o._wrapperState.initialValue,tt||et===o.value||(o.value=et),o.defaultValue=et}tt=o.name,tt!==""&&(o.name=""),o.defaultChecked=!!o._wrapperState.initialChecked,tt!==""&&(o.name=tt)}function cb$1(o,et,tt){(et!=="number"||Xa(o.ownerDocument)!==o)&&(tt==null?o.defaultValue=""+o._wrapperState.initialValue:o.defaultValue!==""+tt&&(o.defaultValue=""+tt))}var eb=Array.isArray;function fb(o,et,tt,nt){if(o=o.options,et){et={};for(var rt=0;rt"+et.valueOf().toString()+"",et=mb.firstChild;o.firstChild;)o.removeChild(o.firstChild);for(;et.firstChild;)o.appendChild(et.firstChild)}});function ob(o,et){if(et){var tt=o.firstChild;if(tt&&tt===o.lastChild&&tt.nodeType===3){tt.nodeValue=et;return}}o.textContent=et}var pb={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},qb=["Webkit","ms","Moz","O"];Object.keys(pb).forEach(function(o){qb.forEach(function(et){et=et+o.charAt(0).toUpperCase()+o.substring(1),pb[et]=pb[o]})});function rb(o,et,tt){return et==null||typeof et=="boolean"||et===""?"":tt||typeof et!="number"||et===0||pb.hasOwnProperty(o)&&pb[o]?(""+et).trim():et+"px"}function sb(o,et){o=o.style;for(var tt in et)if(et.hasOwnProperty(tt)){var nt=tt.indexOf("--")===0,rt=rb(tt,et[tt],nt);tt==="float"&&(tt="cssFloat"),nt?o.setProperty(tt,rt):o[tt]=rt}}var tb=A$1({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function ub(o,et){if(et){if(tb[o]&&(et.children!=null||et.dangerouslySetInnerHTML!=null))throw Error(p$4(137,o));if(et.dangerouslySetInnerHTML!=null){if(et.children!=null)throw Error(p$4(60));if(typeof et.dangerouslySetInnerHTML!="object"||!("__html"in et.dangerouslySetInnerHTML))throw Error(p$4(61))}if(et.style!=null&&typeof et.style!="object")throw Error(p$4(62))}}function vb(o,et){if(o.indexOf("-")===-1)return typeof et.is=="string";switch(o){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var wb=null;function xb(o){return o=o.target||o.srcElement||window,o.correspondingUseElement&&(o=o.correspondingUseElement),o.nodeType===3?o.parentNode:o}var yb=null,zb=null,Ab=null;function Bb(o){if(o=Cb(o)){if(typeof yb!="function")throw Error(p$4(280));var et=o.stateNode;et&&(et=Db(et),yb(o.stateNode,o.type,et))}}function Eb(o){zb?Ab?Ab.push(o):Ab=[o]:zb=o}function Fb(){if(zb){var o=zb,et=Ab;if(Ab=zb=null,Bb(o),et)for(o=0;o>>=0,o===0?32:31-(pc(o)/qc|0)|0}var rc=64,sc=4194304;function tc(o){switch(o&-o){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return o&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return o&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return o}}function uc(o,et){var tt=o.pendingLanes;if(tt===0)return 0;var nt=0,rt=o.suspendedLanes,ot=o.pingedLanes,it=tt&268435455;if(it!==0){var st=it&~rt;st!==0?nt=tc(st):(ot&=it,ot!==0&&(nt=tc(ot)))}else it=tt&~rt,it!==0?nt=tc(it):ot!==0&&(nt=tc(ot));if(nt===0)return 0;if(et!==0&&et!==nt&&!(et&rt)&&(rt=nt&-nt,ot=et&-et,rt>=ot||rt===16&&(ot&4194240)!==0))return et;if(nt&4&&(nt|=tt&16),et=o.entangledLanes,et!==0)for(o=o.entanglements,et&=nt;0tt;tt++)et.push(o);return et}function Ac(o,et,tt){o.pendingLanes|=et,et!==536870912&&(o.suspendedLanes=0,o.pingedLanes=0),o=o.eventTimes,et=31-oc(et),o[et]=tt}function Bc(o,et){var tt=o.pendingLanes&~et;o.pendingLanes=et,o.suspendedLanes=0,o.pingedLanes=0,o.expiredLanes&=et,o.mutableReadLanes&=et,o.entangledLanes&=et,et=o.entanglements;var nt=o.eventTimes;for(o=o.expirationTimes;0=be$1),ee$1=" ",fe$1=!1;function ge$1(o,et){switch(o){case"keyup":return $d.indexOf(et.keyCode)!==-1;case"keydown":return et.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function he$1(o){return o=o.detail,typeof o=="object"&&"data"in o?o.data:null}var ie$1=!1;function je$1(o,et){switch(o){case"compositionend":return he$1(et);case"keypress":return et.which!==32?null:(fe$1=!0,ee$1);case"textInput":return o=et.data,o===ee$1&&fe$1?null:o;default:return null}}function ke$1(o,et){if(ie$1)return o==="compositionend"||!ae$1&&ge$1(o,et)?(o=nd(),md=ld=kd=null,ie$1=!1,o):null;switch(o){case"paste":return null;case"keypress":if(!(et.ctrlKey||et.altKey||et.metaKey)||et.ctrlKey&&et.altKey){if(et.char&&1=et)return{node:tt,offset:et-o};o=nt}e:{for(;tt;){if(tt.nextSibling){tt=tt.nextSibling;break e}tt=tt.parentNode}tt=void 0}tt=Je(tt)}}function Le$1(o,et){return o&&et?o===et?!0:o&&o.nodeType===3?!1:et&&et.nodeType===3?Le$1(o,et.parentNode):"contains"in o?o.contains(et):o.compareDocumentPosition?!!(o.compareDocumentPosition(et)&16):!1:!1}function Me$1(){for(var o=window,et=Xa();et instanceof o.HTMLIFrameElement;){try{var tt=typeof et.contentWindow.location.href=="string"}catch{tt=!1}if(tt)o=et.contentWindow;else break;et=Xa(o.document)}return et}function Ne$1(o){var et=o&&o.nodeName&&o.nodeName.toLowerCase();return et&&(et==="input"&&(o.type==="text"||o.type==="search"||o.type==="tel"||o.type==="url"||o.type==="password")||et==="textarea"||o.contentEditable==="true")}function Oe$1(o){var et=Me$1(),tt=o.focusedElem,nt=o.selectionRange;if(et!==tt&&tt&&tt.ownerDocument&&Le$1(tt.ownerDocument.documentElement,tt)){if(nt!==null&&Ne$1(tt)){if(et=nt.start,o=nt.end,o===void 0&&(o=et),"selectionStart"in tt)tt.selectionStart=et,tt.selectionEnd=Math.min(o,tt.value.length);else if(o=(et=tt.ownerDocument||document)&&et.defaultView||window,o.getSelection){o=o.getSelection();var rt=tt.textContent.length,ot=Math.min(nt.start,rt);nt=nt.end===void 0?ot:Math.min(nt.end,rt),!o.extend&&ot>nt&&(rt=nt,nt=ot,ot=rt),rt=Ke(tt,ot);var it=Ke(tt,nt);rt&&it&&(o.rangeCount!==1||o.anchorNode!==rt.node||o.anchorOffset!==rt.offset||o.focusNode!==it.node||o.focusOffset!==it.offset)&&(et=et.createRange(),et.setStart(rt.node,rt.offset),o.removeAllRanges(),ot>nt?(o.addRange(et),o.extend(it.node,it.offset)):(et.setEnd(it.node,it.offset),o.addRange(et)))}}for(et=[],o=tt;o=o.parentNode;)o.nodeType===1&&et.push({element:o,left:o.scrollLeft,top:o.scrollTop});for(typeof tt.focus=="function"&&tt.focus(),tt=0;tt=document.documentMode,Qe=null,Re$1=null,Se$1=null,Te$1=!1;function Ue(o,et,tt){var nt=tt.window===tt?tt.document:tt.nodeType===9?tt:tt.ownerDocument;Te$1||Qe==null||Qe!==Xa(nt)||(nt=Qe,"selectionStart"in nt&&Ne$1(nt)?nt={start:nt.selectionStart,end:nt.selectionEnd}:(nt=(nt.ownerDocument&&nt.ownerDocument.defaultView||window).getSelection(),nt={anchorNode:nt.anchorNode,anchorOffset:nt.anchorOffset,focusNode:nt.focusNode,focusOffset:nt.focusOffset}),Se$1&&Ie(Se$1,nt)||(Se$1=nt,nt=oe$1(Re$1,"onSelect"),0Tf||(o.current=Sf[Tf],Sf[Tf]=null,Tf--)}function G$1(o,et){Tf++,Sf[Tf]=o.current,o.current=et}var Vf={},H$1=Uf(Vf),Wf=Uf(!1),Xf=Vf;function Yf(o,et){var tt=o.type.contextTypes;if(!tt)return Vf;var nt=o.stateNode;if(nt&&nt.__reactInternalMemoizedUnmaskedChildContext===et)return nt.__reactInternalMemoizedMaskedChildContext;var rt={},ot;for(ot in tt)rt[ot]=et[ot];return nt&&(o=o.stateNode,o.__reactInternalMemoizedUnmaskedChildContext=et,o.__reactInternalMemoizedMaskedChildContext=rt),rt}function Zf(o){return o=o.childContextTypes,o!=null}function $f(){E$1(Wf),E$1(H$1)}function ag(o,et,tt){if(H$1.current!==Vf)throw Error(p$4(168));G$1(H$1,et),G$1(Wf,tt)}function bg(o,et,tt){var nt=o.stateNode;if(et=et.childContextTypes,typeof nt.getChildContext!="function")return tt;nt=nt.getChildContext();for(var rt in nt)if(!(rt in et))throw Error(p$4(108,Ra(o)||"Unknown",rt));return A$1({},tt,nt)}function cg(o){return o=(o=o.stateNode)&&o.__reactInternalMemoizedMergedChildContext||Vf,Xf=H$1.current,G$1(H$1,o),G$1(Wf,Wf.current),!0}function dg(o,et,tt){var nt=o.stateNode;if(!nt)throw Error(p$4(169));tt?(o=bg(o,et,Xf),nt.__reactInternalMemoizedMergedChildContext=o,E$1(Wf),E$1(H$1),G$1(H$1,o)):E$1(Wf),G$1(Wf,tt)}var eg=null,fg=!1,gg=!1;function hg(o){eg===null?eg=[o]:eg.push(o)}function ig(o){fg=!0,hg(o)}function jg(){if(!gg&&eg!==null){gg=!0;var o=0,et=C$1;try{var tt=eg;for(C$1=1;o>=it,rt-=it,rg=1<<32-oc(et)+rt|tt<Tt?(Rt=kt,kt=null):Rt=kt.sibling;var Pt=ht(gt,kt,vt[Tt],bt);if(Pt===null){kt===null&&(kt=Rt);break}o&&kt&&Pt.alternate===null&&et(gt,kt),xt=ot(Pt,xt,Tt),wt===null?Et=Pt:wt.sibling=Pt,wt=Pt,kt=Rt}if(Tt===vt.length)return tt(gt,kt),I$1&&tg(gt,Tt),Et;if(kt===null){for(;TtTt?(Rt=kt,kt=null):Rt=kt.sibling;var $t=ht(gt,kt,Pt.value,bt);if($t===null){kt===null&&(kt=Rt);break}o&&kt&&$t.alternate===null&&et(gt,kt),xt=ot($t,xt,Tt),wt===null?Et=$t:wt.sibling=$t,wt=$t,kt=Rt}if(Pt.done)return tt(gt,kt),I$1&&tg(gt,Tt),Et;if(kt===null){for(;!Pt.done;Tt++,Pt=vt.next())Pt=dt(gt,Pt.value,bt),Pt!==null&&(xt=ot(Pt,xt,Tt),wt===null?Et=Pt:wt.sibling=Pt,wt=Pt);return I$1&&tg(gt,Tt),Et}for(kt=nt(gt,kt);!Pt.done;Tt++,Pt=vt.next())Pt=pt(kt,gt,Tt,Pt.value,bt),Pt!==null&&(o&&Pt.alternate!==null&&kt.delete(Pt.key===null?Tt:Pt.key),xt=ot(Pt,xt,Tt),wt===null?Et=Pt:wt.sibling=Pt,wt=Pt);return o&&kt.forEach(function(Ot){return et(gt,Ot)}),I$1&&tg(gt,Tt),Et}function yt(gt,xt,vt,bt){if(typeof vt=="object"&&vt!==null&&vt.type===ya&&vt.key===null&&(vt=vt.props.children),typeof vt=="object"&&vt!==null){switch(vt.$$typeof){case va:e:{for(var Et=vt.key,wt=xt;wt!==null;){if(wt.key===Et){if(Et=vt.type,Et===ya){if(wt.tag===7){tt(gt,wt.sibling),xt=rt(wt,vt.props.children),xt.return=gt,gt=xt;break e}}else if(wt.elementType===Et||typeof Et=="object"&&Et!==null&&Et.$$typeof===Ha&&Ng(Et)===wt.type){tt(gt,wt.sibling),xt=rt(wt,vt.props),xt.ref=Lg(gt,wt,vt),xt.return=gt,gt=xt;break e}tt(gt,wt);break}else et(gt,wt);wt=wt.sibling}vt.type===ya?(xt=Tg(vt.props.children,gt.mode,bt,vt.key),xt.return=gt,gt=xt):(bt=Rg(vt.type,vt.key,vt.props,null,gt.mode,bt),bt.ref=Lg(gt,xt,vt),bt.return=gt,gt=bt)}return it(gt);case wa:e:{for(wt=vt.key;xt!==null;){if(xt.key===wt)if(xt.tag===4&&xt.stateNode.containerInfo===vt.containerInfo&&xt.stateNode.implementation===vt.implementation){tt(gt,xt.sibling),xt=rt(xt,vt.children||[]),xt.return=gt,gt=xt;break e}else{tt(gt,xt);break}else et(gt,xt);xt=xt.sibling}xt=Sg(vt,gt.mode,bt),xt.return=gt,gt=xt}return it(gt);case Ha:return wt=vt._init,yt(gt,xt,wt(vt._payload),bt)}if(eb(vt))return mt(gt,xt,vt,bt);if(Ka(vt))return ft(gt,xt,vt,bt);Mg(gt,vt)}return typeof vt=="string"&&vt!==""||typeof vt=="number"?(vt=""+vt,xt!==null&&xt.tag===6?(tt(gt,xt.sibling),xt=rt(xt,vt),xt.return=gt,gt=xt):(tt(gt,xt),xt=Qg(vt,gt.mode,bt),xt.return=gt,gt=xt),it(gt)):tt(gt,xt)}return yt}var Ug=Og(!0),Vg=Og(!1),Wg=Uf(null),Xg=null,Yg=null,Zg=null;function $g(){Zg=Yg=Xg=null}function ah(o){var et=Wg.current;E$1(Wg),o._currentValue=et}function bh(o,et,tt){for(;o!==null;){var nt=o.alternate;if((o.childLanes&et)!==et?(o.childLanes|=et,nt!==null&&(nt.childLanes|=et)):nt!==null&&(nt.childLanes&et)!==et&&(nt.childLanes|=et),o===tt)break;o=o.return}}function ch(o,et){Xg=o,Zg=Yg=null,o=o.dependencies,o!==null&&o.firstContext!==null&&(o.lanes&et&&(dh=!0),o.firstContext=null)}function eh(o){var et=o._currentValue;if(Zg!==o)if(o={context:o,memoizedValue:et,next:null},Yg===null){if(Xg===null)throw Error(p$4(308));Yg=o,Xg.dependencies={lanes:0,firstContext:o}}else Yg=Yg.next=o;return et}var fh=null;function gh(o){fh===null?fh=[o]:fh.push(o)}function hh(o,et,tt,nt){var rt=et.interleaved;return rt===null?(tt.next=tt,gh(et)):(tt.next=rt.next,rt.next=tt),et.interleaved=tt,ih(o,nt)}function ih(o,et){o.lanes|=et;var tt=o.alternate;for(tt!==null&&(tt.lanes|=et),tt=o,o=o.return;o!==null;)o.childLanes|=et,tt=o.alternate,tt!==null&&(tt.childLanes|=et),tt=o,o=o.return;return tt.tag===3?tt.stateNode:null}var jh=!1;function kh(o){o.updateQueue={baseState:o.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function lh(o,et){o=o.updateQueue,et.updateQueue===o&&(et.updateQueue={baseState:o.baseState,firstBaseUpdate:o.firstBaseUpdate,lastBaseUpdate:o.lastBaseUpdate,shared:o.shared,effects:o.effects})}function mh(o,et){return{eventTime:o,lane:et,tag:0,payload:null,callback:null,next:null}}function nh(o,et,tt){var nt=o.updateQueue;if(nt===null)return null;if(nt=nt.shared,K$1&2){var rt=nt.pending;return rt===null?et.next=et:(et.next=rt.next,rt.next=et),nt.pending=et,ih(o,tt)}return rt=nt.interleaved,rt===null?(et.next=et,gh(nt)):(et.next=rt.next,rt.next=et),nt.interleaved=et,ih(o,tt)}function oh(o,et,tt){if(et=et.updateQueue,et!==null&&(et=et.shared,(tt&4194240)!==0)){var nt=et.lanes;nt&=o.pendingLanes,tt|=nt,et.lanes=tt,Cc(o,tt)}}function ph(o,et){var tt=o.updateQueue,nt=o.alternate;if(nt!==null&&(nt=nt.updateQueue,tt===nt)){var rt=null,ot=null;if(tt=tt.firstBaseUpdate,tt!==null){do{var it={eventTime:tt.eventTime,lane:tt.lane,tag:tt.tag,payload:tt.payload,callback:tt.callback,next:null};ot===null?rt=ot=it:ot=ot.next=it,tt=tt.next}while(tt!==null);ot===null?rt=ot=et:ot=ot.next=et}else rt=ot=et;tt={baseState:nt.baseState,firstBaseUpdate:rt,lastBaseUpdate:ot,shared:nt.shared,effects:nt.effects},o.updateQueue=tt;return}o=tt.lastBaseUpdate,o===null?tt.firstBaseUpdate=et:o.next=et,tt.lastBaseUpdate=et}function qh(o,et,tt,nt){var rt=o.updateQueue;jh=!1;var ot=rt.firstBaseUpdate,it=rt.lastBaseUpdate,st=rt.shared.pending;if(st!==null){rt.shared.pending=null;var at=st,ct=at.next;at.next=null,it===null?ot=ct:it.next=ct,it=at;var lt=o.alternate;lt!==null&&(lt=lt.updateQueue,st=lt.lastBaseUpdate,st!==it&&(st===null?lt.firstBaseUpdate=ct:st.next=ct,lt.lastBaseUpdate=at))}if(ot!==null){var dt=rt.baseState;it=0,lt=ct=at=null,st=ot;do{var ht=st.lane,pt=st.eventTime;if((nt&ht)===ht){lt!==null&&(lt=lt.next={eventTime:pt,lane:0,tag:st.tag,payload:st.payload,callback:st.callback,next:null});e:{var mt=o,ft=st;switch(ht=et,pt=tt,ft.tag){case 1:if(mt=ft.payload,typeof mt=="function"){dt=mt.call(pt,dt,ht);break e}dt=mt;break e;case 3:mt.flags=mt.flags&-65537|128;case 0:if(mt=ft.payload,ht=typeof mt=="function"?mt.call(pt,dt,ht):mt,ht==null)break e;dt=A$1({},dt,ht);break e;case 2:jh=!0}}st.callback!==null&&st.lane!==0&&(o.flags|=64,ht=rt.effects,ht===null?rt.effects=[st]:ht.push(st))}else pt={eventTime:pt,lane:ht,tag:st.tag,payload:st.payload,callback:st.callback,next:null},lt===null?(ct=lt=pt,at=dt):lt=lt.next=pt,it|=ht;if(st=st.next,st===null){if(st=rt.shared.pending,st===null)break;ht=st,st=ht.next,ht.next=null,rt.lastBaseUpdate=ht,rt.shared.pending=null}}while(!0);if(lt===null&&(at=dt),rt.baseState=at,rt.firstBaseUpdate=ct,rt.lastBaseUpdate=lt,et=rt.shared.interleaved,et!==null){rt=et;do it|=rt.lane,rt=rt.next;while(rt!==et)}else ot===null&&(rt.shared.lanes=0);rh|=it,o.lanes=it,o.memoizedState=dt}}function sh(o,et,tt){if(o=et.effects,et.effects=null,o!==null)for(et=0;ettt?tt:4,o(!0);var nt=Gh.transition;Gh.transition={};try{o(!1),et()}finally{C$1=tt,Gh.transition=nt}}function wi(){return Uh().memoizedState}function xi(o,et,tt){var nt=yi(o);if(tt={lane:nt,action:tt,hasEagerState:!1,eagerState:null,next:null},zi(o))Ai(et,tt);else if(tt=hh(o,et,tt,nt),tt!==null){var rt=R();gi(tt,o,nt,rt),Bi(tt,et,nt)}}function ii(o,et,tt){var nt=yi(o),rt={lane:nt,action:tt,hasEagerState:!1,eagerState:null,next:null};if(zi(o))Ai(et,rt);else{var ot=o.alternate;if(o.lanes===0&&(ot===null||ot.lanes===0)&&(ot=et.lastRenderedReducer,ot!==null))try{var it=et.lastRenderedState,st=ot(it,tt);if(rt.hasEagerState=!0,rt.eagerState=st,He(st,it)){var at=et.interleaved;at===null?(rt.next=rt,gh(et)):(rt.next=at.next,at.next=rt),et.interleaved=rt;return}}catch{}finally{}tt=hh(o,et,rt,nt),tt!==null&&(rt=R(),gi(tt,o,nt,rt),Bi(tt,et,nt))}}function zi(o){var et=o.alternate;return o===M$1||et!==null&&et===M$1}function Ai(o,et){Jh=Ih=!0;var tt=o.pending;tt===null?et.next=et:(et.next=tt.next,tt.next=et),o.pending=et}function Bi(o,et,tt){if(tt&4194240){var nt=et.lanes;nt&=o.pendingLanes,tt|=nt,et.lanes=tt,Cc(o,tt)}}var Rh={readContext:eh,useCallback:P,useContext:P,useEffect:P,useImperativeHandle:P,useInsertionEffect:P,useLayoutEffect:P,useMemo:P,useReducer:P,useRef:P,useState:P,useDebugValue:P,useDeferredValue:P,useTransition:P,useMutableSource:P,useSyncExternalStore:P,useId:P,unstable_isNewReconciler:!1},Oh={readContext:eh,useCallback:function(o,et){return Th().memoizedState=[o,et===void 0?null:et],o},useContext:eh,useEffect:mi,useImperativeHandle:function(o,et,tt){return tt=tt!=null?tt.concat([o]):null,ki(4194308,4,pi.bind(null,et,o),tt)},useLayoutEffect:function(o,et){return ki(4194308,4,o,et)},useInsertionEffect:function(o,et){return ki(4,2,o,et)},useMemo:function(o,et){var tt=Th();return et=et===void 0?null:et,o=o(),tt.memoizedState=[o,et],o},useReducer:function(o,et,tt){var nt=Th();return et=tt!==void 0?tt(et):et,nt.memoizedState=nt.baseState=et,o={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:o,lastRenderedState:et},nt.queue=o,o=o.dispatch=xi.bind(null,M$1,o),[nt.memoizedState,o]},useRef:function(o){var et=Th();return o={current:o},et.memoizedState=o},useState:hi,useDebugValue:ri,useDeferredValue:function(o){return Th().memoizedState=o},useTransition:function(){var o=hi(!1),et=o[0];return o=vi.bind(null,o[1]),Th().memoizedState=o,[et,o]},useMutableSource:function(){},useSyncExternalStore:function(o,et,tt){var nt=M$1,rt=Th();if(I$1){if(tt===void 0)throw Error(p$4(407));tt=tt()}else{if(tt=et(),Q$1===null)throw Error(p$4(349));Hh&30||di(nt,et,tt)}rt.memoizedState=tt;var ot={value:tt,getSnapshot:et};return rt.queue=ot,mi(ai.bind(null,nt,ot,o),[o]),nt.flags|=2048,bi(9,ci.bind(null,nt,ot,tt,et),void 0,null),tt},useId:function(){var o=Th(),et=Q$1.identifierPrefix;if(I$1){var tt=sg,nt=rg;tt=(nt&~(1<<32-oc(nt)-1)).toString(32)+tt,et=":"+et+"R"+tt,tt=Kh++,0")&&(at=at.replace("",o.displayName)),at}while(1<=it&&0<=st);break}}}finally{Na=!1,Error.prepareStackTrace=tt}return(o=o?o.displayName||o.name:"")?Ma(o):""}function Pa(o){switch(o.tag){case 5:return Ma(o.type);case 16:return Ma("Lazy");case 13:return Ma("Suspense");case 19:return Ma("SuspenseList");case 0:case 2:case 15:return o=Oa(o.type,!1),o;case 11:return o=Oa(o.type.render,!1),o;case 1:return o=Oa(o.type,!0),o;default:return""}}function Qa(o){if(o==null)return null;if(typeof o=="function")return o.displayName||o.name||null;if(typeof o=="string")return o;switch(o){case ya:return"Fragment";case wa:return"Portal";case Aa:return"Profiler";case za:return"StrictMode";case Ea:return"Suspense";case Fa:return"SuspenseList"}if(typeof o=="object")switch(o.$$typeof){case Ca:return(o.displayName||"Context")+".Consumer";case Ba:return(o._context.displayName||"Context")+".Provider";case Da:var et=o.render;return o=o.displayName,o||(o=et.displayName||et.name||"",o=o!==""?"ForwardRef("+o+")":"ForwardRef"),o;case Ga:return et=o.displayName||null,et!==null?et:Qa(o.type)||"Memo";case Ha:et=o._payload,o=o._init;try{return Qa(o(et))}catch{}}return null}function Ra(o){var et=o.type;switch(o.tag){case 24:return"Cache";case 9:return(et.displayName||"Context")+".Consumer";case 10:return(et._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return o=et.render,o=o.displayName||o.name||"",et.displayName||(o!==""?"ForwardRef("+o+")":"ForwardRef");case 7:return"Fragment";case 5:return et;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return Qa(et);case 8:return et===za?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof et=="function")return et.displayName||et.name||null;if(typeof et=="string")return et}return null}function Sa(o){switch(typeof o){case"boolean":case"number":case"string":case"undefined":return o;case"object":return o;default:return""}}function Ta(o){var et=o.type;return(o=o.nodeName)&&o.toLowerCase()==="input"&&(et==="checkbox"||et==="radio")}function Ua(o){var et=Ta(o)?"checked":"value",tt=Object.getOwnPropertyDescriptor(o.constructor.prototype,et),nt=""+o[et];if(!o.hasOwnProperty(et)&&typeof tt<"u"&&typeof tt.get=="function"&&typeof tt.set=="function"){var rt=tt.get,ot=tt.set;return Object.defineProperty(o,et,{configurable:!0,get:function(){return rt.call(this)},set:function(it){nt=""+it,ot.call(this,it)}}),Object.defineProperty(o,et,{enumerable:tt.enumerable}),{getValue:function(){return nt},setValue:function(it){nt=""+it},stopTracking:function(){o._valueTracker=null,delete o[et]}}}}function Va(o){o._valueTracker||(o._valueTracker=Ua(o))}function Wa(o){if(!o)return!1;var et=o._valueTracker;if(!et)return!0;var tt=et.getValue(),nt="";return o&&(nt=Ta(o)?o.checked?"true":"false":o.value),o=nt,o!==tt?(et.setValue(o),!0):!1}function Xa(o){if(o=o||(typeof document<"u"?document:void 0),typeof o>"u")return null;try{return o.activeElement||o.body}catch{return o.body}}function Ya(o,et){var tt=et.checked;return A$1({},et,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:tt??o._wrapperState.initialChecked})}function Za(o,et){var tt=et.defaultValue==null?"":et.defaultValue,nt=et.checked!=null?et.checked:et.defaultChecked;tt=Sa(et.value!=null?et.value:tt),o._wrapperState={initialChecked:nt,initialValue:tt,controlled:et.type==="checkbox"||et.type==="radio"?et.checked!=null:et.value!=null}}function ab(o,et){et=et.checked,et!=null&&ta(o,"checked",et,!1)}function bb(o,et){ab(o,et);var tt=Sa(et.value),nt=et.type;if(tt!=null)nt==="number"?(tt===0&&o.value===""||o.value!=tt)&&(o.value=""+tt):o.value!==""+tt&&(o.value=""+tt);else if(nt==="submit"||nt==="reset"){o.removeAttribute("value");return}et.hasOwnProperty("value")?cb$1(o,et.type,tt):et.hasOwnProperty("defaultValue")&&cb$1(o,et.type,Sa(et.defaultValue)),et.checked==null&&et.defaultChecked!=null&&(o.defaultChecked=!!et.defaultChecked)}function db(o,et,tt){if(et.hasOwnProperty("value")||et.hasOwnProperty("defaultValue")){var nt=et.type;if(!(nt!=="submit"&&nt!=="reset"||et.value!==void 0&&et.value!==null))return;et=""+o._wrapperState.initialValue,tt||et===o.value||(o.value=et),o.defaultValue=et}tt=o.name,tt!==""&&(o.name=""),o.defaultChecked=!!o._wrapperState.initialChecked,tt!==""&&(o.name=tt)}function cb$1(o,et,tt){(et!=="number"||Xa(o.ownerDocument)!==o)&&(tt==null?o.defaultValue=""+o._wrapperState.initialValue:o.defaultValue!==""+tt&&(o.defaultValue=""+tt))}var eb=Array.isArray;function fb(o,et,tt,nt){if(o=o.options,et){et={};for(var rt=0;rt"+et.valueOf().toString()+"",et=mb.firstChild;o.firstChild;)o.removeChild(o.firstChild);for(;et.firstChild;)o.appendChild(et.firstChild)}});function ob(o,et){if(et){var tt=o.firstChild;if(tt&&tt===o.lastChild&&tt.nodeType===3){tt.nodeValue=et;return}}o.textContent=et}var pb={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},qb=["Webkit","ms","Moz","O"];Object.keys(pb).forEach(function(o){qb.forEach(function(et){et=et+o.charAt(0).toUpperCase()+o.substring(1),pb[et]=pb[o]})});function rb(o,et,tt){return et==null||typeof et=="boolean"||et===""?"":tt||typeof et!="number"||et===0||pb.hasOwnProperty(o)&&pb[o]?(""+et).trim():et+"px"}function sb(o,et){o=o.style;for(var tt in et)if(et.hasOwnProperty(tt)){var nt=tt.indexOf("--")===0,rt=rb(tt,et[tt],nt);tt==="float"&&(tt="cssFloat"),nt?o.setProperty(tt,rt):o[tt]=rt}}var tb=A$1({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function ub(o,et){if(et){if(tb[o]&&(et.children!=null||et.dangerouslySetInnerHTML!=null))throw Error(p$4(137,o));if(et.dangerouslySetInnerHTML!=null){if(et.children!=null)throw Error(p$4(60));if(typeof et.dangerouslySetInnerHTML!="object"||!("__html"in et.dangerouslySetInnerHTML))throw Error(p$4(61))}if(et.style!=null&&typeof et.style!="object")throw Error(p$4(62))}}function vb(o,et){if(o.indexOf("-")===-1)return typeof et.is=="string";switch(o){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var wb=null;function xb(o){return o=o.target||o.srcElement||window,o.correspondingUseElement&&(o=o.correspondingUseElement),o.nodeType===3?o.parentNode:o}var yb=null,zb=null,Ab=null;function Bb(o){if(o=Cb(o)){if(typeof yb!="function")throw Error(p$4(280));var et=o.stateNode;et&&(et=Db(et),yb(o.stateNode,o.type,et))}}function Eb(o){zb?Ab?Ab.push(o):Ab=[o]:zb=o}function Fb(){if(zb){var o=zb,et=Ab;if(Ab=zb=null,Bb(o),et)for(o=0;o>>=0,o===0?32:31-(pc(o)/qc|0)|0}var rc=64,sc=4194304;function tc(o){switch(o&-o){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return o&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return o&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return o}}function uc(o,et){var tt=o.pendingLanes;if(tt===0)return 0;var nt=0,rt=o.suspendedLanes,ot=o.pingedLanes,it=tt&268435455;if(it!==0){var st=it&~rt;st!==0?nt=tc(st):(ot&=it,ot!==0&&(nt=tc(ot)))}else it=tt&~rt,it!==0?nt=tc(it):ot!==0&&(nt=tc(ot));if(nt===0)return 0;if(et!==0&&et!==nt&&!(et&rt)&&(rt=nt&-nt,ot=et&-et,rt>=ot||rt===16&&(ot&4194240)!==0))return et;if(nt&4&&(nt|=tt&16),et=o.entangledLanes,et!==0)for(o=o.entanglements,et&=nt;0tt;tt++)et.push(o);return et}function Ac(o,et,tt){o.pendingLanes|=et,et!==536870912&&(o.suspendedLanes=0,o.pingedLanes=0),o=o.eventTimes,et=31-oc(et),o[et]=tt}function Bc(o,et){var tt=o.pendingLanes&~et;o.pendingLanes=et,o.suspendedLanes=0,o.pingedLanes=0,o.expiredLanes&=et,o.mutableReadLanes&=et,o.entangledLanes&=et,et=o.entanglements;var nt=o.eventTimes;for(o=o.expirationTimes;0=be$1),ee$1=" ",fe$1=!1;function ge$1(o,et){switch(o){case"keyup":return $d.indexOf(et.keyCode)!==-1;case"keydown":return et.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function he$1(o){return o=o.detail,typeof o=="object"&&"data"in o?o.data:null}var ie$1=!1;function je$1(o,et){switch(o){case"compositionend":return he$1(et);case"keypress":return et.which!==32?null:(fe$1=!0,ee$1);case"textInput":return o=et.data,o===ee$1&&fe$1?null:o;default:return null}}function ke$1(o,et){if(ie$1)return o==="compositionend"||!ae$1&&ge$1(o,et)?(o=nd(),md=ld=kd=null,ie$1=!1,o):null;switch(o){case"paste":return null;case"keypress":if(!(et.ctrlKey||et.altKey||et.metaKey)||et.ctrlKey&&et.altKey){if(et.char&&1=et)return{node:tt,offset:et-o};o=nt}e:{for(;tt;){if(tt.nextSibling){tt=tt.nextSibling;break e}tt=tt.parentNode}tt=void 0}tt=Je(tt)}}function Le$1(o,et){return o&&et?o===et?!0:o&&o.nodeType===3?!1:et&&et.nodeType===3?Le$1(o,et.parentNode):"contains"in o?o.contains(et):o.compareDocumentPosition?!!(o.compareDocumentPosition(et)&16):!1:!1}function Me$1(){for(var o=window,et=Xa();et instanceof o.HTMLIFrameElement;){try{var tt=typeof et.contentWindow.location.href=="string"}catch{tt=!1}if(tt)o=et.contentWindow;else break;et=Xa(o.document)}return et}function Ne$1(o){var et=o&&o.nodeName&&o.nodeName.toLowerCase();return et&&(et==="input"&&(o.type==="text"||o.type==="search"||o.type==="tel"||o.type==="url"||o.type==="password")||et==="textarea"||o.contentEditable==="true")}function Oe$1(o){var et=Me$1(),tt=o.focusedElem,nt=o.selectionRange;if(et!==tt&&tt&&tt.ownerDocument&&Le$1(tt.ownerDocument.documentElement,tt)){if(nt!==null&&Ne$1(tt)){if(et=nt.start,o=nt.end,o===void 0&&(o=et),"selectionStart"in tt)tt.selectionStart=et,tt.selectionEnd=Math.min(o,tt.value.length);else if(o=(et=tt.ownerDocument||document)&&et.defaultView||window,o.getSelection){o=o.getSelection();var rt=tt.textContent.length,ot=Math.min(nt.start,rt);nt=nt.end===void 0?ot:Math.min(nt.end,rt),!o.extend&&ot>nt&&(rt=nt,nt=ot,ot=rt),rt=Ke(tt,ot);var it=Ke(tt,nt);rt&&it&&(o.rangeCount!==1||o.anchorNode!==rt.node||o.anchorOffset!==rt.offset||o.focusNode!==it.node||o.focusOffset!==it.offset)&&(et=et.createRange(),et.setStart(rt.node,rt.offset),o.removeAllRanges(),ot>nt?(o.addRange(et),o.extend(it.node,it.offset)):(et.setEnd(it.node,it.offset),o.addRange(et)))}}for(et=[],o=tt;o=o.parentNode;)o.nodeType===1&&et.push({element:o,left:o.scrollLeft,top:o.scrollTop});for(typeof tt.focus=="function"&&tt.focus(),tt=0;tt=document.documentMode,Qe=null,Re$1=null,Se$1=null,Te$1=!1;function Ue(o,et,tt){var nt=tt.window===tt?tt.document:tt.nodeType===9?tt:tt.ownerDocument;Te$1||Qe==null||Qe!==Xa(nt)||(nt=Qe,"selectionStart"in nt&&Ne$1(nt)?nt={start:nt.selectionStart,end:nt.selectionEnd}:(nt=(nt.ownerDocument&&nt.ownerDocument.defaultView||window).getSelection(),nt={anchorNode:nt.anchorNode,anchorOffset:nt.anchorOffset,focusNode:nt.focusNode,focusOffset:nt.focusOffset}),Se$1&&Ie(Se$1,nt)||(Se$1=nt,nt=oe$1(Re$1,"onSelect"),0Tf||(o.current=Sf[Tf],Sf[Tf]=null,Tf--)}function G$1(o,et){Tf++,Sf[Tf]=o.current,o.current=et}var Vf={},H$1=Uf(Vf),Wf=Uf(!1),Xf=Vf;function Yf(o,et){var tt=o.type.contextTypes;if(!tt)return Vf;var nt=o.stateNode;if(nt&&nt.__reactInternalMemoizedUnmaskedChildContext===et)return nt.__reactInternalMemoizedMaskedChildContext;var rt={},ot;for(ot in tt)rt[ot]=et[ot];return nt&&(o=o.stateNode,o.__reactInternalMemoizedUnmaskedChildContext=et,o.__reactInternalMemoizedMaskedChildContext=rt),rt}function Zf(o){return o=o.childContextTypes,o!=null}function $f(){E$1(Wf),E$1(H$1)}function ag(o,et,tt){if(H$1.current!==Vf)throw Error(p$4(168));G$1(H$1,et),G$1(Wf,tt)}function bg(o,et,tt){var nt=o.stateNode;if(et=et.childContextTypes,typeof nt.getChildContext!="function")return tt;nt=nt.getChildContext();for(var rt in nt)if(!(rt in et))throw Error(p$4(108,Ra(o)||"Unknown",rt));return A$1({},tt,nt)}function cg(o){return o=(o=o.stateNode)&&o.__reactInternalMemoizedMergedChildContext||Vf,Xf=H$1.current,G$1(H$1,o),G$1(Wf,Wf.current),!0}function dg(o,et,tt){var nt=o.stateNode;if(!nt)throw Error(p$4(169));tt?(o=bg(o,et,Xf),nt.__reactInternalMemoizedMergedChildContext=o,E$1(Wf),E$1(H$1),G$1(H$1,o)):E$1(Wf),G$1(Wf,tt)}var eg=null,fg=!1,gg=!1;function hg(o){eg===null?eg=[o]:eg.push(o)}function ig(o){fg=!0,hg(o)}function jg(){if(!gg&&eg!==null){gg=!0;var o=0,et=C$1;try{var tt=eg;for(C$1=1;o>=it,rt-=it,rg=1<<32-oc(et)+rt|tt<It?(Rt=kt,kt=null):Rt=kt.sibling;var Pt=ht(gt,kt,vt[It],bt);if(Pt===null){kt===null&&(kt=Rt);break}o&&kt&&Pt.alternate===null&&et(gt,kt),xt=ot(Pt,xt,It),wt===null?Et=Pt:wt.sibling=Pt,wt=Pt,kt=Rt}if(It===vt.length)return tt(gt,kt),I$1&&tg(gt,It),Et;if(kt===null){for(;ItIt?(Rt=kt,kt=null):Rt=kt.sibling;var jt=ht(gt,kt,Pt.value,bt);if(jt===null){kt===null&&(kt=Rt);break}o&&kt&&jt.alternate===null&&et(gt,kt),xt=ot(jt,xt,It),wt===null?Et=jt:wt.sibling=jt,wt=jt,kt=Rt}if(Pt.done)return tt(gt,kt),I$1&&tg(gt,It),Et;if(kt===null){for(;!Pt.done;It++,Pt=vt.next())Pt=dt(gt,Pt.value,bt),Pt!==null&&(xt=ot(Pt,xt,It),wt===null?Et=Pt:wt.sibling=Pt,wt=Pt);return I$1&&tg(gt,It),Et}for(kt=nt(gt,kt);!Pt.done;It++,Pt=vt.next())Pt=pt(kt,gt,It,Pt.value,bt),Pt!==null&&(o&&Pt.alternate!==null&&kt.delete(Pt.key===null?It:Pt.key),xt=ot(Pt,xt,It),wt===null?Et=Pt:wt.sibling=Pt,wt=Pt);return o&&kt.forEach(function(Ot){return et(gt,Ot)}),I$1&&tg(gt,It),Et}function yt(gt,xt,vt,bt){if(typeof vt=="object"&&vt!==null&&vt.type===ya&&vt.key===null&&(vt=vt.props.children),typeof vt=="object"&&vt!==null){switch(vt.$$typeof){case va:e:{for(var Et=vt.key,wt=xt;wt!==null;){if(wt.key===Et){if(Et=vt.type,Et===ya){if(wt.tag===7){tt(gt,wt.sibling),xt=rt(wt,vt.props.children),xt.return=gt,gt=xt;break e}}else if(wt.elementType===Et||typeof Et=="object"&&Et!==null&&Et.$$typeof===Ha&&Ng(Et)===wt.type){tt(gt,wt.sibling),xt=rt(wt,vt.props),xt.ref=Lg(gt,wt,vt),xt.return=gt,gt=xt;break e}tt(gt,wt);break}else et(gt,wt);wt=wt.sibling}vt.type===ya?(xt=Tg(vt.props.children,gt.mode,bt,vt.key),xt.return=gt,gt=xt):(bt=Rg(vt.type,vt.key,vt.props,null,gt.mode,bt),bt.ref=Lg(gt,xt,vt),bt.return=gt,gt=bt)}return it(gt);case wa:e:{for(wt=vt.key;xt!==null;){if(xt.key===wt)if(xt.tag===4&&xt.stateNode.containerInfo===vt.containerInfo&&xt.stateNode.implementation===vt.implementation){tt(gt,xt.sibling),xt=rt(xt,vt.children||[]),xt.return=gt,gt=xt;break e}else{tt(gt,xt);break}else et(gt,xt);xt=xt.sibling}xt=Sg(vt,gt.mode,bt),xt.return=gt,gt=xt}return it(gt);case Ha:return wt=vt._init,yt(gt,xt,wt(vt._payload),bt)}if(eb(vt))return mt(gt,xt,vt,bt);if(Ka(vt))return ft(gt,xt,vt,bt);Mg(gt,vt)}return typeof vt=="string"&&vt!==""||typeof vt=="number"?(vt=""+vt,xt!==null&&xt.tag===6?(tt(gt,xt.sibling),xt=rt(xt,vt),xt.return=gt,gt=xt):(tt(gt,xt),xt=Qg(vt,gt.mode,bt),xt.return=gt,gt=xt),it(gt)):tt(gt,xt)}return yt}var Ug=Og(!0),Vg=Og(!1),Wg=Uf(null),Xg=null,Yg=null,Zg=null;function $g(){Zg=Yg=Xg=null}function ah(o){var et=Wg.current;E$1(Wg),o._currentValue=et}function bh(o,et,tt){for(;o!==null;){var nt=o.alternate;if((o.childLanes&et)!==et?(o.childLanes|=et,nt!==null&&(nt.childLanes|=et)):nt!==null&&(nt.childLanes&et)!==et&&(nt.childLanes|=et),o===tt)break;o=o.return}}function ch(o,et){Xg=o,Zg=Yg=null,o=o.dependencies,o!==null&&o.firstContext!==null&&(o.lanes&et&&(dh=!0),o.firstContext=null)}function eh(o){var et=o._currentValue;if(Zg!==o)if(o={context:o,memoizedValue:et,next:null},Yg===null){if(Xg===null)throw Error(p$4(308));Yg=o,Xg.dependencies={lanes:0,firstContext:o}}else Yg=Yg.next=o;return et}var fh=null;function gh(o){fh===null?fh=[o]:fh.push(o)}function hh(o,et,tt,nt){var rt=et.interleaved;return rt===null?(tt.next=tt,gh(et)):(tt.next=rt.next,rt.next=tt),et.interleaved=tt,ih(o,nt)}function ih(o,et){o.lanes|=et;var tt=o.alternate;for(tt!==null&&(tt.lanes|=et),tt=o,o=o.return;o!==null;)o.childLanes|=et,tt=o.alternate,tt!==null&&(tt.childLanes|=et),tt=o,o=o.return;return tt.tag===3?tt.stateNode:null}var jh=!1;function kh(o){o.updateQueue={baseState:o.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function lh(o,et){o=o.updateQueue,et.updateQueue===o&&(et.updateQueue={baseState:o.baseState,firstBaseUpdate:o.firstBaseUpdate,lastBaseUpdate:o.lastBaseUpdate,shared:o.shared,effects:o.effects})}function mh(o,et){return{eventTime:o,lane:et,tag:0,payload:null,callback:null,next:null}}function nh(o,et,tt){var nt=o.updateQueue;if(nt===null)return null;if(nt=nt.shared,K$1&2){var rt=nt.pending;return rt===null?et.next=et:(et.next=rt.next,rt.next=et),nt.pending=et,ih(o,tt)}return rt=nt.interleaved,rt===null?(et.next=et,gh(nt)):(et.next=rt.next,rt.next=et),nt.interleaved=et,ih(o,tt)}function oh(o,et,tt){if(et=et.updateQueue,et!==null&&(et=et.shared,(tt&4194240)!==0)){var nt=et.lanes;nt&=o.pendingLanes,tt|=nt,et.lanes=tt,Cc(o,tt)}}function ph(o,et){var tt=o.updateQueue,nt=o.alternate;if(nt!==null&&(nt=nt.updateQueue,tt===nt)){var rt=null,ot=null;if(tt=tt.firstBaseUpdate,tt!==null){do{var it={eventTime:tt.eventTime,lane:tt.lane,tag:tt.tag,payload:tt.payload,callback:tt.callback,next:null};ot===null?rt=ot=it:ot=ot.next=it,tt=tt.next}while(tt!==null);ot===null?rt=ot=et:ot=ot.next=et}else rt=ot=et;tt={baseState:nt.baseState,firstBaseUpdate:rt,lastBaseUpdate:ot,shared:nt.shared,effects:nt.effects},o.updateQueue=tt;return}o=tt.lastBaseUpdate,o===null?tt.firstBaseUpdate=et:o.next=et,tt.lastBaseUpdate=et}function qh(o,et,tt,nt){var rt=o.updateQueue;jh=!1;var ot=rt.firstBaseUpdate,it=rt.lastBaseUpdate,st=rt.shared.pending;if(st!==null){rt.shared.pending=null;var at=st,ct=at.next;at.next=null,it===null?ot=ct:it.next=ct,it=at;var lt=o.alternate;lt!==null&&(lt=lt.updateQueue,st=lt.lastBaseUpdate,st!==it&&(st===null?lt.firstBaseUpdate=ct:st.next=ct,lt.lastBaseUpdate=at))}if(ot!==null){var dt=rt.baseState;it=0,lt=ct=at=null,st=ot;do{var ht=st.lane,pt=st.eventTime;if((nt&ht)===ht){lt!==null&&(lt=lt.next={eventTime:pt,lane:0,tag:st.tag,payload:st.payload,callback:st.callback,next:null});e:{var mt=o,ft=st;switch(ht=et,pt=tt,ft.tag){case 1:if(mt=ft.payload,typeof mt=="function"){dt=mt.call(pt,dt,ht);break e}dt=mt;break e;case 3:mt.flags=mt.flags&-65537|128;case 0:if(mt=ft.payload,ht=typeof mt=="function"?mt.call(pt,dt,ht):mt,ht==null)break e;dt=A$1({},dt,ht);break e;case 2:jh=!0}}st.callback!==null&&st.lane!==0&&(o.flags|=64,ht=rt.effects,ht===null?rt.effects=[st]:ht.push(st))}else pt={eventTime:pt,lane:ht,tag:st.tag,payload:st.payload,callback:st.callback,next:null},lt===null?(ct=lt=pt,at=dt):lt=lt.next=pt,it|=ht;if(st=st.next,st===null){if(st=rt.shared.pending,st===null)break;ht=st,st=ht.next,ht.next=null,rt.lastBaseUpdate=ht,rt.shared.pending=null}}while(!0);if(lt===null&&(at=dt),rt.baseState=at,rt.firstBaseUpdate=ct,rt.lastBaseUpdate=lt,et=rt.shared.interleaved,et!==null){rt=et;do it|=rt.lane,rt=rt.next;while(rt!==et)}else ot===null&&(rt.shared.lanes=0);rh|=it,o.lanes=it,o.memoizedState=dt}}function sh(o,et,tt){if(o=et.effects,et.effects=null,o!==null)for(et=0;ettt?tt:4,o(!0);var nt=Gh.transition;Gh.transition={};try{o(!1),et()}finally{C$1=tt,Gh.transition=nt}}function wi(){return Uh().memoizedState}function xi(o,et,tt){var nt=yi(o);if(tt={lane:nt,action:tt,hasEagerState:!1,eagerState:null,next:null},zi(o))Ai(et,tt);else if(tt=hh(o,et,tt,nt),tt!==null){var rt=R();gi(tt,o,nt,rt),Bi(tt,et,nt)}}function ii(o,et,tt){var nt=yi(o),rt={lane:nt,action:tt,hasEagerState:!1,eagerState:null,next:null};if(zi(o))Ai(et,rt);else{var ot=o.alternate;if(o.lanes===0&&(ot===null||ot.lanes===0)&&(ot=et.lastRenderedReducer,ot!==null))try{var it=et.lastRenderedState,st=ot(it,tt);if(rt.hasEagerState=!0,rt.eagerState=st,He(st,it)){var at=et.interleaved;at===null?(rt.next=rt,gh(et)):(rt.next=at.next,at.next=rt),et.interleaved=rt;return}}catch{}finally{}tt=hh(o,et,rt,nt),tt!==null&&(rt=R(),gi(tt,o,nt,rt),Bi(tt,et,nt))}}function zi(o){var et=o.alternate;return o===M$1||et!==null&&et===M$1}function Ai(o,et){Jh=Ih=!0;var tt=o.pending;tt===null?et.next=et:(et.next=tt.next,tt.next=et),o.pending=et}function Bi(o,et,tt){if(tt&4194240){var nt=et.lanes;nt&=o.pendingLanes,tt|=nt,et.lanes=tt,Cc(o,tt)}}var Rh={readContext:eh,useCallback:P,useContext:P,useEffect:P,useImperativeHandle:P,useInsertionEffect:P,useLayoutEffect:P,useMemo:P,useReducer:P,useRef:P,useState:P,useDebugValue:P,useDeferredValue:P,useTransition:P,useMutableSource:P,useSyncExternalStore:P,useId:P,unstable_isNewReconciler:!1},Oh={readContext:eh,useCallback:function(o,et){return Th().memoizedState=[o,et===void 0?null:et],o},useContext:eh,useEffect:mi,useImperativeHandle:function(o,et,tt){return tt=tt!=null?tt.concat([o]):null,ki(4194308,4,pi.bind(null,et,o),tt)},useLayoutEffect:function(o,et){return ki(4194308,4,o,et)},useInsertionEffect:function(o,et){return ki(4,2,o,et)},useMemo:function(o,et){var tt=Th();return et=et===void 0?null:et,o=o(),tt.memoizedState=[o,et],o},useReducer:function(o,et,tt){var nt=Th();return et=tt!==void 0?tt(et):et,nt.memoizedState=nt.baseState=et,o={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:o,lastRenderedState:et},nt.queue=o,o=o.dispatch=xi.bind(null,M$1,o),[nt.memoizedState,o]},useRef:function(o){var et=Th();return o={current:o},et.memoizedState=o},useState:hi,useDebugValue:ri,useDeferredValue:function(o){return Th().memoizedState=o},useTransition:function(){var o=hi(!1),et=o[0];return o=vi.bind(null,o[1]),Th().memoizedState=o,[et,o]},useMutableSource:function(){},useSyncExternalStore:function(o,et,tt){var nt=M$1,rt=Th();if(I$1){if(tt===void 0)throw Error(p$4(407));tt=tt()}else{if(tt=et(),Q$1===null)throw Error(p$4(349));Hh&30||di(nt,et,tt)}rt.memoizedState=tt;var ot={value:tt,getSnapshot:et};return rt.queue=ot,mi(ai.bind(null,nt,ot,o),[o]),nt.flags|=2048,bi(9,ci.bind(null,nt,ot,tt,et),void 0,null),tt},useId:function(){var o=Th(),et=Q$1.identifierPrefix;if(I$1){var tt=sg,nt=rg;tt=(nt&~(1<<32-oc(nt)-1)).toString(32)+tt,et=":"+et+"R"+tt,tt=Kh++,0<\/script>",o=o.removeChild(o.firstChild)):typeof nt.is=="string"?o=it.createElement(tt,{is:nt.is}):(o=it.createElement(tt),tt==="select"&&(it=o,nt.multiple?it.multiple=!0:nt.size&&(it.size=nt.size))):o=it.createElementNS(o,tt),o[Of]=et,o[Pf]=nt,zj(o,et,!1,!1),et.stateNode=o;e:{switch(it=vb(tt,nt),tt){case"dialog":D$1("cancel",o),D$1("close",o),rt=nt;break;case"iframe":case"object":case"embed":D$1("load",o),rt=nt;break;case"video":case"audio":for(rt=0;rtGj&&(et.flags|=128,nt=!0,Dj(ot,!1),et.lanes=4194304)}else{if(!nt)if(o=Ch(it),o!==null){if(et.flags|=128,nt=!0,tt=o.updateQueue,tt!==null&&(et.updateQueue=tt,et.flags|=4),Dj(ot,!0),ot.tail===null&&ot.tailMode==="hidden"&&!it.alternate&&!I$1)return S$1(et),null}else 2*B$1()-ot.renderingStartTime>Gj&&tt!==1073741824&&(et.flags|=128,nt=!0,Dj(ot,!1),et.lanes=4194304);ot.isBackwards?(it.sibling=et.child,et.child=it):(tt=ot.last,tt!==null?tt.sibling=it:et.child=it,ot.last=it)}return ot.tail!==null?(et=ot.tail,ot.rendering=et,ot.tail=et.sibling,ot.renderingStartTime=B$1(),et.sibling=null,tt=L$1.current,G$1(L$1,nt?tt&1|2:tt&1),et):(S$1(et),null);case 22:case 23:return Hj(),nt=et.memoizedState!==null,o!==null&&o.memoizedState!==null!==nt&&(et.flags|=8192),nt&&et.mode&1?fj&1073741824&&(S$1(et),et.subtreeFlags&6&&(et.flags|=8192)):S$1(et),null;case 24:return null;case 25:return null}throw Error(p$4(156,et.tag))}function Ij(o,et){switch(wg(et),et.tag){case 1:return Zf(et.type)&&$f(),o=et.flags,o&65536?(et.flags=o&-65537|128,et):null;case 3:return zh(),E$1(Wf),E$1(H$1),Eh(),o=et.flags,o&65536&&!(o&128)?(et.flags=o&-65537|128,et):null;case 5:return Bh(et),null;case 13:if(E$1(L$1),o=et.memoizedState,o!==null&&o.dehydrated!==null){if(et.alternate===null)throw Error(p$4(340));Ig()}return o=et.flags,o&65536?(et.flags=o&-65537|128,et):null;case 19:return E$1(L$1),null;case 4:return zh(),null;case 10:return ah(et.type._context),null;case 22:case 23:return Hj(),null;case 24:return null;default:return null}}var Jj=!1,U$1=!1,Kj=typeof WeakSet=="function"?WeakSet:Set,V$2=null;function Lj(o,et){var tt=o.ref;if(tt!==null)if(typeof tt=="function")try{tt(null)}catch(nt){W$1(o,et,nt)}else tt.current=null}function Mj(o,et,tt){try{tt()}catch(nt){W$1(o,et,nt)}}var Nj=!1;function Oj(o,et){if(Cf=dd,o=Me$1(),Ne$1(o)){if("selectionStart"in o)var tt={start:o.selectionStart,end:o.selectionEnd};else e:{tt=(tt=o.ownerDocument)&&tt.defaultView||window;var nt=tt.getSelection&&tt.getSelection();if(nt&&nt.rangeCount!==0){tt=nt.anchorNode;var rt=nt.anchorOffset,ot=nt.focusNode;nt=nt.focusOffset;try{tt.nodeType,ot.nodeType}catch{tt=null;break e}var it=0,st=-1,at=-1,ct=0,lt=0,dt=o,ht=null;t:for(;;){for(var pt;dt!==tt||rt!==0&&dt.nodeType!==3||(st=it+rt),dt!==ot||nt!==0&&dt.nodeType!==3||(at=it+nt),dt.nodeType===3&&(it+=dt.nodeValue.length),(pt=dt.firstChild)!==null;)ht=dt,dt=pt;for(;;){if(dt===o)break t;if(ht===tt&&++ct===rt&&(st=it),ht===ot&&++lt===nt&&(at=it),(pt=dt.nextSibling)!==null)break;dt=ht,ht=dt.parentNode}dt=pt}tt=st===-1||at===-1?null:{start:st,end:at}}else tt=null}tt=tt||{start:0,end:0}}else tt=null;for(Df={focusedElem:o,selectionRange:tt},dd=!1,V$2=et;V$2!==null;)if(et=V$2,o=et.child,(et.subtreeFlags&1028)!==0&&o!==null)o.return=et,V$2=o;else for(;V$2!==null;){et=V$2;try{var mt=et.alternate;if(et.flags&1024)switch(et.tag){case 0:case 11:case 15:break;case 1:if(mt!==null){var ft=mt.memoizedProps,yt=mt.memoizedState,gt=et.stateNode,xt=gt.getSnapshotBeforeUpdate(et.elementType===et.type?ft:Ci(et.type,ft),yt);gt.__reactInternalSnapshotBeforeUpdate=xt}break;case 3:var vt=et.stateNode.containerInfo;vt.nodeType===1?vt.textContent="":vt.nodeType===9&&vt.documentElement&&vt.removeChild(vt.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(p$4(163))}}catch(bt){W$1(et,et.return,bt)}if(o=et.sibling,o!==null){o.return=et.return,V$2=o;break}V$2=et.return}return mt=Nj,Nj=!1,mt}function Pj(o,et,tt){var nt=et.updateQueue;if(nt=nt!==null?nt.lastEffect:null,nt!==null){var rt=nt=nt.next;do{if((rt.tag&o)===o){var ot=rt.destroy;rt.destroy=void 0,ot!==void 0&&Mj(et,tt,ot)}rt=rt.next}while(rt!==nt)}}function Qj(o,et){if(et=et.updateQueue,et=et!==null?et.lastEffect:null,et!==null){var tt=et=et.next;do{if((tt.tag&o)===o){var nt=tt.create;tt.destroy=nt()}tt=tt.next}while(tt!==et)}}function Rj(o){var et=o.ref;if(et!==null){var tt=o.stateNode;switch(o.tag){case 5:o=tt;break;default:o=tt}typeof et=="function"?et(o):et.current=o}}function Sj(o){var et=o.alternate;et!==null&&(o.alternate=null,Sj(et)),o.child=null,o.deletions=null,o.sibling=null,o.tag===5&&(et=o.stateNode,et!==null&&(delete et[Of],delete et[Pf],delete et[of],delete et[Qf],delete et[Rf])),o.stateNode=null,o.return=null,o.dependencies=null,o.memoizedProps=null,o.memoizedState=null,o.pendingProps=null,o.stateNode=null,o.updateQueue=null}function Tj(o){return o.tag===5||o.tag===3||o.tag===4}function Uj(o){e:for(;;){for(;o.sibling===null;){if(o.return===null||Tj(o.return))return null;o=o.return}for(o.sibling.return=o.return,o=o.sibling;o.tag!==5&&o.tag!==6&&o.tag!==18;){if(o.flags&2||o.child===null||o.tag===4)continue e;o.child.return=o,o=o.child}if(!(o.flags&2))return o.stateNode}}function Vj(o,et,tt){var nt=o.tag;if(nt===5||nt===6)o=o.stateNode,et?tt.nodeType===8?tt.parentNode.insertBefore(o,et):tt.insertBefore(o,et):(tt.nodeType===8?(et=tt.parentNode,et.insertBefore(o,tt)):(et=tt,et.appendChild(o)),tt=tt._reactRootContainer,tt!=null||et.onclick!==null||(et.onclick=Bf));else if(nt!==4&&(o=o.child,o!==null))for(Vj(o,et,tt),o=o.sibling;o!==null;)Vj(o,et,tt),o=o.sibling}function Wj(o,et,tt){var nt=o.tag;if(nt===5||nt===6)o=o.stateNode,et?tt.insertBefore(o,et):tt.appendChild(o);else if(nt!==4&&(o=o.child,o!==null))for(Wj(o,et,tt),o=o.sibling;o!==null;)Wj(o,et,tt),o=o.sibling}var X$1=null,Xj=!1;function Yj(o,et,tt){for(tt=tt.child;tt!==null;)Zj(o,et,tt),tt=tt.sibling}function Zj(o,et,tt){if(lc&&typeof lc.onCommitFiberUnmount=="function")try{lc.onCommitFiberUnmount(kc,tt)}catch{}switch(tt.tag){case 5:U$1||Lj(tt,et);case 6:var nt=X$1,rt=Xj;X$1=null,Yj(o,et,tt),X$1=nt,Xj=rt,X$1!==null&&(Xj?(o=X$1,tt=tt.stateNode,o.nodeType===8?o.parentNode.removeChild(tt):o.removeChild(tt)):X$1.removeChild(tt.stateNode));break;case 18:X$1!==null&&(Xj?(o=X$1,tt=tt.stateNode,o.nodeType===8?Kf(o.parentNode,tt):o.nodeType===1&&Kf(o,tt),bd(o)):Kf(X$1,tt.stateNode));break;case 4:nt=X$1,rt=Xj,X$1=tt.stateNode.containerInfo,Xj=!0,Yj(o,et,tt),X$1=nt,Xj=rt;break;case 0:case 11:case 14:case 15:if(!U$1&&(nt=tt.updateQueue,nt!==null&&(nt=nt.lastEffect,nt!==null))){rt=nt=nt.next;do{var ot=rt,it=ot.destroy;ot=ot.tag,it!==void 0&&(ot&2||ot&4)&&Mj(tt,et,it),rt=rt.next}while(rt!==nt)}Yj(o,et,tt);break;case 1:if(!U$1&&(Lj(tt,et),nt=tt.stateNode,typeof nt.componentWillUnmount=="function"))try{nt.props=tt.memoizedProps,nt.state=tt.memoizedState,nt.componentWillUnmount()}catch(st){W$1(tt,et,st)}Yj(o,et,tt);break;case 21:Yj(o,et,tt);break;case 22:tt.mode&1?(U$1=(nt=U$1)||tt.memoizedState!==null,Yj(o,et,tt),U$1=nt):Yj(o,et,tt);break;default:Yj(o,et,tt)}}function ak(o){var et=o.updateQueue;if(et!==null){o.updateQueue=null;var tt=o.stateNode;tt===null&&(tt=o.stateNode=new Kj),et.forEach(function(nt){var rt=bk.bind(null,o,nt);tt.has(nt)||(tt.add(nt),nt.then(rt,rt))})}}function ck(o,et){var tt=et.deletions;if(tt!==null)for(var nt=0;ntrt&&(rt=it),nt&=~ot}if(nt=rt,nt=B$1()-nt,nt=(120>nt?120:480>nt?480:1080>nt?1080:1920>nt?1920:3e3>nt?3e3:4320>nt?4320:1960*lk(nt/1960))-nt,10o?16:o,wk===null)var nt=!1;else{if(o=wk,wk=null,xk=0,K$1&6)throw Error(p$4(331));var rt=K$1;for(K$1|=4,V$2=o.current;V$2!==null;){var ot=V$2,it=ot.child;if(V$2.flags&16){var st=ot.deletions;if(st!==null){for(var at=0;atB$1()-fk?Kk(o,0):rk|=tt),Dk(o,et)}function Yk(o,et){et===0&&(o.mode&1?(et=sc,sc<<=1,!(sc&130023424)&&(sc=4194304)):et=1);var tt=R();o=ih(o,et),o!==null&&(Ac(o,et,tt),Dk(o,tt))}function uj(o){var et=o.memoizedState,tt=0;et!==null&&(tt=et.retryLane),Yk(o,tt)}function bk(o,et){var tt=0;switch(o.tag){case 13:var nt=o.stateNode,rt=o.memoizedState;rt!==null&&(tt=rt.retryLane);break;case 19:nt=o.stateNode;break;default:throw Error(p$4(314))}nt!==null&&nt.delete(et),Yk(o,tt)}var Vk;Vk=function(o,et,tt){if(o!==null)if(o.memoizedProps!==et.pendingProps||Wf.current)dh=!0;else{if(!(o.lanes&tt)&&!(et.flags&128))return dh=!1,yj(o,et,tt);dh=!!(o.flags&131072)}else dh=!1,I$1&&et.flags&1048576&&ug(et,ng,et.index);switch(et.lanes=0,et.tag){case 2:var nt=et.type;ij(o,et),o=et.pendingProps;var rt=Yf(et,H$1.current);ch(et,tt),rt=Nh(null,et,nt,o,rt,tt);var ot=Sh();return et.flags|=1,typeof rt=="object"&&rt!==null&&typeof rt.render=="function"&&rt.$$typeof===void 0?(et.tag=1,et.memoizedState=null,et.updateQueue=null,Zf(nt)?(ot=!0,cg(et)):ot=!1,et.memoizedState=rt.state!==null&&rt.state!==void 0?rt.state:null,kh(et),rt.updater=Ei,et.stateNode=rt,rt._reactInternals=et,Ii(et,nt,o,tt),et=jj(null,et,nt,!0,ot,tt)):(et.tag=0,I$1&&ot&&vg(et),Xi(null,et,rt,tt),et=et.child),et;case 16:nt=et.elementType;e:{switch(ij(o,et),o=et.pendingProps,rt=nt._init,nt=rt(nt._payload),et.type=nt,rt=et.tag=Zk(nt),o=Ci(nt,o),rt){case 0:et=cj(null,et,nt,o,tt);break e;case 1:et=hj(null,et,nt,o,tt);break e;case 11:et=Yi(null,et,nt,o,tt);break e;case 14:et=$i(null,et,nt,Ci(nt.type,o),tt);break e}throw Error(p$4(306,nt,""))}return et;case 0:return nt=et.type,rt=et.pendingProps,rt=et.elementType===nt?rt:Ci(nt,rt),cj(o,et,nt,rt,tt);case 1:return nt=et.type,rt=et.pendingProps,rt=et.elementType===nt?rt:Ci(nt,rt),hj(o,et,nt,rt,tt);case 3:e:{if(kj(et),o===null)throw Error(p$4(387));nt=et.pendingProps,ot=et.memoizedState,rt=ot.element,lh(o,et),qh(et,nt,null,tt);var it=et.memoizedState;if(nt=it.element,ot.isDehydrated)if(ot={element:nt,isDehydrated:!1,cache:it.cache,pendingSuspenseBoundaries:it.pendingSuspenseBoundaries,transitions:it.transitions},et.updateQueue.baseState=ot,et.memoizedState=ot,et.flags&256){rt=Ji(Error(p$4(423)),et),et=lj(o,et,nt,tt,rt);break e}else if(nt!==rt){rt=Ji(Error(p$4(424)),et),et=lj(o,et,nt,tt,rt);break e}else for(yg=Lf(et.stateNode.containerInfo.firstChild),xg=et,I$1=!0,zg=null,tt=Vg(et,null,nt,tt),et.child=tt;tt;)tt.flags=tt.flags&-3|4096,tt=tt.sibling;else{if(Ig(),nt===rt){et=Zi(o,et,tt);break e}Xi(o,et,nt,tt)}et=et.child}return et;case 5:return Ah(et),o===null&&Eg(et),nt=et.type,rt=et.pendingProps,ot=o!==null?o.memoizedProps:null,it=rt.children,Ef(nt,rt)?it=null:ot!==null&&Ef(nt,ot)&&(et.flags|=32),gj(o,et),Xi(o,et,it,tt),et.child;case 6:return o===null&&Eg(et),null;case 13:return oj(o,et,tt);case 4:return yh(et,et.stateNode.containerInfo),nt=et.pendingProps,o===null?et.child=Ug(et,null,nt,tt):Xi(o,et,nt,tt),et.child;case 11:return nt=et.type,rt=et.pendingProps,rt=et.elementType===nt?rt:Ci(nt,rt),Yi(o,et,nt,rt,tt);case 7:return Xi(o,et,et.pendingProps,tt),et.child;case 8:return Xi(o,et,et.pendingProps.children,tt),et.child;case 12:return Xi(o,et,et.pendingProps.children,tt),et.child;case 10:e:{if(nt=et.type._context,rt=et.pendingProps,ot=et.memoizedProps,it=rt.value,G$1(Wg,nt._currentValue),nt._currentValue=it,ot!==null)if(He(ot.value,it)){if(ot.children===rt.children&&!Wf.current){et=Zi(o,et,tt);break e}}else for(ot=et.child,ot!==null&&(ot.return=et);ot!==null;){var st=ot.dependencies;if(st!==null){it=ot.child;for(var at=st.firstContext;at!==null;){if(at.context===nt){if(ot.tag===1){at=mh(-1,tt&-tt),at.tag=2;var ct=ot.updateQueue;if(ct!==null){ct=ct.shared;var lt=ct.pending;lt===null?at.next=at:(at.next=lt.next,lt.next=at),ct.pending=at}}ot.lanes|=tt,at=ot.alternate,at!==null&&(at.lanes|=tt),bh(ot.return,tt,et),st.lanes|=tt;break}at=at.next}}else if(ot.tag===10)it=ot.type===et.type?null:ot.child;else if(ot.tag===18){if(it=ot.return,it===null)throw Error(p$4(341));it.lanes|=tt,st=it.alternate,st!==null&&(st.lanes|=tt),bh(it,tt,et),it=ot.sibling}else it=ot.child;if(it!==null)it.return=ot;else for(it=ot;it!==null;){if(it===et){it=null;break}if(ot=it.sibling,ot!==null){ot.return=it.return,it=ot;break}it=it.return}ot=it}Xi(o,et,rt.children,tt),et=et.child}return et;case 9:return rt=et.type,nt=et.pendingProps.children,ch(et,tt),rt=eh(rt),nt=nt(rt),et.flags|=1,Xi(o,et,nt,tt),et.child;case 14:return nt=et.type,rt=Ci(nt,et.pendingProps),rt=Ci(nt.type,rt),$i(o,et,nt,rt,tt);case 15:return bj(o,et,et.type,et.pendingProps,tt);case 17:return nt=et.type,rt=et.pendingProps,rt=et.elementType===nt?rt:Ci(nt,rt),ij(o,et),et.tag=1,Zf(nt)?(o=!0,cg(et)):o=!1,ch(et,tt),Gi(et,nt,rt),Ii(et,nt,rt,tt),jj(null,et,nt,!0,o,tt);case 19:return xj(o,et,tt);case 22:return dj(o,et,tt)}throw Error(p$4(156,et.tag))};function Fk(o,et){return ac(o,et)}function $k(o,et,tt,nt){this.tag=o,this.key=tt,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=et,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=nt,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Bg(o,et,tt,nt){return new $k(o,et,tt,nt)}function aj(o){return o=o.prototype,!(!o||!o.isReactComponent)}function Zk(o){if(typeof o=="function")return aj(o)?1:0;if(o!=null){if(o=o.$$typeof,o===Da)return 11;if(o===Ga)return 14}return 2}function Pg(o,et){var tt=o.alternate;return tt===null?(tt=Bg(o.tag,et,o.key,o.mode),tt.elementType=o.elementType,tt.type=o.type,tt.stateNode=o.stateNode,tt.alternate=o,o.alternate=tt):(tt.pendingProps=et,tt.type=o.type,tt.flags=0,tt.subtreeFlags=0,tt.deletions=null),tt.flags=o.flags&14680064,tt.childLanes=o.childLanes,tt.lanes=o.lanes,tt.child=o.child,tt.memoizedProps=o.memoizedProps,tt.memoizedState=o.memoizedState,tt.updateQueue=o.updateQueue,et=o.dependencies,tt.dependencies=et===null?null:{lanes:et.lanes,firstContext:et.firstContext},tt.sibling=o.sibling,tt.index=o.index,tt.ref=o.ref,tt}function Rg(o,et,tt,nt,rt,ot){var it=2;if(nt=o,typeof o=="function")aj(o)&&(it=1);else if(typeof o=="string")it=5;else e:switch(o){case ya:return Tg(tt.children,rt,ot,et);case za:it=8,rt|=8;break;case Aa:return o=Bg(12,tt,et,rt|2),o.elementType=Aa,o.lanes=ot,o;case Ea:return o=Bg(13,tt,et,rt),o.elementType=Ea,o.lanes=ot,o;case Fa:return o=Bg(19,tt,et,rt),o.elementType=Fa,o.lanes=ot,o;case Ia:return pj(tt,rt,ot,et);default:if(typeof o=="object"&&o!==null)switch(o.$$typeof){case Ba:it=10;break e;case Ca:it=9;break e;case Da:it=11;break e;case Ga:it=14;break e;case Ha:it=16,nt=null;break e}throw Error(p$4(130,o==null?o:typeof o,""))}return et=Bg(it,tt,et,rt),et.elementType=o,et.type=nt,et.lanes=ot,et}function Tg(o,et,tt,nt){return o=Bg(7,o,nt,et),o.lanes=tt,o}function pj(o,et,tt,nt){return o=Bg(22,o,nt,et),o.elementType=Ia,o.lanes=tt,o.stateNode={isHidden:!1},o}function Qg(o,et,tt){return o=Bg(6,o,null,et),o.lanes=tt,o}function Sg(o,et,tt){return et=Bg(4,o.children!==null?o.children:[],o.key,et),et.lanes=tt,et.stateNode={containerInfo:o.containerInfo,pendingChildren:null,implementation:o.implementation},et}function al(o,et,tt,nt,rt){this.tag=et,this.containerInfo=o,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=zc(0),this.expirationTimes=zc(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=zc(0),this.identifierPrefix=nt,this.onRecoverableError=rt,this.mutableSourceEagerHydrationData=null}function bl(o,et,tt,nt,rt,ot,it,st,at){return o=new al(o,et,tt,st,at),et===1?(et=1,ot===!0&&(et|=8)):et=0,ot=Bg(3,null,null,et),o.current=ot,ot.stateNode=o,ot.memoizedState={element:nt,isDehydrated:tt,cache:null,transitions:null,pendingSuspenseBoundaries:null},kh(ot),o}function cl(o,et,tt){var nt=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(checkDCE)}catch(o){console.error(o)}}checkDCE(),reactDom.exports=reactDom_production_min;var reactDomExports=reactDom.exports;const ReactDOM=getDefaultExportFromCjs(reactDomExports);var createRoot,m$5=reactDomExports;createRoot=m$5.createRoot,m$5.hydrateRoot;const version$8="2.21.44";let errorConfig={getDocsUrl:({docsBaseUrl:o,docsPath:et="",docsSlug:tt})=>et?`${o??"https://viem.sh"}${et}${tt?`#${tt}`:""}`:void 0,version:`viem@${version$8}`},BaseError$3=class Ss extends Error{constructor(et,tt={}){var st;const nt=(()=>{var at;return tt.cause instanceof Ss?tt.cause.details:(at=tt.cause)!=null&&at.message?tt.cause.message:tt.details})(),rt=tt.cause instanceof Ss&&tt.cause.docsPath||tt.docsPath,ot=(st=errorConfig.getDocsUrl)==null?void 0:st.call(errorConfig,{...tt,docsPath:rt}),it=[et||"An error occurred.","",...tt.metaMessages?[...tt.metaMessages,""]:[],...ot?[`Docs: ${ot}`]:[],...nt?[`Details: ${nt}`]:[],...errorConfig.version?[`Version: ${errorConfig.version}`]:[]].join(` `);super(it,tt.cause?{cause:tt.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=nt,this.docsPath=rt,this.metaMessages=tt.metaMessages,this.name=tt.name??this.name,this.shortMessage=et,this.version=version$8}walk(et){return walk(this,et)}};function walk(o,et){return et!=null&&et(o)?o:o&&typeof o=="object"&&"cause"in o&&o.cause!==void 0?walk(o.cause,et):et?null:o}class IntegerOutOfRangeError extends BaseError$3{constructor({max:et,min:tt,signed:nt,size:rt,value:ot}){super(`Number "${ot}" is not in safe ${rt?`${rt*8}-bit ${nt?"signed":"unsigned"} `:""}integer range ${et?`(${tt} to ${et})`:`(above ${tt})`}`,{name:"IntegerOutOfRangeError"})}}class InvalidBytesBooleanError extends BaseError$3{constructor(et){super(`Bytes value "${et}" is not a valid boolean. The bytes array must contain a single byte of either a 0 or 1 value.`,{name:"InvalidBytesBooleanError"})}}class SizeOverflowError extends BaseError$3{constructor({givenSize:et,maxSize:tt}){super(`Size cannot exceed ${tt} bytes. Given size: ${et} bytes.`,{name:"SizeOverflowError"})}}class SliceOffsetOutOfBoundsError extends BaseError$3{constructor({offset:et,position:tt,size:nt}){super(`Slice ${tt==="start"?"starting":"ending"} at offset "${et}" is out-of-bounds (size: ${nt}).`,{name:"SliceOffsetOutOfBoundsError"})}}class SizeExceedsPaddingSizeError extends BaseError$3{constructor({size:et,targetSize:tt,type:nt}){super(`${nt.charAt(0).toUpperCase()}${nt.slice(1).toLowerCase()} size (${et}) exceeds padding size (${tt}).`,{name:"SizeExceedsPaddingSizeError"})}}class InvalidBytesLengthError extends BaseError$3{constructor({size:et,targetSize:tt,type:nt}){super(`${nt.charAt(0).toUpperCase()}${nt.slice(1).toLowerCase()} is expected to be ${tt} ${nt} long, but is ${et} ${nt} long.`,{name:"InvalidBytesLengthError"})}}function pad(o,{dir:et,size:tt=32}={}){return typeof o=="string"?padHex(o,{dir:et,size:tt}):padBytes(o,{dir:et,size:tt})}function padHex(o,{dir:et,size:tt=32}={}){if(tt===null)return o;const nt=o.replace("0x","");if(nt.length>tt*2)throw new SizeExceedsPaddingSizeError({size:Math.ceil(nt.length/2),targetSize:tt,type:"hex"});return`0x${nt[et==="right"?"padEnd":"padStart"](tt*2,"0")}`}function padBytes(o,{dir:et,size:tt=32}={}){if(tt===null)return o;if(o.length>tt)throw new SizeExceedsPaddingSizeError({size:o.length,targetSize:tt,type:"bytes"});const nt=new Uint8Array(tt);for(let rt=0;rt=charCodeMap.zero&&o<=charCodeMap.nine)return o-charCodeMap.zero;if(o>=charCodeMap.A&&o<=charCodeMap.F)return o-(charCodeMap.A-10);if(o>=charCodeMap.a&&o<=charCodeMap.f)return o-(charCodeMap.a-10)}function hexToBytes$3(o,et={}){let tt=o;et.size&&(assertSize(tt,{size:et.size}),tt=pad(tt,{dir:"right",size:et.size}));let nt=tt.slice(2);nt.length%2&&(nt=`0${nt}`);const rt=nt.length/2,ot=new Uint8Array(rt);for(let it=0,st=0;itet)throw new SizeOverflowError({givenSize:size$2(o),maxSize:et})}function hexToBigInt(o,et={}){const{signed:tt}=et;et.size&&assertSize(o,{size:et.size});const nt=BigInt(o);if(!tt)return nt;const rt=(o.length-2)/2,ot=(1n<et.toString(16).padStart(2,"0"));function toHex(o,et={}){return typeof o=="number"||typeof o=="bigint"?numberToHex(o,et):typeof o=="string"?stringToHex(o,et):typeof o=="boolean"?boolToHex(o,et):bytesToHex$4(o,et)}function boolToHex(o,et={}){const tt=`0x${Number(o)}`;return typeof et.size=="number"?(assertSize(tt,{size:et.size}),pad(tt,{size:et.size})):tt}function bytesToHex$4(o,et={}){let tt="";for(let rt=0;rtot||rtformatAbiParam(tt,{includeName:et})).join(et?", ":","):""}function formatAbiParam(o,{includeName:et}){return o.type.startsWith("tuple")?`(${formatAbiParams(o.components,{includeName:et})})${o.type.slice(5)}`:o.type+(et&&o.name?` ${o.name}`:"")}class AbiConstructorNotFoundError extends BaseError$3{constructor({docsPath:et}){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(` @@ -75,8 +75,8 @@ Error generating stack: `+ot.message+` `).slice(0,-1)}function serializeStateMapping(o){if(!(!o||o.length===0))return o.reduce((et,{slot:tt,value:nt})=>{if(tt.length!==66)throw new InvalidBytesLengthError({size:tt.length,targetSize:66,type:"hex"});if(nt.length!==66)throw new InvalidBytesLengthError({size:nt.length,targetSize:66,type:"hex"});return et[tt]=nt,et},{})}function serializeAccountStateOverride(o){const{balance:et,nonce:tt,state:nt,stateDiff:rt,code:ot}=o,it={};if(ot!==void 0&&(it.code=ot),et!==void 0&&(it.balance=numberToHex(et)),tt!==void 0&&(it.nonce=numberToHex(tt)),nt!==void 0&&(it.state=serializeStateMapping(nt)),rt!==void 0){if(it.state)throw new StateAssignmentConflictError;it.stateDiff=serializeStateMapping(rt)}return it}function serializeStateOverride(o){if(!o)return;const et={};for(const{address:tt,...nt}of o){if(!isAddress(tt,{strict:!1}))throw new InvalidAddressError({address:tt});if(et[tt])throw new AccountStateConflictError({address:tt});et[tt]=serializeAccountStateOverride(nt)}return et}async function getBalance$1(o,{address:et,blockNumber:tt,blockTag:nt="latest"}){const rt=tt?numberToHex(tt):void 0,ot=await o.request({method:"eth_getBalance",params:[et,rt||nt]});return BigInt(ot)}function blobsToCommitments(o){const{kzg:et}=o,tt=o.to??(typeof o.blobs[0]=="string"?"hex":"bytes"),nt=typeof o.blobs[0]=="string"?o.blobs.map(ot=>hexToBytes$3(ot)):o.blobs,rt=[];for(const ot of nt)rt.push(Uint8Array.from(et.blobToKzgCommitment(ot)));return tt==="bytes"?rt:rt.map(ot=>bytesToHex$4(ot))}function blobsToProofs(o){const{kzg:et}=o,tt=o.to??(typeof o.blobs[0]=="string"?"hex":"bytes"),nt=typeof o.blobs[0]=="string"?o.blobs.map(it=>hexToBytes$3(it)):o.blobs,rt=typeof o.commitments[0]=="string"?o.commitments.map(it=>hexToBytes$3(it)):o.commitments,ot=[];for(let it=0;itbytesToHex$4(it))}function setBigUint64$1(o,et,tt,nt){if(typeof o.setBigUint64=="function")return o.setBigUint64(et,tt,nt);const rt=BigInt(32),ot=BigInt(4294967295),it=Number(tt>>rt&ot),st=Number(tt&ot),at=nt?4:0,ct=nt?0:4;o.setUint32(et+at,it,nt),o.setUint32(et+ct,st,nt)}const Chi=(o,et,tt)=>o&et^~o&tt,Maj=(o,et,tt)=>o&et^o&tt^et&tt;class HashMD extends Hash{constructor(et,tt,nt,rt){super(),this.blockLen=et,this.outputLen=tt,this.padOffset=nt,this.isLE=rt,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(et),this.view=createView$1(this.buffer)}update(et){exists$1(this);const{view:tt,buffer:nt,blockLen:rt}=this;et=toBytes$2(et);const ot=et.length;for(let it=0;itrt-it&&(this.process(nt,0),it=0);for(let dt=it;dtlt.length)throw new Error("_sha2: outputLen bigger than state");for(let dt=0;dt>>3,ft=rotr(pt,17)^rotr(pt,19)^pt>>>10;SHA256_W[dt]=ft+SHA256_W[dt-7]+mt+SHA256_W[dt-16]|0}let{A:nt,B:rt,C:ot,D:it,E:st,F:at,G:ct,H:lt}=this;for(let dt=0;dt<64;dt++){const ht=rotr(st,6)^rotr(st,11)^rotr(st,25),pt=lt+ht+Chi(st,at,ct)+SHA256_K[dt]+SHA256_W[dt]|0,ft=(rotr(nt,2)^rotr(nt,13)^rotr(nt,22))+Maj(nt,rt,ot)|0;lt=ct,ct=at,at=st,st=it+pt|0,it=ot,ot=rt,rt=nt,nt=pt+ft|0}nt=nt+this.A|0,rt=rt+this.B|0,ot=ot+this.C|0,it=it+this.D|0,st=st+this.E|0,at=at+this.F|0,ct=ct+this.G|0,lt=lt+this.H|0,this.set(nt,rt,ot,it,st,at,ct,lt)}roundClean(){SHA256_W.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}const sha256$2=wrapConstructor(()=>new SHA256);function sha256$1(o,et){return sha256$2(isHex(o,{strict:!1})?toBytes$3(o):o)}function commitmentToVersionedHash(o){const{commitment:et,version:tt=1}=o,nt=o.to??(typeof et=="string"?"hex":"bytes"),rt=sha256$1(et);return rt.set([tt],0),nt==="bytes"?rt:bytesToHex$4(rt)}function commitmentsToVersionedHashes(o){const{commitments:et,version:tt}=o,nt=o.to??(typeof et[0]=="string"?"hex":"bytes"),rt=[];for(const ot of et)rt.push(commitmentToVersionedHash({commitment:ot,to:nt,version:tt}));return rt}const blobsPerTransaction=6,bytesPerFieldElement=32,fieldElementsPerBlob=4096,bytesPerBlob=bytesPerFieldElement*fieldElementsPerBlob,maxBytesPerTransaction=bytesPerBlob*blobsPerTransaction-1-1*fieldElementsPerBlob*blobsPerTransaction,versionedHashVersionKzg=1;class BlobSizeTooLargeError extends BaseError$3{constructor({maxSize:et,size:tt}){super("Blob size is too large.",{metaMessages:[`Max: ${et} bytes`,`Given: ${tt} bytes`],name:"BlobSizeTooLargeError"})}}class EmptyBlobError extends BaseError$3{constructor(){super("Blob data must not be empty.",{name:"EmptyBlobError"})}}class InvalidVersionedHashSizeError extends BaseError$3{constructor({hash:et,size:tt}){super(`Versioned hash "${et}" size is invalid.`,{metaMessages:["Expected: 32",`Received: ${tt}`],name:"InvalidVersionedHashSizeError"})}}class InvalidVersionedHashVersionError extends BaseError$3{constructor({hash:et,version:tt}){super(`Versioned hash "${et}" version is invalid.`,{metaMessages:[`Expected: ${versionedHashVersionKzg}`,`Received: ${tt}`],name:"InvalidVersionedHashVersionError"})}}function toBlobs(o){const et=o.to??(typeof o.data=="string"?"hex":"bytes"),tt=typeof o.data=="string"?hexToBytes$3(o.data):o.data,nt=size$2(tt);if(!nt)throw new EmptyBlobError;if(nt>maxBytesPerTransaction)throw new BlobSizeTooLargeError({maxSize:maxBytesPerTransaction,size:nt});const rt=[];let ot=!0,it=0;for(;ot;){const st=createCursor(new Uint8Array(bytesPerBlob));let at=0;for(;atst.bytes):rt.map(st=>bytesToHex$4(st.bytes))}function toBlobSidecars(o){const{data:et,kzg:tt,to:nt}=o,rt=o.blobs??toBlobs({data:et,to:nt}),ot=o.commitments??blobsToCommitments({blobs:rt,kzg:tt,to:nt}),it=o.proofs??blobsToProofs({blobs:rt,commitments:ot,kzg:tt,to:nt}),st=[];for(let at=0;at1||tt[0]>1)throw new InvalidBytesBooleanError(tt);return!!tt[0]}function bytesToNumber$1(o,et={}){typeof et.size<"u"&&assertSize(o,{size:et.size});const tt=bytesToHex$4(o,et);return hexToNumber$2(tt,et)}function bytesToString(o,et={}){let tt=o;return typeof et.size<"u"&&(assertSize(tt,{size:et.size}),tt=trim$1(tt,{dir:"right"})),new TextDecoder().decode(tt)}function decodeAbiParameters(o,et){const tt=typeof et=="string"?hexToBytes$3(et):et,nt=createCursor(tt);if(size$2(tt)===0&&o.length>0)throw new AbiDecodingZeroDataError;if(size$2(et)&&size$2(et)<32)throw new AbiDecodingDataSizeTooSmallError({data:typeof et=="string"?et:bytesToHex$4(et),params:o,size:size$2(et)});let rt=0;const ot=[];for(let it=0;it48?bytesToBigInt(rt,{signed:tt}):bytesToNumber$1(rt,{signed:tt}),32]}function decodeTuple(o,et,{staticPosition:tt}){const nt=et.components.length===0||et.components.some(({name:it})=>!it),rt=nt?[]:{};let ot=0;if(hasDynamicChild(et)){const it=bytesToNumber$1(o.readBytes(sizeOfOffset)),st=tt+it;for(let at=0;atkeccak256$1(toBytes$3(o));function hashSignature(o){return hash(o)}const version$7="1.0.6";let BaseError$2=class ks extends Error{constructor(et,tt={}){var it;const nt=tt.cause instanceof ks?tt.cause.details:(it=tt.cause)!=null&&it.message?tt.cause.message:tt.details,rt=tt.cause instanceof ks&&tt.cause.docsPath||tt.docsPath,ot=[et||"An error occurred.","",...tt.metaMessages?[...tt.metaMessages,""]:[],...rt?[`Docs: https://abitype.dev${rt}`]:[],...nt?[`Details: ${nt}`]:[],`Version: abitype@${version$7}`].join(` `);super(ot),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"}),tt.cause&&(this.cause=tt.cause),this.details=nt,this.docsPath=rt,this.metaMessages=tt.metaMessages,this.shortMessage=et}};function execTyped(o,et){const tt=o.exec(et);return tt==null?void 0:tt.groups}const bytesRegex=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,integerRegex=/^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)?$/,isTupleRegex=/^\(.+?\).*?$/,tupleRegex=/^tuple(?(\[(\d*)\])*)$/;function formatAbiParameter(o){let et=o.type;if(tupleRegex.test(o.type)&&"components"in o){et="(";const tt=o.components.length;for(let rt=0;rt[a-zA-Z$_][a-zA-Z0-9$_]*)\((?.*?)\)$/;function isErrorSignature(o){return errorSignatureRegex.test(o)}function execErrorSignature(o){return execTyped(errorSignatureRegex,o)}const eventSignatureRegex=/^event (?[a-zA-Z$_][a-zA-Z0-9$_]*)\((?.*?)\)$/;function isEventSignature(o){return eventSignatureRegex.test(o)}function execEventSignature(o){return execTyped(eventSignatureRegex,o)}const functionSignatureRegex=/^function (?[a-zA-Z$_][a-zA-Z0-9$_]*)\((?.*?)\)(?: (?external|public{1}))?(?: (?pure|view|nonpayable|payable{1}))?(?: returns\s?\((?.*?)\))?$/;function isFunctionSignature(o){return functionSignatureRegex.test(o)}function execFunctionSignature(o){return execTyped(functionSignatureRegex,o)}const structSignatureRegex=/^struct (?[a-zA-Z$_][a-zA-Z0-9$_]*) \{(?.*?)\}$/;function isStructSignature(o){return structSignatureRegex.test(o)}function execStructSignature(o){return execTyped(structSignatureRegex,o)}const constructorSignatureRegex=/^constructor\((?.*?)\)(?:\s(?payable{1}))?$/;function isConstructorSignature(o){return constructorSignatureRegex.test(o)}function execConstructorSignature(o){return execTyped(constructorSignatureRegex,o)}const fallbackSignatureRegex=/^fallback\(\) external(?:\s(?payable{1}))?$/;function isFallbackSignature(o){return fallbackSignatureRegex.test(o)}const receiveSignatureRegex=/^receive\(\) external payable$/;function isReceiveSignature(o){return receiveSignatureRegex.test(o)}const eventModifiers=new Set(["indexed"]),functionModifiers=new Set(["calldata","memory","storage"]);class UnknownTypeError extends BaseError$2{constructor({type:et}){super("Unknown type.",{metaMessages:[`Type "${et}" 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 UnknownSolidityTypeError extends BaseError$2{constructor({type:et}){super("Unknown type.",{metaMessages:[`Type "${et}" is not a valid ABI type.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownSolidityTypeError"})}}class InvalidParameterError extends BaseError$2{constructor({param:et}){super("Invalid ABI parameter.",{details:et}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidParameterError"})}}class SolidityProtectedKeywordError extends BaseError$2{constructor({param:et,name:tt}){super("Invalid ABI parameter.",{details:et,metaMessages:[`"${tt}" 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 InvalidModifierError extends BaseError$2{constructor({param:et,type:tt,modifier:nt}){super("Invalid ABI parameter.",{details:et,metaMessages:[`Modifier "${nt}" not allowed${tt?` in "${tt}" type`:""}.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidModifierError"})}}class InvalidFunctionModifierError extends BaseError$2{constructor({param:et,type:tt,modifier:nt}){super("Invalid ABI parameter.",{details:et,metaMessages:[`Modifier "${nt}" not allowed${tt?` in "${tt}" type`:""}.`,`Data location can only be specified for array, struct, or mapping types, but "${nt}" was given.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidFunctionModifierError"})}}class InvalidAbiTypeParameterError extends BaseError$2{constructor({abiParameter:et}){super("Invalid ABI parameter.",{details:JSON.stringify(et,null,2),metaMessages:["ABI parameter type is invalid."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidAbiTypeParameterError"})}}let InvalidSignatureError$1=class extends BaseError$2{constructor({signature:et,type:tt}){super(`Invalid ${tt} signature.`,{details:et}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidSignatureError"})}};class UnknownSignatureError extends BaseError$2{constructor({signature:et}){super("Unknown signature.",{details:et}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownSignatureError"})}}class InvalidStructSignatureError extends BaseError$2{constructor({signature:et}){super("Invalid struct signature.",{details:et,metaMessages:["No properties exist."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidStructSignatureError"})}}class CircularReferenceError extends BaseError$2{constructor({type:et}){super("Circular reference detected.",{metaMessages:[`Struct "${et}" is a circular reference.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"CircularReferenceError"})}}class InvalidParenthesisError extends BaseError$2{constructor({current:et,depth:tt}){super("Unbalanced parentheses.",{metaMessages:[`"${et.trim()}" has too many ${tt>0?"opening":"closing"} parentheses.`],details:`Depth "${tt}"`}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidParenthesisError"})}}function getParameterCacheKey(o,et){return et?`${et}:${o}`:o}const parameterCache=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 parseSignature(o,et={}){if(isFunctionSignature(o)){const tt=execFunctionSignature(o);if(!tt)throw new InvalidSignatureError$1({signature:o,type:"function"});const nt=splitParameters(tt.parameters),rt=[],ot=nt.length;for(let st=0;st[a-zA-Z$_][a-zA-Z0-9$_]*)(?(?:\[\d*?\])+?)?(?:\s(?calldata|indexed|memory|storage{1}))?(?:\s(?[a-zA-Z$_][a-zA-Z0-9$_]*))?$/,abiParameterWithTupleRegex=/^\((?.+?)\)(?(?:\[\d*?\])+?)?(?:\s(?calldata|indexed|memory|storage{1}))?(?:\s(?[a-zA-Z$_][a-zA-Z0-9$_]*))?$/,dynamicIntegerRegex=/^u?int$/;function parseAbiParameter(o,et){var dt,ht;const tt=getParameterCacheKey(o,et==null?void 0:et.type);if(parameterCache.has(tt))return parameterCache.get(tt);const nt=isTupleRegex.test(o),rt=execTyped(nt?abiParameterWithTupleRegex:abiParameterWithoutTupleRegex,o);if(!rt)throw new InvalidParameterError({param:o});if(rt.name&&isSolidityKeyword(rt.name))throw new SolidityProtectedKeywordError({param:o,name:rt.name});const ot=rt.name?{name:rt.name}:{},it=rt.modifier==="indexed"?{indexed:!0}:{},st=(et==null?void 0:et.structs)??{};let at,ct={};if(nt){at="tuple";const pt=splitParameters(rt.type),mt=[],ft=pt.length;for(let yt=0;yt[a-zA-Z$_][a-zA-Z0-9$_]*)(?(?:\[\d*?\])+?)?$/;function resolveStructs(o,et,tt=new Set){const nt=[],rt=o.length;for(let ot=0;ot{const et=typeof o=="string"?o:formatAbiItem(o);return normalizeSignature$1(et)};function toSignatureHash(o){return hashSignature(toSignature(o))}const toEventSelector=toSignatureHash,toFunctionSelector=o=>slice(toSignatureHash(o),0,4);function getAbiItem(o){const{abi:et,args:tt=[],name:nt}=o,rt=isHex(nt,{strict:!1}),ot=et.filter(st=>rt?st.type==="function"?toFunctionSelector(st)===nt:st.type==="event"?toEventSelector(st)===nt:!1:"name"in st&&st.name===nt);if(ot.length===0)return;if(ot.length===1)return ot[0];let it;for(const st of ot){if(!("inputs"in st))continue;if(!tt||tt.length===0){if(!st.inputs||st.inputs.length===0)return st;continue}if(!st.inputs||st.inputs.length===0||st.inputs.length!==tt.length)continue;if(tt.every((ct,lt)=>{const dt="inputs"in st&&st.inputs[lt];return dt?isArgOfType(ct,dt):!1})){if(it&&"inputs"in it&&it.inputs){const ct=getAmbiguousTypes(st.inputs,it.inputs,tt);if(ct)throw new AbiItemAmbiguityError({abiItem:st,type:ct[0]},{abiItem:it,type:ct[1]})}it=st}}return it||ot[0]}function isArgOfType(o,et){const tt=typeof o,nt=et.type;switch(nt){case"address":return isAddress(o,{strict:!1});case"bool":return tt==="boolean";case"function":return tt==="string";case"string":return tt==="string";default:return nt==="tuple"&&"components"in et?Object.values(et.components).every((rt,ot)=>isArgOfType(Object.values(o)[ot],rt)):/^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(nt)?tt==="number"||tt==="bigint":/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/.test(nt)?tt==="string"||o instanceof Uint8Array:/[a-z]+[1-9]{0,3}(\[[0-9]{0,}\])+$/.test(nt)?Array.isArray(o)&&o.every(rt=>isArgOfType(rt,{...et,type:nt.replace(/(\[[0-9]{0,}\])$/,"")})):!1}}function getAmbiguousTypes(o,et,tt){for(const nt in o){const rt=o[nt],ot=et[nt];if(rt.type==="tuple"&&ot.type==="tuple"&&"components"in rt&&"components"in ot)return getAmbiguousTypes(rt.components,ot.components,tt[nt]);const it=[rt.type,ot.type];if(it.includes("address")&&it.includes("bytes20")?!0:it.includes("address")&&it.includes("string")?isAddress(tt[nt],{strict:!1}):it.includes("address")&&it.includes("bytes")?isAddress(tt[nt],{strict:!1}):!1)return it}}const docsPath$1="/docs/contract/decodeFunctionResult";function decodeFunctionResult(o){const{abi:et,args:tt,functionName:nt,data:rt}=o;let ot=et[0];if(nt){const st=getAbiItem({abi:et,args:tt,name:nt});if(!st)throw new AbiFunctionNotFoundError(nt,{docsPath:docsPath$1});ot=st}if(ot.type!=="function")throw new AbiFunctionNotFoundError(void 0,{docsPath:docsPath$1});if(!ot.outputs)throw new AbiFunctionOutputsNotFoundError(ot.name,{docsPath:docsPath$1});const it=decodeAbiParameters(ot.outputs,rt);if(it&&it.length>1)return it;if(it&&it.length===1)return it[0]}const docsPath="/docs/contract/encodeFunctionData";function prepareEncodeFunctionData(o){const{abi:et,args:tt,functionName:nt}=o;let rt=et[0];if(nt){const ot=getAbiItem({abi:et,args:tt,name:nt});if(!ot)throw new AbiFunctionNotFoundError(nt,{docsPath});rt=ot}if(rt.type!=="function")throw new AbiFunctionNotFoundError(void 0,{docsPath});return{abi:[rt],functionName:toFunctionSelector(formatAbiItem$1(rt))}}function encodeFunctionData(o){const{args:et}=o,{abi:tt,functionName:nt}=(()=>{var st;return o.abi.length===1&&((st=o.functionName)!=null&&st.startsWith("0x"))?o:prepareEncodeFunctionData(o)})(),rt=tt[0],ot=nt,it="inputs"in rt&&rt.inputs?encodeAbiParameters(rt.inputs,et??[]):void 0;return concatHex([ot,it??"0x"])}function getChainContractAddress({blockNumber:o,chain:et,contract:tt}){var rt;const nt=(rt=et==null?void 0:et.contracts)==null?void 0:rt[tt];if(!nt)throw new ChainDoesNotSupportContract({chain:et,contract:{name:tt}});if(o&&nt.blockCreated&&nt.blockCreated>o)throw new ChainDoesNotSupportContract({blockNumber:o,chain:et,contract:{name:tt,blockCreated:nt.blockCreated}});return nt.address}const panicReasons={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."},solidityError={inputs:[{name:"message",type:"string"}],name:"Error",type:"error"},solidityPanic={inputs:[{name:"reason",type:"uint256"}],name:"Panic",type:"error"};function decodeErrorResult(o){const{abi:et,data:tt}=o,nt=slice(tt,0,4);if(nt==="0x")throw new AbiDecodingZeroDataError;const ot=[...et||[],solidityError,solidityPanic].find(it=>it.type==="error"&&nt===toFunctionSelector(formatAbiItem$1(it)));if(!ot)throw new AbiErrorSignatureNotFoundError(nt,{docsPath:"/docs/contract/decodeErrorResult"});return{abiItem:ot,args:"inputs"in ot&&ot.inputs&&ot.inputs.length>0?decodeAbiParameters(ot.inputs,slice(tt,4)):void 0,errorName:ot.name}}function formatAbiItemWithArgs({abiItem:o,args:et,includeFunctionName:tt=!0,includeName:nt=!1}){if("name"in o&&"inputs"in o&&o.inputs)return`${tt?o.name:""}(${o.inputs.map((rt,ot)=>`${nt&&rt.name?`${rt.name}: `:""}${typeof et[ot]=="object"?stringify$2(et[ot]):et[ot]}`).join(", ")})`}class CallExecutionError extends BaseError$3{constructor(et,{account:tt,docsPath:nt,chain:rt,data:ot,gas:it,gasPrice:st,maxFeePerGas:at,maxPriorityFeePerGas:ct,nonce:lt,to:dt,value:ht,stateOverride:pt}){var yt;const mt=tt?parseAccount(tt):void 0;let ft=prettyPrint({from:mt==null?void 0:mt.address,to:dt,value:typeof ht<"u"&&`${formatEther(ht)} ${((yt=rt==null?void 0:rt.nativeCurrency)==null?void 0:yt.symbol)||"ETH"}`,data:ot,gas:it,gasPrice:typeof st<"u"&&`${formatGwei(st)} gwei`,maxFeePerGas:typeof at<"u"&&`${formatGwei(at)} gwei`,maxPriorityFeePerGas:typeof ct<"u"&&`${formatGwei(ct)} gwei`,nonce:lt});pt&&(ft+=` ${prettyStateOverride(pt)}`),super(et.shortMessage,{cause:et,docsPath:nt,metaMessages:[...et.metaMessages?[...et.metaMessages," "]:[],"Raw Call Arguments:",ft].filter(Boolean),name:"CallExecutionError"}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.cause=et}}class ContractFunctionExecutionError extends BaseError$3{constructor(et,{abi:tt,args:nt,contractAddress:rt,docsPath:ot,functionName:it,sender:st}){const at=getAbiItem({abi:tt,args:nt,name:it}),ct=at?formatAbiItemWithArgs({abiItem:at,args:nt,includeFunctionName:!1,includeName:!1}):void 0,lt=at?formatAbiItem$1(at,{includeName:!0}):void 0,dt=prettyPrint({address:rt&&getContractAddress(rt),function:lt,args:ct&&ct!=="()"&&`${[...Array((it==null?void 0:it.length)??0).keys()].map(()=>" ").join("")}${ct}`,sender:st});super(et.shortMessage||`An unknown error occurred while executing the contract function "${it}".`,{cause:et,docsPath:ot,metaMessages:[...et.metaMessages?[...et.metaMessages," "]:[],dt&&"Contract Call:",dt].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=tt,this.args=nt,this.cause=et,this.contractAddress=rt,this.functionName=it,this.sender=st}}class ContractFunctionRevertedError extends BaseError$3{constructor({abi:et,data:tt,functionName:nt,message:rt}){let ot,it,st,at;if(tt&&tt!=="0x")try{it=decodeErrorResult({abi:et,data:tt});const{abiItem:lt,errorName:dt,args:ht}=it;if(dt==="Error")at=ht[0];else if(dt==="Panic"){const[pt]=ht;at=panicReasons[pt]}else{const pt=lt?formatAbiItem$1(lt,{includeName:!0}):void 0,mt=lt&&ht?formatAbiItemWithArgs({abiItem:lt,args:ht,includeFunctionName:!1,includeName:!1}):void 0;st=[pt?`Error: ${pt}`:"",mt&&mt!=="()"?` ${[...Array((dt==null?void 0:dt.length)??0).keys()].map(()=>" ").join("")}${mt}`:""]}}catch(lt){ot=lt}else rt&&(at=rt);let ct;ot instanceof AbiErrorSignatureNotFoundError&&(ct=ot.signature,st=[`Unable to decode signature "${ct}" 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=${ct}.`]),super(at&&at!=="execution reverted"||ct?[`The contract function "${nt}" reverted with the following ${ct?"signature":"reason"}:`,at||ct].join(` -`):`The contract function "${nt}" reverted.`,{cause:ot,metaMessages:st,name:"ContractFunctionRevertedError"}),Object.defineProperty(this,"data",{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=it,this.reason=at,this.signature=ct}}class ContractFunctionZeroDataError extends BaseError$3{constructor({functionName:et}){super(`The contract function "${et}" returned no data ("0x").`,{metaMessages:["This could be due to any of the following:",` - The contract does not have the function "${et}",`," - The parameters passed to the contract function may be invalid, or"," - The address is not a contract."],name:"ContractFunctionZeroDataError"})}}class CounterfactualDeploymentFailedError extends BaseError$3{constructor({factory:et}){super(`Deployment for counterfactual contract call failed${et?` for factory "${et}".`:""}`,{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 RawContractError extends BaseError$3{constructor({data:et,message:tt}){super(tt||"",{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=et}}function isNullUniversalResolverError(o,et){var nt,rt,ot,it,st,at;if(!(o instanceof BaseError$3))return!1;const tt=o.walk(ct=>ct instanceof ContractFunctionRevertedError);return tt instanceof ContractFunctionRevertedError?!!(((nt=tt.data)==null?void 0:nt.errorName)==="ResolverNotFound"||((rt=tt.data)==null?void 0:rt.errorName)==="ResolverWildcardNotSupported"||((ot=tt.data)==null?void 0:ot.errorName)==="ResolverNotContract"||((it=tt.data)==null?void 0:it.errorName)==="ResolverError"||((st=tt.data)==null?void 0:st.errorName)==="HttpError"||(at=tt.reason)!=null&&at.includes("Wildcard on non-extended resolvers is not supported")||et==="reverse"&&tt.reason===panicReasons[50]):!1}function encodedLabelToLabelhash(o){if(o.length!==66||o.indexOf("[")!==0||o.indexOf("]")!==65)return null;const et=`0x${o.slice(1,65)}`;return isHex(et)?et:null}function namehash(o){let et=new Uint8Array(32).fill(0);if(!o)return bytesToHex$4(et);const tt=o.split(".");for(let nt=tt.length-1;nt>=0;nt-=1){const rt=encodedLabelToLabelhash(tt[nt]),ot=rt?toBytes$3(rt):keccak256$1(stringToBytes(tt[nt]),"bytes");et=keccak256$1(concat$3([et,ot]),"bytes")}return bytesToHex$4(et)}function encodeLabelhash(o){return`[${o.slice(2)}]`}function labelhash(o){const et=new Uint8Array(32).fill(0);return o?encodedLabelToLabelhash(o)||keccak256$1(stringToBytes(o)):bytesToHex$4(et)}function packetToBytes(o){const et=o.replace(/^\.|\.$/gm,"");if(et.length===0)return new Uint8Array(1);const tt=new Uint8Array(stringToBytes(et).byteLength+2);let nt=0;const rt=et.split(".");for(let ot=0;ot255&&(it=stringToBytes(encodeLabelhash(labelhash(rt[ot])))),tt[nt]=it.length,tt.set(it,nt+1),nt+=it.length+1}return tt.byteLength!==nt+1?tt.slice(0,nt+1):tt}const EXECUTION_REVERTED_ERROR_CODE=3;function getContractError(o,{abi:et,address:tt,args:nt,docsPath:rt,functionName:ot,sender:it}){const{code:st,data:at,message:ct,shortMessage:lt}=o instanceof RawContractError?o:o instanceof BaseError$3?o.walk(ht=>"data"in ht)||o.walk():{},dt=o instanceof AbiDecodingZeroDataError?new ContractFunctionZeroDataError({functionName:ot}):[EXECUTION_REVERTED_ERROR_CODE,InternalRpcError.code].includes(st)&&(at||ct||lt)?new ContractFunctionRevertedError({abi:et,data:typeof at=="object"?at.data:at,functionName:ot,message:lt??ct}):o;return new ContractFunctionExecutionError(dt,{abi:et,args:nt,contractAddress:tt,docsPath:rt,functionName:ot,sender:it})}const aggregate3Signature="0x82ad56cb",deploylessCallViaBytecodeBytecode="0x608060405234801561001057600080fd5b5060405161018e38038061018e83398101604081905261002f91610124565b6000808351602085016000f59050803b61004857600080fd5b6000808351602085016000855af16040513d6000823e81610067573d81fd5b3d81f35b634e487b7160e01b600052604160045260246000fd5b600082601f83011261009257600080fd5b81516001600160401b038111156100ab576100ab61006b565b604051601f8201601f19908116603f011681016001600160401b03811182821017156100d9576100d961006b565b6040528181528382016020018510156100f157600080fd5b60005b82811015610110576020818601810151838301820152016100f4565b506000918101602001919091529392505050565b6000806040838503121561013757600080fd5b82516001600160401b0381111561014d57600080fd5b61015985828601610081565b602085015190935090506001600160401b0381111561017757600080fd5b61018385828601610081565b915050925092905056fe",deploylessCallViaFactoryBytecode="0x608060405234801561001057600080fd5b506040516102c03803806102c083398101604081905261002f916101e6565b836001600160a01b03163b6000036100e457600080836001600160a01b03168360405161005c9190610270565b6000604051808303816000865af19150503d8060008114610099576040519150601f19603f3d011682016040523d82523d6000602084013e61009e565b606091505b50915091508115806100b857506001600160a01b0386163b155b156100e1578060405163101bb98d60e01b81526004016100d8919061028c565b60405180910390fd5b50505b6000808451602086016000885af16040513d6000823e81610103573d81fd5b3d81f35b80516001600160a01b038116811461011e57600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b60005b8381101561015457818101518382015260200161013c565b50506000910152565b600082601f83011261016e57600080fd5b81516001600160401b0381111561018757610187610123565b604051601f8201601f19908116603f011681016001600160401b03811182821017156101b5576101b5610123565b6040528181528382016020018510156101cd57600080fd5b6101de826020830160208701610139565b949350505050565b600080600080608085870312156101fc57600080fd5b61020585610107565b60208601519094506001600160401b0381111561022157600080fd5b61022d8782880161015d565b93505061023c60408601610107565b60608601519092506001600160401b0381111561025857600080fd5b6102648782880161015d565b91505092959194509250565b60008251610282818460208701610139565b9190910192915050565b60208152600082518060208401526102ab816040850160208701610139565b601f01601f1916919091016040019291505056fe";function getCallError(o,{docsPath:et,...tt}){const nt=(()=>{const rt=getNodeError(o,tt);return rt instanceof UnknownNodeError?o:rt})();return new CallExecutionError(nt,{docsPath:et,...tt})}function withResolvers(){let o=()=>{},et=()=>{};return{promise:new Promise((nt,rt)=>{o=nt,et=rt}),resolve:o,reject:et}}const schedulerCache=new Map;function createBatchScheduler({fn:o,id:et,shouldSplitBatch:tt,wait:nt=0,sort:rt}){const ot=async()=>{const lt=at();it();const dt=lt.map(({args:ht})=>ht);dt.length!==0&&o(dt).then(ht=>{rt&&Array.isArray(ht)&&ht.sort(rt);for(let pt=0;pt{for(let pt=0;ptschedulerCache.delete(et),st=()=>at().map(({args:lt})=>lt),at=()=>schedulerCache.get(et)||[],ct=lt=>schedulerCache.set(et,[...at(),lt]);return{flush:it,async schedule(lt){const{promise:dt,resolve:ht,reject:pt}=withResolvers();return(tt==null?void 0:tt([...st(),lt]))&&ot(),at().length>0?(ct({args:lt,resolve:ht,reject:pt}),dt):(ct({args:lt,resolve:ht,reject:pt}),setTimeout(ot,nt),dt)}}}async function call(o,et){var $t,Ot,Bt,zt;const{account:tt=o.account,batch:nt=!!(($t=o.batch)!=null&&$t.multicall),blockNumber:rt,blockTag:ot="latest",accessList:it,blobs:st,code:at,data:ct,factory:lt,factoryData:dt,gas:ht,gasPrice:pt,maxFeePerBlobGas:mt,maxFeePerGas:ft,maxPriorityFeePerGas:yt,nonce:gt,to:xt,value:vt,stateOverride:bt,...Et}=et,wt=tt?parseAccount(tt):void 0;if(at&&(lt||dt))throw new BaseError$3("Cannot provide both `code` & `factory`/`factoryData` as parameters.");if(at&&xt)throw new BaseError$3("Cannot provide both `code` & `to` as parameters.");const kt=at&&ct,Tt=lt&&dt&&xt&&ct,Rt=kt||Tt,Pt=kt?toDeploylessCallViaBytecodeData({code:at,data:ct}):Tt?toDeploylessCallViaFactoryData({data:ct,factory:lt,factoryData:dt,to:xt}):ct;try{assertRequest(et);const Yt=(rt?numberToHex(rt):void 0)||ot,Ht=serializeStateOverride(bt),Ut=(zt=(Bt=(Ot=o.chain)==null?void 0:Ot.formatters)==null?void 0:Bt.transactionRequest)==null?void 0:zt.format,Lt=(Ut||formatTransactionRequest)({...extract$1(Et,{format:Ut}),from:wt==null?void 0:wt.address,accessList:it,blobs:st,data:Pt,gas:ht,gasPrice:pt,maxFeePerBlobGas:mt,maxFeePerGas:ft,maxPriorityFeePerGas:yt,nonce:gt,to:Rt?void 0:xt,value:vt});if(nt&&shouldPerformMulticall({request:Lt})&&!Ht)try{return await scheduleMulticall(o,{...Lt,blockNumber:rt,blockTag:ot})}catch(Qt){if(!(Qt instanceof ClientChainNotConfiguredError)&&!(Qt instanceof ChainDoesNotSupportContract))throw Qt}const Zt=await o.request({method:"eth_call",params:Ht?[Lt,Yt,Ht]:[Lt,Yt]});return Zt==="0x"?{data:void 0}:{data:Zt}}catch(Ft){const Yt=getRevertErrorData(Ft),{offchainLookup:Ht,offchainLookupSignature:Ut}=await __vitePreload(async()=>{const{offchainLookup:qt,offchainLookupSignature:Lt}=await import("./ccip-DqOSmZ6J.js");return{offchainLookup:qt,offchainLookupSignature:Lt}},[]);if(o.ccipRead!==!1&&(Yt==null?void 0:Yt.slice(0,10))===Ut&&xt)return{data:await Ht(o,{data:Yt,to:xt})};throw Rt&&(Yt==null?void 0:Yt.slice(0,10))==="0x101bb98d"?new CounterfactualDeploymentFailedError({factory:lt}):getCallError(Ft,{...et,account:wt,chain:o.chain})}}function shouldPerformMulticall({request:o}){const{data:et,to:tt,...nt}=o;return!(!et||et.startsWith(aggregate3Signature)||!tt||Object.values(nt).filter(rt=>typeof rt<"u").length>0)}async function scheduleMulticall(o,et){var ft;const{batchSize:tt=1024,wait:nt=0}=typeof((ft=o.batch)==null?void 0:ft.multicall)=="object"?o.batch.multicall:{},{blockNumber:rt,blockTag:ot="latest",data:it,multicallAddress:st,to:at}=et;let ct=st;if(!ct){if(!o.chain)throw new ClientChainNotConfiguredError;ct=getChainContractAddress({blockNumber:rt,chain:o.chain,contract:"multicall3"})}const dt=(rt?numberToHex(rt):void 0)||ot,{schedule:ht}=createBatchScheduler({id:`${o.uid}.${dt}`,wait:nt,shouldSplitBatch(yt){return yt.reduce((xt,{data:vt})=>xt+(vt.length-2),0)>tt*2},fn:async yt=>{const gt=yt.map(bt=>({allowFailure:!0,callData:bt.data,target:bt.to})),xt=encodeFunctionData({abi:multicall3Abi,args:[gt],functionName:"aggregate3"}),vt=await o.request({method:"eth_call",params:[{data:xt,to:ct},dt]});return decodeFunctionResult({abi:multicall3Abi,args:[gt],functionName:"aggregate3",data:vt||"0x"})}}),[{returnData:pt,success:mt}]=await ht({data:it,to:at});if(!mt)throw new RawContractError({data:pt});return pt==="0x"?{data:void 0}:{data:pt}}function toDeploylessCallViaBytecodeData(o){const{code:et,data:tt}=o;return encodeDeployData({abi:parseAbi(["constructor(bytes, bytes)"]),bytecode:deploylessCallViaBytecodeBytecode,args:[et,tt]})}function toDeploylessCallViaFactoryData(o){const{data:et,factory:tt,factoryData:nt,to:rt}=o;return encodeDeployData({abi:parseAbi(["constructor(address, bytes, address, bytes)"]),bytecode:deploylessCallViaFactoryBytecode,args:[rt,et,tt,nt]})}function getRevertErrorData(o){var tt;if(!(o instanceof BaseError$3))return;const et=o.walk();return typeof(et==null?void 0:et.data)=="object"?(tt=et.data)==null?void 0:tt.data:et.data}async function readContract$1(o,et){const{abi:tt,address:nt,args:rt,functionName:ot,...it}=et,st=encodeFunctionData({abi:tt,args:rt,functionName:ot});try{const{data:at}=await getAction$1(o,call,"call")({...it,data:st,to:nt});return decodeFunctionResult({abi:tt,args:rt,functionName:ot,data:at||"0x"})}catch(at){throw getContractError(at,{abi:tt,address:nt,args:rt,docsPath:"/docs/contract/readContract",functionName:ot})}}async function getEnsAddress$1(o,{blockNumber:et,blockTag:tt,coinType:nt,name:rt,gatewayUrls:ot,strict:it,universalResolverAddress:st}){let at=st;if(!at){if(!o.chain)throw new Error("client chain not configured. universalResolverAddress is required.");at=getChainContractAddress({blockNumber:et,chain:o.chain,contract:"ensUniversalResolver"})}try{const ct=encodeFunctionData({abi:addressResolverAbi,functionName:"addr",...nt!=null?{args:[namehash(rt),BigInt(nt)]}:{args:[namehash(rt)]}}),lt={address:at,abi:universalResolverResolveAbi,functionName:"resolve",args:[toHex(packetToBytes(rt)),ct],blockNumber:et,blockTag:tt},dt=getAction$1(o,readContract$1,"readContract"),ht=ot?await dt({...lt,args:[...lt.args,ot]}):await dt(lt);if(ht[0]==="0x")return null;const pt=decodeFunctionResult({abi:addressResolverAbi,args:nt!=null?[namehash(rt),BigInt(nt)]:void 0,functionName:"addr",data:ht[0]});return pt==="0x"||trim$1(pt)==="0x00"?null:pt}catch(ct){if(it)throw ct;if(isNullUniversalResolverError(ct,"resolve"))return null;throw ct}}class EnsAvatarInvalidMetadataError extends BaseError$3{constructor({data:et}){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(et)}`],name:"EnsAvatarInvalidMetadataError"})}}class EnsAvatarInvalidNftUriError extends BaseError$3{constructor({reason:et}){super(`ENS NFT avatar URI is invalid. ${et}`,{name:"EnsAvatarInvalidNftUriError"})}}class EnsAvatarUriResolutionError extends BaseError$3{constructor({uri:et}){super(`Unable to resolve ENS avatar URI "${et}". The URI may be malformed, invalid, or does not respond with a valid image.`,{name:"EnsAvatarUriResolutionError"})}}class EnsAvatarUnsupportedNamespaceError extends BaseError$3{constructor({namespace:et}){super(`ENS NFT avatar namespace "${et}" is not supported. Must be "erc721" or "erc1155".`,{name:"EnsAvatarUnsupportedNamespaceError"})}}const networkRegex=/(?https?:\/\/[^\/]*|ipfs:\/|ipns:\/|ar:\/)?(?\/)?(?ipfs\/|ipns\/)?(?[\w\-.]+)(?\/.*)?/,ipfsHashRegex=/^(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,})(\/(?[\w\-.]+))?(?\/.*)?$/,base64Regex=/^data:([a-zA-Z\-/+]*);base64,([^"].*)/,dataURIRegex=/^data:([a-zA-Z\-/+]*)?(;[a-zA-Z0-9].*?)?(,)/;async function isImageUri(o){try{const et=await fetch(o,{method:"HEAD"});if(et.status===200){const tt=et.headers.get("content-type");return tt==null?void 0:tt.startsWith("image/")}return!1}catch(et){return typeof et=="object"&&typeof et.response<"u"||!globalThis.hasOwnProperty("Image")?!1:new Promise(tt=>{const nt=new Image;nt.onload=()=>{tt(!0)},nt.onerror=()=>{tt(!1)},nt.src=o})}}function getGateway(o,et){return o?o.endsWith("/")?o.slice(0,-1):o:et}function resolveAvatarUri({uri:o,gatewayUrls:et}){const tt=base64Regex.test(o);if(tt)return{uri:o,isOnChain:!0,isEncoded:tt};const nt=getGateway(et==null?void 0:et.ipfs,"https://ipfs.io"),rt=getGateway(et==null?void 0:et.arweave,"https://arweave.net"),ot=o.match(networkRegex),{protocol:it,subpath:st,target:at,subtarget:ct=""}=(ot==null?void 0:ot.groups)||{},lt=it==="ipns:/"||st==="ipns/",dt=it==="ipfs:/"||st==="ipfs/"||ipfsHashRegex.test(o);if(o.startsWith("http")&&!lt&&!dt){let pt=o;return et!=null&&et.arweave&&(pt=o.replace(/https:\/\/arweave.net/g,et==null?void 0:et.arweave)),{uri:pt,isOnChain:!1,isEncoded:!1}}if((lt||dt)&&at)return{uri:`${nt}/${lt?"ipns":"ipfs"}/${at}${ct}`,isOnChain:!1,isEncoded:!1};if(it==="ar:/"&&at)return{uri:`${rt}/${at}${ct||""}`,isOnChain:!1,isEncoded:!1};let ht=o.replace(dataURIRegex,"");if(ht.startsWith("rt.json());return await parseAvatarUri({gatewayUrls:o,uri:getJsonImage(tt)})}catch{throw new EnsAvatarUriResolutionError({uri:et})}}async function parseAvatarUri({gatewayUrls:o,uri:et}){const{uri:tt,isOnChain:nt}=resolveAvatarUri({uri:et,gatewayUrls:o});if(nt||await isImageUri(tt))return tt;throw new EnsAvatarUriResolutionError({uri:et})}function parseNftUri(o){let et=o;et.startsWith("did:nft:")&&(et=et.replace("did:nft:","").replace(/_/g,"/"));const[tt,nt,rt]=et.split("/"),[ot,it]=tt.split(":"),[st,at]=nt.split(":");if(!ot||ot.toLowerCase()!=="eip155")throw new EnsAvatarInvalidNftUriError({reason:"Only EIP-155 supported"});if(!it)throw new EnsAvatarInvalidNftUriError({reason:"Chain ID not found"});if(!at)throw new EnsAvatarInvalidNftUriError({reason:"Contract address not found"});if(!rt)throw new EnsAvatarInvalidNftUriError({reason:"Token ID not found"});if(!st)throw new EnsAvatarInvalidNftUriError({reason:"ERC namespace not found"});return{chainID:Number.parseInt(it),namespace:st.toLowerCase(),contractAddress:at,tokenID:rt}}async function getNftTokenUri(o,{nft:et}){if(et.namespace==="erc721")return readContract$1(o,{address:et.contractAddress,abi:[{name:"tokenURI",type:"function",stateMutability:"view",inputs:[{name:"tokenId",type:"uint256"}],outputs:[{name:"",type:"string"}]}],functionName:"tokenURI",args:[BigInt(et.tokenID)]});if(et.namespace==="erc1155")return readContract$1(o,{address:et.contractAddress,abi:[{name:"uri",type:"function",stateMutability:"view",inputs:[{name:"_id",type:"uint256"}],outputs:[{name:"",type:"string"}]}],functionName:"uri",args:[BigInt(et.tokenID)]});throw new EnsAvatarUnsupportedNamespaceError({namespace:et.namespace})}async function parseAvatarRecord(o,{gatewayUrls:et,record:tt}){return/eip155:/i.test(tt)?parseNftAvatarUri(o,{gatewayUrls:et,record:tt}):parseAvatarUri({uri:tt,gatewayUrls:et})}async function parseNftAvatarUri(o,{gatewayUrls:et,record:tt}){const nt=parseNftUri(tt),rt=await getNftTokenUri(o,{nft:nt}),{uri:ot,isOnChain:it,isEncoded:st}=resolveAvatarUri({uri:rt,gatewayUrls:et});if(it&&(ot.includes("data:application/json;base64,")||ot.startsWith("{"))){const ct=st?atob(ot.replace("data:application/json;base64,","")):ot,lt=JSON.parse(ct);return parseAvatarUri({uri:getJsonImage(lt),gatewayUrls:et})}let at=nt.tokenID;return nt.namespace==="erc1155"&&(at=at.replace("0x","").padStart(64,"0")),getMetadataAvatarUri({gatewayUrls:et,uri:ot.replace(/(?:0x)?{id}/,at)})}async function getEnsText(o,{blockNumber:et,blockTag:tt,name:nt,key:rt,gatewayUrls:ot,strict:it,universalResolverAddress:st}){let at=st;if(!at){if(!o.chain)throw new Error("client chain not configured. universalResolverAddress is required.");at=getChainContractAddress({blockNumber:et,chain:o.chain,contract:"ensUniversalResolver"})}try{const ct={address:at,abi:universalResolverResolveAbi,functionName:"resolve",args:[toHex(packetToBytes(nt)),encodeFunctionData({abi:textResolverAbi,functionName:"text",args:[namehash(nt),rt]})],blockNumber:et,blockTag:tt},lt=getAction$1(o,readContract$1,"readContract"),dt=ot?await lt({...ct,args:[...ct.args,ot]}):await lt(ct);if(dt[0]==="0x")return null;const ht=decodeFunctionResult({abi:textResolverAbi,functionName:"text",data:dt[0]});return ht===""?null:ht}catch(ct){if(it)throw ct;if(isNullUniversalResolverError(ct,"resolve"))return null;throw ct}}async function getEnsAvatar$1(o,{blockNumber:et,blockTag:tt,assetGatewayUrls:nt,name:rt,gatewayUrls:ot,strict:it,universalResolverAddress:st}){const at=await getAction$1(o,getEnsText,"getEnsText")({blockNumber:et,blockTag:tt,key:"avatar",name:rt,universalResolverAddress:st,gatewayUrls:ot,strict:it});if(!at)return null;try{return await parseAvatarRecord(o,{record:at,gatewayUrls:nt})}catch{return null}}async function getEnsName$1(o,{address:et,blockNumber:tt,blockTag:nt,gatewayUrls:rt,strict:ot,universalResolverAddress:it}){let st=it;if(!st){if(!o.chain)throw new Error("client chain not configured. universalResolverAddress is required.");st=getChainContractAddress({blockNumber:tt,chain:o.chain,contract:"ensUniversalResolver"})}const at=`${et.toLowerCase().substring(2)}.addr.reverse`;try{const ct={address:st,abi:universalResolverReverseAbi,functionName:"reverse",args:[toHex(packetToBytes(at))],blockNumber:tt,blockTag:nt},lt=getAction$1(o,readContract$1,"readContract"),[dt,ht]=rt?await lt({...ct,args:[...ct.args,rt]}):await lt(ct);return et.toLowerCase()!==ht.toLowerCase()?null:dt}catch(ct){if(ot)throw ct;if(isNullUniversalResolverError(ct,"reverse"))return null;throw ct}}const promiseCache$1=new Map,responseCache=new Map;function getCache(o){const et=(rt,ot)=>({clear:()=>ot.delete(rt),get:()=>ot.get(rt),set:it=>ot.set(rt,it)}),tt=et(o,promiseCache$1),nt=et(o,responseCache);return{clear:()=>{tt.clear(),nt.clear()},promise:tt,response:nt}}async function withCache(o,{cacheKey:et,cacheTime:tt=Number.POSITIVE_INFINITY}){const nt=getCache(et),rt=nt.response.get();if(rt&&tt>0&&new Date().getTime()-rt.created.getTime()`blockNumber.${o}`;async function getBlockNumber$1(o,{cacheTime:et=o.cacheTime}={}){const tt=await withCache(()=>o.request({method:"eth_blockNumber"}),{cacheKey:cacheKey(o.uid),cacheTime:et});return BigInt(tt)}function formatLog(o,{args:et,eventName:tt}={}){return{...o,blockHash:o.blockHash?o.blockHash:null,blockNumber:o.blockNumber?BigInt(o.blockNumber):null,logIndex:o.logIndex?Number(o.logIndex):null,transactionHash:o.transactionHash?o.transactionHash:null,transactionIndex:o.transactionIndex?Number(o.transactionIndex):null,...tt?{args:et,eventName:tt}:{}}}const receiptStatuses={"0x0":"reverted","0x1":"success"};function formatTransactionReceipt(o){const et={...o,blockNumber:o.blockNumber?BigInt(o.blockNumber):null,contractAddress:o.contractAddress?o.contractAddress:null,cumulativeGasUsed:o.cumulativeGasUsed?BigInt(o.cumulativeGasUsed):null,effectiveGasPrice:o.effectiveGasPrice?BigInt(o.effectiveGasPrice):null,gasUsed:o.gasUsed?BigInt(o.gasUsed):null,logs:o.logs?o.logs.map(tt=>formatLog(tt)):null,to:o.to?o.to:null,transactionIndex:o.transactionIndex?hexToNumber$2(o.transactionIndex):null,status:o.status?receiptStatuses[o.status]:null,type:o.type?transactionType[o.type]||o.type:null};return o.blobGasPrice&&(et.blobGasPrice=BigInt(o.blobGasPrice)),o.blobGasUsed&&(et.blobGasUsed=BigInt(o.blobGasUsed)),et}const defineTransactionReceipt=defineFormatter("transactionReceipt",formatTransactionReceipt);async function multicall$1(o,et){var yt;const{allowFailure:tt=!0,batchSize:nt,blockNumber:rt,blockTag:ot,multicallAddress:it,stateOverride:st}=et,at=et.contracts,ct=nt??(typeof((yt=o.batch)==null?void 0:yt.multicall)=="object"&&o.batch.multicall.batchSize||1024);let lt=it;if(!lt){if(!o.chain)throw new Error("client chain not configured. multicallAddress is required.");lt=getChainContractAddress({blockNumber:rt,chain:o.chain,contract:"multicall3"})}const dt=[[]];let ht=0,pt=0;for(let gt=0;gt0&&pt>ct&&dt[ht].length>0&&(ht++,pt=(wt.length-2)/2,dt[ht]=[]),dt[ht]=[...dt[ht],{allowFailure:!0,callData:wt,target:vt}]}catch(wt){const kt=getContractError(wt,{abi:xt,address:vt,args:bt,docsPath:"/docs/contract/multicall",functionName:Et});if(!tt)throw kt;dt[ht]=[...dt[ht],{allowFailure:!0,callData:"0x",target:vt}]}}const mt=await Promise.allSettled(dt.map(gt=>getAction$1(o,readContract$1,"readContract")({abi:multicall3Abi,address:lt,args:[gt],blockNumber:rt,blockTag:ot,functionName:"aggregate3",stateOverride:st}))),ft=[];for(let gt=0;gtlistenersCache.get(o)||[],ot=()=>{const lt=rt();listenersCache.set(o,lt.filter(dt=>dt.id!==nt))},it=()=>{const lt=cleanupCache.get(o);rt().length===1&<&<(),ot()},st=rt();if(listenersCache.set(o,[...st,{id:nt,fns:et}]),st&&st.length>0)return it;const at={};for(const lt in et)at[lt]=(...dt)=>{var pt,mt;const ht=rt();if(ht.length!==0)for(const ft of ht)(mt=(pt=ft.fns)[lt])==null||mt.call(pt,...dt)};const ct=tt(at);return typeof ct=="function"&&cleanupCache.set(o,ct),it}async function wait$1(o){return new Promise(et=>setTimeout(et,o))}function poll(o,{emitOnBegin:et,initialWaitTime:tt,interval:nt}){let rt=!0;const ot=()=>rt=!1;return(async()=>{let st;et&&(st=await o({unpoll:ot}));const at=await(tt==null?void 0:tt(st))??nt;await wait$1(at);const ct=async()=>{rt&&(await o({unpoll:ot}),await wait$1(nt),ct())};ct()})(),ot}function watchBlockNumber$1(o,{emitOnBegin:et=!1,emitMissed:tt=!1,onBlockNumber:nt,onError:rt,poll:ot,pollingInterval:it=o.pollingInterval}){const st=typeof ot<"u"?ot:!(o.transport.type==="webSocket"||o.transport.type==="fallback"&&o.transport.transports[0].config.type==="webSocket");let at;return st?(()=>{const dt=stringify$2(["watchBlockNumber",o.uid,et,tt,it]);return observe(dt,{onBlockNumber:nt,onError:rt},ht=>poll(async()=>{var pt;try{const mt=await getAction$1(o,getBlockNumber$1,"getBlockNumber")({cacheTime:0});if(at){if(mt===at)return;if(mt-at>1&&tt)for(let ft=at+1n;ftat)&&(ht.onBlockNumber(mt,at),at=mt)}catch(mt){(pt=ht.onError)==null||pt.call(ht,mt)}},{emitOnBegin:et,interval:it}))})():(()=>{const dt=stringify$2(["watchBlockNumber",o.uid,et,tt]);return observe(dt,{onBlockNumber:nt,onError:rt},ht=>{let pt=!0,mt=()=>pt=!1;return(async()=>{try{const ft=(()=>{if(o.transport.type==="fallback"){const gt=o.transport.transports.find(xt=>xt.config.type==="webSocket");return gt?gt.value:o.transport}return o.transport})(),{unsubscribe:yt}=await ft.subscribe({params:["newHeads"],onData(gt){var vt;if(!pt)return;const xt=hexToBigInt((vt=gt.result)==null?void 0:vt.number);ht.onBlockNumber(xt,at),at=xt},onError(gt){var xt;(xt=ht.onError)==null||xt.call(ht,gt)}});mt=yt,pt||mt()}catch(ft){rt==null||rt(ft)}})(),()=>mt()})})()}const promiseCache=new LruMap(8192);function withDedupe(o,{enabled:et=!0,id:tt}){if(!et||!tt)return o();if(promiseCache.get(tt))return promiseCache.get(tt);const nt=o().finally(()=>promiseCache.delete(tt));return promiseCache.set(tt,nt),nt}function withRetry(o,{delay:et=100,retryCount:tt=2,shouldRetry:nt=()=>!0}={}){return new Promise((rt,ot)=>{const it=async({count:st=0}={})=>{const at=async({error:ct})=>{const lt=typeof et=="function"?et({count:st,error:ct}):et;lt&&await wait$1(lt),it({count:st+1})};try{const ct=await o();rt(ct)}catch(ct){if(st{const{dedupe:rt=!1,retryDelay:ot=150,retryCount:it=3,uid:st}={...et,...nt},at=rt?keccak256$1(stringToHex(`${st}.${stringify$2(tt)}`)):void 0;return withDedupe(()=>withRetry(async()=>{try{return await o(tt)}catch(ct){const lt=ct;switch(lt.code){case ParseRpcError.code:throw new ParseRpcError(lt);case InvalidRequestRpcError.code:throw new InvalidRequestRpcError(lt);case MethodNotFoundRpcError.code:throw new MethodNotFoundRpcError(lt,{method:tt.method});case InvalidParamsRpcError.code:throw new InvalidParamsRpcError(lt);case InternalRpcError.code:throw new InternalRpcError(lt);case InvalidInputRpcError.code:throw new InvalidInputRpcError(lt);case ResourceNotFoundRpcError.code:throw new ResourceNotFoundRpcError(lt);case ResourceUnavailableRpcError.code:throw new ResourceUnavailableRpcError(lt);case TransactionRejectedRpcError.code:throw new TransactionRejectedRpcError(lt);case MethodNotSupportedRpcError.code:throw new MethodNotSupportedRpcError(lt,{method:tt.method});case LimitExceededRpcError.code:throw new LimitExceededRpcError(lt);case JsonRpcVersionUnsupportedError.code:throw new JsonRpcVersionUnsupportedError(lt);case UserRejectedRequestError.code:throw new UserRejectedRequestError(lt);case UnauthorizedProviderError.code:throw new UnauthorizedProviderError(lt);case UnsupportedProviderMethodError.code:throw new UnsupportedProviderMethodError(lt);case ProviderDisconnectedError.code:throw new ProviderDisconnectedError(lt);case ChainDisconnectedError.code:throw new ChainDisconnectedError(lt);case SwitchChainError.code:throw new SwitchChainError(lt);case 5e3:throw new UserRejectedRequestError(lt);default:throw ct instanceof BaseError$3?ct:new UnknownRpcError(lt)}}},{delay:({count:ct,error:lt})=>{var dt;if(lt&< instanceof HttpRequestError){const ht=(dt=lt==null?void 0:lt.headers)==null?void 0:dt.get("Retry-After");if(ht!=null&&ht.match(/\d/))return Number.parseInt(ht)*1e3}return~~(1<shouldRetry(ct)}),{enabled:rt,id:at})}}function shouldRetry(o){return"code"in o&&typeof o.code=="number"?o.code===-1||o.code===LimitExceededRpcError.code||o.code===InternalRpcError.code:o instanceof HttpRequestError&&o.status?o.status===403||o.status===408||o.status===413||o.status===429||o.status===500||o.status===502||o.status===503||o.status===504:!0}function defineChain(o){return{formatters:void 0,fees:void 0,serializers:void 0,...o}}function withTimeout(o,{errorInstance:et=new Error("timed out"),timeout:tt,signal:nt}){return new Promise((rt,ot)=>{(async()=>{let it;try{const st=new AbortController;tt>0&&(it=setTimeout(()=>{nt?st.abort():ot(et)},tt)),rt(await o({signal:(st==null?void 0:st.signal)||null}))}catch(st){(st==null?void 0:st.name)==="AbortError"&&ot(et),ot(st)}finally{clearTimeout(it)}})()})}function createIdStore(){return{current:0,take(){return this.current++},reset(){this.current=0}}}const idCache=createIdStore();function getHttpRpcClient(o,et={}){return{async request(tt){var dt;const{body:nt,onRequest:rt=et.onRequest,onResponse:ot=et.onResponse,timeout:it=et.timeout??1e4}=tt,st={...et.fetchOptions??{},...tt.fetchOptions??{}},{headers:at,method:ct,signal:lt}=st;try{const ht=await withTimeout(async({signal:mt})=>{const ft={...st,body:Array.isArray(nt)?stringify$2(nt.map(vt=>({jsonrpc:"2.0",id:vt.id??idCache.take(),...vt}))):stringify$2({jsonrpc:"2.0",id:nt.id??idCache.take(),...nt}),headers:{"Content-Type":"application/json",...at},method:ct||"POST",signal:lt||(it>0?mt:null)},yt=new Request(o,ft),gt=await(rt==null?void 0:rt(yt,ft))??{...ft,url:o};return await fetch(gt.url??o,gt)},{errorInstance:new TimeoutError$4({body:nt,url:o}),timeout:it,signal:!0});ot&&await ot(ht);let pt;if((dt=ht.headers.get("Content-Type"))!=null&&dt.startsWith("application/json"))pt=await ht.json();else{pt=await ht.text();try{pt=JSON.parse(pt||"{}")}catch(mt){if(ht.ok)throw mt;pt={error:pt}}}if(!ht.ok)throw new HttpRequestError({body:nt,details:stringify$2(pt.error)||ht.statusText,headers:ht.headers,status:ht.status,url:o});return pt}catch(ht){throw ht instanceof HttpRequestError||ht instanceof TimeoutError$4?ht:new HttpRequestError({body:nt,cause:ht,url:o})}}}}function assertTransactionEIP7702(o){const{authorizationList:et}=o;if(et)for(const tt of et){const{contractAddress:nt,chainId:rt}=tt;if(!isAddress(nt))throw new InvalidAddressError({address:nt});if(rt<0)throw new InvalidChainIdError({chainId:rt})}assertTransactionEIP1559(o)}function assertTransactionEIP4844(o){const{blobVersionedHashes:et}=o;if(et){if(et.length===0)throw new EmptyBlobError;for(const tt of et){const nt=size$2(tt),rt=hexToNumber$2(slice(tt,0,1));if(nt!==32)throw new InvalidVersionedHashSizeError({hash:tt,size:nt});if(rt!==versionedHashVersionKzg)throw new InvalidVersionedHashVersionError({hash:tt,version:rt})}}assertTransactionEIP1559(o)}function assertTransactionEIP1559(o){const{chainId:et,maxPriorityFeePerGas:tt,maxFeePerGas:nt,to:rt}=o;if(et<=0)throw new InvalidChainIdError({chainId:et});if(rt&&!isAddress(rt))throw new InvalidAddressError({address:rt});if(nt&&nt>maxUint256)throw new FeeCapTooHighError({maxFeePerGas:nt});if(tt&&nt&&tt>nt)throw new TipAboveFeeCapError({maxFeePerGas:nt,maxPriorityFeePerGas:tt})}function assertTransactionEIP2930(o){const{chainId:et,maxPriorityFeePerGas:tt,gasPrice:nt,maxFeePerGas:rt,to:ot}=o;if(et<=0)throw new InvalidChainIdError({chainId:et});if(ot&&!isAddress(ot))throw new InvalidAddressError({address:ot});if(tt||rt)throw new BaseError$3("`maxFeePerGas`/`maxPriorityFeePerGas` is not a valid EIP-2930 Transaction attribute.");if(nt&&nt>maxUint256)throw new FeeCapTooHighError({maxFeePerGas:nt})}function assertTransactionLegacy(o){const{chainId:et,maxPriorityFeePerGas:tt,gasPrice:nt,maxFeePerGas:rt,to:ot}=o;if(ot&&!isAddress(ot))throw new InvalidAddressError({address:ot});if(typeof et<"u"&&et<=0)throw new InvalidChainIdError({chainId:et});if(tt||rt)throw new BaseError$3("`maxFeePerGas`/`maxPriorityFeePerGas` is not a valid Legacy Transaction attribute.");if(nt&&nt>maxUint256)throw new FeeCapTooHighError({maxFeePerGas:nt})}function serializeAuthorizationList(o){if(!o||o.length===0)return[];const et=[];for(const tt of o){const{contractAddress:nt,chainId:rt,nonce:ot,...it}=tt;et.push([rt?toHex(rt):"0x",nt,ot?toHex(ot):"0x",...toYParitySignatureArray({},it)])}return et}function serializeAccessList(o){if(!o||o.length===0)return[];const et=[];for(let tt=0;tt"u"||typeof pt>"u")){const vt=typeof o.blobs[0]=="string"?o.blobs:o.blobs.map(wt=>bytesToHex$4(wt)),bt=o.kzg,Et=blobsToCommitments({blobs:vt,kzg:bt});if(typeof ht>"u"&&(ht=commitmentsToVersionedHashes({commitments:Et})),typeof pt>"u"){const wt=blobsToProofs({blobs:vt,commitments:Et,kzg:bt});pt=toBlobSidecars({blobs:vt,commitments:Et,proofs:wt})}}const mt=serializeAccessList(lt),ft=[toHex(tt),rt?toHex(rt):"0x",ct?toHex(ct):"0x",at?toHex(at):"0x",nt?toHex(nt):"0x",ot??"0x",it?toHex(it):"0x",dt??"0x",mt,st?toHex(st):"0x",ht??[],...toYParitySignatureArray(o,et)],yt=[],gt=[],xt=[];if(pt)for(let vt=0;vt{if(et.v>=35n)return(et.v-35n)/2n>0?et.v:27n+(et.v===35n?0n:1n);if(tt>0)return BigInt(tt*2)+BigInt(35n+et.v-27n);const pt=27n+(et.v===27n?0n:1n);if(et.v!==pt)throw new InvalidLegacyVError({v:et.v});return pt})(),dt=trim$1(et.r),ht=trim$1(et.s);ct=[...ct,toHex(lt),dt==="0x00"?"0x":dt,ht==="0x00"?"0x":ht]}else tt>0&&(ct=[...ct,toHex(tt),"0x","0x"]);return toRlp(ct)}function toYParitySignatureArray(o,et){const tt=et??o,{v:nt,yParity:rt}=tt;if(typeof tt.r>"u")return[];if(typeof tt.s>"u")return[];if(typeof nt>"u"&&typeof rt>"u")return[];const ot=trim$1(tt.r),it=trim$1(tt.s);return[typeof rt=="number"?rt?toHex(1):"0x":nt===0n?"0x":nt===1n?toHex(1):nt===27n?"0x":toHex(1),ot==="0x00"?"0x":ot,it==="0x00"?"0x":it]}async function signMessage$1(o,{account:et=o.account,message:tt}){if(!et)throw new AccountNotFoundError({docsPath:"/docs/actions/wallet/signMessage"});const nt=parseAccount(et);if(nt.signMessage)return nt.signMessage({message:tt});const rt=typeof tt=="string"?stringToHex(tt):tt.raw instanceof Uint8Array?toHex(tt.raw):tt.raw;return o.request({method:"personal_sign",params:[rt,nt.address]},{retryCount:0})}class HMAC extends Hash{constructor(et,tt){super(),this.finished=!1,this.destroyed=!1,hash$1(et);const nt=toBytes$2(tt);if(this.iHash=et.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const rt=this.blockLen,ot=new Uint8Array(rt);ot.set(nt.length>rt?et.create().update(nt).digest():nt);for(let it=0;itnew HMAC(o,et).update(tt).digest();hmac.create=(o,et)=>new HMAC(o,et);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const _0n$6=BigInt(0),_1n$8=BigInt(1),_2n$5=BigInt(2);function isBytes$2(o){return o instanceof Uint8Array||o!=null&&typeof o=="object"&&o.constructor.name==="Uint8Array"}function abytes(o){if(!isBytes$2(o))throw new Error("Uint8Array expected")}function abool(o,et){if(typeof et!="boolean")throw new Error(`${o} must be valid boolean, got "${et}".`)}const hexes$1=Array.from({length:256},(o,et)=>et.toString(16).padStart(2,"0"));function bytesToHex$2(o){abytes(o);let et="";for(let tt=0;tt=asciis._0&&o<=asciis._9)return o-asciis._0;if(o>=asciis._A&&o<=asciis._F)return o-(asciis._A-10);if(o>=asciis._a&&o<=asciis._f)return o-(asciis._a-10)}function hexToBytes$2(o){if(typeof o!="string")throw new Error("hex string expected, got "+typeof o);const et=o.length,tt=et/2;if(et%2)throw new Error("padded hex string expected, got unpadded hex of length "+et);const nt=new Uint8Array(tt);for(let rt=0,ot=0;rttypeof o=="bigint"&&_0n$6<=o;function inRange(o,et,tt){return isPosBig(o)&&isPosBig(et)&&isPosBig(tt)&&et<=o&&o_0n$6;o>>=_1n$8,et+=1);return et}function bitGet(o,et){return o>>BigInt(et)&_1n$8}function bitSet(o,et,tt){return o|(tt?_1n$8:_0n$6)<(_2n$5<new Uint8Array(o),u8fr=o=>Uint8Array.from(o);function createHmacDrbg(o,et,tt){if(typeof o!="number"||o<2)throw new Error("hashLen must be a number");if(typeof et!="number"||et<2)throw new Error("qByteLen must be a number");if(typeof tt!="function")throw new Error("hmacFn must be a function");let nt=u8n(o),rt=u8n(o),ot=0;const it=()=>{nt.fill(1),rt.fill(0),ot=0},st=(...dt)=>tt(rt,nt,...dt),at=(dt=u8n())=>{rt=st(u8fr([0]),dt),nt=st(),dt.length!==0&&(rt=st(u8fr([1]),dt),nt=st())},ct=()=>{if(ot++>=1e3)throw new Error("drbg: tried 1000 values");let dt=0;const ht=[];for(;dt{it(),at(dt);let pt;for(;!(pt=ht(ct()));)at();return it(),pt}}const validatorFns={bigint:o=>typeof o=="bigint",function:o=>typeof o=="function",boolean:o=>typeof o=="boolean",string:o=>typeof o=="string",stringOrUint8Array:o=>typeof o=="string"||isBytes$2(o),isSafeInteger:o=>Number.isSafeInteger(o),array:o=>Array.isArray(o),field:(o,et)=>et.Fp.isValid(o),hash:o=>typeof o=="function"&&Number.isSafeInteger(o.outputLen)};function validateObject(o,et,tt={}){const nt=(rt,ot,it)=>{const st=validatorFns[ot];if(typeof st!="function")throw new Error(`Invalid validator "${ot}", expected function`);const at=o[rt];if(!(it&&at===void 0)&&!st(at,o))throw new Error(`Invalid param ${String(rt)}=${at} (${typeof at}), expected ${ot}`)};for(const[rt,ot]of Object.entries(et))nt(rt,ot,!1);for(const[rt,ot]of Object.entries(tt))nt(rt,ot,!0);return o}const notImplemented=()=>{throw new Error("not implemented")};function memoized(o){const et=new WeakMap;return(tt,...nt)=>{const rt=et.get(tt);if(rt!==void 0)return rt;const ot=o(tt,...nt);return et.set(tt,ot),ot}}const ut=Object.freeze(Object.defineProperty({__proto__:null,aInRange,abool,abytes,bitGet,bitLen,bitMask,bitSet,bytesToHex:bytesToHex$2,bytesToNumberBE,bytesToNumberLE,concatBytes:concatBytes$1,createHmacDrbg,ensureBytes:ensureBytes$1,equalBytes:equalBytes$1,hexToBytes:hexToBytes$2,hexToNumber:hexToNumber$1,inRange,isBytes:isBytes$2,memoized,notImplemented,numberToBytesBE,numberToBytesLE,numberToHexUnpadded:numberToHexUnpadded$1,numberToVarBytesBE,utf8ToBytes:utf8ToBytes$2,validateObject},Symbol.toStringTag,{value:"Module"}));/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const _0n$5=BigInt(0),_1n$7=BigInt(1),_2n$4=BigInt(2),_3n$3=BigInt(3),_4n=BigInt(4),_5n$1=BigInt(5),_8n$3=BigInt(8);BigInt(9);BigInt(16);function mod$1(o,et){const tt=o%et;return tt>=_0n$5?tt:et+tt}function pow(o,et,tt){if(tt<=_0n$5||et<_0n$5)throw new Error("Expected power/modulo > 0");if(tt===_1n$7)return _0n$5;let nt=_1n$7;for(;et>_0n$5;)et&_1n$7&&(nt=nt*o%tt),o=o*o%tt,et>>=_1n$7;return nt}function pow2$1(o,et,tt){let nt=o;for(;et-- >_0n$5;)nt*=nt,nt%=tt;return nt}function invert$1(o,et){if(o===_0n$5||et<=_0n$5)throw new Error(`invert: expected positive integers, got n=${o} mod=${et}`);let tt=mod$1(o,et),nt=et,rt=_0n$5,ot=_1n$7;for(;tt!==_0n$5;){const st=nt/tt,at=nt%tt,ct=rt-ot*st;nt=tt,tt=at,rt=ot,ot=ct}if(nt!==_1n$7)throw new Error("invert: does not exist");return mod$1(rt,et)}function tonelliShanks(o){const et=(o-_1n$7)/_2n$4;let tt,nt,rt;for(tt=o-_1n$7,nt=0;tt%_2n$4===_0n$5;tt/=_2n$4,nt++);for(rt=_2n$4;rt(mod$1(o,et)&_1n$7)===_1n$7,FIELD_FIELDS=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function validateField(o){const et={ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"},tt=FIELD_FIELDS.reduce((nt,rt)=>(nt[rt]="function",nt),et);return validateObject(o,tt)}function FpPow(o,et,tt){if(tt<_0n$5)throw new Error("Expected power > 0");if(tt===_0n$5)return o.ONE;if(tt===_1n$7)return et;let nt=o.ONE,rt=et;for(;tt>_0n$5;)tt&_1n$7&&(nt=o.mul(nt,rt)),rt=o.sqr(rt),tt>>=_1n$7;return nt}function FpInvertBatch(o,et){const tt=new Array(et.length),nt=et.reduce((ot,it,st)=>o.is0(it)?ot:(tt[st]=ot,o.mul(ot,it)),o.ONE),rt=o.inv(nt);return et.reduceRight((ot,it,st)=>o.is0(it)?ot:(tt[st]=o.mul(ot,tt[st]),o.mul(ot,it)),rt),tt}function nLength(o,et){const tt=et!==void 0?et:o.toString(2).length,nt=Math.ceil(tt/8);return{nBitLength:tt,nByteLength:nt}}function Field$1(o,et,tt=!1,nt={}){if(o<=_0n$5)throw new Error(`Expected Field ORDER > 0, got ${o}`);const{nBitLength:rt,nByteLength:ot}=nLength(o,et);if(ot>2048)throw new Error("Field lengths over 2048 bytes are not supported");const it=FpSqrt(o),st=Object.freeze({ORDER:o,BITS:rt,BYTES:ot,MASK:bitMask(rt),ZERO:_0n$5,ONE:_1n$7,create:at=>mod$1(at,o),isValid:at=>{if(typeof at!="bigint")throw new Error(`Invalid field element: expected bigint, got ${typeof at}`);return _0n$5<=at&&atat===_0n$5,isOdd:at=>(at&_1n$7)===_1n$7,neg:at=>mod$1(-at,o),eql:(at,ct)=>at===ct,sqr:at=>mod$1(at*at,o),add:(at,ct)=>mod$1(at+ct,o),sub:(at,ct)=>mod$1(at-ct,o),mul:(at,ct)=>mod$1(at*ct,o),pow:(at,ct)=>FpPow(st,at,ct),div:(at,ct)=>mod$1(at*invert$1(ct,o),o),sqrN:at=>at*at,addN:(at,ct)=>at+ct,subN:(at,ct)=>at-ct,mulN:(at,ct)=>at*ct,inv:at=>invert$1(at,o),sqrt:nt.sqrt||(at=>it(st,at)),invertBatch:at=>FpInvertBatch(st,at),cmov:(at,ct,lt)=>lt?ct:at,toBytes:at=>tt?numberToBytesLE(at,ot):numberToBytesBE(at,ot),fromBytes:at=>{if(at.length!==ot)throw new Error(`Fp.fromBytes: expected ${ot}, got ${at.length}`);return tt?bytesToNumberLE(at):bytesToNumberBE(at)}});return Object.freeze(st)}function getFieldBytesLength(o){if(typeof o!="bigint")throw new Error("field order must be bigint");const et=o.toString(2).length;return Math.ceil(et/8)}function getMinHashLength(o){const et=getFieldBytesLength(o);return et+Math.ceil(et/2)}function mapHashToField(o,et,tt=!1){const nt=o.length,rt=getFieldBytesLength(et),ot=getMinHashLength(et);if(nt<16||nt1024)throw new Error(`expected ${ot}-1024 bytes of input, got ${nt}`);const it=tt?bytesToNumberBE(o):bytesToNumberLE(o),st=mod$1(it,et-_1n$7)+_1n$7;return tt?numberToBytesLE(st,rt):numberToBytesBE(st,rt)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const _0n$4=BigInt(0),_1n$6=BigInt(1),pointPrecomputes$1=new WeakMap,pointWindowSizes=new WeakMap;function wNAF(o,et){const tt=(ot,it)=>{const st=it.negate();return ot?st:it},nt=ot=>{if(!Number.isSafeInteger(ot)||ot<=0||ot>et)throw new Error(`Wrong window size=${ot}, should be [1..${et}]`)},rt=ot=>{nt(ot);const it=Math.ceil(et/ot)+1,st=2**(ot-1);return{windows:it,windowSize:st}};return{constTimeNegate:tt,unsafeLadder(ot,it){let st=o.ZERO,at=ot;for(;it>_0n$4;)it&_1n$6&&(st=st.add(at)),at=at.double(),it>>=_1n$6;return st},precomputeWindow(ot,it){const{windows:st,windowSize:at}=rt(it),ct=[];let lt=ot,dt=lt;for(let ht=0;ht>=mt,gt>ct&&(gt-=pt,st+=_1n$6);const xt=yt,vt=yt+Math.abs(gt)-1,bt=ft%2!==0,Et=gt<0;gt===0?dt=dt.add(tt(bt,it[xt])):lt=lt.add(tt(Et,it[vt]))}return{p:lt,f:dt}},wNAFCached(ot,it,st){const at=pointWindowSizes.get(ot)||1;let ct=pointPrecomputes$1.get(ot);return ct||(ct=this.precomputeWindow(ot,at),at!==1&&pointPrecomputes$1.set(ot,st(ct))),this.wNAF(at,ct,it)},setWindowSize(ot,it){nt(it),pointWindowSizes.set(ot,it),pointPrecomputes$1.delete(ot)}}}function pippenger(o,et,tt,nt){if(!Array.isArray(tt)||!Array.isArray(nt)||nt.length!==tt.length)throw new Error("arrays of points and scalars must have equal length");nt.forEach((lt,dt)=>{if(!et.isValid(lt))throw new Error(`wrong scalar at index ${dt}`)}),tt.forEach((lt,dt)=>{if(!(lt instanceof o))throw new Error(`wrong point at index ${dt}`)});const rt=bitLen(BigInt(tt.length)),ot=rt>12?rt-3:rt>4?rt-2:rt?2:1,it=(1<=0;lt-=ot){st.fill(o.ZERO);for(let ht=0;ht>BigInt(lt)&BigInt(it));st[mt]=st[mt].add(tt[ht])}let dt=o.ZERO;for(let ht=st.length-1,pt=o.ZERO;ht>0;ht--)pt=pt.add(st[ht]),dt=dt.add(pt);if(ct=ct.add(dt),lt!==0)for(let ht=0;ht{const{Err:tt}=DER;if(o<0||o>256)throw new tt("tlv.encode: wrong tag");if(et.length&1)throw new tt("tlv.encode: unpadded data");const nt=et.length/2,rt=numberToHexUnpadded$1(nt);if(rt.length/2&128)throw new tt("tlv.encode: long form length too big");const ot=nt>127?numberToHexUnpadded$1(rt.length/2|128):"";return`${numberToHexUnpadded$1(o)}${ot}${rt}${et}`},decode(o,et){const{Err:tt}=DER;let nt=0;if(o<0||o>256)throw new tt("tlv.encode: wrong tag");if(et.length<2||et[nt++]!==o)throw new tt("tlv.decode: wrong tlv");const rt=et[nt++],ot=!!(rt&128);let it=0;if(!ot)it=rt;else{const at=rt&127;if(!at)throw new tt("tlv.decode(long): indefinite length not supported");if(at>4)throw new tt("tlv.decode(long): byte length is too big");const ct=et.subarray(nt,nt+at);if(ct.length!==at)throw new tt("tlv.decode: length bytes not complete");if(ct[0]===0)throw new tt("tlv.decode(long): zero leftmost byte");for(const lt of ct)it=it<<8|lt;if(nt+=at,it<128)throw new tt("tlv.decode(long): not minimal encoding")}const st=et.subarray(nt,nt+it);if(st.length!==it)throw new tt("tlv.decode: wrong value length");return{v:st,l:et.subarray(nt+it)}}},_int:{encode(o){const{Err:et}=DER;if(o<_0n$3)throw new et("integer: negative integers are not allowed");let tt=numberToHexUnpadded$1(o);if(Number.parseInt(tt[0],16)&8&&(tt="00"+tt),tt.length&1)throw new et("unexpected assertion");return tt},decode(o){const{Err:et}=DER;if(o[0]&128)throw new et("Invalid signature integer: negative");if(o[0]===0&&!(o[1]&128))throw new et("Invalid signature integer: unnecessary leading zero");return b2n(o)}},toSig(o){const{Err:et,_int:tt,_tlv:nt}=DER,rt=typeof o=="string"?h2b(o):o;abytes(rt);const{v:ot,l:it}=nt.decode(48,rt);if(it.length)throw new et("Invalid signature: left bytes after parsing");const{v:st,l:at}=nt.decode(2,ot),{v:ct,l:lt}=nt.decode(2,at);if(lt.length)throw new et("Invalid signature: left bytes after parsing");return{r:tt.decode(st),s:tt.decode(ct)}},hexFromSig(o){const{_tlv:et,_int:tt}=DER,nt=`${et.encode(2,tt.encode(o.r))}${et.encode(2,tt.encode(o.s))}`;return et.encode(48,nt)}},_0n$3=BigInt(0),_1n$5=BigInt(1);BigInt(2);const _3n$2=BigInt(3);BigInt(4);function weierstrassPoints(o){const et=validatePointOpts(o),{Fp:tt}=et,nt=Field$1(et.n,et.nBitLength),rt=et.toBytes||((ft,yt,gt)=>{const xt=yt.toAffine();return concatBytes$1(Uint8Array.from([4]),tt.toBytes(xt.x),tt.toBytes(xt.y))}),ot=et.fromBytes||(ft=>{const yt=ft.subarray(1),gt=tt.fromBytes(yt.subarray(0,tt.BYTES)),xt=tt.fromBytes(yt.subarray(tt.BYTES,2*tt.BYTES));return{x:gt,y:xt}});function it(ft){const{a:yt,b:gt}=et,xt=tt.sqr(ft),vt=tt.mul(xt,ft);return tt.add(tt.add(vt,tt.mul(ft,yt)),gt)}if(!tt.eql(tt.sqr(et.Gy),it(et.Gx)))throw new Error("bad generator point: equation left != right");function st(ft){return inRange(ft,_1n$5,et.n)}function at(ft){const{allowedPrivateKeyLengths:yt,nByteLength:gt,wrapPrivateKey:xt,n:vt}=et;if(yt&&typeof ft!="bigint"){if(isBytes$2(ft)&&(ft=bytesToHex$2(ft)),typeof ft!="string"||!yt.includes(ft.length))throw new Error("Invalid key");ft=ft.padStart(gt*2,"0")}let bt;try{bt=typeof ft=="bigint"?ft:bytesToNumberBE(ensureBytes$1("private key",ft,gt))}catch{throw new Error(`private key must be ${gt} bytes, hex or bigint, not ${typeof ft}`)}return xt&&(bt=mod$1(bt,vt)),aInRange("private key",bt,_1n$5,vt),bt}function ct(ft){if(!(ft instanceof ht))throw new Error("ProjectivePoint expected")}const lt=memoized((ft,yt)=>{const{px:gt,py:xt,pz:vt}=ft;if(tt.eql(vt,tt.ONE))return{x:gt,y:xt};const bt=ft.is0();yt==null&&(yt=bt?tt.ONE:tt.inv(vt));const Et=tt.mul(gt,yt),wt=tt.mul(xt,yt),kt=tt.mul(vt,yt);if(bt)return{x:tt.ZERO,y:tt.ZERO};if(!tt.eql(kt,tt.ONE))throw new Error("invZ was invalid");return{x:Et,y:wt}}),dt=memoized(ft=>{if(ft.is0()){if(et.allowInfinityPoint&&!tt.is0(ft.py))return;throw new Error("bad point: ZERO")}const{x:yt,y:gt}=ft.toAffine();if(!tt.isValid(yt)||!tt.isValid(gt))throw new Error("bad point: x or y not FE");const xt=tt.sqr(gt),vt=it(yt);if(!tt.eql(xt,vt))throw new Error("bad point: equation left != right");if(!ft.isTorsionFree())throw new Error("bad point: not in prime-order subgroup");return!0});class ht{constructor(yt,gt,xt){if(this.px=yt,this.py=gt,this.pz=xt,yt==null||!tt.isValid(yt))throw new Error("x required");if(gt==null||!tt.isValid(gt))throw new Error("y required");if(xt==null||!tt.isValid(xt))throw new Error("z required");Object.freeze(this)}static fromAffine(yt){const{x:gt,y:xt}=yt||{};if(!yt||!tt.isValid(gt)||!tt.isValid(xt))throw new Error("invalid affine point");if(yt instanceof ht)throw new Error("projective point not allowed");const vt=bt=>tt.eql(bt,tt.ZERO);return vt(gt)&&vt(xt)?ht.ZERO:new ht(gt,xt,tt.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(yt){const gt=tt.invertBatch(yt.map(xt=>xt.pz));return yt.map((xt,vt)=>xt.toAffine(gt[vt])).map(ht.fromAffine)}static fromHex(yt){const gt=ht.fromAffine(ot(ensureBytes$1("pointHex",yt)));return gt.assertValidity(),gt}static fromPrivateKey(yt){return ht.BASE.multiply(at(yt))}static msm(yt,gt){return pippenger(ht,nt,yt,gt)}_setWindowSize(yt){mt.setWindowSize(this,yt)}assertValidity(){dt(this)}hasEvenY(){const{y:yt}=this.toAffine();if(tt.isOdd)return!tt.isOdd(yt);throw new Error("Field doesn't support isOdd")}equals(yt){ct(yt);const{px:gt,py:xt,pz:vt}=this,{px:bt,py:Et,pz:wt}=yt,kt=tt.eql(tt.mul(gt,wt),tt.mul(bt,vt)),Tt=tt.eql(tt.mul(xt,wt),tt.mul(Et,vt));return kt&&Tt}negate(){return new ht(this.px,tt.neg(this.py),this.pz)}double(){const{a:yt,b:gt}=et,xt=tt.mul(gt,_3n$2),{px:vt,py:bt,pz:Et}=this;let wt=tt.ZERO,kt=tt.ZERO,Tt=tt.ZERO,Rt=tt.mul(vt,vt),Pt=tt.mul(bt,bt),$t=tt.mul(Et,Et),Ot=tt.mul(vt,bt);return Ot=tt.add(Ot,Ot),Tt=tt.mul(vt,Et),Tt=tt.add(Tt,Tt),wt=tt.mul(yt,Tt),kt=tt.mul(xt,$t),kt=tt.add(wt,kt),wt=tt.sub(Pt,kt),kt=tt.add(Pt,kt),kt=tt.mul(wt,kt),wt=tt.mul(Ot,wt),Tt=tt.mul(xt,Tt),$t=tt.mul(yt,$t),Ot=tt.sub(Rt,$t),Ot=tt.mul(yt,Ot),Ot=tt.add(Ot,Tt),Tt=tt.add(Rt,Rt),Rt=tt.add(Tt,Rt),Rt=tt.add(Rt,$t),Rt=tt.mul(Rt,Ot),kt=tt.add(kt,Rt),$t=tt.mul(bt,Et),$t=tt.add($t,$t),Rt=tt.mul($t,Ot),wt=tt.sub(wt,Rt),Tt=tt.mul($t,Pt),Tt=tt.add(Tt,Tt),Tt=tt.add(Tt,Tt),new ht(wt,kt,Tt)}add(yt){ct(yt);const{px:gt,py:xt,pz:vt}=this,{px:bt,py:Et,pz:wt}=yt;let kt=tt.ZERO,Tt=tt.ZERO,Rt=tt.ZERO;const Pt=et.a,$t=tt.mul(et.b,_3n$2);let Ot=tt.mul(gt,bt),Bt=tt.mul(xt,Et),zt=tt.mul(vt,wt),Ft=tt.add(gt,xt),Yt=tt.add(bt,Et);Ft=tt.mul(Ft,Yt),Yt=tt.add(Ot,Bt),Ft=tt.sub(Ft,Yt),Yt=tt.add(gt,vt);let Ht=tt.add(bt,wt);return Yt=tt.mul(Yt,Ht),Ht=tt.add(Ot,zt),Yt=tt.sub(Yt,Ht),Ht=tt.add(xt,vt),kt=tt.add(Et,wt),Ht=tt.mul(Ht,kt),kt=tt.add(Bt,zt),Ht=tt.sub(Ht,kt),Rt=tt.mul(Pt,Yt),kt=tt.mul($t,zt),Rt=tt.add(kt,Rt),kt=tt.sub(Bt,Rt),Rt=tt.add(Bt,Rt),Tt=tt.mul(kt,Rt),Bt=tt.add(Ot,Ot),Bt=tt.add(Bt,Ot),zt=tt.mul(Pt,zt),Yt=tt.mul($t,Yt),Bt=tt.add(Bt,zt),zt=tt.sub(Ot,zt),zt=tt.mul(Pt,zt),Yt=tt.add(Yt,zt),Ot=tt.mul(Bt,Yt),Tt=tt.add(Tt,Ot),Ot=tt.mul(Ht,Yt),kt=tt.mul(Ft,kt),kt=tt.sub(kt,Ot),Ot=tt.mul(Ft,Bt),Rt=tt.mul(Ht,Rt),Rt=tt.add(Rt,Ot),new ht(kt,Tt,Rt)}subtract(yt){return this.add(yt.negate())}is0(){return this.equals(ht.ZERO)}wNAF(yt){return mt.wNAFCached(this,yt,ht.normalizeZ)}multiplyUnsafe(yt){aInRange("scalar",yt,_0n$3,et.n);const gt=ht.ZERO;if(yt===_0n$3)return gt;if(yt===_1n$5)return this;const{endo:xt}=et;if(!xt)return mt.unsafeLadder(this,yt);let{k1neg:vt,k1:bt,k2neg:Et,k2:wt}=xt.splitScalar(yt),kt=gt,Tt=gt,Rt=this;for(;bt>_0n$3||wt>_0n$3;)bt&_1n$5&&(kt=kt.add(Rt)),wt&_1n$5&&(Tt=Tt.add(Rt)),Rt=Rt.double(),bt>>=_1n$5,wt>>=_1n$5;return vt&&(kt=kt.negate()),Et&&(Tt=Tt.negate()),Tt=new ht(tt.mul(Tt.px,xt.beta),Tt.py,Tt.pz),kt.add(Tt)}multiply(yt){const{endo:gt,n:xt}=et;aInRange("scalar",yt,_1n$5,xt);let vt,bt;if(gt){const{k1neg:Et,k1:wt,k2neg:kt,k2:Tt}=gt.splitScalar(yt);let{p:Rt,f:Pt}=this.wNAF(wt),{p:$t,f:Ot}=this.wNAF(Tt);Rt=mt.constTimeNegate(Et,Rt),$t=mt.constTimeNegate(kt,$t),$t=new ht(tt.mul($t.px,gt.beta),$t.py,$t.pz),vt=Rt.add($t),bt=Pt.add(Ot)}else{const{p:Et,f:wt}=this.wNAF(yt);vt=Et,bt=wt}return ht.normalizeZ([vt,bt])[0]}multiplyAndAddUnsafe(yt,gt,xt){const vt=ht.BASE,bt=(wt,kt)=>kt===_0n$3||kt===_1n$5||!wt.equals(vt)?wt.multiplyUnsafe(kt):wt.multiply(kt),Et=bt(this,gt).add(bt(yt,xt));return Et.is0()?void 0:Et}toAffine(yt){return lt(this,yt)}isTorsionFree(){const{h:yt,isTorsionFree:gt}=et;if(yt===_1n$5)return!0;if(gt)return gt(ht,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:yt,clearCofactor:gt}=et;return yt===_1n$5?this:gt?gt(ht,this):this.multiplyUnsafe(et.h)}toRawBytes(yt=!0){return abool("isCompressed",yt),this.assertValidity(),rt(ht,this,yt)}toHex(yt=!0){return abool("isCompressed",yt),bytesToHex$2(this.toRawBytes(yt))}}ht.BASE=new ht(et.Gx,et.Gy,tt.ONE),ht.ZERO=new ht(tt.ZERO,tt.ONE,tt.ZERO);const pt=et.nBitLength,mt=wNAF(ht,et.endo?Math.ceil(pt/2):pt);return{CURVE:et,ProjectivePoint:ht,normPrivateKeyToScalar:at,weierstrassEquation:it,isWithinCurveOrder:st}}function validateOpts$2(o){const et=validateBasic(o);return validateObject(et,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...et})}function weierstrass$1(o){const et=validateOpts$2(o),{Fp:tt,n:nt}=et,rt=tt.BYTES+1,ot=2*tt.BYTES+1;function it(zt){return mod$1(zt,nt)}function st(zt){return invert$1(zt,nt)}const{ProjectivePoint:at,normPrivateKeyToScalar:ct,weierstrassEquation:lt,isWithinCurveOrder:dt}=weierstrassPoints({...et,toBytes(zt,Ft,Yt){const Ht=Ft.toAffine(),Ut=tt.toBytes(Ht.x),qt=concatBytes$1;return abool("isCompressed",Yt),Yt?qt(Uint8Array.from([Ft.hasEvenY()?2:3]),Ut):qt(Uint8Array.from([4]),Ut,tt.toBytes(Ht.y))},fromBytes(zt){const Ft=zt.length,Yt=zt[0],Ht=zt.subarray(1);if(Ft===rt&&(Yt===2||Yt===3)){const Ut=bytesToNumberBE(Ht);if(!inRange(Ut,_1n$5,tt.ORDER))throw new Error("Point is not on curve");const qt=lt(Ut);let Lt;try{Lt=tt.sqrt(qt)}catch(Nt){const Gt=Nt instanceof Error?": "+Nt.message:"";throw new Error("Point is not on curve"+Gt)}const Zt=(Lt&_1n$5)===_1n$5;return(Yt&1)===1!==Zt&&(Lt=tt.neg(Lt)),{x:Ut,y:Lt}}else if(Ft===ot&&Yt===4){const Ut=tt.fromBytes(Ht.subarray(0,tt.BYTES)),qt=tt.fromBytes(Ht.subarray(tt.BYTES,2*tt.BYTES));return{x:Ut,y:qt}}else throw new Error(`Point of length ${Ft} was invalid. Expected ${rt} compressed bytes or ${ot} uncompressed bytes`)}}),ht=zt=>bytesToHex$2(numberToBytesBE(zt,et.nByteLength));function pt(zt){const Ft=nt>>_1n$5;return zt>Ft}function mt(zt){return pt(zt)?it(-zt):zt}const ft=(zt,Ft,Yt)=>bytesToNumberBE(zt.slice(Ft,Yt));class yt{constructor(Ft,Yt,Ht){this.r=Ft,this.s=Yt,this.recovery=Ht,this.assertValidity()}static fromCompact(Ft){const Yt=et.nByteLength;return Ft=ensureBytes$1("compactSignature",Ft,Yt*2),new yt(ft(Ft,0,Yt),ft(Ft,Yt,2*Yt))}static fromDER(Ft){const{r:Yt,s:Ht}=DER.toSig(ensureBytes$1("DER",Ft));return new yt(Yt,Ht)}assertValidity(){aInRange("r",this.r,_1n$5,nt),aInRange("s",this.s,_1n$5,nt)}addRecoveryBit(Ft){return new yt(this.r,this.s,Ft)}recoverPublicKey(Ft){const{r:Yt,s:Ht,recovery:Ut}=this,qt=wt(ensureBytes$1("msgHash",Ft));if(Ut==null||![0,1,2,3].includes(Ut))throw new Error("recovery id invalid");const Lt=Ut===2||Ut===3?Yt+et.n:Yt;if(Lt>=tt.ORDER)throw new Error("recovery id 2 or 3 invalid");const Zt=Ut&1?"03":"02",Qt=at.fromHex(Zt+ht(Lt)),Nt=st(Lt),Gt=it(-qt*Nt),nn=it(Ht*Nt),Wt=at.BASE.multiplyAndAddUnsafe(Qt,Gt,nn);if(!Wt)throw new Error("point at infinify");return Wt.assertValidity(),Wt}hasHighS(){return pt(this.s)}normalizeS(){return this.hasHighS()?new yt(this.r,it(-this.s),this.recovery):this}toDERRawBytes(){return hexToBytes$2(this.toDERHex())}toDERHex(){return DER.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return hexToBytes$2(this.toCompactHex())}toCompactHex(){return ht(this.r)+ht(this.s)}}const gt={isValidPrivateKey(zt){try{return ct(zt),!0}catch{return!1}},normPrivateKeyToScalar:ct,randomPrivateKey:()=>{const zt=getMinHashLength(et.n);return mapHashToField(et.randomBytes(zt),et.n)},precompute(zt=8,Ft=at.BASE){return Ft._setWindowSize(zt),Ft.multiply(BigInt(3)),Ft}};function xt(zt,Ft=!0){return at.fromPrivateKey(zt).toRawBytes(Ft)}function vt(zt){const Ft=isBytes$2(zt),Yt=typeof zt=="string",Ht=(Ft||Yt)&&zt.length;return Ft?Ht===rt||Ht===ot:Yt?Ht===2*rt||Ht===2*ot:zt instanceof at}function bt(zt,Ft,Yt=!0){if(vt(zt))throw new Error("first arg must be private key");if(!vt(Ft))throw new Error("second arg must be public key");return at.fromHex(Ft).multiply(ct(zt)).toRawBytes(Yt)}const Et=et.bits2int||function(zt){const Ft=bytesToNumberBE(zt),Yt=zt.length*8-et.nBitLength;return Yt>0?Ft>>BigInt(Yt):Ft},wt=et.bits2int_modN||function(zt){return it(Et(zt))},kt=bitMask(et.nBitLength);function Tt(zt){return aInRange(`num < 2^${et.nBitLength}`,zt,_0n$3,kt),numberToBytesBE(zt,et.nByteLength)}function Rt(zt,Ft,Yt=Pt){if(["recovered","canonical"].some(Xt=>Xt in Yt))throw new Error("sign() legacy options not supported");const{hash:Ht,randomBytes:Ut}=et;let{lowS:qt,prehash:Lt,extraEntropy:Zt}=Yt;qt==null&&(qt=!0),zt=ensureBytes$1("msgHash",zt),validateSigVerOpts(Yt),Lt&&(zt=ensureBytes$1("prehashed msgHash",Ht(zt)));const Qt=wt(zt),Nt=ct(Ft),Gt=[Tt(Nt),Tt(Qt)];if(Zt!=null&&Zt!==!1){const Xt=Zt===!0?Ut(tt.BYTES):Zt;Gt.push(ensureBytes$1("extraEntropy",Xt))}const nn=concatBytes$1(...Gt),Wt=Qt;function hn(Xt){const Jt=Et(Xt);if(!dt(Jt))return;const tn=st(Jt),_t=at.BASE.multiply(Jt).toAffine(),Dt=it(_t.x);if(Dt===_0n$3)return;const Vt=it(tn*it(Wt+Dt*Nt));if(Vt===_0n$3)return;let en=(_t.x===Dt?0:2)|Number(_t.y&_1n$5),an=Vt;return qt&&pt(Vt)&&(an=mt(Vt),en^=1),new yt(Dt,an,en)}return{seed:nn,k2sig:hn}}const Pt={lowS:et.lowS,prehash:!1},$t={lowS:et.lowS,prehash:!1};function Ot(zt,Ft,Yt=Pt){const{seed:Ht,k2sig:Ut}=Rt(zt,Ft,Yt),qt=et;return createHmacDrbg(qt.hash.outputLen,qt.nByteLength,qt.hmac)(Ht,Ut)}at.BASE._setWindowSize(8);function Bt(zt,Ft,Yt,Ht=$t){var _t;const Ut=zt;if(Ft=ensureBytes$1("msgHash",Ft),Yt=ensureBytes$1("publicKey",Yt),"strict"in Ht)throw new Error("options.strict was renamed to lowS");validateSigVerOpts(Ht);const{lowS:qt,prehash:Lt}=Ht;let Zt,Qt;try{if(typeof Ut=="string"||isBytes$2(Ut))try{Zt=yt.fromDER(Ut)}catch(Dt){if(!(Dt instanceof DER.Err))throw Dt;Zt=yt.fromCompact(Ut)}else if(typeof Ut=="object"&&typeof Ut.r=="bigint"&&typeof Ut.s=="bigint"){const{r:Dt,s:Vt}=Ut;Zt=new yt(Dt,Vt)}else throw new Error("PARSE");Qt=at.fromHex(Yt)}catch(Dt){if(Dt.message==="PARSE")throw new Error("signature must be Signature instance, Uint8Array or hex string");return!1}if(qt&&Zt.hasHighS())return!1;Lt&&(Ft=et.hash(Ft));const{r:Nt,s:Gt}=Zt,nn=wt(Ft),Wt=st(Gt),hn=it(nn*Wt),Xt=it(Nt*Wt),Jt=(_t=at.BASE.multiplyAndAddUnsafe(Qt,hn,Xt))==null?void 0:_t.toAffine();return Jt?it(Jt.x)===Nt:!1}return{CURVE:et,getPublicKey:xt,getSharedSecret:bt,sign:Ot,verify:Bt,ProjectivePoint:at,Signature:yt,utils:gt}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function getHash(o){return{hash:o,hmac:(et,...tt)=>hmac(o,et,concatBytes$2(...tt)),randomBytes:randomBytes$1}}function createCurve(o,et){const tt=nt=>weierstrass$1({...o,...getHash(nt)});return Object.freeze({...tt(et),create:tt})}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const secp256k1P=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),secp256k1N=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),_1n$4=BigInt(1),_2n$3=BigInt(2),divNearest$1=(o,et)=>(o+et/_2n$3)/et;function sqrtMod$1(o){const et=secp256k1P,tt=BigInt(3),nt=BigInt(6),rt=BigInt(11),ot=BigInt(22),it=BigInt(23),st=BigInt(44),at=BigInt(88),ct=o*o*o%et,lt=ct*ct*o%et,dt=pow2$1(lt,tt,et)*lt%et,ht=pow2$1(dt,tt,et)*lt%et,pt=pow2$1(ht,_2n$3,et)*ct%et,mt=pow2$1(pt,rt,et)*pt%et,ft=pow2$1(mt,ot,et)*mt%et,yt=pow2$1(ft,st,et)*ft%et,gt=pow2$1(yt,at,et)*yt%et,xt=pow2$1(gt,st,et)*ft%et,vt=pow2$1(xt,tt,et)*lt%et,bt=pow2$1(vt,it,et)*mt%et,Et=pow2$1(bt,nt,et)*ct%et,wt=pow2$1(Et,_2n$3,et);if(!Fp$1.eql(Fp$1.sqr(wt),o))throw new Error("Cannot find square root");return wt}const Fp$1=Field$1(secp256k1P,void 0,void 0,{sqrt:sqrtMod$1}),secp256k1=createCurve({a:BigInt(0),b:BigInt(7),Fp:Fp$1,n:secp256k1N,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:o=>{const et=secp256k1N,tt=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),nt=-_1n$4*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),rt=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),ot=tt,it=BigInt("0x100000000000000000000000000000000"),st=divNearest$1(ot*o,et),at=divNearest$1(-nt*o,et);let ct=mod$1(o-st*tt-at*rt,et),lt=mod$1(-st*nt-at*ot,et);const dt=ct>it,ht=lt>it;if(dt&&(ct=et-ct),ht&&(lt=et-lt),ct>it||lt>it)throw new Error("splitScalar: Endomorphism failed, k="+o);return{k1neg:dt,k1:ct,k2neg:ht,k2:lt}}}},sha256$2);BigInt(0);secp256k1.ProjectivePoint;function getAction(o,et,tt){const nt=o[et.name];if(typeof nt=="function")return nt;const rt=o[tt];return typeof rt=="function"?rt:ot=>et(o,ot)}const version$6="2.14.4",getVersion$1=()=>`@wagmi/core@${version$6}`;var __classPrivateFieldGet$1=function(o,et,tt,nt){if(tt==="a"&&!nt)throw new TypeError("Private accessor was defined without a getter");if(typeof et=="function"?o!==et||!nt:!et.has(o))throw new TypeError("Cannot read private member from an object whose class did not declare it");return tt==="m"?nt:tt==="a"?nt.call(o):nt?nt.value:et.get(o)},_BaseError_instances,_BaseError_walk;let BaseError$1=class As extends Error{get docsBaseUrl(){return"https://wagmi.sh/core"}get version(){return getVersion$1()}constructor(et,tt={}){var ot;super(),_BaseError_instances.add(this),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:"WagmiCoreError"});const nt=tt.cause instanceof As?tt.cause.details:(ot=tt.cause)!=null&&ot.message?tt.cause.message:tt.details,rt=tt.cause instanceof As&&tt.cause.docsPath||tt.docsPath;this.message=[et||"An error occurred.","",...tt.metaMessages?[...tt.metaMessages,""]:[],...rt?[`Docs: ${this.docsBaseUrl}${rt}.html${tt.docsSlug?`#${tt.docsSlug}`:""}`]:[],...nt?[`Details: ${nt}`]:[],`Version: ${this.version}`].join(` -`),tt.cause&&(this.cause=tt.cause),this.details=nt,this.docsPath=rt,this.metaMessages=tt.metaMessages,this.shortMessage=et}walk(et){return __classPrivateFieldGet$1(this,_BaseError_instances,"m",_BaseError_walk).call(this,this,et)}};_BaseError_instances=new WeakSet,_BaseError_walk=function o(et,tt){return tt!=null&&tt(et)?et:et.cause?__classPrivateFieldGet$1(this,_BaseError_instances,"m",o).call(this,et.cause,tt):et};class ChainNotConfiguredError extends BaseError$1{constructor(){super("Chain not configured."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ChainNotConfiguredError"})}}class ConnectorAlreadyConnectedError extends BaseError$1{constructor(){super("Connector already connected."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ConnectorAlreadyConnectedError"})}}class ConnectorNotConnectedError extends BaseError$1{constructor(){super("Connector not connected."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ConnectorNotConnectedError"})}}class ConnectorAccountNotFoundError extends BaseError$1{constructor({address:et,connector:tt}){super(`Account "${et}" not found for connector "${tt.name}".`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ConnectorAccountNotFoundError"})}}class ConnectorChainMismatchError extends BaseError$1{constructor({connectionChainId:et,connectorChainId:tt}){super(`The current chain of the connector (id: ${tt}) does not match the connection's chain (id: ${et}).`,{metaMessages:[`Current Chain ID: ${tt}`,`Expected Chain ID: ${et}`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ConnectorChainMismatchError"})}}class ConnectorUnavailableReconnectingError extends BaseError$1{constructor({connector:et}){super(`Connector "${et.name}" unavailable while reconnecting.`,{details:["During the reconnection step, the only connector methods guaranteed to be available are: `id`, `name`, `type`, `uuid`.","All other methods are not guaranteed to be available until reconnection completes and connectors are fully restored.","This error commonly occurs for connectors that asynchronously inject after reconnection has already started."].join(" ")}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ConnectorUnavailableReconnectingError"})}}async function connect$1(o,et){var nt;let tt;if(typeof et.connector=="function"?tt=o._internal.connectors.setup(et.connector):tt=et.connector,tt.uid===o.state.current)throw new ConnectorAlreadyConnectedError;try{o.setState(it=>({...it,status:"connecting"})),tt.emitter.emit("message",{type:"connecting"});const rt=await tt.connect({chainId:et.chainId}),ot=rt.accounts;return tt.emitter.off("connect",o._internal.events.connect),tt.emitter.on("change",o._internal.events.change),tt.emitter.on("disconnect",o._internal.events.disconnect),await((nt=o.storage)==null?void 0:nt.setItem("recentConnectorId",tt.id)),o.setState(it=>({...it,connections:new Map(it.connections).set(tt.uid,{accounts:ot,chainId:rt.chainId,connector:tt}),current:tt.uid,status:"connected"})),{accounts:ot,chainId:rt.chainId}}catch(rt){throw o.setState(ot=>({...ot,status:ot.current?"connected":"disconnected"})),rt}}const size$1=256;let index$3=size$1,buffer$1;function uid$1(o=11){if(!buffer$1||index$3+o>size$1*2){buffer$1="",index$3=0;for(let et=0;et{const xt=gt(yt);for(const bt in mt)delete xt[bt];const vt={...yt,...xt};return Object.assign(vt,{extend:ft(vt)})}}return Object.assign(mt,{extend:ft(mt)})}function createTransport({key:o,name:et,request:tt,retryCount:nt=3,retryDelay:rt=150,timeout:ot,type:it},st){const at=uid$1();return{config:{key:o,name:et,request:tt,retryCount:nt,retryDelay:rt,timeout:ot,type:it},request:buildRequest(tt,{retryCount:nt,retryDelay:rt,uid:at}),value:st}}function custom(o,et={}){const{key:tt="custom",name:nt="Custom Provider",retryDelay:rt}=et;return({retryCount:ot})=>createTransport({key:tt,name:nt,request:o.request.bind(o),retryCount:et.retryCount??ot,retryDelay:rt,type:"custom"})}class UrlRequiredError extends BaseError$3{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 http(o,et={}){const{batch:tt,fetchOptions:nt,key:rt="http",name:ot="HTTP JSON-RPC",onFetchRequest:it,onFetchResponse:st,retryDelay:at}=et;return({chain:ct,retryCount:lt,timeout:dt})=>{const{batchSize:ht=1e3,wait:pt=0}=typeof tt=="object"?tt:{},mt=et.retryCount??lt,ft=dt??et.timeout??1e4,yt=ct==null?void 0:ct.rpcUrls.default.http[0];if(!yt)throw new UrlRequiredError;const gt=getHttpRpcClient(yt,{fetchOptions:nt,onRequest:it,onResponse:st,timeout:ft});return createTransport({key:rt,name:ot,async request({method:xt,params:vt}){const bt={method:xt,params:vt},{schedule:Et}=createBatchScheduler({id:yt,wait:pt,shouldSplitBatch(Rt){return Rt.length>ht},fn:Rt=>gt.request({body:Rt}),sort:(Rt,Pt)=>Rt.id-Pt.id}),wt=async Rt=>tt?Et(Rt):[await gt.request({body:Rt})],[{error:kt,result:Tt}]=await wt(bt);if(kt)throw new RpcRequestError({body:bt,error:kt,url:yt});return Tt},retryCount:mt,retryDelay:at,timeout:ft,type:"http"},{fetchOptions:nt,url:yt})}}async function getConnectorClient(o,et={}){let tt;if(et.connector){const{connector:ct}=et;if(o.state.status==="reconnecting"&&!ct.getAccounts&&!ct.getChainId)throw new ConnectorUnavailableReconnectingError({connector:ct});const[lt,dt]=await Promise.all([ct.getAccounts(),ct.getChainId()]);tt={accounts:lt,chainId:dt,connector:ct}}else tt=o.state.connections.get(o.state.current);if(!tt)throw new ConnectorNotConnectedError;const nt=et.chainId??tt.chainId,rt=await tt.connector.getChainId();if(rt!==tt.chainId)throw new ConnectorChainMismatchError({connectionChainId:tt.chainId,connectorChainId:rt});const ot=tt.connector;if(ot.getClient)return ot.getClient({chainId:nt});const it=parseAccount(et.account??tt.accounts[0]);if(it.address=getAddress(it.address),et.account&&!tt.accounts.some(ct=>ct.toLowerCase()===it.address.toLowerCase()))throw new ConnectorAccountNotFoundError({address:it.address,connector:ot});const st=o.chains.find(ct=>ct.id===nt),at=await tt.connector.getProvider({chainId:nt});return createClient({account:it,chain:st,name:"Connector Client",transport:ct=>custom(at)({...ct,retryCount:0})})}async function disconnect(o,et={}){var rt,ot;let tt;if(et.connector)tt=et.connector;else{const{connections:it,current:st}=o.state,at=it.get(st);tt=at==null?void 0:at.connector}const nt=o.state.connections;tt&&(await tt.disconnect(),tt.emitter.off("change",o._internal.events.change),tt.emitter.off("disconnect",o._internal.events.disconnect),tt.emitter.on("connect",o._internal.events.connect),nt.delete(tt.uid)),o.setState(it=>{if(nt.size===0)return{...it,connections:new Map,current:null,status:"disconnected"};const st=nt.values().next().value;return{...it,connections:new Map(nt),current:st.connector.uid}});{const it=o.state.current;if(!it)return;const st=(rt=o.state.connections.get(it))==null?void 0:rt.connector;if(!st)return;await((ot=o.storage)==null?void 0:ot.setItem("recentConnectorId",st.id))}}function getUnit(o){return typeof o=="number"?o:o==="wei"?0:Math.abs(weiUnits[o])}function getAccount(o){const et=o.state.current,tt=o.state.connections.get(et),nt=tt==null?void 0:tt.accounts,rt=nt==null?void 0:nt[0],ot=o.chains.find(st=>st.id===(tt==null?void 0:tt.chainId)),it=o.state.status;switch(it){case"connected":return{address:rt,addresses:nt,chain:ot,chainId:tt==null?void 0:tt.chainId,connector:tt==null?void 0:tt.connector,isConnected:!0,isConnecting:!1,isDisconnected:!1,isReconnecting:!1,status:it};case"reconnecting":return{address:rt,addresses:nt,chain:ot,chainId:tt==null?void 0:tt.chainId,connector:tt==null?void 0:tt.connector,isConnected:!!rt,isConnecting:!1,isDisconnected:!1,isReconnecting:!0,status:it};case"connecting":return{address:rt,addresses:nt,chain:ot,chainId:tt==null?void 0:tt.chainId,connector:tt==null?void 0:tt.connector,isConnected:!1,isConnecting:!0,isDisconnected:!1,isReconnecting:!1,status:it};case"disconnected":return{address:void 0,addresses:void 0,chain:void 0,chainId:void 0,connector:void 0,isConnected:!1,isConnecting:!1,isDisconnected:!0,isReconnecting:!1,status:it}}}async function multicall(o,et){const{allowFailure:tt=!0,chainId:nt,contracts:rt,...ot}=et,it=o.getClient({chainId:nt});return getAction(it,multicall$1,"multicall")({allowFailure:tt,contracts:rt,...ot})}function readContract(o,et){const{chainId:tt,...nt}=et,rt=o.getClient({chainId:tt});return getAction(rt,readContract$1,"readContract")(nt)}async function readContracts(o,et){var st;const{allowFailure:tt=!0,blockNumber:nt,blockTag:rt,...ot}=et,it=et.contracts;try{const at={};for(const[ht,pt]of it.entries()){const mt=pt.chainId??o.state.chainId;at[mt]||(at[mt]=[]),(st=at[mt])==null||st.push({contract:pt,index:ht})}const ct=()=>Object.entries(at).map(([ht,pt])=>multicall(o,{...ot,allowFailure:tt,blockNumber:nt,blockTag:rt,chainId:Number.parseInt(ht),contracts:pt.map(({contract:mt})=>mt)})),lt=(await Promise.all(ct())).flat(),dt=Object.values(at).flatMap(ht=>ht.map(({index:pt})=>pt));return lt.reduce((ht,pt,mt)=>(ht&&(ht[dt[mt]]=pt),ht),[])}catch(at){if(at instanceof ContractFunctionExecutionError)throw at;const ct=()=>it.map(lt=>readContract(o,{...lt,blockNumber:nt,blockTag:rt}));return tt?(await Promise.allSettled(ct())).map(lt=>lt.status==="fulfilled"?{result:lt.value,status:"success"}:{error:lt.reason,result:void 0,status:"failure"}):await Promise.all(ct())}}async function getBalance(o,et){const{address:tt,blockNumber:nt,blockTag:rt,chainId:ot,token:it,unit:st="ether"}=et;if(it)try{return await getTokenBalance(o,{balanceAddress:tt,chainId:ot,symbolType:"string",tokenAddress:it})}catch(ht){if(ht.name==="ContractFunctionExecutionError"){const pt=await getTokenBalance(o,{balanceAddress:tt,chainId:ot,symbolType:"bytes32",tokenAddress:it}),mt=hexToString(trim$1(pt.symbol,{dir:"right"}));return{...pt,symbol:mt}}throw ht}const at=o.getClient({chainId:ot}),lt=await getAction(at,getBalance$1,"getBalance")(nt?{address:tt,blockNumber:nt}:{address:tt,blockTag:rt}),dt=o.chains.find(ht=>ht.id===ot)??at.chain;return{decimals:dt.nativeCurrency.decimals,formatted:formatUnits(lt,getUnit(st)),symbol:dt.nativeCurrency.symbol,value:lt}}async function getTokenBalance(o,et){const{balanceAddress:tt,chainId:nt,symbolType:rt,tokenAddress:ot,unit:it}=et,st={abi:[{type:"function",name:"balanceOf",stateMutability:"view",inputs:[{type:"address"}],outputs:[{type:"uint256"}]},{type:"function",name:"decimals",stateMutability:"view",inputs:[],outputs:[{type:"uint8"}]},{type:"function",name:"symbol",stateMutability:"view",inputs:[],outputs:[{type:rt}]}],address:ot},[at,ct,lt]=await readContracts(o,{allowFailure:!1,contracts:[{...st,functionName:"balanceOf",args:[tt],chainId:nt},{...st,functionName:"decimals",chainId:nt},{...st,functionName:"symbol",chainId:nt}]}),dt=formatUnits(at??"0",getUnit(it??ct));return{decimals:ct,formatted:dt,symbol:lt,value:at}}function getBlockNumber(o,et={}){const{chainId:tt,...nt}=et,rt=o.getClient({chainId:tt});return getAction(rt,getBlockNumber$1,"getBlockNumber")(nt)}function getChainId(o){return o.state.chainId}function deepEqual(o,et){if(o===et)return!0;if(o&&et&&typeof o=="object"&&typeof et=="object"){if(o.constructor!==et.constructor)return!1;let tt,nt;if(Array.isArray(o)&&Array.isArray(et)){if(tt=o.length,tt!==et.length)return!1;for(nt=tt;nt--!==0;)if(!deepEqual(o[nt],et[nt]))return!1;return!0}if(o.valueOf!==Object.prototype.valueOf)return o.valueOf()===et.valueOf();if(o.toString!==Object.prototype.toString)return o.toString()===et.toString();const rt=Object.keys(o);if(tt=rt.length,tt!==Object.keys(et).length)return!1;for(nt=tt;nt--!==0;)if(!Object.prototype.hasOwnProperty.call(et,rt[nt]))return!1;for(nt=tt;nt--!==0;){const ot=rt[nt];if(ot&&!deepEqual(o[ot],et[ot]))return!1}return!0}return o!==o&&et!==et}let previousChains=[];function getChains(o){const et=o.chains;return deepEqual(previousChains,et)?previousChains:(previousChains=et,et)}let previousConnections=[];function getConnections(o){const et=[...o.state.connections.values()];return o.state.status==="reconnecting"||deepEqual(previousConnections,et)?previousConnections:(previousConnections=et,et)}let previousConnectors=[];function getConnectors(o){const et=o.connectors;return deepEqual(previousConnectors,et)?previousConnectors:(previousConnectors=et,et)}function getEnsAddress(o,et){const{chainId:tt,...nt}=et,rt=o.getClient({chainId:tt});return getAction(rt,getEnsAddress$1,"getEnsAddress")(nt)}function getEnsAvatar(o,et){const{chainId:tt,...nt}=et,rt=o.getClient({chainId:tt});return getAction(rt,getEnsAvatar$1,"getEnsAvatar")(nt)}function getEnsName(o,et){const{chainId:tt,...nt}=et,rt=o.getClient({chainId:tt});return getAction(rt,getEnsName$1,"getEnsName")(nt)}let isReconnecting=!1;async function reconnect(o,et={}){var ct,lt;if(isReconnecting)return[];isReconnecting=!0,o.setState(dt=>({...dt,status:dt.current?"reconnecting":"connecting"}));const tt=[];if((ct=et.connectors)!=null&&ct.length)for(const dt of et.connectors){let ht;typeof dt=="function"?ht=o._internal.connectors.setup(dt):ht=dt,tt.push(ht)}else tt.push(...o.connectors);let nt;try{nt=await((lt=o.storage)==null?void 0:lt.getItem("recentConnectorId"))}catch{}const rt={};for(const[,dt]of o.state.connections)rt[dt.connector.id]=1;nt&&(rt[nt]=0);const ot=Object.keys(rt).length>0?[...tt].sort((dt,ht)=>(rt[dt.id]??10)-(rt[ht.id]??10)):tt;let it=!1;const st=[],at=[];for(const dt of ot){const ht=await dt.getProvider().catch(()=>{});if(!ht||at.some(ft=>ft===ht)||!await dt.isAuthorized())continue;const mt=await dt.connect({isReconnecting:!0}).catch(()=>null);mt&&(dt.emitter.off("connect",o._internal.events.connect),dt.emitter.on("change",o._internal.events.change),dt.emitter.on("disconnect",o._internal.events.disconnect),o.setState(ft=>{const yt=new Map(it?ft.connections:new Map).set(dt.uid,{accounts:mt.accounts,chainId:mt.chainId,connector:dt});return{...ft,current:it?ft.current:dt.uid,connections:yt}}),st.push({accounts:mt.accounts,chainId:mt.chainId,connector:dt}),at.push(ht),it=!0)}return(o.state.status==="reconnecting"||o.state.status==="connecting")&&(it?o.setState(dt=>({...dt,status:"connected"})):o.setState(dt=>({...dt,connections:new Map,current:null,status:"disconnected"}))),isReconnecting=!1,st}async function signMessage(o,et){const{account:tt,connector:nt,...rt}=et;let ot;return typeof tt=="object"&&tt.type==="local"?ot=o.getClient():ot=await getConnectorClient(o,{account:tt,connector:nt}),getAction(ot,signMessage$1,"signMessage")({...rt,...tt?{account:tt}:{}})}class ProviderNotFoundError extends BaseError$1{constructor(){super("Provider not found."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ProviderNotFoundError"})}}class SwitchChainNotSupportedError extends BaseError$1{constructor({connector:et}){super(`"${et.name}" does not support programmatic chain switching.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"SwitchChainNotSupportedError"})}}async function switchChain(o,et){var it;const{addEthereumChainParameter:tt,chainId:nt}=et,rt=o.state.connections.get(((it=et.connector)==null?void 0:it.uid)??o.state.current);if(rt){const st=rt.connector;if(!st.switchChain)throw new SwitchChainNotSupportedError({connector:st});return await st.switchChain({addEthereumChainParameter:tt,chainId:nt})}const ot=o.chains.find(st=>st.id===nt);if(!ot)throw new ChainNotConfiguredError;return o.setState(st=>({...st,chainId:nt})),ot}function watchAccount(o,et){const{onChange:tt}=et;return o.subscribe(()=>getAccount(o),tt,{equalityFn(nt,rt){const{connector:ot,...it}=nt,{connector:st,...at}=rt;return deepEqual(it,at)&&(ot==null?void 0:ot.id)===(st==null?void 0:st.id)&&(ot==null?void 0:ot.uid)===(st==null?void 0:st.uid)}})}function watchBlockNumber(o,et){const{syncConnectedChain:tt=o._internal.syncConnectedChain,...nt}=et;let rt;const ot=at=>{rt&&rt();const ct=o.getClient({chainId:at});return rt=getAction(ct,watchBlockNumber$1,"watchBlockNumber")(nt),rt},it=ot(et.chainId);let st;return tt&&!et.chainId&&(st=o.subscribe(({chainId:at})=>at,async at=>ot(at))),()=>{it==null||it(),st==null||st()}}function watchChainId(o,et){const{onChange:tt}=et;return o.subscribe(nt=>nt.chainId,tt)}function watchConnections(o,et){const{onChange:tt}=et;return o.subscribe(()=>getConnections(o),tt,{equalityFn:deepEqual})}function watchConnectors(o,et){const{onChange:tt}=et;return o._internal.connectors.subscribe((nt,rt)=>{tt(Object.values(nt),rt)})}function createConnector(o){return o}const supportsSimulationIdRegex=/(rabby|trustwallet)/;injected.type="injected";function injected(o={}){const{shimDisconnect:et=!0,unstable_shimAsyncInject:tt}=o;function nt(){const at=o.target;if(typeof at=="function"){const ct=at();if(ct)return ct}return typeof at=="object"?at:typeof at=="string"?{...targetMap[at]??{id:at,name:`${at[0].toUpperCase()}${at.slice(1)}`,provider:`is${at[0].toUpperCase()}${at.slice(1)}`}}:{id:"injected",name:"Injected",provider(ct){return ct==null?void 0:ct.ethereum}}}let rt,ot,it,st;return at=>({get icon(){return nt().icon},get id(){return nt().id},get name(){return nt().name},get supportsSimulation(){return supportsSimulationIdRegex.test(this.id.toLowerCase())},type:injected.type,async setup(){const ct=await this.getProvider();ct!=null&&ct.on&&o.target&&(it||(it=this.onConnect.bind(this),ct.on("connect",it)),rt||(rt=this.onAccountsChanged.bind(this),ct.on("accountsChanged",rt)))},async connect({chainId:ct,isReconnecting:lt}={}){var pt,mt,ft,yt,gt,xt;const dt=await this.getProvider();if(!dt)throw new ProviderNotFoundError;let ht=[];if(lt)ht=await this.getAccounts().catch(()=>[]);else if(et)try{ht=(yt=(ft=(mt=(pt=(await dt.request({method:"wallet_requestPermissions",params:[{eth_accounts:{}}]}))[0])==null?void 0:pt.caveats)==null?void 0:mt[0])==null?void 0:ft.value)==null?void 0:yt.map(bt=>getAddress(bt)),ht.length>0&&(ht=await this.getAccounts())}catch(vt){const bt=vt;if(bt.code===UserRejectedRequestError.code)throw new UserRejectedRequestError(bt);if(bt.code===ResourceUnavailableRpcError.code)throw bt}try{!(ht!=null&&ht.length)&&!lt&&(ht=(await dt.request({method:"eth_requestAccounts"})).map(Et=>getAddress(Et))),it&&(dt.removeListener("connect",it),it=void 0),rt||(rt=this.onAccountsChanged.bind(this),dt.on("accountsChanged",rt)),ot||(ot=this.onChainChanged.bind(this),dt.on("chainChanged",ot)),st||(st=this.onDisconnect.bind(this),dt.on("disconnect",st));let vt=await this.getChainId();if(ct&&vt!==ct){const bt=await this.switchChain({chainId:ct}).catch(Et=>{if(Et.code===UserRejectedRequestError.code)throw Et;return{id:vt}});vt=(bt==null?void 0:bt.id)??vt}return et&&await((gt=at.storage)==null?void 0:gt.removeItem(`${this.id}.disconnected`)),o.target||await((xt=at.storage)==null?void 0:xt.setItem("injected.connected",!0)),{accounts:ht,chainId:vt}}catch(vt){const bt=vt;throw bt.code===UserRejectedRequestError.code?new UserRejectedRequestError(bt):bt.code===ResourceUnavailableRpcError.code?new ResourceUnavailableRpcError(bt):bt}},async disconnect(){var lt,dt;const ct=await this.getProvider();if(!ct)throw new ProviderNotFoundError;ot&&(ct.removeListener("chainChanged",ot),ot=void 0),st&&(ct.removeListener("disconnect",st),st=void 0),it||(it=this.onConnect.bind(this),ct.on("connect",it));try{await withTimeout(()=>ct.request({method:"wallet_revokePermissions",params:[{eth_accounts:{}}]}),{timeout:100})}catch{}et&&await((lt=at.storage)==null?void 0:lt.setItem(`${this.id}.disconnected`,!0)),o.target||await((dt=at.storage)==null?void 0:dt.removeItem("injected.connected"))},async getAccounts(){const ct=await this.getProvider();if(!ct)throw new ProviderNotFoundError;return(await ct.request({method:"eth_accounts"})).map(dt=>getAddress(dt))},async getChainId(){const ct=await this.getProvider();if(!ct)throw new ProviderNotFoundError;const lt=await ct.request({method:"eth_chainId"});return Number(lt)},async getProvider(){if(typeof window>"u")return;let ct;const lt=nt();return typeof lt.provider=="function"?ct=lt.provider(window):typeof lt.provider=="string"?ct=findProvider(window,lt.provider):ct=lt.provider,ct&&!ct.removeListener&&("off"in ct&&typeof ct.off=="function"?ct.removeListener=ct.off:ct.removeListener=()=>{}),ct},async isAuthorized(){var ct,lt;try{if(et&&await((ct=at.storage)==null?void 0:ct.getItem(`${this.id}.disconnected`))||!o.target&&!await((lt=at.storage)==null?void 0:lt.getItem("injected.connected")))return!1;if(!await this.getProvider()){if(tt!==void 0&&tt!==!1){const mt=async()=>(typeof window<"u"&&window.removeEventListener("ethereum#initialized",mt),!!await this.getProvider()),ft=typeof tt=="number"?tt:1e3;if(await Promise.race([...typeof window<"u"?[new Promise(gt=>window.addEventListener("ethereum#initialized",()=>gt(mt()),{once:!0}))]:[],new Promise(gt=>setTimeout(()=>gt(mt()),ft))]))return!0}throw new ProviderNotFoundError}return!!(await withRetry(()=>this.getAccounts())).length}catch{return!1}},async switchChain({addEthereumChainParameter:ct,chainId:lt}){var mt,ft,yt,gt;const dt=await this.getProvider();if(!dt)throw new ProviderNotFoundError;const ht=at.chains.find(xt=>xt.id===lt);if(!ht)throw new SwitchChainError(new ChainNotConfiguredError);const pt=new Promise(xt=>{const vt=bt=>{"chainId"in bt&&bt.chainId===lt&&(at.emitter.off("change",vt),xt())};at.emitter.on("change",vt)});try{return await Promise.all([dt.request({method:"wallet_switchEthereumChain",params:[{chainId:numberToHex(lt)}]}).then(async()=>{await this.getChainId()===lt&&at.emitter.emit("change",{chainId:lt})}),pt]),ht}catch(xt){const vt=xt;if(vt.code===4902||((ft=(mt=vt==null?void 0:vt.data)==null?void 0:mt.originalError)==null?void 0:ft.code)===4902)try{const{default:bt,...Et}=ht.blockExplorers??{};let wt;ct!=null&&ct.blockExplorerUrls?wt=ct.blockExplorerUrls:bt&&(wt=[bt.url,...Object.values(Et).map(Rt=>Rt.url)]);let kt;(yt=ct==null?void 0:ct.rpcUrls)!=null&&yt.length?kt=ct.rpcUrls:kt=[((gt=ht.rpcUrls.default)==null?void 0:gt.http[0])??""];const Tt={blockExplorerUrls:wt,chainId:numberToHex(lt),chainName:(ct==null?void 0:ct.chainName)??ht.name,iconUrls:ct==null?void 0:ct.iconUrls,nativeCurrency:(ct==null?void 0:ct.nativeCurrency)??ht.nativeCurrency,rpcUrls:kt};return await Promise.all([dt.request({method:"wallet_addEthereumChain",params:[Tt]}).then(async()=>{if(await this.getChainId()===lt)at.emitter.emit("change",{chainId:lt});else throw new UserRejectedRequestError(new Error("User rejected switch after adding network."))}),pt]),ht}catch(bt){throw new UserRejectedRequestError(bt)}throw vt.code===UserRejectedRequestError.code?new UserRejectedRequestError(vt):new SwitchChainError(vt)}},async onAccountsChanged(ct){var lt;if(ct.length===0)this.onDisconnect();else if(at.emitter.listenerCount("connect")){const dt=(await this.getChainId()).toString();this.onConnect({chainId:dt}),et&&await((lt=at.storage)==null?void 0:lt.removeItem(`${this.id}.disconnected`))}else at.emitter.emit("change",{accounts:ct.map(dt=>getAddress(dt))})},onChainChanged(ct){const lt=Number(ct);at.emitter.emit("change",{chainId:lt})},async onConnect(ct){const lt=await this.getAccounts();if(lt.length===0)return;const dt=Number(ct.chainId);at.emitter.emit("connect",{accounts:lt,chainId:dt});const ht=await this.getProvider();ht&&(it&&(ht.removeListener("connect",it),it=void 0),rt||(rt=this.onAccountsChanged.bind(this),ht.on("accountsChanged",rt)),ot||(ot=this.onChainChanged.bind(this),ht.on("chainChanged",ot)),st||(st=this.onDisconnect.bind(this),ht.on("disconnect",st)))},async onDisconnect(ct){const lt=await this.getProvider();ct&&ct.code===1013&<&&(await this.getAccounts()).length||(at.emitter.emit("disconnect"),lt&&(ot&&(lt.removeListener("chainChanged",ot),ot=void 0),st&&(lt.removeListener("disconnect",st),st=void 0),it||(it=this.onConnect.bind(this),lt.on("connect",it))))}})}const targetMap={coinbaseWallet:{id:"coinbaseWallet",name:"Coinbase Wallet",provider(o){return o!=null&&o.coinbaseWalletExtension?o.coinbaseWalletExtension:findProvider(o,"isCoinbaseWallet")}},metaMask:{id:"metaMask",name:"MetaMask",provider(o){return findProvider(o,et=>{if(!et.isMetaMask||et.isBraveWallet&&!et._events&&!et._state)return!1;const tt=["isApexWallet","isAvalanche","isBitKeep","isBlockWallet","isKuCoinWallet","isMathWallet","isOkxWallet","isOKExWallet","isOneInchIOSWallet","isOneInchAndroidWallet","isOpera","isPortal","isRabby","isTokenPocket","isTokenary","isUniswapWallet","isZerion"];for(const nt of tt)if(et[nt])return!1;return!0})}},phantom:{id:"phantom",name:"Phantom",provider(o){var et,tt;return(et=o==null?void 0:o.phantom)!=null&&et.ethereum?(tt=o.phantom)==null?void 0:tt.ethereum:findProvider(o,"isPhantom")}}};function findProvider(o,et){function tt(rt){return typeof et=="function"?et(rt):typeof et=="string"?rt[et]:!0}const nt=o.ethereum;if(nt!=null&&nt.providers)return nt.providers.find(rt=>tt(rt));if(nt&&tt(nt))return nt}function requestProviders(o){if(typeof window>"u")return;const et=tt=>o(tt.detail);return window.addEventListener("eip6963:announceProvider",et),window.dispatchEvent(new CustomEvent("eip6963:requestProvider")),()=>window.removeEventListener("eip6963:announceProvider",et)}function createStore$1(){const o=new Set;let et=[];const tt=()=>requestProviders(rt=>{et.some(({info:ot})=>ot.uuid===rt.info.uuid)||(et=[...et,rt],o.forEach(ot=>ot(et,{added:[rt]})))});let nt=tt();return{_listeners(){return o},clear(){o.forEach(rt=>rt([],{removed:[...et]})),et=[]},destroy(){this.clear(),o.clear(),nt==null||nt()},findProvider({rdns:rt}){return et.find(ot=>ot.info.rdns===rt)},getProviders(){return et},reset(){this.clear(),nt==null||nt(),nt=tt()},subscribe(rt,{emitImmediately:ot}={}){return o.add(rt),ot&&rt(et,{added:et}),()=>o.delete(rt)}}}const subscribeWithSelectorImpl=o=>(et,tt,nt)=>{const rt=nt.subscribe;return nt.subscribe=(it,st,at)=>{let ct=it;if(st){const lt=(at==null?void 0:at.equalityFn)||Object.is;let dt=it(nt.getState());ct=ht=>{const pt=it(ht);if(!lt(dt,pt)){const mt=dt;st(dt=pt,mt)}},at!=null&&at.fireImmediately&&st(dt,dt)}return rt(ct)},o(et,tt,nt)},subscribeWithSelector=subscribeWithSelectorImpl;function createJSONStorage(o,et){let tt;try{tt=o()}catch{return}return{getItem:rt=>{var ot;const it=at=>at===null?null:JSON.parse(at,void 0),st=(ot=tt.getItem(rt))!=null?ot:null;return st instanceof Promise?st.then(it):it(st)},setItem:(rt,ot)=>tt.setItem(rt,JSON.stringify(ot,void 0)),removeItem:rt=>tt.removeItem(rt)}}const toThenable=o=>et=>{try{const tt=o(et);return tt instanceof Promise?tt:{then(nt){return toThenable(nt)(tt)},catch(nt){return this}}}catch(tt){return{then(nt){return this},catch(nt){return toThenable(nt)(tt)}}}},persistImpl=(o,et)=>(tt,nt,rt)=>{let ot={storage:createJSONStorage(()=>localStorage),partialize:ft=>ft,version:0,merge:(ft,yt)=>({...yt,...ft}),...et},it=!1;const st=new Set,at=new Set;let ct=ot.storage;if(!ct)return o((...ft)=>{console.warn(`[zustand persist middleware] Unable to update item '${ot.name}', the given storage is currently unavailable.`),tt(...ft)},nt,rt);const lt=()=>{const ft=ot.partialize({...nt()});return ct.setItem(ot.name,{state:ft,version:ot.version})},dt=rt.setState;rt.setState=(ft,yt)=>{dt(ft,yt),lt()};const ht=o((...ft)=>{tt(...ft),lt()},nt,rt);rt.getInitialState=()=>ht;let pt;const mt=()=>{var ft,yt;if(!ct)return;it=!1,st.forEach(xt=>{var vt;return xt((vt=nt())!=null?vt:ht)});const gt=((yt=ot.onRehydrateStorage)==null?void 0:yt.call(ot,(ft=nt())!=null?ft:ht))||void 0;return toThenable(ct.getItem.bind(ct))(ot.name).then(xt=>{if(xt)if(typeof xt.version=="number"&&xt.version!==ot.version){if(ot.migrate)return[!0,ot.migrate(xt.state,xt.version)];console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return[!1,xt.state];return[!1,void 0]}).then(xt=>{var vt;const[bt,Et]=xt;if(pt=ot.merge(Et,(vt=nt())!=null?vt:ht),tt(pt,!0),bt)return lt()}).then(()=>{gt==null||gt(pt,void 0),pt=nt(),it=!0,at.forEach(xt=>xt(pt))}).catch(xt=>{gt==null||gt(void 0,xt)})};return rt.persist={setOptions:ft=>{ot={...ot,...ft},ft.storage&&(ct=ft.storage)},clearStorage:()=>{ct==null||ct.removeItem(ot.name)},getOptions:()=>ot,rehydrate:()=>mt(),hasHydrated:()=>it,onHydrate:ft=>(st.add(ft),()=>{st.delete(ft)}),onFinishHydration:ft=>(at.add(ft),()=>{at.delete(ft)})},ot.skipHydration||mt(),pt||ht},persist=persistImpl,createStoreImpl=o=>{let et;const tt=new Set,nt=(ct,lt)=>{const dt=typeof ct=="function"?ct(et):ct;if(!Object.is(dt,et)){const ht=et;et=lt??(typeof dt!="object"||dt===null)?dt:Object.assign({},et,dt),tt.forEach(pt=>pt(et,ht))}},rt=()=>et,st={setState:nt,getState:rt,getInitialState:()=>at,subscribe:ct=>(tt.add(ct),()=>tt.delete(ct))},at=et=o(nt,rt,st);return st},createStore=o=>o?createStoreImpl(o):createStoreImpl;var eventemitter3={exports:{}};(function(o){var et=Object.prototype.hasOwnProperty,tt="~";function nt(){}Object.create&&(nt.prototype=Object.create(null),new nt().__proto__||(tt=!1));function rt(at,ct,lt){this.fn=at,this.context=ct,this.once=lt||!1}function ot(at,ct,lt,dt,ht){if(typeof lt!="function")throw new TypeError("The listener must be a function");var pt=new rt(lt,dt||at,ht),mt=tt?tt+ct:ct;return at._events[mt]?at._events[mt].fn?at._events[mt]=[at._events[mt],pt]:at._events[mt].push(pt):(at._events[mt]=pt,at._eventsCount++),at}function it(at,ct){--at._eventsCount===0?at._events=new nt:delete at._events[ct]}function st(){this._events=new nt,this._eventsCount=0}st.prototype.eventNames=function(){var ct=[],lt,dt;if(this._eventsCount===0)return ct;for(dt in lt=this._events)et.call(lt,dt)&&ct.push(tt?dt.slice(1):dt);return Object.getOwnPropertySymbols?ct.concat(Object.getOwnPropertySymbols(lt)):ct},st.prototype.listeners=function(ct){var lt=tt?tt+ct:ct,dt=this._events[lt];if(!dt)return[];if(dt.fn)return[dt.fn];for(var ht=0,pt=dt.length,mt=new Array(pt);ht{let rt=nt;return(rt==null?void 0:rt.__type)==="bigint"&&(rt=BigInt(rt.value)),(rt==null?void 0:rt.__type)==="Map"&&(rt=new Map(rt.value)),(et==null?void 0:et(tt,rt))??rt})}function getReferenceKey(o,et){return o.slice(0,et).join(".")||"."}function getCutoff(o,et){const{length:tt}=o;for(let nt=0;nt{let it=ot;return typeof it=="bigint"&&(it={__type:"bigint",value:ot.toString()}),it instanceof Map&&(it={__type:"Map",value:Array.from(ot.entries())}),(et==null?void 0:et(rt,it))??it},nt),tt??void 0)}function createStorage(o){const{deserialize:et=deserialize$1,key:tt="wagmi",serialize:nt=serialize$1,storage:rt=noopStorage}=o;function ot(it){return it instanceof Promise?it.then(st=>st).catch(()=>null):it}return{...rt,key:tt,async getItem(it,st){const at=rt.getItem(`${tt}.${it}`),ct=await ot(at);return ct?et(ct)??null:st??null},async setItem(it,st){const at=`${tt}.${it}`;st===null?await ot(rt.removeItem(at)):await ot(rt.setItem(at,nt(st)))},async removeItem(it){await ot(rt.removeItem(`${tt}.${it}`))}}}const noopStorage={getItem:()=>null,setItem:()=>{},removeItem:()=>{}},size=256;let index$2=size,buffer;function uid(o=11){if(!buffer||index$2+o>size*2){buffer="",index$2=0;for(let et=0;etot.chains),at=createStore(()=>{const Et=[],wt=new Set;for(const kt of ot.connectors??[]){const Tt=ct(kt);Et.push(Tt),!rt&&Tt.rdns&&wt.add(Tt.rdns)}if(!rt&&it){const kt=it.getProviders();for(const Tt of kt)wt.has(Tt.info.rdns)||Et.push(ct(lt(Tt)))}return Et});function ct(Et){var Tt;const wt=createEmitter(uid()),kt={...Et({emitter:wt,chains:st.getState(),storage:tt,transports:ot.transports}),emitter:wt,uid:wt.uid};return wt.on("connect",vt),(Tt=kt.setup)==null||Tt.call(kt),kt}function lt(Et){const{info:wt}=Et,kt=Et.provider;return injected({target:{...wt,id:wt.rdns,provider:kt}})}const dt=new Map;function ht(Et={}){const wt=Et.chainId??yt.getState().chainId,kt=st.getState().find(Rt=>Rt.id===wt);if(Et.chainId&&!kt)throw new ChainNotConfiguredError;{const Rt=dt.get(yt.getState().chainId);if(Rt&&!kt)return Rt;if(!kt)throw new ChainNotConfiguredError}{const Rt=dt.get(wt);if(Rt)return Rt}let Tt;if(ot.client)Tt=ot.client({chain:kt});else{const Rt=kt.id,Pt=st.getState().map(Bt=>Bt.id),$t={},Ot=Object.entries(ot);for(const[Bt,zt]of Ot)if(!(Bt==="chains"||Bt==="client"||Bt==="connectors"||Bt==="transports"))if(typeof zt=="object")if(Rt in zt)$t[Bt]=zt[Rt];else{if(Pt.some(Yt=>Yt in zt))continue;$t[Bt]=zt}else $t[Bt]=zt;Tt=createClient({...$t,chain:kt,batch:$t.batch??{multicall:!0},transport:Bt=>ot.transports[Rt]({...Bt,connectors:at})})}return dt.set(wt,Tt),Tt}function pt(){return{chainId:st.getState()[0].id,connections:new Map,current:null,status:"disconnected"}}let mt;const ft="0.0.0-canary-";version$6.startsWith(ft)?mt=Number.parseInt(version$6.replace(ft,"")):mt=Number.parseInt(version$6.split(".")[0]??"0");const yt=createStore(subscribeWithSelector(tt?persist(pt,{migrate(Et,wt){if(wt===mt)return Et;const kt=pt(),Tt=gt(Et,kt.chainId);return{...kt,chainId:Tt}},name:"store",partialize(Et){return{connections:{__type:"Map",value:Array.from(Et.connections.entries()).map(([wt,kt])=>{const{id:Tt,name:Rt,type:Pt,uid:$t}=kt.connector;return[wt,{...kt,connector:{id:Tt,name:Rt,type:Pt,uid:$t}}]})},chainId:Et.chainId,current:Et.current}},merge(Et,wt){typeof Et=="object"&&Et&&"status"in Et&&delete Et.status;const kt=gt(Et,wt.chainId);return{...wt,...Et,chainId:kt}},skipHydration:rt,storage:tt,version:mt}):pt));yt.setState(pt());function gt(Et,wt){return Et&&typeof Et=="object"&&"chainId"in Et&&typeof Et.chainId=="number"&&st.getState().some(kt=>kt.id===Et.chainId)?Et.chainId:wt}nt&&yt.subscribe(({connections:Et,current:wt})=>{var kt;return wt?(kt=Et.get(wt))==null?void 0:kt.chainId:void 0},Et=>{if(st.getState().some(kt=>kt.id===Et))return yt.setState(kt=>({...kt,chainId:Et??kt.chainId}))}),it==null||it.subscribe(Et=>{const wt=new Set,kt=new Set;for(const Rt of at.getState())wt.add(Rt.id),Rt.rdns&&kt.add(Rt.rdns);const Tt=[];for(const Rt of Et){if(kt.has(Rt.info.rdns))continue;const Pt=ct(lt(Rt));wt.has(Pt.id)||Tt.push(Pt)}tt&&!yt.persist.hasHydrated()||at.setState(Rt=>[...Rt,...Tt],!0)});function xt(Et){yt.setState(wt=>{const kt=wt.connections.get(Et.uid);return kt?{...wt,connections:new Map(wt.connections).set(Et.uid,{accounts:Et.accounts??kt.accounts,chainId:Et.chainId??kt.chainId,connector:kt.connector})}:wt})}function vt(Et){yt.getState().status==="connecting"||yt.getState().status==="reconnecting"||yt.setState(wt=>{const kt=at.getState().find(Tt=>Tt.uid===Et.uid);return kt?(kt.emitter.listenerCount("connect")&&kt.emitter.off("connect",xt),kt.emitter.listenerCount("change")||kt.emitter.on("change",xt),kt.emitter.listenerCount("disconnect")||kt.emitter.on("disconnect",bt),{...wt,connections:new Map(wt.connections).set(Et.uid,{accounts:Et.accounts,chainId:Et.chainId,connector:kt}),current:Et.uid,status:"connected"}):wt})}function bt(Et){yt.setState(wt=>{const kt=wt.connections.get(Et.uid);if(kt){const Rt=kt.connector;Rt.emitter.listenerCount("change")&&kt.connector.emitter.off("change",xt),Rt.emitter.listenerCount("disconnect")&&kt.connector.emitter.off("disconnect",bt),Rt.emitter.listenerCount("connect")||kt.connector.emitter.on("connect",vt)}if(wt.connections.delete(Et.uid),wt.connections.size===0)return{...wt,connections:new Map,current:null,status:"disconnected"};const Tt=wt.connections.values().next().value;return{...wt,connections:new Map(wt.connections),current:Tt.connector.uid}})}return{get chains(){return st.getState()},get connectors(){return at.getState()},storage:tt,getClient:ht,get state(){return yt.getState()},setState(Et){let wt;typeof Et=="function"?wt=Et(yt.getState()):wt=Et;const kt=pt();typeof wt!="object"&&(wt=kt),Object.keys(kt).some(Rt=>!(Rt in wt))&&(wt=kt),yt.setState(wt,!0)},subscribe(Et,wt,kt){return yt.subscribe(Et,wt,kt?{...kt,fireImmediately:kt.emitImmediately}:void 0)},_internal:{mipd:it,store:yt,ssr:!!rt,syncConnectedChain:nt,transports:ot.transports,chains:{setState(Et){const wt=typeof Et=="function"?Et(st.getState()):Et;if(wt.length!==0)return st.setState(wt,!0)},subscribe(Et){return st.subscribe(Et)}},connectors:{providerDetailToConnector:lt,setup:ct,setState(Et){return at.setState(typeof Et=="function"?Et(at.getState()):Et,!0)},subscribe(Et){return at.subscribe(Et)}},events:{change:xt,connect:vt,disconnect:bt}}}}function hydrate(o,et){const{initialState:tt,reconnectOnMount:nt}=et;return tt&&!o._internal.store.persist.hasHydrated()&&o.setState({...tt,chainId:o.chains.some(rt=>rt.id===tt.chainId)?tt.chainId:o.chains[0].id,connections:nt?tt.connections:new Map,status:nt?"reconnecting":"disconnected"}),{async onMount(){o._internal.ssr&&(await o._internal.store.persist.rehydrate(),o._internal.mipd&&o._internal.connectors.setState(rt=>{var at;const ot=new Set;for(const ct of rt??[])ct.rdns&&ot.add(ct.rdns);const it=[],st=((at=o._internal.mipd)==null?void 0:at.getProviders())??[];for(const ct of st){if(ot.has(ct.info.rdns))continue;const lt=o._internal.connectors.providerDetailToConnector(ct),dt=o._internal.connectors.setup(lt);it.push(dt)}return[...rt,...it]})),nt?reconnect(o):o.storage&&o.setState(rt=>({...rt,connections:new Map}))}}}function extractRpcUrls(o){var ot,it,st;const{chain:et}=o,tt=et.rpcUrls.default.http[0];if(!o.transports)return[tt];const nt=(it=(ot=o.transports)==null?void 0:ot[et.id])==null?void 0:it.call(ot,{chain:et});return(((st=nt==null?void 0:nt.value)==null?void 0:st.transports)||[nt]).map(({value:at})=>(at==null?void 0:at.url)||tt)}function Hydrate(o){const{children:et,config:tt,initialState:nt,reconnectOnMount:rt=!0}=o,{onMount:ot}=hydrate(tt,{initialState:nt,reconnectOnMount:rt});tt._internal.ssr||ot();const it=reactExports.useRef(!0);return reactExports.useEffect(()=>{if(it.current&&tt._internal.ssr)return ot(),()=>{it.current=!1}},[]),et}const WagmiContext=reactExports.createContext(void 0);function WagmiProvider(o){const{children:et,config:tt}=o,nt={value:tt};return reactExports.createElement(Hydrate,o,reactExports.createElement(WagmiContext.Provider,nt,et))}const version$5="2.12.29",getVersion=()=>`wagmi@${version$5}`;class BaseError extends BaseError$1{constructor(){super(...arguments),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"WagmiError"})}get docsBaseUrl(){return"https://wagmi.sh/react"}get version(){return getVersion()}}class WagmiProviderNotFoundError extends BaseError{constructor(){super("`useConfig` must be used within `WagmiProvider`.",{docsPath:"/api/WagmiProvider"}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"WagmiProviderNotFoundError"})}}function useConfig(o={}){const et=o.config??reactExports.useContext(WagmiContext);if(!et)throw new WagmiProviderNotFoundError;return et}function watchChains(o,et){const{onChange:tt}=et;return o._internal.chains.subscribe((nt,rt)=>{tt(nt,rt)})}var withSelector={exports:{}},withSelector_production_min={},shim={exports:{}},useSyncExternalStoreShim_production_min={};/** +`):`The contract function "${nt}" reverted.`,{cause:ot,metaMessages:st,name:"ContractFunctionRevertedError"}),Object.defineProperty(this,"data",{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=it,this.reason=at,this.signature=ct}}class ContractFunctionZeroDataError extends BaseError$3{constructor({functionName:et}){super(`The contract function "${et}" returned no data ("0x").`,{metaMessages:["This could be due to any of the following:",` - The contract does not have the function "${et}",`," - The parameters passed to the contract function may be invalid, or"," - The address is not a contract."],name:"ContractFunctionZeroDataError"})}}class CounterfactualDeploymentFailedError extends BaseError$3{constructor({factory:et}){super(`Deployment for counterfactual contract call failed${et?` for factory "${et}".`:""}`,{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 RawContractError extends BaseError$3{constructor({data:et,message:tt}){super(tt||"",{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=et}}function isNullUniversalResolverError(o,et){var nt,rt,ot,it,st,at;if(!(o instanceof BaseError$3))return!1;const tt=o.walk(ct=>ct instanceof ContractFunctionRevertedError);return tt instanceof ContractFunctionRevertedError?!!(((nt=tt.data)==null?void 0:nt.errorName)==="ResolverNotFound"||((rt=tt.data)==null?void 0:rt.errorName)==="ResolverWildcardNotSupported"||((ot=tt.data)==null?void 0:ot.errorName)==="ResolverNotContract"||((it=tt.data)==null?void 0:it.errorName)==="ResolverError"||((st=tt.data)==null?void 0:st.errorName)==="HttpError"||(at=tt.reason)!=null&&at.includes("Wildcard on non-extended resolvers is not supported")||et==="reverse"&&tt.reason===panicReasons[50]):!1}function encodedLabelToLabelhash(o){if(o.length!==66||o.indexOf("[")!==0||o.indexOf("]")!==65)return null;const et=`0x${o.slice(1,65)}`;return isHex(et)?et:null}function namehash(o){let et=new Uint8Array(32).fill(0);if(!o)return bytesToHex$4(et);const tt=o.split(".");for(let nt=tt.length-1;nt>=0;nt-=1){const rt=encodedLabelToLabelhash(tt[nt]),ot=rt?toBytes$3(rt):keccak256$1(stringToBytes(tt[nt]),"bytes");et=keccak256$1(concat$3([et,ot]),"bytes")}return bytesToHex$4(et)}function encodeLabelhash(o){return`[${o.slice(2)}]`}function labelhash(o){const et=new Uint8Array(32).fill(0);return o?encodedLabelToLabelhash(o)||keccak256$1(stringToBytes(o)):bytesToHex$4(et)}function packetToBytes(o){const et=o.replace(/^\.|\.$/gm,"");if(et.length===0)return new Uint8Array(1);const tt=new Uint8Array(stringToBytes(et).byteLength+2);let nt=0;const rt=et.split(".");for(let ot=0;ot255&&(it=stringToBytes(encodeLabelhash(labelhash(rt[ot])))),tt[nt]=it.length,tt.set(it,nt+1),nt+=it.length+1}return tt.byteLength!==nt+1?tt.slice(0,nt+1):tt}const EXECUTION_REVERTED_ERROR_CODE=3;function getContractError(o,{abi:et,address:tt,args:nt,docsPath:rt,functionName:ot,sender:it}){const{code:st,data:at,message:ct,shortMessage:lt}=o instanceof RawContractError?o:o instanceof BaseError$3?o.walk(ht=>"data"in ht)||o.walk():{},dt=o instanceof AbiDecodingZeroDataError?new ContractFunctionZeroDataError({functionName:ot}):[EXECUTION_REVERTED_ERROR_CODE,InternalRpcError.code].includes(st)&&(at||ct||lt)?new ContractFunctionRevertedError({abi:et,data:typeof at=="object"?at.data:at,functionName:ot,message:lt??ct}):o;return new ContractFunctionExecutionError(dt,{abi:et,args:nt,contractAddress:tt,docsPath:rt,functionName:ot,sender:it})}const aggregate3Signature="0x82ad56cb",deploylessCallViaBytecodeBytecode="0x608060405234801561001057600080fd5b5060405161018e38038061018e83398101604081905261002f91610124565b6000808351602085016000f59050803b61004857600080fd5b6000808351602085016000855af16040513d6000823e81610067573d81fd5b3d81f35b634e487b7160e01b600052604160045260246000fd5b600082601f83011261009257600080fd5b81516001600160401b038111156100ab576100ab61006b565b604051601f8201601f19908116603f011681016001600160401b03811182821017156100d9576100d961006b565b6040528181528382016020018510156100f157600080fd5b60005b82811015610110576020818601810151838301820152016100f4565b506000918101602001919091529392505050565b6000806040838503121561013757600080fd5b82516001600160401b0381111561014d57600080fd5b61015985828601610081565b602085015190935090506001600160401b0381111561017757600080fd5b61018385828601610081565b915050925092905056fe",deploylessCallViaFactoryBytecode="0x608060405234801561001057600080fd5b506040516102c03803806102c083398101604081905261002f916101e6565b836001600160a01b03163b6000036100e457600080836001600160a01b03168360405161005c9190610270565b6000604051808303816000865af19150503d8060008114610099576040519150601f19603f3d011682016040523d82523d6000602084013e61009e565b606091505b50915091508115806100b857506001600160a01b0386163b155b156100e1578060405163101bb98d60e01b81526004016100d8919061028c565b60405180910390fd5b50505b6000808451602086016000885af16040513d6000823e81610103573d81fd5b3d81f35b80516001600160a01b038116811461011e57600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b60005b8381101561015457818101518382015260200161013c565b50506000910152565b600082601f83011261016e57600080fd5b81516001600160401b0381111561018757610187610123565b604051601f8201601f19908116603f011681016001600160401b03811182821017156101b5576101b5610123565b6040528181528382016020018510156101cd57600080fd5b6101de826020830160208701610139565b949350505050565b600080600080608085870312156101fc57600080fd5b61020585610107565b60208601519094506001600160401b0381111561022157600080fd5b61022d8782880161015d565b93505061023c60408601610107565b60608601519092506001600160401b0381111561025857600080fd5b6102648782880161015d565b91505092959194509250565b60008251610282818460208701610139565b9190910192915050565b60208152600082518060208401526102ab816040850160208701610139565b601f01601f1916919091016040019291505056fe";function getCallError(o,{docsPath:et,...tt}){const nt=(()=>{const rt=getNodeError(o,tt);return rt instanceof UnknownNodeError?o:rt})();return new CallExecutionError(nt,{docsPath:et,...tt})}function withResolvers(){let o=()=>{},et=()=>{};return{promise:new Promise((nt,rt)=>{o=nt,et=rt}),resolve:o,reject:et}}const schedulerCache=new Map;function createBatchScheduler({fn:o,id:et,shouldSplitBatch:tt,wait:nt=0,sort:rt}){const ot=async()=>{const lt=at();it();const dt=lt.map(({args:ht})=>ht);dt.length!==0&&o(dt).then(ht=>{rt&&Array.isArray(ht)&&ht.sort(rt);for(let pt=0;pt{for(let pt=0;ptschedulerCache.delete(et),st=()=>at().map(({args:lt})=>lt),at=()=>schedulerCache.get(et)||[],ct=lt=>schedulerCache.set(et,[...at(),lt]);return{flush:it,async schedule(lt){const{promise:dt,resolve:ht,reject:pt}=withResolvers();return(tt==null?void 0:tt([...st(),lt]))&&ot(),at().length>0?(ct({args:lt,resolve:ht,reject:pt}),dt):(ct({args:lt,resolve:ht,reject:pt}),setTimeout(ot,nt),dt)}}}async function call(o,et){var jt,Ot,Bt,zt;const{account:tt=o.account,batch:nt=!!((jt=o.batch)!=null&&jt.multicall),blockNumber:rt,blockTag:ot="latest",accessList:it,blobs:st,code:at,data:ct,factory:lt,factoryData:dt,gas:ht,gasPrice:pt,maxFeePerBlobGas:mt,maxFeePerGas:ft,maxPriorityFeePerGas:yt,nonce:gt,to:xt,value:vt,stateOverride:bt,...Et}=et,wt=tt?parseAccount(tt):void 0;if(at&&(lt||dt))throw new BaseError$3("Cannot provide both `code` & `factory`/`factoryData` as parameters.");if(at&&xt)throw new BaseError$3("Cannot provide both `code` & `to` as parameters.");const kt=at&&ct,It=lt&&dt&&xt&&ct,Rt=kt||It,Pt=kt?toDeploylessCallViaBytecodeData({code:at,data:ct}):It?toDeploylessCallViaFactoryData({data:ct,factory:lt,factoryData:dt,to:xt}):ct;try{assertRequest(et);const Yt=(rt?numberToHex(rt):void 0)||ot,Ht=serializeStateOverride(bt),Ut=(zt=(Bt=(Ot=o.chain)==null?void 0:Ot.formatters)==null?void 0:Bt.transactionRequest)==null?void 0:zt.format,Lt=(Ut||formatTransactionRequest)({...extract$1(Et,{format:Ut}),from:wt==null?void 0:wt.address,accessList:it,blobs:st,data:Pt,gas:ht,gasPrice:pt,maxFeePerBlobGas:mt,maxFeePerGas:ft,maxPriorityFeePerGas:yt,nonce:gt,to:Rt?void 0:xt,value:vt});if(nt&&shouldPerformMulticall({request:Lt})&&!Ht)try{return await scheduleMulticall(o,{...Lt,blockNumber:rt,blockTag:ot})}catch(Qt){if(!(Qt instanceof ClientChainNotConfiguredError)&&!(Qt instanceof ChainDoesNotSupportContract))throw Qt}const Zt=await o.request({method:"eth_call",params:Ht?[Lt,Yt,Ht]:[Lt,Yt]});return Zt==="0x"?{data:void 0}:{data:Zt}}catch(Ft){const Yt=getRevertErrorData(Ft),{offchainLookup:Ht,offchainLookupSignature:Ut}=await __vitePreload(async()=>{const{offchainLookup:qt,offchainLookupSignature:Lt}=await import("./ccip-DU5pFHxb.js");return{offchainLookup:qt,offchainLookupSignature:Lt}},[]);if(o.ccipRead!==!1&&(Yt==null?void 0:Yt.slice(0,10))===Ut&&xt)return{data:await Ht(o,{data:Yt,to:xt})};throw Rt&&(Yt==null?void 0:Yt.slice(0,10))==="0x101bb98d"?new CounterfactualDeploymentFailedError({factory:lt}):getCallError(Ft,{...et,account:wt,chain:o.chain})}}function shouldPerformMulticall({request:o}){const{data:et,to:tt,...nt}=o;return!(!et||et.startsWith(aggregate3Signature)||!tt||Object.values(nt).filter(rt=>typeof rt<"u").length>0)}async function scheduleMulticall(o,et){var ft;const{batchSize:tt=1024,wait:nt=0}=typeof((ft=o.batch)==null?void 0:ft.multicall)=="object"?o.batch.multicall:{},{blockNumber:rt,blockTag:ot="latest",data:it,multicallAddress:st,to:at}=et;let ct=st;if(!ct){if(!o.chain)throw new ClientChainNotConfiguredError;ct=getChainContractAddress({blockNumber:rt,chain:o.chain,contract:"multicall3"})}const dt=(rt?numberToHex(rt):void 0)||ot,{schedule:ht}=createBatchScheduler({id:`${o.uid}.${dt}`,wait:nt,shouldSplitBatch(yt){return yt.reduce((xt,{data:vt})=>xt+(vt.length-2),0)>tt*2},fn:async yt=>{const gt=yt.map(bt=>({allowFailure:!0,callData:bt.data,target:bt.to})),xt=encodeFunctionData({abi:multicall3Abi,args:[gt],functionName:"aggregate3"}),vt=await o.request({method:"eth_call",params:[{data:xt,to:ct},dt]});return decodeFunctionResult({abi:multicall3Abi,args:[gt],functionName:"aggregate3",data:vt||"0x"})}}),[{returnData:pt,success:mt}]=await ht({data:it,to:at});if(!mt)throw new RawContractError({data:pt});return pt==="0x"?{data:void 0}:{data:pt}}function toDeploylessCallViaBytecodeData(o){const{code:et,data:tt}=o;return encodeDeployData({abi:parseAbi(["constructor(bytes, bytes)"]),bytecode:deploylessCallViaBytecodeBytecode,args:[et,tt]})}function toDeploylessCallViaFactoryData(o){const{data:et,factory:tt,factoryData:nt,to:rt}=o;return encodeDeployData({abi:parseAbi(["constructor(address, bytes, address, bytes)"]),bytecode:deploylessCallViaFactoryBytecode,args:[rt,et,tt,nt]})}function getRevertErrorData(o){var tt;if(!(o instanceof BaseError$3))return;const et=o.walk();return typeof(et==null?void 0:et.data)=="object"?(tt=et.data)==null?void 0:tt.data:et.data}async function readContract$1(o,et){const{abi:tt,address:nt,args:rt,functionName:ot,...it}=et,st=encodeFunctionData({abi:tt,args:rt,functionName:ot});try{const{data:at}=await getAction$1(o,call,"call")({...it,data:st,to:nt});return decodeFunctionResult({abi:tt,args:rt,functionName:ot,data:at||"0x"})}catch(at){throw getContractError(at,{abi:tt,address:nt,args:rt,docsPath:"/docs/contract/readContract",functionName:ot})}}async function getEnsAddress$1(o,{blockNumber:et,blockTag:tt,coinType:nt,name:rt,gatewayUrls:ot,strict:it,universalResolverAddress:st}){let at=st;if(!at){if(!o.chain)throw new Error("client chain not configured. universalResolverAddress is required.");at=getChainContractAddress({blockNumber:et,chain:o.chain,contract:"ensUniversalResolver"})}try{const ct=encodeFunctionData({abi:addressResolverAbi,functionName:"addr",...nt!=null?{args:[namehash(rt),BigInt(nt)]}:{args:[namehash(rt)]}}),lt={address:at,abi:universalResolverResolveAbi,functionName:"resolve",args:[toHex(packetToBytes(rt)),ct],blockNumber:et,blockTag:tt},dt=getAction$1(o,readContract$1,"readContract"),ht=ot?await dt({...lt,args:[...lt.args,ot]}):await dt(lt);if(ht[0]==="0x")return null;const pt=decodeFunctionResult({abi:addressResolverAbi,args:nt!=null?[namehash(rt),BigInt(nt)]:void 0,functionName:"addr",data:ht[0]});return pt==="0x"||trim$1(pt)==="0x00"?null:pt}catch(ct){if(it)throw ct;if(isNullUniversalResolverError(ct,"resolve"))return null;throw ct}}class EnsAvatarInvalidMetadataError extends BaseError$3{constructor({data:et}){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(et)}`],name:"EnsAvatarInvalidMetadataError"})}}class EnsAvatarInvalidNftUriError extends BaseError$3{constructor({reason:et}){super(`ENS NFT avatar URI is invalid. ${et}`,{name:"EnsAvatarInvalidNftUriError"})}}class EnsAvatarUriResolutionError extends BaseError$3{constructor({uri:et}){super(`Unable to resolve ENS avatar URI "${et}". The URI may be malformed, invalid, or does not respond with a valid image.`,{name:"EnsAvatarUriResolutionError"})}}class EnsAvatarUnsupportedNamespaceError extends BaseError$3{constructor({namespace:et}){super(`ENS NFT avatar namespace "${et}" is not supported. Must be "erc721" or "erc1155".`,{name:"EnsAvatarUnsupportedNamespaceError"})}}const networkRegex=/(?https?:\/\/[^\/]*|ipfs:\/|ipns:\/|ar:\/)?(?\/)?(?ipfs\/|ipns\/)?(?[\w\-.]+)(?\/.*)?/,ipfsHashRegex=/^(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,})(\/(?[\w\-.]+))?(?\/.*)?$/,base64Regex=/^data:([a-zA-Z\-/+]*);base64,([^"].*)/,dataURIRegex=/^data:([a-zA-Z\-/+]*)?(;[a-zA-Z0-9].*?)?(,)/;async function isImageUri(o){try{const et=await fetch(o,{method:"HEAD"});if(et.status===200){const tt=et.headers.get("content-type");return tt==null?void 0:tt.startsWith("image/")}return!1}catch(et){return typeof et=="object"&&typeof et.response<"u"||!globalThis.hasOwnProperty("Image")?!1:new Promise(tt=>{const nt=new Image;nt.onload=()=>{tt(!0)},nt.onerror=()=>{tt(!1)},nt.src=o})}}function getGateway(o,et){return o?o.endsWith("/")?o.slice(0,-1):o:et}function resolveAvatarUri({uri:o,gatewayUrls:et}){const tt=base64Regex.test(o);if(tt)return{uri:o,isOnChain:!0,isEncoded:tt};const nt=getGateway(et==null?void 0:et.ipfs,"https://ipfs.io"),rt=getGateway(et==null?void 0:et.arweave,"https://arweave.net"),ot=o.match(networkRegex),{protocol:it,subpath:st,target:at,subtarget:ct=""}=(ot==null?void 0:ot.groups)||{},lt=it==="ipns:/"||st==="ipns/",dt=it==="ipfs:/"||st==="ipfs/"||ipfsHashRegex.test(o);if(o.startsWith("http")&&!lt&&!dt){let pt=o;return et!=null&&et.arweave&&(pt=o.replace(/https:\/\/arweave.net/g,et==null?void 0:et.arweave)),{uri:pt,isOnChain:!1,isEncoded:!1}}if((lt||dt)&&at)return{uri:`${nt}/${lt?"ipns":"ipfs"}/${at}${ct}`,isOnChain:!1,isEncoded:!1};if(it==="ar:/"&&at)return{uri:`${rt}/${at}${ct||""}`,isOnChain:!1,isEncoded:!1};let ht=o.replace(dataURIRegex,"");if(ht.startsWith("rt.json());return await parseAvatarUri({gatewayUrls:o,uri:getJsonImage(tt)})}catch{throw new EnsAvatarUriResolutionError({uri:et})}}async function parseAvatarUri({gatewayUrls:o,uri:et}){const{uri:tt,isOnChain:nt}=resolveAvatarUri({uri:et,gatewayUrls:o});if(nt||await isImageUri(tt))return tt;throw new EnsAvatarUriResolutionError({uri:et})}function parseNftUri(o){let et=o;et.startsWith("did:nft:")&&(et=et.replace("did:nft:","").replace(/_/g,"/"));const[tt,nt,rt]=et.split("/"),[ot,it]=tt.split(":"),[st,at]=nt.split(":");if(!ot||ot.toLowerCase()!=="eip155")throw new EnsAvatarInvalidNftUriError({reason:"Only EIP-155 supported"});if(!it)throw new EnsAvatarInvalidNftUriError({reason:"Chain ID not found"});if(!at)throw new EnsAvatarInvalidNftUriError({reason:"Contract address not found"});if(!rt)throw new EnsAvatarInvalidNftUriError({reason:"Token ID not found"});if(!st)throw new EnsAvatarInvalidNftUriError({reason:"ERC namespace not found"});return{chainID:Number.parseInt(it),namespace:st.toLowerCase(),contractAddress:at,tokenID:rt}}async function getNftTokenUri(o,{nft:et}){if(et.namespace==="erc721")return readContract$1(o,{address:et.contractAddress,abi:[{name:"tokenURI",type:"function",stateMutability:"view",inputs:[{name:"tokenId",type:"uint256"}],outputs:[{name:"",type:"string"}]}],functionName:"tokenURI",args:[BigInt(et.tokenID)]});if(et.namespace==="erc1155")return readContract$1(o,{address:et.contractAddress,abi:[{name:"uri",type:"function",stateMutability:"view",inputs:[{name:"_id",type:"uint256"}],outputs:[{name:"",type:"string"}]}],functionName:"uri",args:[BigInt(et.tokenID)]});throw new EnsAvatarUnsupportedNamespaceError({namespace:et.namespace})}async function parseAvatarRecord(o,{gatewayUrls:et,record:tt}){return/eip155:/i.test(tt)?parseNftAvatarUri(o,{gatewayUrls:et,record:tt}):parseAvatarUri({uri:tt,gatewayUrls:et})}async function parseNftAvatarUri(o,{gatewayUrls:et,record:tt}){const nt=parseNftUri(tt),rt=await getNftTokenUri(o,{nft:nt}),{uri:ot,isOnChain:it,isEncoded:st}=resolveAvatarUri({uri:rt,gatewayUrls:et});if(it&&(ot.includes("data:application/json;base64,")||ot.startsWith("{"))){const ct=st?atob(ot.replace("data:application/json;base64,","")):ot,lt=JSON.parse(ct);return parseAvatarUri({uri:getJsonImage(lt),gatewayUrls:et})}let at=nt.tokenID;return nt.namespace==="erc1155"&&(at=at.replace("0x","").padStart(64,"0")),getMetadataAvatarUri({gatewayUrls:et,uri:ot.replace(/(?:0x)?{id}/,at)})}async function getEnsText(o,{blockNumber:et,blockTag:tt,name:nt,key:rt,gatewayUrls:ot,strict:it,universalResolverAddress:st}){let at=st;if(!at){if(!o.chain)throw new Error("client chain not configured. universalResolverAddress is required.");at=getChainContractAddress({blockNumber:et,chain:o.chain,contract:"ensUniversalResolver"})}try{const ct={address:at,abi:universalResolverResolveAbi,functionName:"resolve",args:[toHex(packetToBytes(nt)),encodeFunctionData({abi:textResolverAbi,functionName:"text",args:[namehash(nt),rt]})],blockNumber:et,blockTag:tt},lt=getAction$1(o,readContract$1,"readContract"),dt=ot?await lt({...ct,args:[...ct.args,ot]}):await lt(ct);if(dt[0]==="0x")return null;const ht=decodeFunctionResult({abi:textResolverAbi,functionName:"text",data:dt[0]});return ht===""?null:ht}catch(ct){if(it)throw ct;if(isNullUniversalResolverError(ct,"resolve"))return null;throw ct}}async function getEnsAvatar$1(o,{blockNumber:et,blockTag:tt,assetGatewayUrls:nt,name:rt,gatewayUrls:ot,strict:it,universalResolverAddress:st}){const at=await getAction$1(o,getEnsText,"getEnsText")({blockNumber:et,blockTag:tt,key:"avatar",name:rt,universalResolverAddress:st,gatewayUrls:ot,strict:it});if(!at)return null;try{return await parseAvatarRecord(o,{record:at,gatewayUrls:nt})}catch{return null}}async function getEnsName$1(o,{address:et,blockNumber:tt,blockTag:nt,gatewayUrls:rt,strict:ot,universalResolverAddress:it}){let st=it;if(!st){if(!o.chain)throw new Error("client chain not configured. universalResolverAddress is required.");st=getChainContractAddress({blockNumber:tt,chain:o.chain,contract:"ensUniversalResolver"})}const at=`${et.toLowerCase().substring(2)}.addr.reverse`;try{const ct={address:st,abi:universalResolverReverseAbi,functionName:"reverse",args:[toHex(packetToBytes(at))],blockNumber:tt,blockTag:nt},lt=getAction$1(o,readContract$1,"readContract"),[dt,ht]=rt?await lt({...ct,args:[...ct.args,rt]}):await lt(ct);return et.toLowerCase()!==ht.toLowerCase()?null:dt}catch(ct){if(ot)throw ct;if(isNullUniversalResolverError(ct,"reverse"))return null;throw ct}}const promiseCache$1=new Map,responseCache=new Map;function getCache(o){const et=(rt,ot)=>({clear:()=>ot.delete(rt),get:()=>ot.get(rt),set:it=>ot.set(rt,it)}),tt=et(o,promiseCache$1),nt=et(o,responseCache);return{clear:()=>{tt.clear(),nt.clear()},promise:tt,response:nt}}async function withCache(o,{cacheKey:et,cacheTime:tt=Number.POSITIVE_INFINITY}){const nt=getCache(et),rt=nt.response.get();if(rt&&tt>0&&new Date().getTime()-rt.created.getTime()`blockNumber.${o}`;async function getBlockNumber$1(o,{cacheTime:et=o.cacheTime}={}){const tt=await withCache(()=>o.request({method:"eth_blockNumber"}),{cacheKey:cacheKey(o.uid),cacheTime:et});return BigInt(tt)}function formatLog(o,{args:et,eventName:tt}={}){return{...o,blockHash:o.blockHash?o.blockHash:null,blockNumber:o.blockNumber?BigInt(o.blockNumber):null,logIndex:o.logIndex?Number(o.logIndex):null,transactionHash:o.transactionHash?o.transactionHash:null,transactionIndex:o.transactionIndex?Number(o.transactionIndex):null,...tt?{args:et,eventName:tt}:{}}}const receiptStatuses={"0x0":"reverted","0x1":"success"};function formatTransactionReceipt(o){const et={...o,blockNumber:o.blockNumber?BigInt(o.blockNumber):null,contractAddress:o.contractAddress?o.contractAddress:null,cumulativeGasUsed:o.cumulativeGasUsed?BigInt(o.cumulativeGasUsed):null,effectiveGasPrice:o.effectiveGasPrice?BigInt(o.effectiveGasPrice):null,gasUsed:o.gasUsed?BigInt(o.gasUsed):null,logs:o.logs?o.logs.map(tt=>formatLog(tt)):null,to:o.to?o.to:null,transactionIndex:o.transactionIndex?hexToNumber$2(o.transactionIndex):null,status:o.status?receiptStatuses[o.status]:null,type:o.type?transactionType[o.type]||o.type:null};return o.blobGasPrice&&(et.blobGasPrice=BigInt(o.blobGasPrice)),o.blobGasUsed&&(et.blobGasUsed=BigInt(o.blobGasUsed)),et}const defineTransactionReceipt=defineFormatter("transactionReceipt",formatTransactionReceipt);async function multicall$1(o,et){var yt;const{allowFailure:tt=!0,batchSize:nt,blockNumber:rt,blockTag:ot,multicallAddress:it,stateOverride:st}=et,at=et.contracts,ct=nt??(typeof((yt=o.batch)==null?void 0:yt.multicall)=="object"&&o.batch.multicall.batchSize||1024);let lt=it;if(!lt){if(!o.chain)throw new Error("client chain not configured. multicallAddress is required.");lt=getChainContractAddress({blockNumber:rt,chain:o.chain,contract:"multicall3"})}const dt=[[]];let ht=0,pt=0;for(let gt=0;gt0&&pt>ct&&dt[ht].length>0&&(ht++,pt=(wt.length-2)/2,dt[ht]=[]),dt[ht]=[...dt[ht],{allowFailure:!0,callData:wt,target:vt}]}catch(wt){const kt=getContractError(wt,{abi:xt,address:vt,args:bt,docsPath:"/docs/contract/multicall",functionName:Et});if(!tt)throw kt;dt[ht]=[...dt[ht],{allowFailure:!0,callData:"0x",target:vt}]}}const mt=await Promise.allSettled(dt.map(gt=>getAction$1(o,readContract$1,"readContract")({abi:multicall3Abi,address:lt,args:[gt],blockNumber:rt,blockTag:ot,functionName:"aggregate3",stateOverride:st}))),ft=[];for(let gt=0;gtlistenersCache.get(o)||[],ot=()=>{const lt=rt();listenersCache.set(o,lt.filter(dt=>dt.id!==nt))},it=()=>{const lt=cleanupCache.get(o);rt().length===1&<&<(),ot()},st=rt();if(listenersCache.set(o,[...st,{id:nt,fns:et}]),st&&st.length>0)return it;const at={};for(const lt in et)at[lt]=(...dt)=>{var pt,mt;const ht=rt();if(ht.length!==0)for(const ft of ht)(mt=(pt=ft.fns)[lt])==null||mt.call(pt,...dt)};const ct=tt(at);return typeof ct=="function"&&cleanupCache.set(o,ct),it}async function wait$1(o){return new Promise(et=>setTimeout(et,o))}function poll(o,{emitOnBegin:et,initialWaitTime:tt,interval:nt}){let rt=!0;const ot=()=>rt=!1;return(async()=>{let st;et&&(st=await o({unpoll:ot}));const at=await(tt==null?void 0:tt(st))??nt;await wait$1(at);const ct=async()=>{rt&&(await o({unpoll:ot}),await wait$1(nt),ct())};ct()})(),ot}function watchBlockNumber$1(o,{emitOnBegin:et=!1,emitMissed:tt=!1,onBlockNumber:nt,onError:rt,poll:ot,pollingInterval:it=o.pollingInterval}){const st=typeof ot<"u"?ot:!(o.transport.type==="webSocket"||o.transport.type==="fallback"&&o.transport.transports[0].config.type==="webSocket");let at;return st?(()=>{const dt=stringify$2(["watchBlockNumber",o.uid,et,tt,it]);return observe(dt,{onBlockNumber:nt,onError:rt},ht=>poll(async()=>{var pt;try{const mt=await getAction$1(o,getBlockNumber$1,"getBlockNumber")({cacheTime:0});if(at){if(mt===at)return;if(mt-at>1&&tt)for(let ft=at+1n;ftat)&&(ht.onBlockNumber(mt,at),at=mt)}catch(mt){(pt=ht.onError)==null||pt.call(ht,mt)}},{emitOnBegin:et,interval:it}))})():(()=>{const dt=stringify$2(["watchBlockNumber",o.uid,et,tt]);return observe(dt,{onBlockNumber:nt,onError:rt},ht=>{let pt=!0,mt=()=>pt=!1;return(async()=>{try{const ft=(()=>{if(o.transport.type==="fallback"){const gt=o.transport.transports.find(xt=>xt.config.type==="webSocket");return gt?gt.value:o.transport}return o.transport})(),{unsubscribe:yt}=await ft.subscribe({params:["newHeads"],onData(gt){var vt;if(!pt)return;const xt=hexToBigInt((vt=gt.result)==null?void 0:vt.number);ht.onBlockNumber(xt,at),at=xt},onError(gt){var xt;(xt=ht.onError)==null||xt.call(ht,gt)}});mt=yt,pt||mt()}catch(ft){rt==null||rt(ft)}})(),()=>mt()})})()}const promiseCache=new LruMap(8192);function withDedupe(o,{enabled:et=!0,id:tt}){if(!et||!tt)return o();if(promiseCache.get(tt))return promiseCache.get(tt);const nt=o().finally(()=>promiseCache.delete(tt));return promiseCache.set(tt,nt),nt}function withRetry(o,{delay:et=100,retryCount:tt=2,shouldRetry:nt=()=>!0}={}){return new Promise((rt,ot)=>{const it=async({count:st=0}={})=>{const at=async({error:ct})=>{const lt=typeof et=="function"?et({count:st,error:ct}):et;lt&&await wait$1(lt),it({count:st+1})};try{const ct=await o();rt(ct)}catch(ct){if(st{const{dedupe:rt=!1,retryDelay:ot=150,retryCount:it=3,uid:st}={...et,...nt},at=rt?keccak256$1(stringToHex(`${st}.${stringify$2(tt)}`)):void 0;return withDedupe(()=>withRetry(async()=>{try{return await o(tt)}catch(ct){const lt=ct;switch(lt.code){case ParseRpcError.code:throw new ParseRpcError(lt);case InvalidRequestRpcError.code:throw new InvalidRequestRpcError(lt);case MethodNotFoundRpcError.code:throw new MethodNotFoundRpcError(lt,{method:tt.method});case InvalidParamsRpcError.code:throw new InvalidParamsRpcError(lt);case InternalRpcError.code:throw new InternalRpcError(lt);case InvalidInputRpcError.code:throw new InvalidInputRpcError(lt);case ResourceNotFoundRpcError.code:throw new ResourceNotFoundRpcError(lt);case ResourceUnavailableRpcError.code:throw new ResourceUnavailableRpcError(lt);case TransactionRejectedRpcError.code:throw new TransactionRejectedRpcError(lt);case MethodNotSupportedRpcError.code:throw new MethodNotSupportedRpcError(lt,{method:tt.method});case LimitExceededRpcError.code:throw new LimitExceededRpcError(lt);case JsonRpcVersionUnsupportedError.code:throw new JsonRpcVersionUnsupportedError(lt);case UserRejectedRequestError.code:throw new UserRejectedRequestError(lt);case UnauthorizedProviderError.code:throw new UnauthorizedProviderError(lt);case UnsupportedProviderMethodError.code:throw new UnsupportedProviderMethodError(lt);case ProviderDisconnectedError.code:throw new ProviderDisconnectedError(lt);case ChainDisconnectedError.code:throw new ChainDisconnectedError(lt);case SwitchChainError.code:throw new SwitchChainError(lt);case 5e3:throw new UserRejectedRequestError(lt);default:throw ct instanceof BaseError$3?ct:new UnknownRpcError(lt)}}},{delay:({count:ct,error:lt})=>{var dt;if(lt&< instanceof HttpRequestError){const ht=(dt=lt==null?void 0:lt.headers)==null?void 0:dt.get("Retry-After");if(ht!=null&&ht.match(/\d/))return Number.parseInt(ht)*1e3}return~~(1<shouldRetry(ct)}),{enabled:rt,id:at})}}function shouldRetry(o){return"code"in o&&typeof o.code=="number"?o.code===-1||o.code===LimitExceededRpcError.code||o.code===InternalRpcError.code:o instanceof HttpRequestError&&o.status?o.status===403||o.status===408||o.status===413||o.status===429||o.status===500||o.status===502||o.status===503||o.status===504:!0}function defineChain(o){return{formatters:void 0,fees:void 0,serializers:void 0,...o}}function withTimeout(o,{errorInstance:et=new Error("timed out"),timeout:tt,signal:nt}){return new Promise((rt,ot)=>{(async()=>{let it;try{const st=new AbortController;tt>0&&(it=setTimeout(()=>{nt?st.abort():ot(et)},tt)),rt(await o({signal:(st==null?void 0:st.signal)||null}))}catch(st){(st==null?void 0:st.name)==="AbortError"&&ot(et),ot(st)}finally{clearTimeout(it)}})()})}function createIdStore(){return{current:0,take(){return this.current++},reset(){this.current=0}}}const idCache=createIdStore();function getHttpRpcClient(o,et={}){return{async request(tt){var dt;const{body:nt,onRequest:rt=et.onRequest,onResponse:ot=et.onResponse,timeout:it=et.timeout??1e4}=tt,st={...et.fetchOptions??{},...tt.fetchOptions??{}},{headers:at,method:ct,signal:lt}=st;try{const ht=await withTimeout(async({signal:mt})=>{const ft={...st,body:Array.isArray(nt)?stringify$2(nt.map(vt=>({jsonrpc:"2.0",id:vt.id??idCache.take(),...vt}))):stringify$2({jsonrpc:"2.0",id:nt.id??idCache.take(),...nt}),headers:{"Content-Type":"application/json",...at},method:ct||"POST",signal:lt||(it>0?mt:null)},yt=new Request(o,ft),gt=await(rt==null?void 0:rt(yt,ft))??{...ft,url:o};return await fetch(gt.url??o,gt)},{errorInstance:new TimeoutError$4({body:nt,url:o}),timeout:it,signal:!0});ot&&await ot(ht);let pt;if((dt=ht.headers.get("Content-Type"))!=null&&dt.startsWith("application/json"))pt=await ht.json();else{pt=await ht.text();try{pt=JSON.parse(pt||"{}")}catch(mt){if(ht.ok)throw mt;pt={error:pt}}}if(!ht.ok)throw new HttpRequestError({body:nt,details:stringify$2(pt.error)||ht.statusText,headers:ht.headers,status:ht.status,url:o});return pt}catch(ht){throw ht instanceof HttpRequestError||ht instanceof TimeoutError$4?ht:new HttpRequestError({body:nt,cause:ht,url:o})}}}}function assertTransactionEIP7702(o){const{authorizationList:et}=o;if(et)for(const tt of et){const{contractAddress:nt,chainId:rt}=tt;if(!isAddress(nt))throw new InvalidAddressError({address:nt});if(rt<0)throw new InvalidChainIdError({chainId:rt})}assertTransactionEIP1559(o)}function assertTransactionEIP4844(o){const{blobVersionedHashes:et}=o;if(et){if(et.length===0)throw new EmptyBlobError;for(const tt of et){const nt=size$2(tt),rt=hexToNumber$2(slice(tt,0,1));if(nt!==32)throw new InvalidVersionedHashSizeError({hash:tt,size:nt});if(rt!==versionedHashVersionKzg)throw new InvalidVersionedHashVersionError({hash:tt,version:rt})}}assertTransactionEIP1559(o)}function assertTransactionEIP1559(o){const{chainId:et,maxPriorityFeePerGas:tt,maxFeePerGas:nt,to:rt}=o;if(et<=0)throw new InvalidChainIdError({chainId:et});if(rt&&!isAddress(rt))throw new InvalidAddressError({address:rt});if(nt&&nt>maxUint256)throw new FeeCapTooHighError({maxFeePerGas:nt});if(tt&&nt&&tt>nt)throw new TipAboveFeeCapError({maxFeePerGas:nt,maxPriorityFeePerGas:tt})}function assertTransactionEIP2930(o){const{chainId:et,maxPriorityFeePerGas:tt,gasPrice:nt,maxFeePerGas:rt,to:ot}=o;if(et<=0)throw new InvalidChainIdError({chainId:et});if(ot&&!isAddress(ot))throw new InvalidAddressError({address:ot});if(tt||rt)throw new BaseError$3("`maxFeePerGas`/`maxPriorityFeePerGas` is not a valid EIP-2930 Transaction attribute.");if(nt&&nt>maxUint256)throw new FeeCapTooHighError({maxFeePerGas:nt})}function assertTransactionLegacy(o){const{chainId:et,maxPriorityFeePerGas:tt,gasPrice:nt,maxFeePerGas:rt,to:ot}=o;if(ot&&!isAddress(ot))throw new InvalidAddressError({address:ot});if(typeof et<"u"&&et<=0)throw new InvalidChainIdError({chainId:et});if(tt||rt)throw new BaseError$3("`maxFeePerGas`/`maxPriorityFeePerGas` is not a valid Legacy Transaction attribute.");if(nt&&nt>maxUint256)throw new FeeCapTooHighError({maxFeePerGas:nt})}function serializeAuthorizationList(o){if(!o||o.length===0)return[];const et=[];for(const tt of o){const{contractAddress:nt,chainId:rt,nonce:ot,...it}=tt;et.push([rt?toHex(rt):"0x",nt,ot?toHex(ot):"0x",...toYParitySignatureArray({},it)])}return et}function serializeAccessList(o){if(!o||o.length===0)return[];const et=[];for(let tt=0;tt"u"||typeof pt>"u")){const vt=typeof o.blobs[0]=="string"?o.blobs:o.blobs.map(wt=>bytesToHex$4(wt)),bt=o.kzg,Et=blobsToCommitments({blobs:vt,kzg:bt});if(typeof ht>"u"&&(ht=commitmentsToVersionedHashes({commitments:Et})),typeof pt>"u"){const wt=blobsToProofs({blobs:vt,commitments:Et,kzg:bt});pt=toBlobSidecars({blobs:vt,commitments:Et,proofs:wt})}}const mt=serializeAccessList(lt),ft=[toHex(tt),rt?toHex(rt):"0x",ct?toHex(ct):"0x",at?toHex(at):"0x",nt?toHex(nt):"0x",ot??"0x",it?toHex(it):"0x",dt??"0x",mt,st?toHex(st):"0x",ht??[],...toYParitySignatureArray(o,et)],yt=[],gt=[],xt=[];if(pt)for(let vt=0;vt{if(et.v>=35n)return(et.v-35n)/2n>0?et.v:27n+(et.v===35n?0n:1n);if(tt>0)return BigInt(tt*2)+BigInt(35n+et.v-27n);const pt=27n+(et.v===27n?0n:1n);if(et.v!==pt)throw new InvalidLegacyVError({v:et.v});return pt})(),dt=trim$1(et.r),ht=trim$1(et.s);ct=[...ct,toHex(lt),dt==="0x00"?"0x":dt,ht==="0x00"?"0x":ht]}else tt>0&&(ct=[...ct,toHex(tt),"0x","0x"]);return toRlp(ct)}function toYParitySignatureArray(o,et){const tt=et??o,{v:nt,yParity:rt}=tt;if(typeof tt.r>"u")return[];if(typeof tt.s>"u")return[];if(typeof nt>"u"&&typeof rt>"u")return[];const ot=trim$1(tt.r),it=trim$1(tt.s);return[typeof rt=="number"?rt?toHex(1):"0x":nt===0n?"0x":nt===1n?toHex(1):nt===27n?"0x":toHex(1),ot==="0x00"?"0x":ot,it==="0x00"?"0x":it]}async function signMessage$1(o,{account:et=o.account,message:tt}){if(!et)throw new AccountNotFoundError({docsPath:"/docs/actions/wallet/signMessage"});const nt=parseAccount(et);if(nt.signMessage)return nt.signMessage({message:tt});const rt=typeof tt=="string"?stringToHex(tt):tt.raw instanceof Uint8Array?toHex(tt.raw):tt.raw;return o.request({method:"personal_sign",params:[rt,nt.address]},{retryCount:0})}class HMAC extends Hash{constructor(et,tt){super(),this.finished=!1,this.destroyed=!1,hash$1(et);const nt=toBytes$2(tt);if(this.iHash=et.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const rt=this.blockLen,ot=new Uint8Array(rt);ot.set(nt.length>rt?et.create().update(nt).digest():nt);for(let it=0;itnew HMAC(o,et).update(tt).digest();hmac.create=(o,et)=>new HMAC(o,et);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const _0n$6=BigInt(0),_1n$8=BigInt(1),_2n$5=BigInt(2);function isBytes$2(o){return o instanceof Uint8Array||o!=null&&typeof o=="object"&&o.constructor.name==="Uint8Array"}function abytes(o){if(!isBytes$2(o))throw new Error("Uint8Array expected")}function abool(o,et){if(typeof et!="boolean")throw new Error(`${o} must be valid boolean, got "${et}".`)}const hexes$1=Array.from({length:256},(o,et)=>et.toString(16).padStart(2,"0"));function bytesToHex$2(o){abytes(o);let et="";for(let tt=0;tt=asciis._0&&o<=asciis._9)return o-asciis._0;if(o>=asciis._A&&o<=asciis._F)return o-(asciis._A-10);if(o>=asciis._a&&o<=asciis._f)return o-(asciis._a-10)}function hexToBytes$2(o){if(typeof o!="string")throw new Error("hex string expected, got "+typeof o);const et=o.length,tt=et/2;if(et%2)throw new Error("padded hex string expected, got unpadded hex of length "+et);const nt=new Uint8Array(tt);for(let rt=0,ot=0;rttypeof o=="bigint"&&_0n$6<=o;function inRange(o,et,tt){return isPosBig(o)&&isPosBig(et)&&isPosBig(tt)&&et<=o&&o_0n$6;o>>=_1n$8,et+=1);return et}function bitGet(o,et){return o>>BigInt(et)&_1n$8}function bitSet(o,et,tt){return o|(tt?_1n$8:_0n$6)<(_2n$5<new Uint8Array(o),u8fr=o=>Uint8Array.from(o);function createHmacDrbg(o,et,tt){if(typeof o!="number"||o<2)throw new Error("hashLen must be a number");if(typeof et!="number"||et<2)throw new Error("qByteLen must be a number");if(typeof tt!="function")throw new Error("hmacFn must be a function");let nt=u8n(o),rt=u8n(o),ot=0;const it=()=>{nt.fill(1),rt.fill(0),ot=0},st=(...dt)=>tt(rt,nt,...dt),at=(dt=u8n())=>{rt=st(u8fr([0]),dt),nt=st(),dt.length!==0&&(rt=st(u8fr([1]),dt),nt=st())},ct=()=>{if(ot++>=1e3)throw new Error("drbg: tried 1000 values");let dt=0;const ht=[];for(;dt{it(),at(dt);let pt;for(;!(pt=ht(ct()));)at();return it(),pt}}const validatorFns={bigint:o=>typeof o=="bigint",function:o=>typeof o=="function",boolean:o=>typeof o=="boolean",string:o=>typeof o=="string",stringOrUint8Array:o=>typeof o=="string"||isBytes$2(o),isSafeInteger:o=>Number.isSafeInteger(o),array:o=>Array.isArray(o),field:(o,et)=>et.Fp.isValid(o),hash:o=>typeof o=="function"&&Number.isSafeInteger(o.outputLen)};function validateObject(o,et,tt={}){const nt=(rt,ot,it)=>{const st=validatorFns[ot];if(typeof st!="function")throw new Error(`Invalid validator "${ot}", expected function`);const at=o[rt];if(!(it&&at===void 0)&&!st(at,o))throw new Error(`Invalid param ${String(rt)}=${at} (${typeof at}), expected ${ot}`)};for(const[rt,ot]of Object.entries(et))nt(rt,ot,!1);for(const[rt,ot]of Object.entries(tt))nt(rt,ot,!0);return o}const notImplemented=()=>{throw new Error("not implemented")};function memoized(o){const et=new WeakMap;return(tt,...nt)=>{const rt=et.get(tt);if(rt!==void 0)return rt;const ot=o(tt,...nt);return et.set(tt,ot),ot}}const ut=Object.freeze(Object.defineProperty({__proto__:null,aInRange,abool,abytes,bitGet,bitLen,bitMask,bitSet,bytesToHex:bytesToHex$2,bytesToNumberBE,bytesToNumberLE,concatBytes:concatBytes$1,createHmacDrbg,ensureBytes:ensureBytes$1,equalBytes:equalBytes$1,hexToBytes:hexToBytes$2,hexToNumber:hexToNumber$1,inRange,isBytes:isBytes$2,memoized,notImplemented,numberToBytesBE,numberToBytesLE,numberToHexUnpadded:numberToHexUnpadded$1,numberToVarBytesBE,utf8ToBytes:utf8ToBytes$2,validateObject},Symbol.toStringTag,{value:"Module"}));/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const _0n$5=BigInt(0),_1n$7=BigInt(1),_2n$4=BigInt(2),_3n$3=BigInt(3),_4n=BigInt(4),_5n$1=BigInt(5),_8n$3=BigInt(8);BigInt(9);BigInt(16);function mod$1(o,et){const tt=o%et;return tt>=_0n$5?tt:et+tt}function pow(o,et,tt){if(tt<=_0n$5||et<_0n$5)throw new Error("Expected power/modulo > 0");if(tt===_1n$7)return _0n$5;let nt=_1n$7;for(;et>_0n$5;)et&_1n$7&&(nt=nt*o%tt),o=o*o%tt,et>>=_1n$7;return nt}function pow2$1(o,et,tt){let nt=o;for(;et-- >_0n$5;)nt*=nt,nt%=tt;return nt}function invert$1(o,et){if(o===_0n$5||et<=_0n$5)throw new Error(`invert: expected positive integers, got n=${o} mod=${et}`);let tt=mod$1(o,et),nt=et,rt=_0n$5,ot=_1n$7;for(;tt!==_0n$5;){const st=nt/tt,at=nt%tt,ct=rt-ot*st;nt=tt,tt=at,rt=ot,ot=ct}if(nt!==_1n$7)throw new Error("invert: does not exist");return mod$1(rt,et)}function tonelliShanks(o){const et=(o-_1n$7)/_2n$4;let tt,nt,rt;for(tt=o-_1n$7,nt=0;tt%_2n$4===_0n$5;tt/=_2n$4,nt++);for(rt=_2n$4;rt(mod$1(o,et)&_1n$7)===_1n$7,FIELD_FIELDS=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function validateField(o){const et={ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"},tt=FIELD_FIELDS.reduce((nt,rt)=>(nt[rt]="function",nt),et);return validateObject(o,tt)}function FpPow(o,et,tt){if(tt<_0n$5)throw new Error("Expected power > 0");if(tt===_0n$5)return o.ONE;if(tt===_1n$7)return et;let nt=o.ONE,rt=et;for(;tt>_0n$5;)tt&_1n$7&&(nt=o.mul(nt,rt)),rt=o.sqr(rt),tt>>=_1n$7;return nt}function FpInvertBatch(o,et){const tt=new Array(et.length),nt=et.reduce((ot,it,st)=>o.is0(it)?ot:(tt[st]=ot,o.mul(ot,it)),o.ONE),rt=o.inv(nt);return et.reduceRight((ot,it,st)=>o.is0(it)?ot:(tt[st]=o.mul(ot,tt[st]),o.mul(ot,it)),rt),tt}function nLength(o,et){const tt=et!==void 0?et:o.toString(2).length,nt=Math.ceil(tt/8);return{nBitLength:tt,nByteLength:nt}}function Field$1(o,et,tt=!1,nt={}){if(o<=_0n$5)throw new Error(`Expected Field ORDER > 0, got ${o}`);const{nBitLength:rt,nByteLength:ot}=nLength(o,et);if(ot>2048)throw new Error("Field lengths over 2048 bytes are not supported");const it=FpSqrt(o),st=Object.freeze({ORDER:o,BITS:rt,BYTES:ot,MASK:bitMask(rt),ZERO:_0n$5,ONE:_1n$7,create:at=>mod$1(at,o),isValid:at=>{if(typeof at!="bigint")throw new Error(`Invalid field element: expected bigint, got ${typeof at}`);return _0n$5<=at&&atat===_0n$5,isOdd:at=>(at&_1n$7)===_1n$7,neg:at=>mod$1(-at,o),eql:(at,ct)=>at===ct,sqr:at=>mod$1(at*at,o),add:(at,ct)=>mod$1(at+ct,o),sub:(at,ct)=>mod$1(at-ct,o),mul:(at,ct)=>mod$1(at*ct,o),pow:(at,ct)=>FpPow(st,at,ct),div:(at,ct)=>mod$1(at*invert$1(ct,o),o),sqrN:at=>at*at,addN:(at,ct)=>at+ct,subN:(at,ct)=>at-ct,mulN:(at,ct)=>at*ct,inv:at=>invert$1(at,o),sqrt:nt.sqrt||(at=>it(st,at)),invertBatch:at=>FpInvertBatch(st,at),cmov:(at,ct,lt)=>lt?ct:at,toBytes:at=>tt?numberToBytesLE(at,ot):numberToBytesBE(at,ot),fromBytes:at=>{if(at.length!==ot)throw new Error(`Fp.fromBytes: expected ${ot}, got ${at.length}`);return tt?bytesToNumberLE(at):bytesToNumberBE(at)}});return Object.freeze(st)}function getFieldBytesLength(o){if(typeof o!="bigint")throw new Error("field order must be bigint");const et=o.toString(2).length;return Math.ceil(et/8)}function getMinHashLength(o){const et=getFieldBytesLength(o);return et+Math.ceil(et/2)}function mapHashToField(o,et,tt=!1){const nt=o.length,rt=getFieldBytesLength(et),ot=getMinHashLength(et);if(nt<16||nt1024)throw new Error(`expected ${ot}-1024 bytes of input, got ${nt}`);const it=tt?bytesToNumberBE(o):bytesToNumberLE(o),st=mod$1(it,et-_1n$7)+_1n$7;return tt?numberToBytesLE(st,rt):numberToBytesBE(st,rt)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const _0n$4=BigInt(0),_1n$6=BigInt(1),pointPrecomputes$1=new WeakMap,pointWindowSizes=new WeakMap;function wNAF(o,et){const tt=(ot,it)=>{const st=it.negate();return ot?st:it},nt=ot=>{if(!Number.isSafeInteger(ot)||ot<=0||ot>et)throw new Error(`Wrong window size=${ot}, should be [1..${et}]`)},rt=ot=>{nt(ot);const it=Math.ceil(et/ot)+1,st=2**(ot-1);return{windows:it,windowSize:st}};return{constTimeNegate:tt,unsafeLadder(ot,it){let st=o.ZERO,at=ot;for(;it>_0n$4;)it&_1n$6&&(st=st.add(at)),at=at.double(),it>>=_1n$6;return st},precomputeWindow(ot,it){const{windows:st,windowSize:at}=rt(it),ct=[];let lt=ot,dt=lt;for(let ht=0;ht>=mt,gt>ct&&(gt-=pt,st+=_1n$6);const xt=yt,vt=yt+Math.abs(gt)-1,bt=ft%2!==0,Et=gt<0;gt===0?dt=dt.add(tt(bt,it[xt])):lt=lt.add(tt(Et,it[vt]))}return{p:lt,f:dt}},wNAFCached(ot,it,st){const at=pointWindowSizes.get(ot)||1;let ct=pointPrecomputes$1.get(ot);return ct||(ct=this.precomputeWindow(ot,at),at!==1&&pointPrecomputes$1.set(ot,st(ct))),this.wNAF(at,ct,it)},setWindowSize(ot,it){nt(it),pointWindowSizes.set(ot,it),pointPrecomputes$1.delete(ot)}}}function pippenger(o,et,tt,nt){if(!Array.isArray(tt)||!Array.isArray(nt)||nt.length!==tt.length)throw new Error("arrays of points and scalars must have equal length");nt.forEach((lt,dt)=>{if(!et.isValid(lt))throw new Error(`wrong scalar at index ${dt}`)}),tt.forEach((lt,dt)=>{if(!(lt instanceof o))throw new Error(`wrong point at index ${dt}`)});const rt=bitLen(BigInt(tt.length)),ot=rt>12?rt-3:rt>4?rt-2:rt?2:1,it=(1<=0;lt-=ot){st.fill(o.ZERO);for(let ht=0;ht>BigInt(lt)&BigInt(it));st[mt]=st[mt].add(tt[ht])}let dt=o.ZERO;for(let ht=st.length-1,pt=o.ZERO;ht>0;ht--)pt=pt.add(st[ht]),dt=dt.add(pt);if(ct=ct.add(dt),lt!==0)for(let ht=0;ht{const{Err:tt}=DER;if(o<0||o>256)throw new tt("tlv.encode: wrong tag");if(et.length&1)throw new tt("tlv.encode: unpadded data");const nt=et.length/2,rt=numberToHexUnpadded$1(nt);if(rt.length/2&128)throw new tt("tlv.encode: long form length too big");const ot=nt>127?numberToHexUnpadded$1(rt.length/2|128):"";return`${numberToHexUnpadded$1(o)}${ot}${rt}${et}`},decode(o,et){const{Err:tt}=DER;let nt=0;if(o<0||o>256)throw new tt("tlv.encode: wrong tag");if(et.length<2||et[nt++]!==o)throw new tt("tlv.decode: wrong tlv");const rt=et[nt++],ot=!!(rt&128);let it=0;if(!ot)it=rt;else{const at=rt&127;if(!at)throw new tt("tlv.decode(long): indefinite length not supported");if(at>4)throw new tt("tlv.decode(long): byte length is too big");const ct=et.subarray(nt,nt+at);if(ct.length!==at)throw new tt("tlv.decode: length bytes not complete");if(ct[0]===0)throw new tt("tlv.decode(long): zero leftmost byte");for(const lt of ct)it=it<<8|lt;if(nt+=at,it<128)throw new tt("tlv.decode(long): not minimal encoding")}const st=et.subarray(nt,nt+it);if(st.length!==it)throw new tt("tlv.decode: wrong value length");return{v:st,l:et.subarray(nt+it)}}},_int:{encode(o){const{Err:et}=DER;if(o<_0n$3)throw new et("integer: negative integers are not allowed");let tt=numberToHexUnpadded$1(o);if(Number.parseInt(tt[0],16)&8&&(tt="00"+tt),tt.length&1)throw new et("unexpected assertion");return tt},decode(o){const{Err:et}=DER;if(o[0]&128)throw new et("Invalid signature integer: negative");if(o[0]===0&&!(o[1]&128))throw new et("Invalid signature integer: unnecessary leading zero");return b2n(o)}},toSig(o){const{Err:et,_int:tt,_tlv:nt}=DER,rt=typeof o=="string"?h2b(o):o;abytes(rt);const{v:ot,l:it}=nt.decode(48,rt);if(it.length)throw new et("Invalid signature: left bytes after parsing");const{v:st,l:at}=nt.decode(2,ot),{v:ct,l:lt}=nt.decode(2,at);if(lt.length)throw new et("Invalid signature: left bytes after parsing");return{r:tt.decode(st),s:tt.decode(ct)}},hexFromSig(o){const{_tlv:et,_int:tt}=DER,nt=`${et.encode(2,tt.encode(o.r))}${et.encode(2,tt.encode(o.s))}`;return et.encode(48,nt)}},_0n$3=BigInt(0),_1n$5=BigInt(1);BigInt(2);const _3n$2=BigInt(3);BigInt(4);function weierstrassPoints(o){const et=validatePointOpts(o),{Fp:tt}=et,nt=Field$1(et.n,et.nBitLength),rt=et.toBytes||((ft,yt,gt)=>{const xt=yt.toAffine();return concatBytes$1(Uint8Array.from([4]),tt.toBytes(xt.x),tt.toBytes(xt.y))}),ot=et.fromBytes||(ft=>{const yt=ft.subarray(1),gt=tt.fromBytes(yt.subarray(0,tt.BYTES)),xt=tt.fromBytes(yt.subarray(tt.BYTES,2*tt.BYTES));return{x:gt,y:xt}});function it(ft){const{a:yt,b:gt}=et,xt=tt.sqr(ft),vt=tt.mul(xt,ft);return tt.add(tt.add(vt,tt.mul(ft,yt)),gt)}if(!tt.eql(tt.sqr(et.Gy),it(et.Gx)))throw new Error("bad generator point: equation left != right");function st(ft){return inRange(ft,_1n$5,et.n)}function at(ft){const{allowedPrivateKeyLengths:yt,nByteLength:gt,wrapPrivateKey:xt,n:vt}=et;if(yt&&typeof ft!="bigint"){if(isBytes$2(ft)&&(ft=bytesToHex$2(ft)),typeof ft!="string"||!yt.includes(ft.length))throw new Error("Invalid key");ft=ft.padStart(gt*2,"0")}let bt;try{bt=typeof ft=="bigint"?ft:bytesToNumberBE(ensureBytes$1("private key",ft,gt))}catch{throw new Error(`private key must be ${gt} bytes, hex or bigint, not ${typeof ft}`)}return xt&&(bt=mod$1(bt,vt)),aInRange("private key",bt,_1n$5,vt),bt}function ct(ft){if(!(ft instanceof ht))throw new Error("ProjectivePoint expected")}const lt=memoized((ft,yt)=>{const{px:gt,py:xt,pz:vt}=ft;if(tt.eql(vt,tt.ONE))return{x:gt,y:xt};const bt=ft.is0();yt==null&&(yt=bt?tt.ONE:tt.inv(vt));const Et=tt.mul(gt,yt),wt=tt.mul(xt,yt),kt=tt.mul(vt,yt);if(bt)return{x:tt.ZERO,y:tt.ZERO};if(!tt.eql(kt,tt.ONE))throw new Error("invZ was invalid");return{x:Et,y:wt}}),dt=memoized(ft=>{if(ft.is0()){if(et.allowInfinityPoint&&!tt.is0(ft.py))return;throw new Error("bad point: ZERO")}const{x:yt,y:gt}=ft.toAffine();if(!tt.isValid(yt)||!tt.isValid(gt))throw new Error("bad point: x or y not FE");const xt=tt.sqr(gt),vt=it(yt);if(!tt.eql(xt,vt))throw new Error("bad point: equation left != right");if(!ft.isTorsionFree())throw new Error("bad point: not in prime-order subgroup");return!0});class ht{constructor(yt,gt,xt){if(this.px=yt,this.py=gt,this.pz=xt,yt==null||!tt.isValid(yt))throw new Error("x required");if(gt==null||!tt.isValid(gt))throw new Error("y required");if(xt==null||!tt.isValid(xt))throw new Error("z required");Object.freeze(this)}static fromAffine(yt){const{x:gt,y:xt}=yt||{};if(!yt||!tt.isValid(gt)||!tt.isValid(xt))throw new Error("invalid affine point");if(yt instanceof ht)throw new Error("projective point not allowed");const vt=bt=>tt.eql(bt,tt.ZERO);return vt(gt)&&vt(xt)?ht.ZERO:new ht(gt,xt,tt.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(yt){const gt=tt.invertBatch(yt.map(xt=>xt.pz));return yt.map((xt,vt)=>xt.toAffine(gt[vt])).map(ht.fromAffine)}static fromHex(yt){const gt=ht.fromAffine(ot(ensureBytes$1("pointHex",yt)));return gt.assertValidity(),gt}static fromPrivateKey(yt){return ht.BASE.multiply(at(yt))}static msm(yt,gt){return pippenger(ht,nt,yt,gt)}_setWindowSize(yt){mt.setWindowSize(this,yt)}assertValidity(){dt(this)}hasEvenY(){const{y:yt}=this.toAffine();if(tt.isOdd)return!tt.isOdd(yt);throw new Error("Field doesn't support isOdd")}equals(yt){ct(yt);const{px:gt,py:xt,pz:vt}=this,{px:bt,py:Et,pz:wt}=yt,kt=tt.eql(tt.mul(gt,wt),tt.mul(bt,vt)),It=tt.eql(tt.mul(xt,wt),tt.mul(Et,vt));return kt&&It}negate(){return new ht(this.px,tt.neg(this.py),this.pz)}double(){const{a:yt,b:gt}=et,xt=tt.mul(gt,_3n$2),{px:vt,py:bt,pz:Et}=this;let wt=tt.ZERO,kt=tt.ZERO,It=tt.ZERO,Rt=tt.mul(vt,vt),Pt=tt.mul(bt,bt),jt=tt.mul(Et,Et),Ot=tt.mul(vt,bt);return Ot=tt.add(Ot,Ot),It=tt.mul(vt,Et),It=tt.add(It,It),wt=tt.mul(yt,It),kt=tt.mul(xt,jt),kt=tt.add(wt,kt),wt=tt.sub(Pt,kt),kt=tt.add(Pt,kt),kt=tt.mul(wt,kt),wt=tt.mul(Ot,wt),It=tt.mul(xt,It),jt=tt.mul(yt,jt),Ot=tt.sub(Rt,jt),Ot=tt.mul(yt,Ot),Ot=tt.add(Ot,It),It=tt.add(Rt,Rt),Rt=tt.add(It,Rt),Rt=tt.add(Rt,jt),Rt=tt.mul(Rt,Ot),kt=tt.add(kt,Rt),jt=tt.mul(bt,Et),jt=tt.add(jt,jt),Rt=tt.mul(jt,Ot),wt=tt.sub(wt,Rt),It=tt.mul(jt,Pt),It=tt.add(It,It),It=tt.add(It,It),new ht(wt,kt,It)}add(yt){ct(yt);const{px:gt,py:xt,pz:vt}=this,{px:bt,py:Et,pz:wt}=yt;let kt=tt.ZERO,It=tt.ZERO,Rt=tt.ZERO;const Pt=et.a,jt=tt.mul(et.b,_3n$2);let Ot=tt.mul(gt,bt),Bt=tt.mul(xt,Et),zt=tt.mul(vt,wt),Ft=tt.add(gt,xt),Yt=tt.add(bt,Et);Ft=tt.mul(Ft,Yt),Yt=tt.add(Ot,Bt),Ft=tt.sub(Ft,Yt),Yt=tt.add(gt,vt);let Ht=tt.add(bt,wt);return Yt=tt.mul(Yt,Ht),Ht=tt.add(Ot,zt),Yt=tt.sub(Yt,Ht),Ht=tt.add(xt,vt),kt=tt.add(Et,wt),Ht=tt.mul(Ht,kt),kt=tt.add(Bt,zt),Ht=tt.sub(Ht,kt),Rt=tt.mul(Pt,Yt),kt=tt.mul(jt,zt),Rt=tt.add(kt,Rt),kt=tt.sub(Bt,Rt),Rt=tt.add(Bt,Rt),It=tt.mul(kt,Rt),Bt=tt.add(Ot,Ot),Bt=tt.add(Bt,Ot),zt=tt.mul(Pt,zt),Yt=tt.mul(jt,Yt),Bt=tt.add(Bt,zt),zt=tt.sub(Ot,zt),zt=tt.mul(Pt,zt),Yt=tt.add(Yt,zt),Ot=tt.mul(Bt,Yt),It=tt.add(It,Ot),Ot=tt.mul(Ht,Yt),kt=tt.mul(Ft,kt),kt=tt.sub(kt,Ot),Ot=tt.mul(Ft,Bt),Rt=tt.mul(Ht,Rt),Rt=tt.add(Rt,Ot),new ht(kt,It,Rt)}subtract(yt){return this.add(yt.negate())}is0(){return this.equals(ht.ZERO)}wNAF(yt){return mt.wNAFCached(this,yt,ht.normalizeZ)}multiplyUnsafe(yt){aInRange("scalar",yt,_0n$3,et.n);const gt=ht.ZERO;if(yt===_0n$3)return gt;if(yt===_1n$5)return this;const{endo:xt}=et;if(!xt)return mt.unsafeLadder(this,yt);let{k1neg:vt,k1:bt,k2neg:Et,k2:wt}=xt.splitScalar(yt),kt=gt,It=gt,Rt=this;for(;bt>_0n$3||wt>_0n$3;)bt&_1n$5&&(kt=kt.add(Rt)),wt&_1n$5&&(It=It.add(Rt)),Rt=Rt.double(),bt>>=_1n$5,wt>>=_1n$5;return vt&&(kt=kt.negate()),Et&&(It=It.negate()),It=new ht(tt.mul(It.px,xt.beta),It.py,It.pz),kt.add(It)}multiply(yt){const{endo:gt,n:xt}=et;aInRange("scalar",yt,_1n$5,xt);let vt,bt;if(gt){const{k1neg:Et,k1:wt,k2neg:kt,k2:It}=gt.splitScalar(yt);let{p:Rt,f:Pt}=this.wNAF(wt),{p:jt,f:Ot}=this.wNAF(It);Rt=mt.constTimeNegate(Et,Rt),jt=mt.constTimeNegate(kt,jt),jt=new ht(tt.mul(jt.px,gt.beta),jt.py,jt.pz),vt=Rt.add(jt),bt=Pt.add(Ot)}else{const{p:Et,f:wt}=this.wNAF(yt);vt=Et,bt=wt}return ht.normalizeZ([vt,bt])[0]}multiplyAndAddUnsafe(yt,gt,xt){const vt=ht.BASE,bt=(wt,kt)=>kt===_0n$3||kt===_1n$5||!wt.equals(vt)?wt.multiplyUnsafe(kt):wt.multiply(kt),Et=bt(this,gt).add(bt(yt,xt));return Et.is0()?void 0:Et}toAffine(yt){return lt(this,yt)}isTorsionFree(){const{h:yt,isTorsionFree:gt}=et;if(yt===_1n$5)return!0;if(gt)return gt(ht,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:yt,clearCofactor:gt}=et;return yt===_1n$5?this:gt?gt(ht,this):this.multiplyUnsafe(et.h)}toRawBytes(yt=!0){return abool("isCompressed",yt),this.assertValidity(),rt(ht,this,yt)}toHex(yt=!0){return abool("isCompressed",yt),bytesToHex$2(this.toRawBytes(yt))}}ht.BASE=new ht(et.Gx,et.Gy,tt.ONE),ht.ZERO=new ht(tt.ZERO,tt.ONE,tt.ZERO);const pt=et.nBitLength,mt=wNAF(ht,et.endo?Math.ceil(pt/2):pt);return{CURVE:et,ProjectivePoint:ht,normPrivateKeyToScalar:at,weierstrassEquation:it,isWithinCurveOrder:st}}function validateOpts$2(o){const et=validateBasic(o);return validateObject(et,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...et})}function weierstrass$1(o){const et=validateOpts$2(o),{Fp:tt,n:nt}=et,rt=tt.BYTES+1,ot=2*tt.BYTES+1;function it(zt){return mod$1(zt,nt)}function st(zt){return invert$1(zt,nt)}const{ProjectivePoint:at,normPrivateKeyToScalar:ct,weierstrassEquation:lt,isWithinCurveOrder:dt}=weierstrassPoints({...et,toBytes(zt,Ft,Yt){const Ht=Ft.toAffine(),Ut=tt.toBytes(Ht.x),qt=concatBytes$1;return abool("isCompressed",Yt),Yt?qt(Uint8Array.from([Ft.hasEvenY()?2:3]),Ut):qt(Uint8Array.from([4]),Ut,tt.toBytes(Ht.y))},fromBytes(zt){const Ft=zt.length,Yt=zt[0],Ht=zt.subarray(1);if(Ft===rt&&(Yt===2||Yt===3)){const Ut=bytesToNumberBE(Ht);if(!inRange(Ut,_1n$5,tt.ORDER))throw new Error("Point is not on curve");const qt=lt(Ut);let Lt;try{Lt=tt.sqrt(qt)}catch(Nt){const Gt=Nt instanceof Error?": "+Nt.message:"";throw new Error("Point is not on curve"+Gt)}const Zt=(Lt&_1n$5)===_1n$5;return(Yt&1)===1!==Zt&&(Lt=tt.neg(Lt)),{x:Ut,y:Lt}}else if(Ft===ot&&Yt===4){const Ut=tt.fromBytes(Ht.subarray(0,tt.BYTES)),qt=tt.fromBytes(Ht.subarray(tt.BYTES,2*tt.BYTES));return{x:Ut,y:qt}}else throw new Error(`Point of length ${Ft} was invalid. Expected ${rt} compressed bytes or ${ot} uncompressed bytes`)}}),ht=zt=>bytesToHex$2(numberToBytesBE(zt,et.nByteLength));function pt(zt){const Ft=nt>>_1n$5;return zt>Ft}function mt(zt){return pt(zt)?it(-zt):zt}const ft=(zt,Ft,Yt)=>bytesToNumberBE(zt.slice(Ft,Yt));class yt{constructor(Ft,Yt,Ht){this.r=Ft,this.s=Yt,this.recovery=Ht,this.assertValidity()}static fromCompact(Ft){const Yt=et.nByteLength;return Ft=ensureBytes$1("compactSignature",Ft,Yt*2),new yt(ft(Ft,0,Yt),ft(Ft,Yt,2*Yt))}static fromDER(Ft){const{r:Yt,s:Ht}=DER.toSig(ensureBytes$1("DER",Ft));return new yt(Yt,Ht)}assertValidity(){aInRange("r",this.r,_1n$5,nt),aInRange("s",this.s,_1n$5,nt)}addRecoveryBit(Ft){return new yt(this.r,this.s,Ft)}recoverPublicKey(Ft){const{r:Yt,s:Ht,recovery:Ut}=this,qt=wt(ensureBytes$1("msgHash",Ft));if(Ut==null||![0,1,2,3].includes(Ut))throw new Error("recovery id invalid");const Lt=Ut===2||Ut===3?Yt+et.n:Yt;if(Lt>=tt.ORDER)throw new Error("recovery id 2 or 3 invalid");const Zt=Ut&1?"03":"02",Qt=at.fromHex(Zt+ht(Lt)),Nt=st(Lt),Gt=it(-qt*Nt),nn=it(Ht*Nt),Wt=at.BASE.multiplyAndAddUnsafe(Qt,Gt,nn);if(!Wt)throw new Error("point at infinify");return Wt.assertValidity(),Wt}hasHighS(){return pt(this.s)}normalizeS(){return this.hasHighS()?new yt(this.r,it(-this.s),this.recovery):this}toDERRawBytes(){return hexToBytes$2(this.toDERHex())}toDERHex(){return DER.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return hexToBytes$2(this.toCompactHex())}toCompactHex(){return ht(this.r)+ht(this.s)}}const gt={isValidPrivateKey(zt){try{return ct(zt),!0}catch{return!1}},normPrivateKeyToScalar:ct,randomPrivateKey:()=>{const zt=getMinHashLength(et.n);return mapHashToField(et.randomBytes(zt),et.n)},precompute(zt=8,Ft=at.BASE){return Ft._setWindowSize(zt),Ft.multiply(BigInt(3)),Ft}};function xt(zt,Ft=!0){return at.fromPrivateKey(zt).toRawBytes(Ft)}function vt(zt){const Ft=isBytes$2(zt),Yt=typeof zt=="string",Ht=(Ft||Yt)&&zt.length;return Ft?Ht===rt||Ht===ot:Yt?Ht===2*rt||Ht===2*ot:zt instanceof at}function bt(zt,Ft,Yt=!0){if(vt(zt))throw new Error("first arg must be private key");if(!vt(Ft))throw new Error("second arg must be public key");return at.fromHex(Ft).multiply(ct(zt)).toRawBytes(Yt)}const Et=et.bits2int||function(zt){const Ft=bytesToNumberBE(zt),Yt=zt.length*8-et.nBitLength;return Yt>0?Ft>>BigInt(Yt):Ft},wt=et.bits2int_modN||function(zt){return it(Et(zt))},kt=bitMask(et.nBitLength);function It(zt){return aInRange(`num < 2^${et.nBitLength}`,zt,_0n$3,kt),numberToBytesBE(zt,et.nByteLength)}function Rt(zt,Ft,Yt=Pt){if(["recovered","canonical"].some(Xt=>Xt in Yt))throw new Error("sign() legacy options not supported");const{hash:Ht,randomBytes:Ut}=et;let{lowS:qt,prehash:Lt,extraEntropy:Zt}=Yt;qt==null&&(qt=!0),zt=ensureBytes$1("msgHash",zt),validateSigVerOpts(Yt),Lt&&(zt=ensureBytes$1("prehashed msgHash",Ht(zt)));const Qt=wt(zt),Nt=ct(Ft),Gt=[It(Nt),It(Qt)];if(Zt!=null&&Zt!==!1){const Xt=Zt===!0?Ut(tt.BYTES):Zt;Gt.push(ensureBytes$1("extraEntropy",Xt))}const nn=concatBytes$1(...Gt),Wt=Qt;function hn(Xt){const Jt=Et(Xt);if(!dt(Jt))return;const tn=st(Jt),_t=at.BASE.multiply(Jt).toAffine(),Dt=it(_t.x);if(Dt===_0n$3)return;const Vt=it(tn*it(Wt+Dt*Nt));if(Vt===_0n$3)return;let en=(_t.x===Dt?0:2)|Number(_t.y&_1n$5),an=Vt;return qt&&pt(Vt)&&(an=mt(Vt),en^=1),new yt(Dt,an,en)}return{seed:nn,k2sig:hn}}const Pt={lowS:et.lowS,prehash:!1},jt={lowS:et.lowS,prehash:!1};function Ot(zt,Ft,Yt=Pt){const{seed:Ht,k2sig:Ut}=Rt(zt,Ft,Yt),qt=et;return createHmacDrbg(qt.hash.outputLen,qt.nByteLength,qt.hmac)(Ht,Ut)}at.BASE._setWindowSize(8);function Bt(zt,Ft,Yt,Ht=jt){var _t;const Ut=zt;if(Ft=ensureBytes$1("msgHash",Ft),Yt=ensureBytes$1("publicKey",Yt),"strict"in Ht)throw new Error("options.strict was renamed to lowS");validateSigVerOpts(Ht);const{lowS:qt,prehash:Lt}=Ht;let Zt,Qt;try{if(typeof Ut=="string"||isBytes$2(Ut))try{Zt=yt.fromDER(Ut)}catch(Dt){if(!(Dt instanceof DER.Err))throw Dt;Zt=yt.fromCompact(Ut)}else if(typeof Ut=="object"&&typeof Ut.r=="bigint"&&typeof Ut.s=="bigint"){const{r:Dt,s:Vt}=Ut;Zt=new yt(Dt,Vt)}else throw new Error("PARSE");Qt=at.fromHex(Yt)}catch(Dt){if(Dt.message==="PARSE")throw new Error("signature must be Signature instance, Uint8Array or hex string");return!1}if(qt&&Zt.hasHighS())return!1;Lt&&(Ft=et.hash(Ft));const{r:Nt,s:Gt}=Zt,nn=wt(Ft),Wt=st(Gt),hn=it(nn*Wt),Xt=it(Nt*Wt),Jt=(_t=at.BASE.multiplyAndAddUnsafe(Qt,hn,Xt))==null?void 0:_t.toAffine();return Jt?it(Jt.x)===Nt:!1}return{CURVE:et,getPublicKey:xt,getSharedSecret:bt,sign:Ot,verify:Bt,ProjectivePoint:at,Signature:yt,utils:gt}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function getHash(o){return{hash:o,hmac:(et,...tt)=>hmac(o,et,concatBytes$2(...tt)),randomBytes:randomBytes$1}}function createCurve(o,et){const tt=nt=>weierstrass$1({...o,...getHash(nt)});return Object.freeze({...tt(et),create:tt})}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const secp256k1P=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),secp256k1N=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),_1n$4=BigInt(1),_2n$3=BigInt(2),divNearest$1=(o,et)=>(o+et/_2n$3)/et;function sqrtMod$1(o){const et=secp256k1P,tt=BigInt(3),nt=BigInt(6),rt=BigInt(11),ot=BigInt(22),it=BigInt(23),st=BigInt(44),at=BigInt(88),ct=o*o*o%et,lt=ct*ct*o%et,dt=pow2$1(lt,tt,et)*lt%et,ht=pow2$1(dt,tt,et)*lt%et,pt=pow2$1(ht,_2n$3,et)*ct%et,mt=pow2$1(pt,rt,et)*pt%et,ft=pow2$1(mt,ot,et)*mt%et,yt=pow2$1(ft,st,et)*ft%et,gt=pow2$1(yt,at,et)*yt%et,xt=pow2$1(gt,st,et)*ft%et,vt=pow2$1(xt,tt,et)*lt%et,bt=pow2$1(vt,it,et)*mt%et,Et=pow2$1(bt,nt,et)*ct%et,wt=pow2$1(Et,_2n$3,et);if(!Fp$1.eql(Fp$1.sqr(wt),o))throw new Error("Cannot find square root");return wt}const Fp$1=Field$1(secp256k1P,void 0,void 0,{sqrt:sqrtMod$1}),secp256k1=createCurve({a:BigInt(0),b:BigInt(7),Fp:Fp$1,n:secp256k1N,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:o=>{const et=secp256k1N,tt=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),nt=-_1n$4*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),rt=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),ot=tt,it=BigInt("0x100000000000000000000000000000000"),st=divNearest$1(ot*o,et),at=divNearest$1(-nt*o,et);let ct=mod$1(o-st*tt-at*rt,et),lt=mod$1(-st*nt-at*ot,et);const dt=ct>it,ht=lt>it;if(dt&&(ct=et-ct),ht&&(lt=et-lt),ct>it||lt>it)throw new Error("splitScalar: Endomorphism failed, k="+o);return{k1neg:dt,k1:ct,k2neg:ht,k2:lt}}}},sha256$2);BigInt(0);secp256k1.ProjectivePoint;function getAction(o,et,tt){const nt=o[et.name];if(typeof nt=="function")return nt;const rt=o[tt];return typeof rt=="function"?rt:ot=>et(o,ot)}const version$6="2.14.4",getVersion$1=()=>`@wagmi/core@${version$6}`;var __classPrivateFieldGet$1=function(o,et,tt,nt){if(tt==="a"&&!nt)throw new TypeError("Private accessor was defined without a getter");if(typeof et=="function"?o!==et||!nt:!et.has(o))throw new TypeError("Cannot read private member from an object whose class did not declare it");return tt==="m"?nt:tt==="a"?nt.call(o):nt?nt.value:et.get(o)},_BaseError_instances,_BaseError_walk;let BaseError$1=class As extends Error{get docsBaseUrl(){return"https://wagmi.sh/core"}get version(){return getVersion$1()}constructor(et,tt={}){var ot;super(),_BaseError_instances.add(this),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:"WagmiCoreError"});const nt=tt.cause instanceof As?tt.cause.details:(ot=tt.cause)!=null&&ot.message?tt.cause.message:tt.details,rt=tt.cause instanceof As&&tt.cause.docsPath||tt.docsPath;this.message=[et||"An error occurred.","",...tt.metaMessages?[...tt.metaMessages,""]:[],...rt?[`Docs: ${this.docsBaseUrl}${rt}.html${tt.docsSlug?`#${tt.docsSlug}`:""}`]:[],...nt?[`Details: ${nt}`]:[],`Version: ${this.version}`].join(` +`),tt.cause&&(this.cause=tt.cause),this.details=nt,this.docsPath=rt,this.metaMessages=tt.metaMessages,this.shortMessage=et}walk(et){return __classPrivateFieldGet$1(this,_BaseError_instances,"m",_BaseError_walk).call(this,this,et)}};_BaseError_instances=new WeakSet,_BaseError_walk=function o(et,tt){return tt!=null&&tt(et)?et:et.cause?__classPrivateFieldGet$1(this,_BaseError_instances,"m",o).call(this,et.cause,tt):et};class ChainNotConfiguredError extends BaseError$1{constructor(){super("Chain not configured."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ChainNotConfiguredError"})}}class ConnectorAlreadyConnectedError extends BaseError$1{constructor(){super("Connector already connected."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ConnectorAlreadyConnectedError"})}}class ConnectorNotConnectedError extends BaseError$1{constructor(){super("Connector not connected."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ConnectorNotConnectedError"})}}class ConnectorAccountNotFoundError extends BaseError$1{constructor({address:et,connector:tt}){super(`Account "${et}" not found for connector "${tt.name}".`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ConnectorAccountNotFoundError"})}}class ConnectorChainMismatchError extends BaseError$1{constructor({connectionChainId:et,connectorChainId:tt}){super(`The current chain of the connector (id: ${tt}) does not match the connection's chain (id: ${et}).`,{metaMessages:[`Current Chain ID: ${tt}`,`Expected Chain ID: ${et}`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ConnectorChainMismatchError"})}}class ConnectorUnavailableReconnectingError extends BaseError$1{constructor({connector:et}){super(`Connector "${et.name}" unavailable while reconnecting.`,{details:["During the reconnection step, the only connector methods guaranteed to be available are: `id`, `name`, `type`, `uuid`.","All other methods are not guaranteed to be available until reconnection completes and connectors are fully restored.","This error commonly occurs for connectors that asynchronously inject after reconnection has already started."].join(" ")}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ConnectorUnavailableReconnectingError"})}}async function connect$1(o,et){var nt;let tt;if(typeof et.connector=="function"?tt=o._internal.connectors.setup(et.connector):tt=et.connector,tt.uid===o.state.current)throw new ConnectorAlreadyConnectedError;try{o.setState(it=>({...it,status:"connecting"})),tt.emitter.emit("message",{type:"connecting"});const rt=await tt.connect({chainId:et.chainId}),ot=rt.accounts;return tt.emitter.off("connect",o._internal.events.connect),tt.emitter.on("change",o._internal.events.change),tt.emitter.on("disconnect",o._internal.events.disconnect),await((nt=o.storage)==null?void 0:nt.setItem("recentConnectorId",tt.id)),o.setState(it=>({...it,connections:new Map(it.connections).set(tt.uid,{accounts:ot,chainId:rt.chainId,connector:tt}),current:tt.uid,status:"connected"})),{accounts:ot,chainId:rt.chainId}}catch(rt){throw o.setState(ot=>({...ot,status:ot.current?"connected":"disconnected"})),rt}}const size$1=256;let index$3=size$1,buffer$1;function uid$1(o=11){if(!buffer$1||index$3+o>size$1*2){buffer$1="",index$3=0;for(let et=0;et{const xt=gt(yt);for(const bt in mt)delete xt[bt];const vt={...yt,...xt};return Object.assign(vt,{extend:ft(vt)})}}return Object.assign(mt,{extend:ft(mt)})}function createTransport({key:o,name:et,request:tt,retryCount:nt=3,retryDelay:rt=150,timeout:ot,type:it},st){const at=uid$1();return{config:{key:o,name:et,request:tt,retryCount:nt,retryDelay:rt,timeout:ot,type:it},request:buildRequest(tt,{retryCount:nt,retryDelay:rt,uid:at}),value:st}}function custom(o,et={}){const{key:tt="custom",name:nt="Custom Provider",retryDelay:rt}=et;return({retryCount:ot})=>createTransport({key:tt,name:nt,request:o.request.bind(o),retryCount:et.retryCount??ot,retryDelay:rt,type:"custom"})}class UrlRequiredError extends BaseError$3{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 http(o,et={}){const{batch:tt,fetchOptions:nt,key:rt="http",name:ot="HTTP JSON-RPC",onFetchRequest:it,onFetchResponse:st,retryDelay:at}=et;return({chain:ct,retryCount:lt,timeout:dt})=>{const{batchSize:ht=1e3,wait:pt=0}=typeof tt=="object"?tt:{},mt=et.retryCount??lt,ft=dt??et.timeout??1e4,yt=ct==null?void 0:ct.rpcUrls.default.http[0];if(!yt)throw new UrlRequiredError;const gt=getHttpRpcClient(yt,{fetchOptions:nt,onRequest:it,onResponse:st,timeout:ft});return createTransport({key:rt,name:ot,async request({method:xt,params:vt}){const bt={method:xt,params:vt},{schedule:Et}=createBatchScheduler({id:yt,wait:pt,shouldSplitBatch(Rt){return Rt.length>ht},fn:Rt=>gt.request({body:Rt}),sort:(Rt,Pt)=>Rt.id-Pt.id}),wt=async Rt=>tt?Et(Rt):[await gt.request({body:Rt})],[{error:kt,result:It}]=await wt(bt);if(kt)throw new RpcRequestError({body:bt,error:kt,url:yt});return It},retryCount:mt,retryDelay:at,timeout:ft,type:"http"},{fetchOptions:nt,url:yt})}}async function getConnectorClient(o,et={}){let tt;if(et.connector){const{connector:ct}=et;if(o.state.status==="reconnecting"&&!ct.getAccounts&&!ct.getChainId)throw new ConnectorUnavailableReconnectingError({connector:ct});const[lt,dt]=await Promise.all([ct.getAccounts(),ct.getChainId()]);tt={accounts:lt,chainId:dt,connector:ct}}else tt=o.state.connections.get(o.state.current);if(!tt)throw new ConnectorNotConnectedError;const nt=et.chainId??tt.chainId,rt=await tt.connector.getChainId();if(rt!==tt.chainId)throw new ConnectorChainMismatchError({connectionChainId:tt.chainId,connectorChainId:rt});const ot=tt.connector;if(ot.getClient)return ot.getClient({chainId:nt});const it=parseAccount(et.account??tt.accounts[0]);if(it.address=getAddress(it.address),et.account&&!tt.accounts.some(ct=>ct.toLowerCase()===it.address.toLowerCase()))throw new ConnectorAccountNotFoundError({address:it.address,connector:ot});const st=o.chains.find(ct=>ct.id===nt),at=await tt.connector.getProvider({chainId:nt});return createClient({account:it,chain:st,name:"Connector Client",transport:ct=>custom(at)({...ct,retryCount:0})})}async function disconnect(o,et={}){var rt,ot;let tt;if(et.connector)tt=et.connector;else{const{connections:it,current:st}=o.state,at=it.get(st);tt=at==null?void 0:at.connector}const nt=o.state.connections;tt&&(await tt.disconnect(),tt.emitter.off("change",o._internal.events.change),tt.emitter.off("disconnect",o._internal.events.disconnect),tt.emitter.on("connect",o._internal.events.connect),nt.delete(tt.uid)),o.setState(it=>{if(nt.size===0)return{...it,connections:new Map,current:null,status:"disconnected"};const st=nt.values().next().value;return{...it,connections:new Map(nt),current:st.connector.uid}});{const it=o.state.current;if(!it)return;const st=(rt=o.state.connections.get(it))==null?void 0:rt.connector;if(!st)return;await((ot=o.storage)==null?void 0:ot.setItem("recentConnectorId",st.id))}}function getUnit(o){return typeof o=="number"?o:o==="wei"?0:Math.abs(weiUnits[o])}function getAccount(o){const et=o.state.current,tt=o.state.connections.get(et),nt=tt==null?void 0:tt.accounts,rt=nt==null?void 0:nt[0],ot=o.chains.find(st=>st.id===(tt==null?void 0:tt.chainId)),it=o.state.status;switch(it){case"connected":return{address:rt,addresses:nt,chain:ot,chainId:tt==null?void 0:tt.chainId,connector:tt==null?void 0:tt.connector,isConnected:!0,isConnecting:!1,isDisconnected:!1,isReconnecting:!1,status:it};case"reconnecting":return{address:rt,addresses:nt,chain:ot,chainId:tt==null?void 0:tt.chainId,connector:tt==null?void 0:tt.connector,isConnected:!!rt,isConnecting:!1,isDisconnected:!1,isReconnecting:!0,status:it};case"connecting":return{address:rt,addresses:nt,chain:ot,chainId:tt==null?void 0:tt.chainId,connector:tt==null?void 0:tt.connector,isConnected:!1,isConnecting:!0,isDisconnected:!1,isReconnecting:!1,status:it};case"disconnected":return{address:void 0,addresses:void 0,chain:void 0,chainId:void 0,connector:void 0,isConnected:!1,isConnecting:!1,isDisconnected:!0,isReconnecting:!1,status:it}}}async function multicall(o,et){const{allowFailure:tt=!0,chainId:nt,contracts:rt,...ot}=et,it=o.getClient({chainId:nt});return getAction(it,multicall$1,"multicall")({allowFailure:tt,contracts:rt,...ot})}function readContract(o,et){const{chainId:tt,...nt}=et,rt=o.getClient({chainId:tt});return getAction(rt,readContract$1,"readContract")(nt)}async function readContracts(o,et){var st;const{allowFailure:tt=!0,blockNumber:nt,blockTag:rt,...ot}=et,it=et.contracts;try{const at={};for(const[ht,pt]of it.entries()){const mt=pt.chainId??o.state.chainId;at[mt]||(at[mt]=[]),(st=at[mt])==null||st.push({contract:pt,index:ht})}const ct=()=>Object.entries(at).map(([ht,pt])=>multicall(o,{...ot,allowFailure:tt,blockNumber:nt,blockTag:rt,chainId:Number.parseInt(ht),contracts:pt.map(({contract:mt})=>mt)})),lt=(await Promise.all(ct())).flat(),dt=Object.values(at).flatMap(ht=>ht.map(({index:pt})=>pt));return lt.reduce((ht,pt,mt)=>(ht&&(ht[dt[mt]]=pt),ht),[])}catch(at){if(at instanceof ContractFunctionExecutionError)throw at;const ct=()=>it.map(lt=>readContract(o,{...lt,blockNumber:nt,blockTag:rt}));return tt?(await Promise.allSettled(ct())).map(lt=>lt.status==="fulfilled"?{result:lt.value,status:"success"}:{error:lt.reason,result:void 0,status:"failure"}):await Promise.all(ct())}}async function getBalance(o,et){const{address:tt,blockNumber:nt,blockTag:rt,chainId:ot,token:it,unit:st="ether"}=et;if(it)try{return await getTokenBalance(o,{balanceAddress:tt,chainId:ot,symbolType:"string",tokenAddress:it})}catch(ht){if(ht.name==="ContractFunctionExecutionError"){const pt=await getTokenBalance(o,{balanceAddress:tt,chainId:ot,symbolType:"bytes32",tokenAddress:it}),mt=hexToString(trim$1(pt.symbol,{dir:"right"}));return{...pt,symbol:mt}}throw ht}const at=o.getClient({chainId:ot}),lt=await getAction(at,getBalance$1,"getBalance")(nt?{address:tt,blockNumber:nt}:{address:tt,blockTag:rt}),dt=o.chains.find(ht=>ht.id===ot)??at.chain;return{decimals:dt.nativeCurrency.decimals,formatted:formatUnits(lt,getUnit(st)),symbol:dt.nativeCurrency.symbol,value:lt}}async function getTokenBalance(o,et){const{balanceAddress:tt,chainId:nt,symbolType:rt,tokenAddress:ot,unit:it}=et,st={abi:[{type:"function",name:"balanceOf",stateMutability:"view",inputs:[{type:"address"}],outputs:[{type:"uint256"}]},{type:"function",name:"decimals",stateMutability:"view",inputs:[],outputs:[{type:"uint8"}]},{type:"function",name:"symbol",stateMutability:"view",inputs:[],outputs:[{type:rt}]}],address:ot},[at,ct,lt]=await readContracts(o,{allowFailure:!1,contracts:[{...st,functionName:"balanceOf",args:[tt],chainId:nt},{...st,functionName:"decimals",chainId:nt},{...st,functionName:"symbol",chainId:nt}]}),dt=formatUnits(at??"0",getUnit(it??ct));return{decimals:ct,formatted:dt,symbol:lt,value:at}}function getBlockNumber(o,et={}){const{chainId:tt,...nt}=et,rt=o.getClient({chainId:tt});return getAction(rt,getBlockNumber$1,"getBlockNumber")(nt)}function getChainId(o){return o.state.chainId}function deepEqual(o,et){if(o===et)return!0;if(o&&et&&typeof o=="object"&&typeof et=="object"){if(o.constructor!==et.constructor)return!1;let tt,nt;if(Array.isArray(o)&&Array.isArray(et)){if(tt=o.length,tt!==et.length)return!1;for(nt=tt;nt--!==0;)if(!deepEqual(o[nt],et[nt]))return!1;return!0}if(o.valueOf!==Object.prototype.valueOf)return o.valueOf()===et.valueOf();if(o.toString!==Object.prototype.toString)return o.toString()===et.toString();const rt=Object.keys(o);if(tt=rt.length,tt!==Object.keys(et).length)return!1;for(nt=tt;nt--!==0;)if(!Object.prototype.hasOwnProperty.call(et,rt[nt]))return!1;for(nt=tt;nt--!==0;){const ot=rt[nt];if(ot&&!deepEqual(o[ot],et[ot]))return!1}return!0}return o!==o&&et!==et}let previousChains=[];function getChains(o){const et=o.chains;return deepEqual(previousChains,et)?previousChains:(previousChains=et,et)}let previousConnections=[];function getConnections(o){const et=[...o.state.connections.values()];return o.state.status==="reconnecting"||deepEqual(previousConnections,et)?previousConnections:(previousConnections=et,et)}let previousConnectors=[];function getConnectors(o){const et=o.connectors;return deepEqual(previousConnectors,et)?previousConnectors:(previousConnectors=et,et)}function getEnsAddress(o,et){const{chainId:tt,...nt}=et,rt=o.getClient({chainId:tt});return getAction(rt,getEnsAddress$1,"getEnsAddress")(nt)}function getEnsAvatar(o,et){const{chainId:tt,...nt}=et,rt=o.getClient({chainId:tt});return getAction(rt,getEnsAvatar$1,"getEnsAvatar")(nt)}function getEnsName(o,et){const{chainId:tt,...nt}=et,rt=o.getClient({chainId:tt});return getAction(rt,getEnsName$1,"getEnsName")(nt)}let isReconnecting=!1;async function reconnect(o,et={}){var ct,lt;if(isReconnecting)return[];isReconnecting=!0,o.setState(dt=>({...dt,status:dt.current?"reconnecting":"connecting"}));const tt=[];if((ct=et.connectors)!=null&&ct.length)for(const dt of et.connectors){let ht;typeof dt=="function"?ht=o._internal.connectors.setup(dt):ht=dt,tt.push(ht)}else tt.push(...o.connectors);let nt;try{nt=await((lt=o.storage)==null?void 0:lt.getItem("recentConnectorId"))}catch{}const rt={};for(const[,dt]of o.state.connections)rt[dt.connector.id]=1;nt&&(rt[nt]=0);const ot=Object.keys(rt).length>0?[...tt].sort((dt,ht)=>(rt[dt.id]??10)-(rt[ht.id]??10)):tt;let it=!1;const st=[],at=[];for(const dt of ot){const ht=await dt.getProvider().catch(()=>{});if(!ht||at.some(ft=>ft===ht)||!await dt.isAuthorized())continue;const mt=await dt.connect({isReconnecting:!0}).catch(()=>null);mt&&(dt.emitter.off("connect",o._internal.events.connect),dt.emitter.on("change",o._internal.events.change),dt.emitter.on("disconnect",o._internal.events.disconnect),o.setState(ft=>{const yt=new Map(it?ft.connections:new Map).set(dt.uid,{accounts:mt.accounts,chainId:mt.chainId,connector:dt});return{...ft,current:it?ft.current:dt.uid,connections:yt}}),st.push({accounts:mt.accounts,chainId:mt.chainId,connector:dt}),at.push(ht),it=!0)}return(o.state.status==="reconnecting"||o.state.status==="connecting")&&(it?o.setState(dt=>({...dt,status:"connected"})):o.setState(dt=>({...dt,connections:new Map,current:null,status:"disconnected"}))),isReconnecting=!1,st}async function signMessage(o,et){const{account:tt,connector:nt,...rt}=et;let ot;return typeof tt=="object"&&tt.type==="local"?ot=o.getClient():ot=await getConnectorClient(o,{account:tt,connector:nt}),getAction(ot,signMessage$1,"signMessage")({...rt,...tt?{account:tt}:{}})}class ProviderNotFoundError extends BaseError$1{constructor(){super("Provider not found."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ProviderNotFoundError"})}}class SwitchChainNotSupportedError extends BaseError$1{constructor({connector:et}){super(`"${et.name}" does not support programmatic chain switching.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"SwitchChainNotSupportedError"})}}async function switchChain(o,et){var it;const{addEthereumChainParameter:tt,chainId:nt}=et,rt=o.state.connections.get(((it=et.connector)==null?void 0:it.uid)??o.state.current);if(rt){const st=rt.connector;if(!st.switchChain)throw new SwitchChainNotSupportedError({connector:st});return await st.switchChain({addEthereumChainParameter:tt,chainId:nt})}const ot=o.chains.find(st=>st.id===nt);if(!ot)throw new ChainNotConfiguredError;return o.setState(st=>({...st,chainId:nt})),ot}function watchAccount(o,et){const{onChange:tt}=et;return o.subscribe(()=>getAccount(o),tt,{equalityFn(nt,rt){const{connector:ot,...it}=nt,{connector:st,...at}=rt;return deepEqual(it,at)&&(ot==null?void 0:ot.id)===(st==null?void 0:st.id)&&(ot==null?void 0:ot.uid)===(st==null?void 0:st.uid)}})}function watchBlockNumber(o,et){const{syncConnectedChain:tt=o._internal.syncConnectedChain,...nt}=et;let rt;const ot=at=>{rt&&rt();const ct=o.getClient({chainId:at});return rt=getAction(ct,watchBlockNumber$1,"watchBlockNumber")(nt),rt},it=ot(et.chainId);let st;return tt&&!et.chainId&&(st=o.subscribe(({chainId:at})=>at,async at=>ot(at))),()=>{it==null||it(),st==null||st()}}function watchChainId(o,et){const{onChange:tt}=et;return o.subscribe(nt=>nt.chainId,tt)}function watchConnections(o,et){const{onChange:tt}=et;return o.subscribe(()=>getConnections(o),tt,{equalityFn:deepEqual})}function watchConnectors(o,et){const{onChange:tt}=et;return o._internal.connectors.subscribe((nt,rt)=>{tt(Object.values(nt),rt)})}function createConnector(o){return o}const supportsSimulationIdRegex=/(rabby|trustwallet)/;injected.type="injected";function injected(o={}){const{shimDisconnect:et=!0,unstable_shimAsyncInject:tt}=o;function nt(){const at=o.target;if(typeof at=="function"){const ct=at();if(ct)return ct}return typeof at=="object"?at:typeof at=="string"?{...targetMap[at]??{id:at,name:`${at[0].toUpperCase()}${at.slice(1)}`,provider:`is${at[0].toUpperCase()}${at.slice(1)}`}}:{id:"injected",name:"Injected",provider(ct){return ct==null?void 0:ct.ethereum}}}let rt,ot,it,st;return at=>({get icon(){return nt().icon},get id(){return nt().id},get name(){return nt().name},get supportsSimulation(){return supportsSimulationIdRegex.test(this.id.toLowerCase())},type:injected.type,async setup(){const ct=await this.getProvider();ct!=null&&ct.on&&o.target&&(it||(it=this.onConnect.bind(this),ct.on("connect",it)),rt||(rt=this.onAccountsChanged.bind(this),ct.on("accountsChanged",rt)))},async connect({chainId:ct,isReconnecting:lt}={}){var pt,mt,ft,yt,gt,xt;const dt=await this.getProvider();if(!dt)throw new ProviderNotFoundError;let ht=[];if(lt)ht=await this.getAccounts().catch(()=>[]);else if(et)try{ht=(yt=(ft=(mt=(pt=(await dt.request({method:"wallet_requestPermissions",params:[{eth_accounts:{}}]}))[0])==null?void 0:pt.caveats)==null?void 0:mt[0])==null?void 0:ft.value)==null?void 0:yt.map(bt=>getAddress(bt)),ht.length>0&&(ht=await this.getAccounts())}catch(vt){const bt=vt;if(bt.code===UserRejectedRequestError.code)throw new UserRejectedRequestError(bt);if(bt.code===ResourceUnavailableRpcError.code)throw bt}try{!(ht!=null&&ht.length)&&!lt&&(ht=(await dt.request({method:"eth_requestAccounts"})).map(Et=>getAddress(Et))),it&&(dt.removeListener("connect",it),it=void 0),rt||(rt=this.onAccountsChanged.bind(this),dt.on("accountsChanged",rt)),ot||(ot=this.onChainChanged.bind(this),dt.on("chainChanged",ot)),st||(st=this.onDisconnect.bind(this),dt.on("disconnect",st));let vt=await this.getChainId();if(ct&&vt!==ct){const bt=await this.switchChain({chainId:ct}).catch(Et=>{if(Et.code===UserRejectedRequestError.code)throw Et;return{id:vt}});vt=(bt==null?void 0:bt.id)??vt}return et&&await((gt=at.storage)==null?void 0:gt.removeItem(`${this.id}.disconnected`)),o.target||await((xt=at.storage)==null?void 0:xt.setItem("injected.connected",!0)),{accounts:ht,chainId:vt}}catch(vt){const bt=vt;throw bt.code===UserRejectedRequestError.code?new UserRejectedRequestError(bt):bt.code===ResourceUnavailableRpcError.code?new ResourceUnavailableRpcError(bt):bt}},async disconnect(){var lt,dt;const ct=await this.getProvider();if(!ct)throw new ProviderNotFoundError;ot&&(ct.removeListener("chainChanged",ot),ot=void 0),st&&(ct.removeListener("disconnect",st),st=void 0),it||(it=this.onConnect.bind(this),ct.on("connect",it));try{await withTimeout(()=>ct.request({method:"wallet_revokePermissions",params:[{eth_accounts:{}}]}),{timeout:100})}catch{}et&&await((lt=at.storage)==null?void 0:lt.setItem(`${this.id}.disconnected`,!0)),o.target||await((dt=at.storage)==null?void 0:dt.removeItem("injected.connected"))},async getAccounts(){const ct=await this.getProvider();if(!ct)throw new ProviderNotFoundError;return(await ct.request({method:"eth_accounts"})).map(dt=>getAddress(dt))},async getChainId(){const ct=await this.getProvider();if(!ct)throw new ProviderNotFoundError;const lt=await ct.request({method:"eth_chainId"});return Number(lt)},async getProvider(){if(typeof window>"u")return;let ct;const lt=nt();return typeof lt.provider=="function"?ct=lt.provider(window):typeof lt.provider=="string"?ct=findProvider(window,lt.provider):ct=lt.provider,ct&&!ct.removeListener&&("off"in ct&&typeof ct.off=="function"?ct.removeListener=ct.off:ct.removeListener=()=>{}),ct},async isAuthorized(){var ct,lt;try{if(et&&await((ct=at.storage)==null?void 0:ct.getItem(`${this.id}.disconnected`))||!o.target&&!await((lt=at.storage)==null?void 0:lt.getItem("injected.connected")))return!1;if(!await this.getProvider()){if(tt!==void 0&&tt!==!1){const mt=async()=>(typeof window<"u"&&window.removeEventListener("ethereum#initialized",mt),!!await this.getProvider()),ft=typeof tt=="number"?tt:1e3;if(await Promise.race([...typeof window<"u"?[new Promise(gt=>window.addEventListener("ethereum#initialized",()=>gt(mt()),{once:!0}))]:[],new Promise(gt=>setTimeout(()=>gt(mt()),ft))]))return!0}throw new ProviderNotFoundError}return!!(await withRetry(()=>this.getAccounts())).length}catch{return!1}},async switchChain({addEthereumChainParameter:ct,chainId:lt}){var mt,ft,yt,gt;const dt=await this.getProvider();if(!dt)throw new ProviderNotFoundError;const ht=at.chains.find(xt=>xt.id===lt);if(!ht)throw new SwitchChainError(new ChainNotConfiguredError);const pt=new Promise(xt=>{const vt=bt=>{"chainId"in bt&&bt.chainId===lt&&(at.emitter.off("change",vt),xt())};at.emitter.on("change",vt)});try{return await Promise.all([dt.request({method:"wallet_switchEthereumChain",params:[{chainId:numberToHex(lt)}]}).then(async()=>{await this.getChainId()===lt&&at.emitter.emit("change",{chainId:lt})}),pt]),ht}catch(xt){const vt=xt;if(vt.code===4902||((ft=(mt=vt==null?void 0:vt.data)==null?void 0:mt.originalError)==null?void 0:ft.code)===4902)try{const{default:bt,...Et}=ht.blockExplorers??{};let wt;ct!=null&&ct.blockExplorerUrls?wt=ct.blockExplorerUrls:bt&&(wt=[bt.url,...Object.values(Et).map(Rt=>Rt.url)]);let kt;(yt=ct==null?void 0:ct.rpcUrls)!=null&&yt.length?kt=ct.rpcUrls:kt=[((gt=ht.rpcUrls.default)==null?void 0:gt.http[0])??""];const It={blockExplorerUrls:wt,chainId:numberToHex(lt),chainName:(ct==null?void 0:ct.chainName)??ht.name,iconUrls:ct==null?void 0:ct.iconUrls,nativeCurrency:(ct==null?void 0:ct.nativeCurrency)??ht.nativeCurrency,rpcUrls:kt};return await Promise.all([dt.request({method:"wallet_addEthereumChain",params:[It]}).then(async()=>{if(await this.getChainId()===lt)at.emitter.emit("change",{chainId:lt});else throw new UserRejectedRequestError(new Error("User rejected switch after adding network."))}),pt]),ht}catch(bt){throw new UserRejectedRequestError(bt)}throw vt.code===UserRejectedRequestError.code?new UserRejectedRequestError(vt):new SwitchChainError(vt)}},async onAccountsChanged(ct){var lt;if(ct.length===0)this.onDisconnect();else if(at.emitter.listenerCount("connect")){const dt=(await this.getChainId()).toString();this.onConnect({chainId:dt}),et&&await((lt=at.storage)==null?void 0:lt.removeItem(`${this.id}.disconnected`))}else at.emitter.emit("change",{accounts:ct.map(dt=>getAddress(dt))})},onChainChanged(ct){const lt=Number(ct);at.emitter.emit("change",{chainId:lt})},async onConnect(ct){const lt=await this.getAccounts();if(lt.length===0)return;const dt=Number(ct.chainId);at.emitter.emit("connect",{accounts:lt,chainId:dt});const ht=await this.getProvider();ht&&(it&&(ht.removeListener("connect",it),it=void 0),rt||(rt=this.onAccountsChanged.bind(this),ht.on("accountsChanged",rt)),ot||(ot=this.onChainChanged.bind(this),ht.on("chainChanged",ot)),st||(st=this.onDisconnect.bind(this),ht.on("disconnect",st)))},async onDisconnect(ct){const lt=await this.getProvider();ct&&ct.code===1013&<&&(await this.getAccounts()).length||(at.emitter.emit("disconnect"),lt&&(ot&&(lt.removeListener("chainChanged",ot),ot=void 0),st&&(lt.removeListener("disconnect",st),st=void 0),it||(it=this.onConnect.bind(this),lt.on("connect",it))))}})}const targetMap={coinbaseWallet:{id:"coinbaseWallet",name:"Coinbase Wallet",provider(o){return o!=null&&o.coinbaseWalletExtension?o.coinbaseWalletExtension:findProvider(o,"isCoinbaseWallet")}},metaMask:{id:"metaMask",name:"MetaMask",provider(o){return findProvider(o,et=>{if(!et.isMetaMask||et.isBraveWallet&&!et._events&&!et._state)return!1;const tt=["isApexWallet","isAvalanche","isBitKeep","isBlockWallet","isKuCoinWallet","isMathWallet","isOkxWallet","isOKExWallet","isOneInchIOSWallet","isOneInchAndroidWallet","isOpera","isPortal","isRabby","isTokenPocket","isTokenary","isUniswapWallet","isZerion"];for(const nt of tt)if(et[nt])return!1;return!0})}},phantom:{id:"phantom",name:"Phantom",provider(o){var et,tt;return(et=o==null?void 0:o.phantom)!=null&&et.ethereum?(tt=o.phantom)==null?void 0:tt.ethereum:findProvider(o,"isPhantom")}}};function findProvider(o,et){function tt(rt){return typeof et=="function"?et(rt):typeof et=="string"?rt[et]:!0}const nt=o.ethereum;if(nt!=null&&nt.providers)return nt.providers.find(rt=>tt(rt));if(nt&&tt(nt))return nt}function requestProviders(o){if(typeof window>"u")return;const et=tt=>o(tt.detail);return window.addEventListener("eip6963:announceProvider",et),window.dispatchEvent(new CustomEvent("eip6963:requestProvider")),()=>window.removeEventListener("eip6963:announceProvider",et)}function createStore$1(){const o=new Set;let et=[];const tt=()=>requestProviders(rt=>{et.some(({info:ot})=>ot.uuid===rt.info.uuid)||(et=[...et,rt],o.forEach(ot=>ot(et,{added:[rt]})))});let nt=tt();return{_listeners(){return o},clear(){o.forEach(rt=>rt([],{removed:[...et]})),et=[]},destroy(){this.clear(),o.clear(),nt==null||nt()},findProvider({rdns:rt}){return et.find(ot=>ot.info.rdns===rt)},getProviders(){return et},reset(){this.clear(),nt==null||nt(),nt=tt()},subscribe(rt,{emitImmediately:ot}={}){return o.add(rt),ot&&rt(et,{added:et}),()=>o.delete(rt)}}}const subscribeWithSelectorImpl=o=>(et,tt,nt)=>{const rt=nt.subscribe;return nt.subscribe=(it,st,at)=>{let ct=it;if(st){const lt=(at==null?void 0:at.equalityFn)||Object.is;let dt=it(nt.getState());ct=ht=>{const pt=it(ht);if(!lt(dt,pt)){const mt=dt;st(dt=pt,mt)}},at!=null&&at.fireImmediately&&st(dt,dt)}return rt(ct)},o(et,tt,nt)},subscribeWithSelector=subscribeWithSelectorImpl;function createJSONStorage(o,et){let tt;try{tt=o()}catch{return}return{getItem:rt=>{var ot;const it=at=>at===null?null:JSON.parse(at,void 0),st=(ot=tt.getItem(rt))!=null?ot:null;return st instanceof Promise?st.then(it):it(st)},setItem:(rt,ot)=>tt.setItem(rt,JSON.stringify(ot,void 0)),removeItem:rt=>tt.removeItem(rt)}}const toThenable=o=>et=>{try{const tt=o(et);return tt instanceof Promise?tt:{then(nt){return toThenable(nt)(tt)},catch(nt){return this}}}catch(tt){return{then(nt){return this},catch(nt){return toThenable(nt)(tt)}}}},persistImpl=(o,et)=>(tt,nt,rt)=>{let ot={storage:createJSONStorage(()=>localStorage),partialize:ft=>ft,version:0,merge:(ft,yt)=>({...yt,...ft}),...et},it=!1;const st=new Set,at=new Set;let ct=ot.storage;if(!ct)return o((...ft)=>{console.warn(`[zustand persist middleware] Unable to update item '${ot.name}', the given storage is currently unavailable.`),tt(...ft)},nt,rt);const lt=()=>{const ft=ot.partialize({...nt()});return ct.setItem(ot.name,{state:ft,version:ot.version})},dt=rt.setState;rt.setState=(ft,yt)=>{dt(ft,yt),lt()};const ht=o((...ft)=>{tt(...ft),lt()},nt,rt);rt.getInitialState=()=>ht;let pt;const mt=()=>{var ft,yt;if(!ct)return;it=!1,st.forEach(xt=>{var vt;return xt((vt=nt())!=null?vt:ht)});const gt=((yt=ot.onRehydrateStorage)==null?void 0:yt.call(ot,(ft=nt())!=null?ft:ht))||void 0;return toThenable(ct.getItem.bind(ct))(ot.name).then(xt=>{if(xt)if(typeof xt.version=="number"&&xt.version!==ot.version){if(ot.migrate)return[!0,ot.migrate(xt.state,xt.version)];console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return[!1,xt.state];return[!1,void 0]}).then(xt=>{var vt;const[bt,Et]=xt;if(pt=ot.merge(Et,(vt=nt())!=null?vt:ht),tt(pt,!0),bt)return lt()}).then(()=>{gt==null||gt(pt,void 0),pt=nt(),it=!0,at.forEach(xt=>xt(pt))}).catch(xt=>{gt==null||gt(void 0,xt)})};return rt.persist={setOptions:ft=>{ot={...ot,...ft},ft.storage&&(ct=ft.storage)},clearStorage:()=>{ct==null||ct.removeItem(ot.name)},getOptions:()=>ot,rehydrate:()=>mt(),hasHydrated:()=>it,onHydrate:ft=>(st.add(ft),()=>{st.delete(ft)}),onFinishHydration:ft=>(at.add(ft),()=>{at.delete(ft)})},ot.skipHydration||mt(),pt||ht},persist=persistImpl,createStoreImpl=o=>{let et;const tt=new Set,nt=(ct,lt)=>{const dt=typeof ct=="function"?ct(et):ct;if(!Object.is(dt,et)){const ht=et;et=lt??(typeof dt!="object"||dt===null)?dt:Object.assign({},et,dt),tt.forEach(pt=>pt(et,ht))}},rt=()=>et,st={setState:nt,getState:rt,getInitialState:()=>at,subscribe:ct=>(tt.add(ct),()=>tt.delete(ct))},at=et=o(nt,rt,st);return st},createStore=o=>o?createStoreImpl(o):createStoreImpl;var eventemitter3={exports:{}};(function(o){var et=Object.prototype.hasOwnProperty,tt="~";function nt(){}Object.create&&(nt.prototype=Object.create(null),new nt().__proto__||(tt=!1));function rt(at,ct,lt){this.fn=at,this.context=ct,this.once=lt||!1}function ot(at,ct,lt,dt,ht){if(typeof lt!="function")throw new TypeError("The listener must be a function");var pt=new rt(lt,dt||at,ht),mt=tt?tt+ct:ct;return at._events[mt]?at._events[mt].fn?at._events[mt]=[at._events[mt],pt]:at._events[mt].push(pt):(at._events[mt]=pt,at._eventsCount++),at}function it(at,ct){--at._eventsCount===0?at._events=new nt:delete at._events[ct]}function st(){this._events=new nt,this._eventsCount=0}st.prototype.eventNames=function(){var ct=[],lt,dt;if(this._eventsCount===0)return ct;for(dt in lt=this._events)et.call(lt,dt)&&ct.push(tt?dt.slice(1):dt);return Object.getOwnPropertySymbols?ct.concat(Object.getOwnPropertySymbols(lt)):ct},st.prototype.listeners=function(ct){var lt=tt?tt+ct:ct,dt=this._events[lt];if(!dt)return[];if(dt.fn)return[dt.fn];for(var ht=0,pt=dt.length,mt=new Array(pt);ht{let rt=nt;return(rt==null?void 0:rt.__type)==="bigint"&&(rt=BigInt(rt.value)),(rt==null?void 0:rt.__type)==="Map"&&(rt=new Map(rt.value)),(et==null?void 0:et(tt,rt))??rt})}function getReferenceKey(o,et){return o.slice(0,et).join(".")||"."}function getCutoff(o,et){const{length:tt}=o;for(let nt=0;nt{let it=ot;return typeof it=="bigint"&&(it={__type:"bigint",value:ot.toString()}),it instanceof Map&&(it={__type:"Map",value:Array.from(ot.entries())}),(et==null?void 0:et(rt,it))??it},nt),tt??void 0)}function createStorage(o){const{deserialize:et=deserialize$1,key:tt="wagmi",serialize:nt=serialize$1,storage:rt=noopStorage}=o;function ot(it){return it instanceof Promise?it.then(st=>st).catch(()=>null):it}return{...rt,key:tt,async getItem(it,st){const at=rt.getItem(`${tt}.${it}`),ct=await ot(at);return ct?et(ct)??null:st??null},async setItem(it,st){const at=`${tt}.${it}`;st===null?await ot(rt.removeItem(at)):await ot(rt.setItem(at,nt(st)))},async removeItem(it){await ot(rt.removeItem(`${tt}.${it}`))}}}const noopStorage={getItem:()=>null,setItem:()=>{},removeItem:()=>{}},size=256;let index$2=size,buffer;function uid(o=11){if(!buffer||index$2+o>size*2){buffer="",index$2=0;for(let et=0;etot.chains),at=createStore(()=>{const Et=[],wt=new Set;for(const kt of ot.connectors??[]){const It=ct(kt);Et.push(It),!rt&&It.rdns&&wt.add(It.rdns)}if(!rt&&it){const kt=it.getProviders();for(const It of kt)wt.has(It.info.rdns)||Et.push(ct(lt(It)))}return Et});function ct(Et){var It;const wt=createEmitter(uid()),kt={...Et({emitter:wt,chains:st.getState(),storage:tt,transports:ot.transports}),emitter:wt,uid:wt.uid};return wt.on("connect",vt),(It=kt.setup)==null||It.call(kt),kt}function lt(Et){const{info:wt}=Et,kt=Et.provider;return injected({target:{...wt,id:wt.rdns,provider:kt}})}const dt=new Map;function ht(Et={}){const wt=Et.chainId??yt.getState().chainId,kt=st.getState().find(Rt=>Rt.id===wt);if(Et.chainId&&!kt)throw new ChainNotConfiguredError;{const Rt=dt.get(yt.getState().chainId);if(Rt&&!kt)return Rt;if(!kt)throw new ChainNotConfiguredError}{const Rt=dt.get(wt);if(Rt)return Rt}let It;if(ot.client)It=ot.client({chain:kt});else{const Rt=kt.id,Pt=st.getState().map(Bt=>Bt.id),jt={},Ot=Object.entries(ot);for(const[Bt,zt]of Ot)if(!(Bt==="chains"||Bt==="client"||Bt==="connectors"||Bt==="transports"))if(typeof zt=="object")if(Rt in zt)jt[Bt]=zt[Rt];else{if(Pt.some(Yt=>Yt in zt))continue;jt[Bt]=zt}else jt[Bt]=zt;It=createClient({...jt,chain:kt,batch:jt.batch??{multicall:!0},transport:Bt=>ot.transports[Rt]({...Bt,connectors:at})})}return dt.set(wt,It),It}function pt(){return{chainId:st.getState()[0].id,connections:new Map,current:null,status:"disconnected"}}let mt;const ft="0.0.0-canary-";version$6.startsWith(ft)?mt=Number.parseInt(version$6.replace(ft,"")):mt=Number.parseInt(version$6.split(".")[0]??"0");const yt=createStore(subscribeWithSelector(tt?persist(pt,{migrate(Et,wt){if(wt===mt)return Et;const kt=pt(),It=gt(Et,kt.chainId);return{...kt,chainId:It}},name:"store",partialize(Et){return{connections:{__type:"Map",value:Array.from(Et.connections.entries()).map(([wt,kt])=>{const{id:It,name:Rt,type:Pt,uid:jt}=kt.connector;return[wt,{...kt,connector:{id:It,name:Rt,type:Pt,uid:jt}}]})},chainId:Et.chainId,current:Et.current}},merge(Et,wt){typeof Et=="object"&&Et&&"status"in Et&&delete Et.status;const kt=gt(Et,wt.chainId);return{...wt,...Et,chainId:kt}},skipHydration:rt,storage:tt,version:mt}):pt));yt.setState(pt());function gt(Et,wt){return Et&&typeof Et=="object"&&"chainId"in Et&&typeof Et.chainId=="number"&&st.getState().some(kt=>kt.id===Et.chainId)?Et.chainId:wt}nt&&yt.subscribe(({connections:Et,current:wt})=>{var kt;return wt?(kt=Et.get(wt))==null?void 0:kt.chainId:void 0},Et=>{if(st.getState().some(kt=>kt.id===Et))return yt.setState(kt=>({...kt,chainId:Et??kt.chainId}))}),it==null||it.subscribe(Et=>{const wt=new Set,kt=new Set;for(const Rt of at.getState())wt.add(Rt.id),Rt.rdns&&kt.add(Rt.rdns);const It=[];for(const Rt of Et){if(kt.has(Rt.info.rdns))continue;const Pt=ct(lt(Rt));wt.has(Pt.id)||It.push(Pt)}tt&&!yt.persist.hasHydrated()||at.setState(Rt=>[...Rt,...It],!0)});function xt(Et){yt.setState(wt=>{const kt=wt.connections.get(Et.uid);return kt?{...wt,connections:new Map(wt.connections).set(Et.uid,{accounts:Et.accounts??kt.accounts,chainId:Et.chainId??kt.chainId,connector:kt.connector})}:wt})}function vt(Et){yt.getState().status==="connecting"||yt.getState().status==="reconnecting"||yt.setState(wt=>{const kt=at.getState().find(It=>It.uid===Et.uid);return kt?(kt.emitter.listenerCount("connect")&&kt.emitter.off("connect",xt),kt.emitter.listenerCount("change")||kt.emitter.on("change",xt),kt.emitter.listenerCount("disconnect")||kt.emitter.on("disconnect",bt),{...wt,connections:new Map(wt.connections).set(Et.uid,{accounts:Et.accounts,chainId:Et.chainId,connector:kt}),current:Et.uid,status:"connected"}):wt})}function bt(Et){yt.setState(wt=>{const kt=wt.connections.get(Et.uid);if(kt){const Rt=kt.connector;Rt.emitter.listenerCount("change")&&kt.connector.emitter.off("change",xt),Rt.emitter.listenerCount("disconnect")&&kt.connector.emitter.off("disconnect",bt),Rt.emitter.listenerCount("connect")||kt.connector.emitter.on("connect",vt)}if(wt.connections.delete(Et.uid),wt.connections.size===0)return{...wt,connections:new Map,current:null,status:"disconnected"};const It=wt.connections.values().next().value;return{...wt,connections:new Map(wt.connections),current:It.connector.uid}})}return{get chains(){return st.getState()},get connectors(){return at.getState()},storage:tt,getClient:ht,get state(){return yt.getState()},setState(Et){let wt;typeof Et=="function"?wt=Et(yt.getState()):wt=Et;const kt=pt();typeof wt!="object"&&(wt=kt),Object.keys(kt).some(Rt=>!(Rt in wt))&&(wt=kt),yt.setState(wt,!0)},subscribe(Et,wt,kt){return yt.subscribe(Et,wt,kt?{...kt,fireImmediately:kt.emitImmediately}:void 0)},_internal:{mipd:it,store:yt,ssr:!!rt,syncConnectedChain:nt,transports:ot.transports,chains:{setState(Et){const wt=typeof Et=="function"?Et(st.getState()):Et;if(wt.length!==0)return st.setState(wt,!0)},subscribe(Et){return st.subscribe(Et)}},connectors:{providerDetailToConnector:lt,setup:ct,setState(Et){return at.setState(typeof Et=="function"?Et(at.getState()):Et,!0)},subscribe(Et){return at.subscribe(Et)}},events:{change:xt,connect:vt,disconnect:bt}}}}function hydrate(o,et){const{initialState:tt,reconnectOnMount:nt}=et;return tt&&!o._internal.store.persist.hasHydrated()&&o.setState({...tt,chainId:o.chains.some(rt=>rt.id===tt.chainId)?tt.chainId:o.chains[0].id,connections:nt?tt.connections:new Map,status:nt?"reconnecting":"disconnected"}),{async onMount(){o._internal.ssr&&(await o._internal.store.persist.rehydrate(),o._internal.mipd&&o._internal.connectors.setState(rt=>{var at;const ot=new Set;for(const ct of rt??[])ct.rdns&&ot.add(ct.rdns);const it=[],st=((at=o._internal.mipd)==null?void 0:at.getProviders())??[];for(const ct of st){if(ot.has(ct.info.rdns))continue;const lt=o._internal.connectors.providerDetailToConnector(ct),dt=o._internal.connectors.setup(lt);it.push(dt)}return[...rt,...it]})),nt?reconnect(o):o.storage&&o.setState(rt=>({...rt,connections:new Map}))}}}function extractRpcUrls(o){var ot,it,st;const{chain:et}=o,tt=et.rpcUrls.default.http[0];if(!o.transports)return[tt];const nt=(it=(ot=o.transports)==null?void 0:ot[et.id])==null?void 0:it.call(ot,{chain:et});return(((st=nt==null?void 0:nt.value)==null?void 0:st.transports)||[nt]).map(({value:at})=>(at==null?void 0:at.url)||tt)}function Hydrate(o){const{children:et,config:tt,initialState:nt,reconnectOnMount:rt=!0}=o,{onMount:ot}=hydrate(tt,{initialState:nt,reconnectOnMount:rt});tt._internal.ssr||ot();const it=reactExports.useRef(!0);return reactExports.useEffect(()=>{if(it.current&&tt._internal.ssr)return ot(),()=>{it.current=!1}},[]),et}const WagmiContext=reactExports.createContext(void 0);function WagmiProvider(o){const{children:et,config:tt}=o,nt={value:tt};return reactExports.createElement(Hydrate,o,reactExports.createElement(WagmiContext.Provider,nt,et))}const version$5="2.12.29",getVersion=()=>`wagmi@${version$5}`;class BaseError extends BaseError$1{constructor(){super(...arguments),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"WagmiError"})}get docsBaseUrl(){return"https://wagmi.sh/react"}get version(){return getVersion()}}class WagmiProviderNotFoundError extends BaseError{constructor(){super("`useConfig` must be used within `WagmiProvider`.",{docsPath:"/api/WagmiProvider"}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"WagmiProviderNotFoundError"})}}function useConfig(o={}){const et=o.config??reactExports.useContext(WagmiContext);if(!et)throw new WagmiProviderNotFoundError;return et}function watchChains(o,et){const{onChange:tt}=et;return o._internal.chains.subscribe((nt,rt)=>{tt(nt,rt)})}var withSelector={exports:{}},withSelector_production_min={},shim={exports:{}},useSyncExternalStoreShim_production_min={};/** * @license React * use-sync-external-store-shim.production.min.js * @@ -92,7 +92,7 @@ ${prettyStateOverride(pt)}`),super(et.shortMessage,{cause:et,docsPath:nt,metaMes * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var h$3=reactExports,n$2=shimExports;function p$2(o,et){return o===et&&(o!==0||1/o===1/et)||o!==o&&et!==et}var q$3=typeof Object.is=="function"?Object.is:p$2,r$3=n$2.useSyncExternalStore,t$2=h$3.useRef,u$1=h$3.useEffect,v$3=h$3.useMemo,w$3=h$3.useDebugValue;withSelector_production_min.useSyncExternalStoreWithSelector=function(o,et,tt,nt,rt){var ot=t$2(null);if(ot.current===null){var it={hasValue:!1,value:null};ot.current=it}else it=ot.current;ot=v$3(function(){function at(pt){if(!ct){if(ct=!0,lt=pt,pt=nt(pt),rt!==void 0&&it.hasValue){var mt=it.value;if(rt(mt,pt))return dt=mt}return dt=pt}if(mt=dt,q$3(lt,pt))return mt;var ft=nt(pt);return rt!==void 0&&rt(mt,ft)?mt:(lt=pt,dt=ft)}var ct=!1,lt,dt,ht=tt===void 0?null:tt;return[function(){return at(et())},ht===null?void 0:function(){return at(ht())}]},[et,tt,nt,rt]);var st=r$3(o,ot[0],ot[1]);return u$1(function(){it.hasValue=!0,it.value=st},[st]),w$3(st),st};withSelector.exports=withSelector_production_min;var withSelectorExports=withSelector.exports;const isPlainObject$4=o=>typeof o=="object"&&!Array.isArray(o);function useSyncExternalStoreWithTracked(o,et,tt=et,nt=deepEqual){const rt=reactExports.useRef([]),ot=withSelectorExports.useSyncExternalStoreWithSelector(o,et,tt,it=>it,(it,st)=>{if(isPlainObject$4(it)&&isPlainObject$4(st)&&rt.current.length){for(const at of rt.current)if(!nt(it[at],st[at]))return!1;return!0}return nt(it,st)});return reactExports.useMemo(()=>{if(isPlainObject$4(ot)){const it={...ot};let st={};for(const[at,ct]of Object.entries(it))st={...st,[at]:{configurable:!1,enumerable:!0,get:()=>(rt.current.includes(at)||rt.current.push(at),ct)}};return Object.defineProperties(it,st),it}return ot},[ot])}function useAccount(o={}){const et=useConfig(o);return useSyncExternalStoreWithTracked(tt=>watchAccount(et,{onChange:tt}),()=>getAccount(et))}function useAccountEffect(o={}){const{onConnect:et,onDisconnect:tt}=o,nt=useConfig(o);reactExports.useEffect(()=>watchAccount(nt,{onChange(rt,ot){if((ot.status==="reconnecting"||ot.status==="connecting"&&ot.address===void 0)&&rt.status==="connected"){const{address:it,addresses:st,chain:at,chainId:ct,connector:lt}=rt,dt=ot.status==="reconnecting"||ot.status===void 0;et==null||et({address:it,addresses:st,chain:at,chainId:ct,connector:lt,isReconnected:dt})}else ot.status==="connected"&&rt.status==="disconnected"&&(tt==null||tt())}}),[nt,et,tt])}var Subscribable=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(o){return this.listeners.add(o),this.onSubscribe(),()=>{this.listeners.delete(o),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},isServer=typeof window>"u"||"Deno"in globalThis;function noop$4(){}function functionalUpdate(o,et){return typeof o=="function"?o(et):o}function isValidTimeout(o){return typeof o=="number"&&o>=0&&o!==1/0}function timeUntilStale(o,et){return Math.max(o+(et||0)-Date.now(),0)}function resolveStaleTime(o,et){return typeof o=="function"?o(et):o}function resolveEnabled(o,et){return typeof o=="function"?o(et):o}function matchQuery(o,et){const{type:tt="all",exact:nt,fetchStatus:rt,predicate:ot,queryKey:it,stale:st}=o;if(it){if(nt){if(et.queryHash!==hashQueryKeyByOptions(it,et.options))return!1}else if(!partialMatchKey(et.queryKey,it))return!1}if(tt!=="all"){const at=et.isActive();if(tt==="active"&&!at||tt==="inactive"&&at)return!1}return!(typeof st=="boolean"&&et.isStale()!==st||rt&&rt!==et.state.fetchStatus||ot&&!ot(et))}function matchMutation(o,et){const{exact:tt,status:nt,predicate:rt,mutationKey:ot}=o;if(ot){if(!et.options.mutationKey)return!1;if(tt){if(hashKey(et.options.mutationKey)!==hashKey(ot))return!1}else if(!partialMatchKey(et.options.mutationKey,ot))return!1}return!(nt&&et.state.status!==nt||rt&&!rt(et))}function hashQueryKeyByOptions(o,et){return((et==null?void 0:et.queryKeyHashFn)||hashKey)(o)}function hashKey(o){return JSON.stringify(o,(et,tt)=>isPlainObject$3(tt)?Object.keys(tt).sort().reduce((nt,rt)=>(nt[rt]=tt[rt],nt),{}):tt)}function partialMatchKey(o,et){return o===et?!0:typeof o!=typeof et?!1:o&&et&&typeof o=="object"&&typeof et=="object"?!Object.keys(et).some(tt=>!partialMatchKey(o[tt],et[tt])):!1}function replaceEqualDeep(o,et){if(o===et)return o;const tt=isPlainArray(o)&&isPlainArray(et);if(tt||isPlainObject$3(o)&&isPlainObject$3(et)){const nt=tt?o:Object.keys(o),rt=nt.length,ot=tt?et:Object.keys(et),it=ot.length,st=tt?[]:{};let at=0;for(let ct=0;ct{setTimeout(et,o)})}function replaceData(o,et,tt){return typeof tt.structuralSharing=="function"?tt.structuralSharing(o,et):tt.structuralSharing!==!1?replaceEqualDeep(o,et):et}function addToEnd(o,et,tt=0){const nt=[...o,et];return tt&&nt.length>tt?nt.slice(1):nt}function addToStart(o,et,tt=0){const nt=[et,...o];return tt&&nt.length>tt?nt.slice(0,-1):nt}var skipToken=Symbol();function ensureQueryFn(o,et){return!o.queryFn&&(et!=null&&et.initialPromise)?()=>et.initialPromise:!o.queryFn||o.queryFn===skipToken?()=>Promise.reject(new Error(`Missing queryFn: '${o.queryHash}'`)):o.queryFn}var Sr,lr,jr,Ds,FocusManager=(Ds=class extends Subscribable{constructor(){super();fn(this,Sr);fn(this,lr);fn(this,jr);un(this,jr,et=>{if(!isServer&&window.addEventListener){const tt=()=>et();return window.addEventListener("visibilitychange",tt,!1),()=>{window.removeEventListener("visibilitychange",tt)}}})}onSubscribe(){Mt(this,lr)||this.setEventListener(Mt(this,jr))}onUnsubscribe(){var et;this.hasListeners()||((et=Mt(this,lr))==null||et.call(this),un(this,lr,void 0))}setEventListener(et){var tt;un(this,jr,et),(tt=Mt(this,lr))==null||tt.call(this),un(this,lr,et(nt=>{typeof nt=="boolean"?this.setFocused(nt):this.onFocus()}))}setFocused(et){Mt(this,Sr)!==et&&(un(this,Sr,et),this.onFocus())}onFocus(){const et=this.isFocused();this.listeners.forEach(tt=>{tt(et)})}isFocused(){var et;return typeof Mt(this,Sr)=="boolean"?Mt(this,Sr):((et=globalThis.document)==null?void 0:et.visibilityState)!=="hidden"}},Sr=new WeakMap,lr=new WeakMap,jr=new WeakMap,Ds),focusManager=new FocusManager,Or,ur,Mr,Fs,OnlineManager=(Fs=class extends Subscribable{constructor(){super();fn(this,Or,!0);fn(this,ur);fn(this,Mr);un(this,Mr,et=>{if(!isServer&&window.addEventListener){const tt=()=>et(!0),nt=()=>et(!1);return window.addEventListener("online",tt,!1),window.addEventListener("offline",nt,!1),()=>{window.removeEventListener("online",tt),window.removeEventListener("offline",nt)}}})}onSubscribe(){Mt(this,ur)||this.setEventListener(Mt(this,Mr))}onUnsubscribe(){var et;this.hasListeners()||((et=Mt(this,ur))==null||et.call(this),un(this,ur,void 0))}setEventListener(et){var tt;un(this,Mr,et),(tt=Mt(this,ur))==null||tt.call(this),un(this,ur,et(this.setOnline.bind(this)))}setOnline(et){Mt(this,Or)!==et&&(un(this,Or,et),this.listeners.forEach(nt=>{nt(et)}))}isOnline(){return Mt(this,Or)}},Or=new WeakMap,ur=new WeakMap,Mr=new WeakMap,Fs),onlineManager=new OnlineManager;function pendingThenable(){let o,et;const tt=new Promise((rt,ot)=>{o=rt,et=ot});tt.status="pending",tt.catch(()=>{});function nt(rt){Object.assign(tt,rt),delete tt.resolve,delete tt.reject}return tt.resolve=rt=>{nt({status:"fulfilled",value:rt}),o(rt)},tt.reject=rt=>{nt({status:"rejected",reason:rt}),et(rt)},tt}function defaultRetryDelay(o){return Math.min(1e3*2**o,3e4)}function canFetch(o){return(o??"online")==="online"?onlineManager.isOnline():!0}var CancelledError=class extends Error{constructor(o){super("CancelledError"),this.revert=o==null?void 0:o.revert,this.silent=o==null?void 0:o.silent}};function isCancelledError(o){return o instanceof CancelledError}function createRetryer(o){let et=!1,tt=0,nt=!1,rt;const ot=pendingThenable(),it=ft=>{var yt;nt||(ht(new CancelledError(ft)),(yt=o.abort)==null||yt.call(o))},st=()=>{et=!0},at=()=>{et=!1},ct=()=>focusManager.isFocused()&&(o.networkMode==="always"||onlineManager.isOnline())&&o.canRun(),lt=()=>canFetch(o.networkMode)&&o.canRun(),dt=ft=>{var yt;nt||(nt=!0,(yt=o.onSuccess)==null||yt.call(o,ft),rt==null||rt(),ot.resolve(ft))},ht=ft=>{var yt;nt||(nt=!0,(yt=o.onError)==null||yt.call(o,ft),rt==null||rt(),ot.reject(ft))},pt=()=>new Promise(ft=>{var yt;rt=gt=>{(nt||ct())&&ft(gt)},(yt=o.onPause)==null||yt.call(o)}).then(()=>{var ft;rt=void 0,nt||(ft=o.onContinue)==null||ft.call(o)}),mt=()=>{if(nt)return;let ft;const yt=tt===0?o.initialPromise:void 0;try{ft=yt??o.fn()}catch(gt){ft=Promise.reject(gt)}Promise.resolve(ft).then(dt).catch(gt=>{var wt;if(nt)return;const xt=o.retry??(isServer?0:3),vt=o.retryDelay??defaultRetryDelay,bt=typeof vt=="function"?vt(tt,gt):vt,Et=xt===!0||typeof xt=="number"&&ttct()?void 0:pt()).then(()=>{et?ht(gt):mt()})})};return{promise:ot,cancel:it,continue:()=>(rt==null||rt(),ot),cancelRetry:st,continueRetry:at,canStart:lt,start:()=>(lt()?mt():pt().then(mt),ot)}}function createNotifyManager(){let o=[],et=0,tt=st=>{st()},nt=st=>{st()},rt=st=>setTimeout(st,0);const ot=st=>{et?o.push(st):rt(()=>{tt(st)})},it=()=>{const st=o;o=[],st.length&&rt(()=>{nt(()=>{st.forEach(at=>{tt(at)})})})};return{batch:st=>{let at;et++;try{at=st()}finally{et--,et||it()}return at},batchCalls:st=>(...at)=>{ot(()=>{st(...at)})},schedule:ot,setNotifyFunction:st=>{tt=st},setBatchNotifyFunction:st=>{nt=st},setScheduler:st=>{rt=st}}}var notifyManager=createNotifyManager(),kr,Us,Removable=(Us=class{constructor(){fn(this,kr)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),isValidTimeout(this.gcTime)&&un(this,kr,setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(o){this.gcTime=Math.max(this.gcTime||0,o??(isServer?1/0:5*60*1e3))}clearGcTimeout(){Mt(this,kr)&&(clearTimeout(Mt(this,kr)),un(this,kr,void 0))}},kr=new WeakMap,Us),Br,Dr,Un,$n,no,Ar,Hn,tr,zs,Query=(zs=class extends Removable{constructor(et){super();fn(this,Hn);fn(this,Br);fn(this,Dr);fn(this,Un);fn(this,$n);fn(this,no);fn(this,Ar);un(this,Ar,!1),un(this,no,et.defaultOptions),this.setOptions(et.options),this.observers=[],un(this,Un,et.cache),this.queryKey=et.queryKey,this.queryHash=et.queryHash,un(this,Br,getDefaultState$1(this.options)),this.state=et.state??Mt(this,Br),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var et;return(et=Mt(this,$n))==null?void 0:et.promise}setOptions(et){this.options={...Mt(this,no),...et},this.updateGcTime(this.options.gcTime)}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&Mt(this,Un).remove(this)}setData(et,tt){const nt=replaceData(this.state.data,et,this.options);return gn(this,Hn,tr).call(this,{data:nt,type:"success",dataUpdatedAt:tt==null?void 0:tt.updatedAt,manual:tt==null?void 0:tt.manual}),nt}setState(et,tt){gn(this,Hn,tr).call(this,{type:"setState",state:et,setStateOptions:tt})}cancel(et){var nt,rt;const tt=(nt=Mt(this,$n))==null?void 0:nt.promise;return(rt=Mt(this,$n))==null||rt.cancel(et),tt?tt.then(noop$4).catch(noop$4):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(Mt(this,Br))}isActive(){return this.observers.some(et=>resolveEnabled(et.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===skipToken||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStale(){return this.state.isInvalidated?!0:this.getObserversCount()>0?this.observers.some(et=>et.getCurrentResult().isStale):this.state.data===void 0}isStaleByTime(et=0){return this.state.isInvalidated||this.state.data===void 0||!timeUntilStale(this.state.dataUpdatedAt,et)}onFocus(){var tt;const et=this.observers.find(nt=>nt.shouldFetchOnWindowFocus());et==null||et.refetch({cancelRefetch:!1}),(tt=Mt(this,$n))==null||tt.continue()}onOnline(){var tt;const et=this.observers.find(nt=>nt.shouldFetchOnReconnect());et==null||et.refetch({cancelRefetch:!1}),(tt=Mt(this,$n))==null||tt.continue()}addObserver(et){this.observers.includes(et)||(this.observers.push(et),this.clearGcTimeout(),Mt(this,Un).notify({type:"observerAdded",query:this,observer:et}))}removeObserver(et){this.observers.includes(et)&&(this.observers=this.observers.filter(tt=>tt!==et),this.observers.length||(Mt(this,$n)&&(Mt(this,Ar)?Mt(this,$n).cancel({revert:!0}):Mt(this,$n).cancelRetry()),this.scheduleGc()),Mt(this,Un).notify({type:"observerRemoved",query:this,observer:et}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||gn(this,Hn,tr).call(this,{type:"invalidate"})}fetch(et,tt){var at,ct,lt;if(this.state.fetchStatus!=="idle"){if(this.state.data!==void 0&&(tt!=null&&tt.cancelRefetch))this.cancel({silent:!0});else if(Mt(this,$n))return Mt(this,$n).continueRetry(),Mt(this,$n).promise}if(et&&this.setOptions(et),!this.options.queryFn){const dt=this.observers.find(ht=>ht.options.queryFn);dt&&this.setOptions(dt.options)}const nt=new AbortController,rt=dt=>{Object.defineProperty(dt,"signal",{enumerable:!0,get:()=>(un(this,Ar,!0),nt.signal)})},ot=()=>{const dt=ensureQueryFn(this.options,tt),ht={queryKey:this.queryKey,meta:this.meta};return rt(ht),un(this,Ar,!1),this.options.persister?this.options.persister(dt,ht,this):dt(ht)},it={fetchOptions:tt,options:this.options,queryKey:this.queryKey,state:this.state,fetchFn:ot};rt(it),(at=this.options.behavior)==null||at.onFetch(it,this),un(this,Dr,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((ct=it.fetchOptions)==null?void 0:ct.meta))&&gn(this,Hn,tr).call(this,{type:"fetch",meta:(lt=it.fetchOptions)==null?void 0:lt.meta});const st=dt=>{var ht,pt,mt,ft;isCancelledError(dt)&&dt.silent||gn(this,Hn,tr).call(this,{type:"error",error:dt}),isCancelledError(dt)||((pt=(ht=Mt(this,Un).config).onError)==null||pt.call(ht,dt,this),(ft=(mt=Mt(this,Un).config).onSettled)==null||ft.call(mt,this.state.data,dt,this)),this.scheduleGc()};return un(this,$n,createRetryer({initialPromise:tt==null?void 0:tt.initialPromise,fn:it.fetchFn,abort:nt.abort.bind(nt),onSuccess:dt=>{var ht,pt,mt,ft;if(dt===void 0){st(new Error(`${this.queryHash} data is undefined`));return}try{this.setData(dt)}catch(yt){st(yt);return}(pt=(ht=Mt(this,Un).config).onSuccess)==null||pt.call(ht,dt,this),(ft=(mt=Mt(this,Un).config).onSettled)==null||ft.call(mt,dt,this.state.error,this),this.scheduleGc()},onError:st,onFail:(dt,ht)=>{gn(this,Hn,tr).call(this,{type:"failed",failureCount:dt,error:ht})},onPause:()=>{gn(this,Hn,tr).call(this,{type:"pause"})},onContinue:()=>{gn(this,Hn,tr).call(this,{type:"continue"})},retry:it.options.retry,retryDelay:it.options.retryDelay,networkMode:it.options.networkMode,canRun:()=>!0})),Mt(this,$n).start()}},Br=new WeakMap,Dr=new WeakMap,Un=new WeakMap,$n=new WeakMap,no=new WeakMap,Ar=new WeakMap,Hn=new WeakSet,tr=function(et){const tt=nt=>{switch(et.type){case"failed":return{...nt,fetchFailureCount:et.failureCount,fetchFailureReason:et.error};case"pause":return{...nt,fetchStatus:"paused"};case"continue":return{...nt,fetchStatus:"fetching"};case"fetch":return{...nt,...fetchState(nt.data,this.options),fetchMeta:et.meta??null};case"success":return{...nt,data:et.data,dataUpdateCount:nt.dataUpdateCount+1,dataUpdatedAt:et.dataUpdatedAt??Date.now(),error:null,isInvalidated:!1,status:"success",...!et.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};case"error":const rt=et.error;return isCancelledError(rt)&&rt.revert&&Mt(this,Dr)?{...Mt(this,Dr),fetchStatus:"idle"}:{...nt,error:rt,errorUpdateCount:nt.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:nt.fetchFailureCount+1,fetchFailureReason:rt,fetchStatus:"idle",status:"error"};case"invalidate":return{...nt,isInvalidated:!0};case"setState":return{...nt,...et.state}}};this.state=tt(this.state),notifyManager.batch(()=>{this.observers.forEach(nt=>{nt.onQueryUpdate()}),Mt(this,Un).notify({query:this,type:"updated",action:et})})},zs);function fetchState(o,et){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:canFetch(et.networkMode)?"fetching":"paused",...o===void 0&&{error:null,status:"pending"}}}function getDefaultState$1(o){const et=typeof o.initialData=="function"?o.initialData():o.initialData,tt=et!==void 0,nt=tt?typeof o.initialDataUpdatedAt=="function"?o.initialDataUpdatedAt():o.initialDataUpdatedAt:0;return{data:et,dataUpdateCount:0,dataUpdatedAt:tt?nt??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:tt?"success":"pending",fetchStatus:"idle"}}var Wn,Vs,QueryCache=(Vs=class extends Subscribable{constructor(et={}){super();fn(this,Wn);this.config=et,un(this,Wn,new Map)}build(et,tt,nt){const rt=tt.queryKey,ot=tt.queryHash??hashQueryKeyByOptions(rt,tt);let it=this.get(ot);return it||(it=new Query({cache:this,queryKey:rt,queryHash:ot,options:et.defaultQueryOptions(tt),state:nt,defaultOptions:et.getQueryDefaults(rt)}),this.add(it)),it}add(et){Mt(this,Wn).has(et.queryHash)||(Mt(this,Wn).set(et.queryHash,et),this.notify({type:"added",query:et}))}remove(et){const tt=Mt(this,Wn).get(et.queryHash);tt&&(et.destroy(),tt===et&&Mt(this,Wn).delete(et.queryHash),this.notify({type:"removed",query:et}))}clear(){notifyManager.batch(()=>{this.getAll().forEach(et=>{this.remove(et)})})}get(et){return Mt(this,Wn).get(et)}getAll(){return[...Mt(this,Wn).values()]}find(et){const tt={exact:!0,...et};return this.getAll().find(nt=>matchQuery(tt,nt))}findAll(et={}){const tt=this.getAll();return Object.keys(et).length>0?tt.filter(nt=>matchQuery(et,nt)):tt}notify(et){notifyManager.batch(()=>{this.listeners.forEach(tt=>{tt(et)})})}onFocus(){notifyManager.batch(()=>{this.getAll().forEach(et=>{et.onFocus()})})}onOnline(){notifyManager.batch(()=>{this.getAll().forEach(et=>{et.onOnline()})})}},Wn=new WeakMap,Vs),Gn,jn,Rr,qn,ar,Hs,Mutation=(Hs=class extends Removable{constructor(et){super();fn(this,qn);fn(this,Gn);fn(this,jn);fn(this,Rr);this.mutationId=et.mutationId,un(this,jn,et.mutationCache),un(this,Gn,[]),this.state=et.state||getDefaultState(),this.setOptions(et.options),this.scheduleGc()}setOptions(et){this.options=et,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(et){Mt(this,Gn).includes(et)||(Mt(this,Gn).push(et),this.clearGcTimeout(),Mt(this,jn).notify({type:"observerAdded",mutation:this,observer:et}))}removeObserver(et){un(this,Gn,Mt(this,Gn).filter(tt=>tt!==et)),this.scheduleGc(),Mt(this,jn).notify({type:"observerRemoved",mutation:this,observer:et})}optionalRemove(){Mt(this,Gn).length||(this.state.status==="pending"?this.scheduleGc():Mt(this,jn).remove(this))}continue(){var et;return((et=Mt(this,Rr))==null?void 0:et.continue())??this.execute(this.state.variables)}async execute(et){var rt,ot,it,st,at,ct,lt,dt,ht,pt,mt,ft,yt,gt,xt,vt,bt,Et,wt,kt;un(this,Rr,createRetryer({fn:()=>this.options.mutationFn?this.options.mutationFn(et):Promise.reject(new Error("No mutationFn found")),onFail:(Tt,Rt)=>{gn(this,qn,ar).call(this,{type:"failed",failureCount:Tt,error:Rt})},onPause:()=>{gn(this,qn,ar).call(this,{type:"pause"})},onContinue:()=>{gn(this,qn,ar).call(this,{type:"continue"})},retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>Mt(this,jn).canRun(this)}));const tt=this.state.status==="pending",nt=!Mt(this,Rr).canStart();try{if(!tt){gn(this,qn,ar).call(this,{type:"pending",variables:et,isPaused:nt}),await((ot=(rt=Mt(this,jn).config).onMutate)==null?void 0:ot.call(rt,et,this));const Rt=await((st=(it=this.options).onMutate)==null?void 0:st.call(it,et));Rt!==this.state.context&&gn(this,qn,ar).call(this,{type:"pending",context:Rt,variables:et,isPaused:nt})}const Tt=await Mt(this,Rr).start();return await((ct=(at=Mt(this,jn).config).onSuccess)==null?void 0:ct.call(at,Tt,et,this.state.context,this)),await((dt=(lt=this.options).onSuccess)==null?void 0:dt.call(lt,Tt,et,this.state.context)),await((pt=(ht=Mt(this,jn).config).onSettled)==null?void 0:pt.call(ht,Tt,null,this.state.variables,this.state.context,this)),await((ft=(mt=this.options).onSettled)==null?void 0:ft.call(mt,Tt,null,et,this.state.context)),gn(this,qn,ar).call(this,{type:"success",data:Tt}),Tt}catch(Tt){try{throw await((gt=(yt=Mt(this,jn).config).onError)==null?void 0:gt.call(yt,Tt,et,this.state.context,this)),await((vt=(xt=this.options).onError)==null?void 0:vt.call(xt,Tt,et,this.state.context)),await((Et=(bt=Mt(this,jn).config).onSettled)==null?void 0:Et.call(bt,void 0,Tt,this.state.variables,this.state.context,this)),await((kt=(wt=this.options).onSettled)==null?void 0:kt.call(wt,void 0,Tt,et,this.state.context)),Tt}finally{gn(this,qn,ar).call(this,{type:"error",error:Tt})}}finally{Mt(this,jn).runNext(this)}}},Gn=new WeakMap,jn=new WeakMap,Rr=new WeakMap,qn=new WeakSet,ar=function(et){const tt=nt=>{switch(et.type){case"failed":return{...nt,failureCount:et.failureCount,failureReason:et.error};case"pause":return{...nt,isPaused:!0};case"continue":return{...nt,isPaused:!1};case"pending":return{...nt,context:et.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:et.isPaused,status:"pending",variables:et.variables,submittedAt:Date.now()};case"success":return{...nt,data:et.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...nt,data:void 0,error:et.error,failureCount:nt.failureCount+1,failureReason:et.error,isPaused:!1,status:"error"}}};this.state=tt(this.state),notifyManager.batch(()=>{Mt(this,Gn).forEach(nt=>{nt.onMutationUpdate(et)}),Mt(this,jn).notify({mutation:this,type:"updated",action:et})})},Hs);function getDefaultState(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var Fn,ro,Ws,MutationCache=(Ws=class extends Subscribable{constructor(et={}){super();fn(this,Fn);fn(this,ro);this.config=et,un(this,Fn,new Map),un(this,ro,Date.now())}build(et,tt,nt){const rt=new Mutation({mutationCache:this,mutationId:++br(this,ro)._,options:et.defaultMutationOptions(tt),state:nt});return this.add(rt),rt}add(et){const tt=scopeFor(et),nt=Mt(this,Fn).get(tt)??[];nt.push(et),Mt(this,Fn).set(tt,nt),this.notify({type:"added",mutation:et})}remove(et){var nt;const tt=scopeFor(et);if(Mt(this,Fn).has(tt)){const rt=(nt=Mt(this,Fn).get(tt))==null?void 0:nt.filter(ot=>ot!==et);rt&&(rt.length===0?Mt(this,Fn).delete(tt):Mt(this,Fn).set(tt,rt))}this.notify({type:"removed",mutation:et})}canRun(et){var nt;const tt=(nt=Mt(this,Fn).get(scopeFor(et)))==null?void 0:nt.find(rt=>rt.state.status==="pending");return!tt||tt===et}runNext(et){var nt;const tt=(nt=Mt(this,Fn).get(scopeFor(et)))==null?void 0:nt.find(rt=>rt!==et&&rt.state.isPaused);return(tt==null?void 0:tt.continue())??Promise.resolve()}clear(){notifyManager.batch(()=>{this.getAll().forEach(et=>{this.remove(et)})})}getAll(){return[...Mt(this,Fn).values()].flat()}find(et){const tt={exact:!0,...et};return this.getAll().find(nt=>matchMutation(tt,nt))}findAll(et={}){return this.getAll().filter(tt=>matchMutation(et,tt))}notify(et){notifyManager.batch(()=>{this.listeners.forEach(tt=>{tt(et)})})}resumePausedMutations(){const et=this.getAll().filter(tt=>tt.state.isPaused);return notifyManager.batch(()=>Promise.all(et.map(tt=>tt.continue().catch(noop$4))))}},Fn=new WeakMap,ro=new WeakMap,Ws);function scopeFor(o){var et;return((et=o.options.scope)==null?void 0:et.id)??String(o.mutationId)}function infiniteQueryBehavior(o){return{onFetch:(et,tt)=>{var lt,dt,ht,pt,mt;const nt=et.options,rt=(ht=(dt=(lt=et.fetchOptions)==null?void 0:lt.meta)==null?void 0:dt.fetchMore)==null?void 0:ht.direction,ot=((pt=et.state.data)==null?void 0:pt.pages)||[],it=((mt=et.state.data)==null?void 0:mt.pageParams)||[];let st={pages:[],pageParams:[]},at=0;const ct=async()=>{let ft=!1;const yt=vt=>{Object.defineProperty(vt,"signal",{enumerable:!0,get:()=>(et.signal.aborted?ft=!0:et.signal.addEventListener("abort",()=>{ft=!0}),et.signal)})},gt=ensureQueryFn(et.options,et.fetchOptions),xt=async(vt,bt,Et)=>{if(ft)return Promise.reject();if(bt==null&&vt.pages.length)return Promise.resolve(vt);const wt={queryKey:et.queryKey,pageParam:bt,direction:Et?"backward":"forward",meta:et.options.meta};yt(wt);const kt=await gt(wt),{maxPages:Tt}=et.options,Rt=Et?addToStart:addToEnd;return{pages:Rt(vt.pages,kt,Tt),pageParams:Rt(vt.pageParams,bt,Tt)}};if(rt&&ot.length){const vt=rt==="backward",bt=vt?getPreviousPageParam:getNextPageParam,Et={pages:ot,pageParams:it},wt=bt(nt,Et);st=await xt(Et,wt,vt)}else{const vt=o??ot.length;do{const bt=at===0?it[0]??nt.initialPageParam:getNextPageParam(nt,st);if(at>0&&bt==null)break;st=await xt(st,bt),at++}while(at{var ft,yt;return(yt=(ft=et.options).persister)==null?void 0:yt.call(ft,ct,{queryKey:et.queryKey,meta:et.options.meta,signal:et.signal},tt)}:et.fetchFn=ct}}}function getNextPageParam(o,{pages:et,pageParams:tt}){const nt=et.length-1;return et.length>0?o.getNextPageParam(et[nt],et,tt[nt],tt):void 0}function getPreviousPageParam(o,{pages:et,pageParams:tt}){var nt;return et.length>0?(nt=o.getPreviousPageParam)==null?void 0:nt.call(o,et[0],et,tt[0],tt):void 0}var Nn,dr,hr,Fr,Ur,pr,zr,Vr,Gs,QueryClient=(Gs=class{constructor(o={}){fn(this,Nn);fn(this,dr);fn(this,hr);fn(this,Fr);fn(this,Ur);fn(this,pr);fn(this,zr);fn(this,Vr);un(this,Nn,o.queryCache||new QueryCache),un(this,dr,o.mutationCache||new MutationCache),un(this,hr,o.defaultOptions||{}),un(this,Fr,new Map),un(this,Ur,new Map),un(this,pr,0)}mount(){br(this,pr)._++,Mt(this,pr)===1&&(un(this,zr,focusManager.subscribe(async o=>{o&&(await this.resumePausedMutations(),Mt(this,Nn).onFocus())})),un(this,Vr,onlineManager.subscribe(async o=>{o&&(await this.resumePausedMutations(),Mt(this,Nn).onOnline())})))}unmount(){var o,et;br(this,pr)._--,Mt(this,pr)===0&&((o=Mt(this,zr))==null||o.call(this),un(this,zr,void 0),(et=Mt(this,Vr))==null||et.call(this),un(this,Vr,void 0))}isFetching(o){return Mt(this,Nn).findAll({...o,fetchStatus:"fetching"}).length}isMutating(o){return Mt(this,dr).findAll({...o,status:"pending"}).length}getQueryData(o){var tt;const et=this.defaultQueryOptions({queryKey:o});return(tt=Mt(this,Nn).get(et.queryHash))==null?void 0:tt.state.data}ensureQueryData(o){const et=this.getQueryData(o.queryKey);if(et===void 0)return this.fetchQuery(o);{const tt=this.defaultQueryOptions(o),nt=Mt(this,Nn).build(this,tt);return o.revalidateIfStale&&nt.isStaleByTime(resolveStaleTime(tt.staleTime,nt))&&this.prefetchQuery(tt),Promise.resolve(et)}}getQueriesData(o){return Mt(this,Nn).findAll(o).map(({queryKey:et,state:tt})=>{const nt=tt.data;return[et,nt]})}setQueryData(o,et,tt){const nt=this.defaultQueryOptions({queryKey:o}),rt=Mt(this,Nn).get(nt.queryHash),ot=rt==null?void 0:rt.state.data,it=functionalUpdate(et,ot);if(it!==void 0)return Mt(this,Nn).build(this,nt).setData(it,{...tt,manual:!0})}setQueriesData(o,et,tt){return notifyManager.batch(()=>Mt(this,Nn).findAll(o).map(({queryKey:nt})=>[nt,this.setQueryData(nt,et,tt)]))}getQueryState(o){var tt;const et=this.defaultQueryOptions({queryKey:o});return(tt=Mt(this,Nn).get(et.queryHash))==null?void 0:tt.state}removeQueries(o){const et=Mt(this,Nn);notifyManager.batch(()=>{et.findAll(o).forEach(tt=>{et.remove(tt)})})}resetQueries(o,et){const tt=Mt(this,Nn),nt={type:"active",...o};return notifyManager.batch(()=>(tt.findAll(o).forEach(rt=>{rt.reset()}),this.refetchQueries(nt,et)))}cancelQueries(o={},et={}){const tt={revert:!0,...et},nt=notifyManager.batch(()=>Mt(this,Nn).findAll(o).map(rt=>rt.cancel(tt)));return Promise.all(nt).then(noop$4).catch(noop$4)}invalidateQueries(o={},et={}){return notifyManager.batch(()=>{if(Mt(this,Nn).findAll(o).forEach(nt=>{nt.invalidate()}),o.refetchType==="none")return Promise.resolve();const tt={...o,type:o.refetchType??o.type??"active"};return this.refetchQueries(tt,et)})}refetchQueries(o={},et){const tt={...et,cancelRefetch:(et==null?void 0:et.cancelRefetch)??!0},nt=notifyManager.batch(()=>Mt(this,Nn).findAll(o).filter(rt=>!rt.isDisabled()).map(rt=>{let ot=rt.fetch(void 0,tt);return tt.throwOnError||(ot=ot.catch(noop$4)),rt.state.fetchStatus==="paused"?Promise.resolve():ot}));return Promise.all(nt).then(noop$4)}fetchQuery(o){const et=this.defaultQueryOptions(o);et.retry===void 0&&(et.retry=!1);const tt=Mt(this,Nn).build(this,et);return tt.isStaleByTime(resolveStaleTime(et.staleTime,tt))?tt.fetch(et):Promise.resolve(tt.state.data)}prefetchQuery(o){return this.fetchQuery(o).then(noop$4).catch(noop$4)}fetchInfiniteQuery(o){return o.behavior=infiniteQueryBehavior(o.pages),this.fetchQuery(o)}prefetchInfiniteQuery(o){return this.fetchInfiniteQuery(o).then(noop$4).catch(noop$4)}ensureInfiniteQueryData(o){return o.behavior=infiniteQueryBehavior(o.pages),this.ensureQueryData(o)}resumePausedMutations(){return onlineManager.isOnline()?Mt(this,dr).resumePausedMutations():Promise.resolve()}getQueryCache(){return Mt(this,Nn)}getMutationCache(){return Mt(this,dr)}getDefaultOptions(){return Mt(this,hr)}setDefaultOptions(o){un(this,hr,o)}setQueryDefaults(o,et){Mt(this,Fr).set(hashKey(o),{queryKey:o,defaultOptions:et})}getQueryDefaults(o){const et=[...Mt(this,Fr).values()];let tt={};return et.forEach(nt=>{partialMatchKey(o,nt.queryKey)&&(tt={...tt,...nt.defaultOptions})}),tt}setMutationDefaults(o,et){Mt(this,Ur).set(hashKey(o),{mutationKey:o,defaultOptions:et})}getMutationDefaults(o){const et=[...Mt(this,Ur).values()];let tt={};return et.forEach(nt=>{partialMatchKey(o,nt.mutationKey)&&(tt={...tt,...nt.defaultOptions})}),tt}defaultQueryOptions(o){if(o._defaulted)return o;const et={...Mt(this,hr).queries,...this.getQueryDefaults(o.queryKey),...o,_defaulted:!0};return et.queryHash||(et.queryHash=hashQueryKeyByOptions(et.queryKey,et)),et.refetchOnReconnect===void 0&&(et.refetchOnReconnect=et.networkMode!=="always"),et.throwOnError===void 0&&(et.throwOnError=!!et.suspense),!et.networkMode&&et.persister&&(et.networkMode="offlineFirst"),et.enabled!==!0&&et.queryFn===skipToken&&(et.enabled=!1),et}defaultMutationOptions(o){return o!=null&&o._defaulted?o:{...Mt(this,hr).mutations,...(o==null?void 0:o.mutationKey)&&this.getMutationDefaults(o.mutationKey),...o,_defaulted:!0}}clear(){Mt(this,Nn).clear(),Mt(this,dr).clear()}},Nn=new WeakMap,dr=new WeakMap,hr=new WeakMap,Fr=new WeakMap,Ur=new WeakMap,pr=new WeakMap,zr=new WeakMap,Vr=new WeakMap,Gs),Mn,Sn,oo,On,_r,Hr,fr,Kn,io,Wr,Gr,Tr,Ir,mr,qr,Tn,to,Rs,_s,Ts,Is,Ps,Ls,Ns,Ql,qs,QueryObserver=(qs=class extends Subscribable{constructor(et,tt){super();fn(this,Tn);fn(this,Mn);fn(this,Sn);fn(this,oo);fn(this,On);fn(this,_r);fn(this,Hr);fn(this,fr);fn(this,Kn);fn(this,io);fn(this,Wr);fn(this,Gr);fn(this,Tr);fn(this,Ir);fn(this,mr);fn(this,qr,new Set);this.options=tt,un(this,Mn,et),un(this,Kn,null),un(this,fr,pendingThenable()),this.options.experimental_prefetchInRender||Mt(this,fr).reject(new Error("experimental_prefetchInRender feature flag is not enabled")),this.bindMethods(),this.setOptions(tt)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(Mt(this,Sn).addObserver(this),shouldFetchOnMount(Mt(this,Sn),this.options)?gn(this,Tn,to).call(this):this.updateResult(),gn(this,Tn,Is).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return shouldFetchOn(Mt(this,Sn),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return shouldFetchOn(Mt(this,Sn),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,gn(this,Tn,Ps).call(this),gn(this,Tn,Ls).call(this),Mt(this,Sn).removeObserver(this)}setOptions(et,tt){const nt=this.options,rt=Mt(this,Sn);if(this.options=Mt(this,Mn).defaultQueryOptions(et),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof resolveEnabled(this.options.enabled,Mt(this,Sn))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");gn(this,Tn,Ns).call(this),Mt(this,Sn).setOptions(this.options),nt._defaulted&&!shallowEqualObjects(this.options,nt)&&Mt(this,Mn).getQueryCache().notify({type:"observerOptionsUpdated",query:Mt(this,Sn),observer:this});const ot=this.hasListeners();ot&&shouldFetchOptionally(Mt(this,Sn),rt,this.options,nt)&&gn(this,Tn,to).call(this),this.updateResult(tt),ot&&(Mt(this,Sn)!==rt||resolveEnabled(this.options.enabled,Mt(this,Sn))!==resolveEnabled(nt.enabled,Mt(this,Sn))||resolveStaleTime(this.options.staleTime,Mt(this,Sn))!==resolveStaleTime(nt.staleTime,Mt(this,Sn)))&&gn(this,Tn,Rs).call(this);const it=gn(this,Tn,_s).call(this);ot&&(Mt(this,Sn)!==rt||resolveEnabled(this.options.enabled,Mt(this,Sn))!==resolveEnabled(nt.enabled,Mt(this,Sn))||it!==Mt(this,mr))&&gn(this,Tn,Ts).call(this,it)}getOptimisticResult(et){const tt=Mt(this,Mn).getQueryCache().build(Mt(this,Mn),et),nt=this.createResult(tt,et);return shouldAssignObserverCurrentProperties(this,nt)&&(un(this,On,nt),un(this,Hr,this.options),un(this,_r,Mt(this,Sn).state)),nt}getCurrentResult(){return Mt(this,On)}trackResult(et,tt){const nt={};return Object.keys(et).forEach(rt=>{Object.defineProperty(nt,rt,{configurable:!1,enumerable:!0,get:()=>(this.trackProp(rt),tt==null||tt(rt),et[rt])})}),nt}trackProp(et){Mt(this,qr).add(et)}getCurrentQuery(){return Mt(this,Sn)}refetch({...et}={}){return this.fetch({...et})}fetchOptimistic(et){const tt=Mt(this,Mn).defaultQueryOptions(et),nt=Mt(this,Mn).getQueryCache().build(Mt(this,Mn),tt);return nt.fetch().then(()=>this.createResult(nt,tt))}fetch(et){return gn(this,Tn,to).call(this,{...et,cancelRefetch:et.cancelRefetch??!0}).then(()=>(this.updateResult(),Mt(this,On)))}createResult(et,tt){var Tt;const nt=Mt(this,Sn),rt=this.options,ot=Mt(this,On),it=Mt(this,_r),st=Mt(this,Hr),ct=et!==nt?et.state:Mt(this,oo),{state:lt}=et;let dt={...lt},ht=!1,pt;if(tt._optimisticResults){const Rt=this.hasListeners(),Pt=!Rt&&shouldFetchOnMount(et,tt),$t=Rt&&shouldFetchOptionally(et,nt,tt,rt);(Pt||$t)&&(dt={...dt,...fetchState(lt.data,et.options)}),tt._optimisticResults==="isRestoring"&&(dt.fetchStatus="idle")}let{error:mt,errorUpdatedAt:ft,status:yt}=dt;if(tt.select&&dt.data!==void 0)if(ot&&dt.data===(it==null?void 0:it.data)&&tt.select===Mt(this,io))pt=Mt(this,Wr);else try{un(this,io,tt.select),pt=tt.select(dt.data),pt=replaceData(ot==null?void 0:ot.data,pt,tt),un(this,Wr,pt),un(this,Kn,null)}catch(Rt){un(this,Kn,Rt)}else pt=dt.data;if(tt.placeholderData!==void 0&&pt===void 0&&yt==="pending"){let Rt;if(ot!=null&&ot.isPlaceholderData&&tt.placeholderData===(st==null?void 0:st.placeholderData))Rt=ot.data;else if(Rt=typeof tt.placeholderData=="function"?tt.placeholderData((Tt=Mt(this,Gr))==null?void 0:Tt.state.data,Mt(this,Gr)):tt.placeholderData,tt.select&&Rt!==void 0)try{Rt=tt.select(Rt),un(this,Kn,null)}catch(Pt){un(this,Kn,Pt)}Rt!==void 0&&(yt="success",pt=replaceData(ot==null?void 0:ot.data,Rt,tt),ht=!0)}Mt(this,Kn)&&(mt=Mt(this,Kn),pt=Mt(this,Wr),ft=Date.now(),yt="error");const gt=dt.fetchStatus==="fetching",xt=yt==="pending",vt=yt==="error",bt=xt&>,Et=pt!==void 0,kt={status:yt,fetchStatus:dt.fetchStatus,isPending:xt,isSuccess:yt==="success",isError:vt,isInitialLoading:bt,isLoading:bt,data:pt,dataUpdatedAt:dt.dataUpdatedAt,error:mt,errorUpdatedAt:ft,failureCount:dt.fetchFailureCount,failureReason:dt.fetchFailureReason,errorUpdateCount:dt.errorUpdateCount,isFetched:dt.dataUpdateCount>0||dt.errorUpdateCount>0,isFetchedAfterMount:dt.dataUpdateCount>ct.dataUpdateCount||dt.errorUpdateCount>ct.errorUpdateCount,isFetching:gt,isRefetching:gt&&!xt,isLoadingError:vt&&!Et,isPaused:dt.fetchStatus==="paused",isPlaceholderData:ht,isRefetchError:vt&&Et,isStale:isStale(et,tt),refetch:this.refetch,promise:Mt(this,fr)};if(this.options.experimental_prefetchInRender){const Rt=Ot=>{kt.status==="error"?Ot.reject(kt.error):kt.data!==void 0&&Ot.resolve(kt.data)},Pt=()=>{const Ot=un(this,fr,kt.promise=pendingThenable());Rt(Ot)},$t=Mt(this,fr);switch($t.status){case"pending":et.queryHash===nt.queryHash&&Rt($t);break;case"fulfilled":(kt.status==="error"||kt.data!==$t.value)&&Pt();break;case"rejected":(kt.status!=="error"||kt.error!==$t.reason)&&Pt();break}}return kt}updateResult(et){const tt=Mt(this,On),nt=this.createResult(Mt(this,Sn),this.options);if(un(this,_r,Mt(this,Sn).state),un(this,Hr,this.options),Mt(this,_r).data!==void 0&&un(this,Gr,Mt(this,Sn)),shallowEqualObjects(nt,tt))return;un(this,On,nt);const rt={},ot=()=>{if(!tt)return!0;const{notifyOnChangeProps:it}=this.options,st=typeof it=="function"?it():it;if(st==="all"||!st&&!Mt(this,qr).size)return!0;const at=new Set(st??Mt(this,qr));return this.options.throwOnError&&at.add("error"),Object.keys(Mt(this,On)).some(ct=>{const lt=ct;return Mt(this,On)[lt]!==tt[lt]&&at.has(lt)})};(et==null?void 0:et.listeners)!==!1&&ot()&&(rt.listeners=!0),gn(this,Tn,Ql).call(this,{...rt,...et})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&gn(this,Tn,Is).call(this)}},Mn=new WeakMap,Sn=new WeakMap,oo=new WeakMap,On=new WeakMap,_r=new WeakMap,Hr=new WeakMap,fr=new WeakMap,Kn=new WeakMap,io=new WeakMap,Wr=new WeakMap,Gr=new WeakMap,Tr=new WeakMap,Ir=new WeakMap,mr=new WeakMap,qr=new WeakMap,Tn=new WeakSet,to=function(et){gn(this,Tn,Ns).call(this);let tt=Mt(this,Sn).fetch(this.options,et);return et!=null&&et.throwOnError||(tt=tt.catch(noop$4)),tt},Rs=function(){gn(this,Tn,Ps).call(this);const et=resolveStaleTime(this.options.staleTime,Mt(this,Sn));if(isServer||Mt(this,On).isStale||!isValidTimeout(et))return;const nt=timeUntilStale(Mt(this,On).dataUpdatedAt,et)+1;un(this,Tr,setTimeout(()=>{Mt(this,On).isStale||this.updateResult()},nt))},_s=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(Mt(this,Sn)):this.options.refetchInterval)??!1},Ts=function(et){gn(this,Tn,Ls).call(this),un(this,mr,et),!(isServer||resolveEnabled(this.options.enabled,Mt(this,Sn))===!1||!isValidTimeout(Mt(this,mr))||Mt(this,mr)===0)&&un(this,Ir,setInterval(()=>{(this.options.refetchIntervalInBackground||focusManager.isFocused())&&gn(this,Tn,to).call(this)},Mt(this,mr)))},Is=function(){gn(this,Tn,Rs).call(this),gn(this,Tn,Ts).call(this,gn(this,Tn,_s).call(this))},Ps=function(){Mt(this,Tr)&&(clearTimeout(Mt(this,Tr)),un(this,Tr,void 0))},Ls=function(){Mt(this,Ir)&&(clearInterval(Mt(this,Ir)),un(this,Ir,void 0))},Ns=function(){const et=Mt(this,Mn).getQueryCache().build(Mt(this,Mn),this.options);if(et===Mt(this,Sn))return;const tt=Mt(this,Sn);un(this,Sn,et),un(this,oo,et.state),this.hasListeners()&&(tt==null||tt.removeObserver(this),et.addObserver(this))},Ql=function(et){notifyManager.batch(()=>{et.listeners&&this.listeners.forEach(tt=>{tt(Mt(this,On))}),Mt(this,Mn).getQueryCache().notify({query:Mt(this,Sn),type:"observerResultsUpdated"})})},qs);function shouldLoadOnMount(o,et){return resolveEnabled(et.enabled,o)!==!1&&o.state.data===void 0&&!(o.state.status==="error"&&et.retryOnMount===!1)}function shouldFetchOnMount(o,et){return shouldLoadOnMount(o,et)||o.state.data!==void 0&&shouldFetchOn(o,et,et.refetchOnMount)}function shouldFetchOn(o,et,tt){if(resolveEnabled(et.enabled,o)!==!1){const nt=typeof tt=="function"?tt(o):tt;return nt==="always"||nt!==!1&&isStale(o,et)}return!1}function shouldFetchOptionally(o,et,tt,nt){return(o!==et||resolveEnabled(nt.enabled,o)===!1)&&(!tt.suspense||o.state.status!=="error")&&isStale(o,tt)}function isStale(o,et){return resolveEnabled(et.enabled,o)!==!1&&o.isStaleByTime(resolveStaleTime(et.staleTime,o))}function shouldAssignObserverCurrentProperties(o,et){return!shallowEqualObjects(o.getCurrentResult(),et)}var gr,yr,Bn,rr,sr,Yo,$s,Ks,MutationObserver$1=(Ks=class extends Subscribable{constructor(tt,nt){super();fn(this,sr);fn(this,gr);fn(this,yr);fn(this,Bn);fn(this,rr);un(this,gr,tt),this.setOptions(nt),this.bindMethods(),gn(this,sr,Yo).call(this)}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(tt){var rt;const nt=this.options;this.options=Mt(this,gr).defaultMutationOptions(tt),shallowEqualObjects(this.options,nt)||Mt(this,gr).getMutationCache().notify({type:"observerOptionsUpdated",mutation:Mt(this,Bn),observer:this}),nt!=null&&nt.mutationKey&&this.options.mutationKey&&hashKey(nt.mutationKey)!==hashKey(this.options.mutationKey)?this.reset():((rt=Mt(this,Bn))==null?void 0:rt.state.status)==="pending"&&Mt(this,Bn).setOptions(this.options)}onUnsubscribe(){var tt;this.hasListeners()||(tt=Mt(this,Bn))==null||tt.removeObserver(this)}onMutationUpdate(tt){gn(this,sr,Yo).call(this),gn(this,sr,$s).call(this,tt)}getCurrentResult(){return Mt(this,yr)}reset(){var tt;(tt=Mt(this,Bn))==null||tt.removeObserver(this),un(this,Bn,void 0),gn(this,sr,Yo).call(this),gn(this,sr,$s).call(this)}mutate(tt,nt){var rt;return un(this,rr,nt),(rt=Mt(this,Bn))==null||rt.removeObserver(this),un(this,Bn,Mt(this,gr).getMutationCache().build(Mt(this,gr),this.options)),Mt(this,Bn).addObserver(this),Mt(this,Bn).execute(tt)}},gr=new WeakMap,yr=new WeakMap,Bn=new WeakMap,rr=new WeakMap,sr=new WeakSet,Yo=function(){var nt;const tt=((nt=Mt(this,Bn))==null?void 0:nt.state)??getDefaultState();un(this,yr,{...tt,isPending:tt.status==="pending",isSuccess:tt.status==="success",isError:tt.status==="error",isIdle:tt.status==="idle",mutate:this.mutate,reset:this.reset})},$s=function(tt){notifyManager.batch(()=>{var nt,rt,ot,it,st,at,ct,lt;if(Mt(this,rr)&&this.hasListeners()){const dt=Mt(this,yr).variables,ht=Mt(this,yr).context;(tt==null?void 0:tt.type)==="success"?((rt=(nt=Mt(this,rr)).onSuccess)==null||rt.call(nt,tt.data,dt,ht),(it=(ot=Mt(this,rr)).onSettled)==null||it.call(ot,tt.data,null,dt,ht)):(tt==null?void 0:tt.type)==="error"&&((at=(st=Mt(this,rr)).onError)==null||at.call(st,tt.error,dt,ht),(lt=(ct=Mt(this,rr)).onSettled)==null||lt.call(ct,void 0,tt.error,dt,ht))}this.listeners.forEach(dt=>{dt(Mt(this,yr))})})},Ks);function hashFn(o){return JSON.stringify(o,(et,tt)=>isPlainObject$2(tt)?Object.keys(tt).sort().reduce((nt,rt)=>(nt[rt]=tt[rt],nt),{}):typeof tt=="bigint"?tt.toString():tt)}function isPlainObject$2(o){if(!hasObjectPrototype(o))return!1;const et=o.constructor;if(typeof et>"u")return!0;const tt=et.prototype;return!(!hasObjectPrototype(tt)||!tt.hasOwnProperty("isPrototypeOf"))}function hasObjectPrototype(o){return Object.prototype.toString.call(o)==="[object Object]"}function filterQueryOptions(o){const{_defaulted:et,behavior:tt,gcTime:nt,initialData:rt,initialDataUpdatedAt:ot,maxPages:it,meta:st,networkMode:at,queryFn:ct,queryHash:lt,queryKey:dt,queryKeyHashFn:ht,retry:pt,retryDelay:mt,structuralSharing:ft,getPreviousPageParam:yt,getNextPageParam:gt,initialPageParam:xt,_optimisticResults:vt,enabled:bt,notifyOnChangeProps:Et,placeholderData:wt,refetchInterval:kt,refetchIntervalInBackground:Tt,refetchOnMount:Rt,refetchOnReconnect:Pt,refetchOnWindowFocus:$t,retryOnMount:Ot,select:Bt,staleTime:zt,suspense:Ft,throwOnError:Yt,config:Ht,connector:Ut,query:qt,...Lt}=o;return Lt}function connectMutationOptions(o){return{mutationFn(et){return connect$1(o,et)},mutationKey:["connect"]}}function disconnectMutationOptions(o){return{mutationFn(et){return disconnect(o,et)},mutationKey:["disconnect"]}}function getBalanceQueryOptions(o,et={}){return{async queryFn({queryKey:tt}){const{address:nt,scopeKey:rt,...ot}=tt[1];if(!nt)throw new Error("address is required");return await getBalance(o,{...ot,address:nt})??null},queryKey:getBalanceQueryKey(et)}}function getBalanceQueryKey(o={}){return["balance",filterQueryOptions(o)]}function getBlockNumberQueryOptions(o,et={}){return{gcTime:0,async queryFn({queryKey:tt}){const{scopeKey:nt,...rt}=tt[1];return await getBlockNumber(o,rt)??null},queryKey:getBlockNumberQueryKey(et)}}function getBlockNumberQueryKey(o={}){return["blockNumber",filterQueryOptions(o)]}function getEnsAddressQueryOptions(o,et={}){return{async queryFn({queryKey:tt}){const{name:nt,scopeKey:rt,...ot}=tt[1];if(!nt)throw new Error("name is required");return getEnsAddress(o,{...ot,name:nt})},queryKey:getEnsAddressQueryKey(et)}}function getEnsAddressQueryKey(o={}){return["ensAddress",filterQueryOptions(o)]}function getEnsAvatarQueryOptions(o,et={}){return{async queryFn({queryKey:tt}){const{name:nt,scopeKey:rt,...ot}=tt[1];if(!nt)throw new Error("name is required");return getEnsAvatar(o,{...ot,name:nt})},queryKey:getEnsAvatarQueryKey(et)}}function getEnsAvatarQueryKey(o={}){return["ensAvatar",filterQueryOptions(o)]}function getEnsNameQueryOptions(o,et={}){return{async queryFn({queryKey:tt}){const{address:nt,scopeKey:rt,...ot}=tt[1];if(!nt)throw new Error("address is required");return getEnsName(o,{...ot,address:nt})},queryKey:getEnsNameQueryKey(et)}}function getEnsNameQueryKey(o={}){return["ensName",filterQueryOptions(o)]}function signMessageMutationOptions(o){return{mutationFn(et){return signMessage(o,et)},mutationKey:["signMessage"]}}function switchChainMutationOptions(o){return{mutationFn(et){return switchChain(o,et)},mutationKey:["switchChain"]}}var QueryClientContext=reactExports.createContext(void 0),useQueryClient=o=>{const et=reactExports.useContext(QueryClientContext);if(!et)throw new Error("No QueryClient set, use QueryClientProvider to set one");return et},QueryClientProvider=({client:o,children:et})=>(reactExports.useEffect(()=>(o.mount(),()=>{o.unmount()}),[o]),jsxRuntimeExports.jsx(QueryClientContext.Provider,{value:o,children:et})),IsRestoringContext=reactExports.createContext(!1),useIsRestoring=()=>reactExports.useContext(IsRestoringContext);IsRestoringContext.Provider;function createValue(){let o=!1;return{clearReset:()=>{o=!1},reset:()=>{o=!0},isReset:()=>o}}var QueryErrorResetBoundaryContext=reactExports.createContext(createValue()),useQueryErrorResetBoundary=()=>reactExports.useContext(QueryErrorResetBoundaryContext);function shouldThrowError(o,et){return typeof o=="function"?o(...et):!!o}function noop$3(){}var ensurePreventErrorBoundaryRetry=(o,et)=>{(o.suspense||o.throwOnError||o.experimental_prefetchInRender)&&(et.isReset()||(o.retryOnMount=!1))},useClearResetErrorBoundary=o=>{reactExports.useEffect(()=>{o.clearReset()},[o])},getHasError=({result:o,errorResetBoundary:et,throwOnError:tt,query:nt})=>o.isError&&!et.isReset()&&!o.isFetching&&nt&&shouldThrowError(tt,[o.error,nt]),ensureSuspenseTimers=o=>{o.suspense&&(o.staleTime===void 0&&(o.staleTime=1e3),typeof o.gcTime=="number"&&(o.gcTime=Math.max(o.gcTime,1e3)))},willFetch=(o,et)=>o.isLoading&&o.isFetching&&!et,shouldSuspend=(o,et)=>(o==null?void 0:o.suspense)&&et.isPending,fetchOptimistic=(o,et,tt)=>et.fetchOptimistic(o).catch(()=>{tt.clearReset()});function useBaseQuery(o,et,tt){var lt,dt,ht,pt,mt;const nt=useQueryClient(),rt=useIsRestoring(),ot=useQueryErrorResetBoundary(),it=nt.defaultQueryOptions(o);(dt=(lt=nt.getDefaultOptions().queries)==null?void 0:lt._experimental_beforeQuery)==null||dt.call(lt,it),it._optimisticResults=rt?"isRestoring":"optimistic",ensureSuspenseTimers(it),ensurePreventErrorBoundaryRetry(it,ot),useClearResetErrorBoundary(ot);const st=!nt.getQueryCache().get(it.queryHash),[at]=reactExports.useState(()=>new et(nt,it)),ct=at.getOptimisticResult(it);if(reactExports.useSyncExternalStore(reactExports.useCallback(ft=>{const yt=rt?()=>{}:at.subscribe(notifyManager.batchCalls(ft));return at.updateResult(),yt},[at,rt]),()=>at.getCurrentResult(),()=>at.getCurrentResult()),reactExports.useEffect(()=>{at.setOptions(it,{listeners:!1})},[it,at]),shouldSuspend(it,ct))throw fetchOptimistic(it,at,ot);if(getHasError({result:ct,errorResetBoundary:ot,throwOnError:it.throwOnError,query:nt.getQueryCache().get(it.queryHash)}))throw ct.error;if((pt=(ht=nt.getDefaultOptions().queries)==null?void 0:ht._experimental_afterQuery)==null||pt.call(ht,it,ct),it.experimental_prefetchInRender&&!isServer&&willFetch(ct,rt)){const ft=st?fetchOptimistic(it,at,ot):(mt=nt.getQueryCache().get(it.queryHash))==null?void 0:mt.promise;ft==null||ft.catch(noop$3).finally(()=>{at.updateResult()})}return it.notifyOnChangeProps?ct:at.trackResult(ct)}function useQuery$1(o,et){return useBaseQuery(o,QueryObserver)}function useMutation(o,et){const tt=useQueryClient(),[nt]=reactExports.useState(()=>new MutationObserver$1(tt,o));reactExports.useEffect(()=>{nt.setOptions(o)},[nt,o]);const rt=reactExports.useSyncExternalStore(reactExports.useCallback(it=>nt.subscribe(notifyManager.batchCalls(it)),[nt]),()=>nt.getCurrentResult(),()=>nt.getCurrentResult()),ot=reactExports.useCallback((it,st)=>{nt.mutate(it,st).catch(noop$3)},[nt]);if(rt.error&&shouldThrowError(nt.options.throwOnError,[rt.error]))throw rt.error;return{...rt,mutate:ot,mutateAsync:rt.mutate}}function useQuery(o){const et=useQuery$1({...o,queryKeyHashFn:hashFn});return et.queryKey=o.queryKey,et}function useChainId(o={}){const et=useConfig(o);return reactExports.useSyncExternalStore(tt=>watchChainId(et,{onChange:tt}),()=>getChainId(et),()=>getChainId(et))}function useBalance(o={}){const{address:et,query:tt={}}=o,nt=useConfig(o),rt=useChainId({config:nt}),ot=getBalanceQueryOptions(nt,{...o,chainId:o.chainId??rt}),it=!!(et&&(tt.enabled??!0));return useQuery({...tt,...ot,enabled:it})}function useWatchBlockNumber(o={}){const{enabled:et=!0,onBlockNumber:tt,config:nt,...rt}=o,ot=useConfig(o),it=useChainId({config:ot}),st=o.chainId??it;reactExports.useEffect(()=>{if(et&&tt)return watchBlockNumber(ot,{...rt,chainId:st,onBlockNumber:tt})},[st,ot,et,tt,rt.onError,rt.emitMissed,rt.emitOnBegin,rt.poll,rt.pollingInterval,rt.syncConnectedChain])}function useBlockNumber(o={}){const{query:et={},watch:tt}=o,nt=useConfig(o),rt=useQueryClient(),ot=useChainId({config:nt}),it=o.chainId??ot,st=getBlockNumberQueryOptions(nt,{...o,chainId:it});return useWatchBlockNumber({config:o.config,chainId:o.chainId,...typeof tt=="object"?tt:{},enabled:!!((et.enabled??!0)&&(typeof tt=="object"?tt.enabled:tt)),onBlockNumber(at){rt.setQueryData(st.queryKey,at)}}),useQuery({...et,...st})}function useChains$1(o={}){const et=useConfig(o);return reactExports.useSyncExternalStore(tt=>watchChains(et,{onChange:tt}),()=>getChains(et),()=>getChains(et))}function useConnectors$1(o={}){const et=useConfig(o);return reactExports.useSyncExternalStore(tt=>watchConnectors(et,{onChange:tt}),()=>getConnectors(et),()=>getConnectors(et))}function useConnect$1(o={}){const{mutation:et}=o,tt=useConfig(o),nt=connectMutationOptions(tt),{mutate:rt,mutateAsync:ot,...it}=useMutation({...et,...nt});return reactExports.useEffect(()=>tt.subscribe(({status:st})=>st,(st,at)=>{at==="connected"&&st==="disconnected"&&it.reset()}),[tt,it.reset]),{...it,connect:rt,connectAsync:ot,connectors:useConnectors$1({config:tt})}}function useConnections(o={}){const et=useConfig(o);return reactExports.useSyncExternalStore(tt=>watchConnections(et,{onChange:tt}),()=>getConnections(et),()=>getConnections(et))}function useDisconnect(o={}){const{mutation:et}=o,tt=useConfig(o),nt=disconnectMutationOptions(tt),{mutate:rt,mutateAsync:ot,...it}=useMutation({...et,...nt});return{...it,connectors:useConnections({config:tt}).map(st=>st.connector),disconnect:rt,disconnectAsync:ot}}function useEnsAddress(o={}){const{name:et,query:tt={}}=o,nt=useConfig(o),rt=useChainId({config:nt}),ot=getEnsAddressQueryOptions(nt,{...o,chainId:o.chainId??rt}),it=!!(et&&(tt.enabled??!0));return useQuery({...tt,...ot,enabled:it})}function useEnsAvatar(o={}){const{name:et,query:tt={}}=o,nt=useConfig(o),rt=useChainId({config:nt}),ot=getEnsAvatarQueryOptions(nt,{...o,chainId:o.chainId??rt}),it=!!(et&&(tt.enabled??!0));return useQuery({...tt,...ot,enabled:it})}function useEnsName(o={}){const{address:et,query:tt={}}=o,nt=useConfig(o),rt=useChainId({config:nt}),ot=getEnsNameQueryOptions(nt,{...o,chainId:o.chainId??rt}),it=!!(et&&(tt.enabled??!0));return useQuery({...tt,...ot,enabled:it})}function useSignMessage(o={}){const{mutation:et}=o,tt=useConfig(o),nt=signMessageMutationOptions(tt),{mutate:rt,mutateAsync:ot,...it}=useMutation({...et,...nt});return{...it,signMessage:rt,signMessageAsync:ot}}function useSwitchChain(o={}){const{mutation:et}=o,tt=useConfig(o),nt=switchChainMutationOptions(tt),{mutate:rt,mutateAsync:ot,...it}=useMutation({...et,...nt});return{...it,chains:useChains$1({config:tt}),switchChain:rt,switchChainAsync:ot}}const contracts={gasPriceOracle:{address:"0x420000000000000000000000000000000000000F"},l1Block:{address:"0x4200000000000000000000000000000000000015"},l2CrossDomainMessenger:{address:"0x4200000000000000000000000000000000000007"},l2Erc721Bridge:{address:"0x4200000000000000000000000000000000000014"},l2StandardBridge:{address:"0x4200000000000000000000000000000000000010"},l2ToL1MessagePasser:{address:"0x4200000000000000000000000000000000000016"}},formatters={block:defineBlock({format(o){var tt;return{transactions:(tt=o.transactions)==null?void 0:tt.map(nt=>{if(typeof nt=="string")return nt;const rt=formatTransaction(nt);return rt.typeHex==="0x7e"&&(rt.isSystemTx=nt.isSystemTx,rt.mint=nt.mint?hexToBigInt(nt.mint):void 0,rt.sourceHash=nt.sourceHash,rt.type="deposit"),rt}),stateRoot:o.stateRoot}}}),transaction:defineTransaction({format(o){const et={};return o.type==="0x7e"&&(et.isSystemTx=o.isSystemTx,et.mint=o.mint?hexToBigInt(o.mint):void 0,et.sourceHash=o.sourceHash,et.type="deposit"),et}}),transactionReceipt:defineTransactionReceipt({format(o){return{l1GasPrice:o.l1GasPrice?hexToBigInt(o.l1GasPrice):null,l1GasUsed:o.l1GasUsed?hexToBigInt(o.l1GasUsed):null,l1Fee:o.l1Fee?hexToBigInt(o.l1Fee):null,l1FeeScalar:o.l1FeeScalar?Number(o.l1FeeScalar):null}}})};function serializeTransaction(o,et){return isDeposit(o)?serializeTransactionDeposit(o):serializeTransaction$1(o,et)}const serializers={transaction:serializeTransaction};function serializeTransactionDeposit(o){assertTransactionDeposit(o);const{sourceHash:et,data:tt,from:nt,gas:rt,isSystemTx:ot,mint:it,to:st,value:at}=o,ct=[et,nt,st??"0x",it?toHex(it):"0x",at?toHex(at):"0x",rt?toHex(rt):"0x",ot?"0x1":"0x",tt??"0x"];return concatHex(["0x7e",toRlp(ct)])}function isDeposit(o){return o.type==="deposit"||typeof o.sourceHash<"u"}function assertTransactionDeposit(o){const{from:et,to:tt}=o;if(et&&!isAddress(et))throw new InvalidAddressError({address:et});if(tt&&!isAddress(tt))throw new InvalidAddressError({address:tt})}const chainConfig={contracts,formatters,serializers},arbitrum=defineChain({id:42161,name:"Arbitrum One",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://arb1.arbitrum.io/rpc"]}},blockExplorers:{default:{name:"Arbiscan",url:"https://arbiscan.io",apiUrl:"https://api.arbiscan.io/api"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:7654707}}}),mainnet=defineChain({id:1,name:"Ethereum",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://cloudflare-eth.com"]}},blockExplorers:{default:{name:"Etherscan",url:"https://etherscan.io",apiUrl:"https://api.etherscan.io/api"}},contracts:{ensRegistry:{address:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e"},ensUniversalResolver:{address:"0xce01f8eee7E479C928F8919abD53E553a36CeF67",blockCreated:19258213},multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:14353601}}}),sourceId=1,optimism=defineChain({...chainConfig,id:10,name:"OP Mainnet",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://mainnet.optimism.io"]}},blockExplorers:{default:{name:"Optimism Explorer",url:"https://optimistic.etherscan.io",apiUrl:"https://api-optimistic.etherscan.io/api"}},contracts:{...chainConfig.contracts,disputeGameFactory:{[sourceId]:{address:"0xe5965Ab5962eDc7477C8520243A95517CD252fA9"}},l2OutputOracle:{[sourceId]:{address:"0xdfe97868233d1aa22e815a266982f2cf17685a27"}},multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:4286263},portal:{[sourceId]:{address:"0xbEb5Fc579115071764c7423A4f12eDde41f106Ed"}},l1StandardBridge:{[sourceId]:{address:"0x99C9fc46f92E8a1c0deC1b1747d010903E884bE1"}}},sourceId}),polygon=defineChain({id:137,name:"Polygon",nativeCurrency:{name:"POL",symbol:"POL",decimals:18},rpcUrls:{default:{http:["https://polygon-rpc.com"]}},blockExplorers:{default:{name:"PolygonScan",url:"https://polygonscan.com",apiUrl:"https://api.polygonscan.com/api"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:25770160}}});coinbaseWallet.type="coinbaseWallet";function coinbaseWallet(o={}){return o.version==="3"||o.headlessMode?version3(o):version4(o)}function version4(o){let et,tt,nt,rt,ot;return it=>({id:"coinbaseWalletSDK",name:"Coinbase Wallet",rdns:"com.coinbase.wallet",supportsSimulation:!0,type:coinbaseWallet.type,async connect({chainId:st}={}){try{const at=await this.getProvider(),ct=(await at.request({method:"eth_requestAccounts"})).map(dt=>getAddress(dt));nt||(nt=this.onAccountsChanged.bind(this),at.on("accountsChanged",nt)),rt||(rt=this.onChainChanged.bind(this),at.on("chainChanged",rt)),ot||(ot=this.onDisconnect.bind(this),at.on("disconnect",ot));let lt=await this.getChainId();if(st&<!==st){const dt=await this.switchChain({chainId:st}).catch(ht=>{if(ht.code===UserRejectedRequestError.code)throw ht;return{id:lt}});lt=(dt==null?void 0:dt.id)??lt}return{accounts:ct,chainId:lt}}catch(at){throw/(user closed modal|accounts received is empty|user denied account|request rejected)/i.test(at.message)?new UserRejectedRequestError(at):at}},async disconnect(){var at;const st=await this.getProvider();nt&&(st.removeListener("accountsChanged",nt),nt=void 0),rt&&(st.removeListener("chainChanged",rt),rt=void 0),ot&&(st.removeListener("disconnect",ot),ot=void 0),st.disconnect(),(at=st.close)==null||at.call(st)},async getAccounts(){return(await(await this.getProvider()).request({method:"eth_accounts"})).map(at=>getAddress(at))},async getChainId(){const at=await(await this.getProvider()).request({method:"eth_chainId"});return Number(at)},async getProvider(){if(!tt){const st=await(async()=>{const at=await __vitePreload(()=>import("./index-B6MMxlAs.js"),__vite__mapDeps([0,1]));return typeof at.CoinbaseWalletSDK!="function"&&typeof at.default=="function"?at.default:at.CoinbaseWalletSDK})();et=new st({...o,appChainIds:it.chains.map(at=>at.id)}),tt=et.makeWeb3Provider({...o,options:o.preference??"all"})}return tt},async isAuthorized(){try{return!!(await this.getAccounts()).length}catch{return!1}},async switchChain({addEthereumChainParameter:st,chainId:at}){var dt,ht,pt,mt;const ct=it.chains.find(ft=>ft.id===at);if(!ct)throw new SwitchChainError(new ChainNotConfiguredError);const lt=await this.getProvider();try{return await lt.request({method:"wallet_switchEthereumChain",params:[{chainId:numberToHex(ct.id)}]}),ct}catch(ft){if(ft.code===4902)try{let yt;st!=null&&st.blockExplorerUrls?yt=st.blockExplorerUrls:yt=(dt=ct.blockExplorers)!=null&&dt.default.url?[(ht=ct.blockExplorers)==null?void 0:ht.default.url]:[];let gt;(pt=st==null?void 0:st.rpcUrls)!=null&&pt.length?gt=st.rpcUrls:gt=[((mt=ct.rpcUrls.default)==null?void 0:mt.http[0])??""];const xt={blockExplorerUrls:yt,chainId:numberToHex(at),chainName:(st==null?void 0:st.chainName)??ct.name,iconUrls:st==null?void 0:st.iconUrls,nativeCurrency:(st==null?void 0:st.nativeCurrency)??ct.nativeCurrency,rpcUrls:gt};return await lt.request({method:"wallet_addEthereumChain",params:[xt]}),ct}catch(yt){throw new UserRejectedRequestError(yt)}throw new SwitchChainError(ft)}},onAccountsChanged(st){st.length===0?this.onDisconnect():it.emitter.emit("change",{accounts:st.map(at=>getAddress(at))})},onChainChanged(st){const at=Number(st);it.emitter.emit("change",{chainId:at})},async onDisconnect(st){it.emitter.emit("disconnect");const at=await this.getProvider();nt&&(at.removeListener("accountsChanged",nt),nt=void 0),rt&&(at.removeListener("chainChanged",rt),rt=void 0),ot&&(at.removeListener("disconnect",ot),ot=void 0)}})}function version3(o){let tt,nt,rt,ot,it;return st=>({id:"coinbaseWalletSDK",name:"Coinbase Wallet",supportsSimulation:!0,type:coinbaseWallet.type,async connect({chainId:at}={}){try{const ct=await this.getProvider(),lt=(await ct.request({method:"eth_requestAccounts"})).map(ht=>getAddress(ht));rt||(rt=this.onAccountsChanged.bind(this),ct.on("accountsChanged",rt)),ot||(ot=this.onChainChanged.bind(this),ct.on("chainChanged",ot)),it||(it=this.onDisconnect.bind(this),ct.on("disconnect",it));let dt=await this.getChainId();if(at&&dt!==at){const ht=await this.switchChain({chainId:at}).catch(pt=>{if(pt.code===UserRejectedRequestError.code)throw pt;return{id:dt}});dt=(ht==null?void 0:ht.id)??dt}return{accounts:lt,chainId:dt}}catch(ct){throw/(user closed modal|accounts received is empty|user denied account)/i.test(ct.message)?new UserRejectedRequestError(ct):ct}},async disconnect(){const at=await this.getProvider();rt&&(at.removeListener("accountsChanged",rt),rt=void 0),ot&&(at.removeListener("chainChanged",ot),ot=void 0),it&&(at.removeListener("disconnect",it),it=void 0),at.disconnect(),at.close()},async getAccounts(){return(await(await this.getProvider()).request({method:"eth_accounts"})).map(ct=>getAddress(ct))},async getChainId(){const ct=await(await this.getProvider()).request({method:"eth_chainId"});return Number(ct)},async getProvider(){var at;if(!nt){const ct=await(async()=>{const{default:mt}=await __vitePreload(async()=>{const{default:ft}=await import("./index-CRce2FXR.js").then(yt=>yt.i);return{default:ft}},__vite__mapDeps([2,3,1,4]));return typeof mt!="function"&&typeof mt.default=="function"?mt.default:mt})();tt=new ct({...o,reloadOnDisconnect:!1});const lt=(at=tt.walletExtension)==null?void 0:at.getChainId(),dt=st.chains.find(mt=>o.chainId?mt.id===o.chainId:mt.id===lt)||st.chains[0],ht=o.chainId||(dt==null?void 0:dt.id),pt=o.jsonRpcUrl||(dt==null?void 0:dt.rpcUrls.default.http[0]);nt=tt.makeWeb3Provider(pt,ht)}return nt},async isAuthorized(){try{return!!(await this.getAccounts()).length}catch{return!1}},async switchChain({addEthereumChainParameter:at,chainId:ct}){var ht,pt,mt,ft;const lt=st.chains.find(yt=>yt.id===ct);if(!lt)throw new SwitchChainError(new ChainNotConfiguredError);const dt=await this.getProvider();try{return await dt.request({method:"wallet_switchEthereumChain",params:[{chainId:numberToHex(lt.id)}]}),lt}catch(yt){if(yt.code===4902)try{let gt;at!=null&&at.blockExplorerUrls?gt=at.blockExplorerUrls:gt=(ht=lt.blockExplorers)!=null&&ht.default.url?[(pt=lt.blockExplorers)==null?void 0:pt.default.url]:[];let xt;(mt=at==null?void 0:at.rpcUrls)!=null&&mt.length?xt=at.rpcUrls:xt=[((ft=lt.rpcUrls.default)==null?void 0:ft.http[0])??""];const vt={blockExplorerUrls:gt,chainId:numberToHex(ct),chainName:(at==null?void 0:at.chainName)??lt.name,iconUrls:at==null?void 0:at.iconUrls,nativeCurrency:(at==null?void 0:at.nativeCurrency)??lt.nativeCurrency,rpcUrls:xt};return await dt.request({method:"wallet_addEthereumChain",params:[vt]}),lt}catch(gt){throw new UserRejectedRequestError(gt)}throw new SwitchChainError(yt)}},onAccountsChanged(at){at.length===0?this.onDisconnect():st.emitter.emit("change",{accounts:at.map(ct=>getAddress(ct))})},onChainChanged(at){const ct=Number(at);st.emitter.emit("change",{chainId:ct})},async onDisconnect(at){st.emitter.emit("disconnect");const ct=await this.getProvider();rt&&(ct.removeListener("accountsChanged",rt),rt=void 0),ot&&(ct.removeListener("chainChanged",ot),ot=void 0),it&&(ct.removeListener("disconnect",it),it=void 0)}})}safe.type="safe";function safe(o={}){const{shimDisconnect:et=!1}=o;let tt,nt;return rt=>({id:"safe",name:"Safe",type:safe.type,async connect(){var at;const ot=await this.getProvider();if(!ot)throw new ProviderNotFoundError;const it=await this.getAccounts(),st=await this.getChainId();return nt||(nt=this.onDisconnect.bind(this),ot.on("disconnect",nt)),et&&await((at=rt.storage)==null?void 0:at.removeItem("safe.disconnected")),{accounts:it,chainId:st}},async disconnect(){var it;const ot=await this.getProvider();if(!ot)throw new ProviderNotFoundError;nt&&(ot.removeListener("disconnect",nt),nt=void 0),et&&await((it=rt.storage)==null?void 0:it.setItem("safe.disconnected",!0))},async getAccounts(){const ot=await this.getProvider();if(!ot)throw new ProviderNotFoundError;return(await ot.request({method:"eth_accounts"})).map(getAddress)},async getProvider(){if(typeof window<"u"&&(window==null?void 0:window.parent)!==window){if(!tt){const{default:it}=await __vitePreload(async()=>{const{default:lt}=await import("./index-BA4zS8rk.js");return{default:lt}},[]),st=new it(o),at=await withTimeout(()=>st.safe.getInfo(),{timeout:o.unstable_getInfoTimeout??10});if(!at)throw new Error("Could not load Safe information");const ct=await(async()=>{const lt=await __vitePreload(()=>import("./index-c_vQ90mY.js").then(dt=>dt.i),__vite__mapDeps([5,4]));return typeof lt.SafeAppProvider!="function"&&typeof lt.default.SafeAppProvider=="function"?lt.default.SafeAppProvider:lt.SafeAppProvider})();tt=new ct(at,st)}return tt}},async getChainId(){const ot=await this.getProvider();if(!ot)throw new ProviderNotFoundError;return Number(ot.chainId)},async isAuthorized(){var ot;try{return et&&await((ot=rt.storage)==null?void 0:ot.getItem("safe.disconnected"))?!1:!!(await this.getAccounts()).length}catch{return!1}},onAccountsChanged(){},onChainChanged(){},onDisconnect(){rt.emitter.emit("disconnect")}})}walletConnect.type="walletConnect";function walletConnect(o){const et=o.isNewChainsStale??!0;let tt,nt;const rt="eip155";let ot,it,st,at,ct,lt;return dt=>({id:"walletConnect",name:"WalletConnect",type:walletConnect.type,async setup(){const ht=await this.getProvider().catch(()=>null);ht&&(st||(st=this.onConnect.bind(this),ht.on("connect",st)),ct||(ct=this.onSessionDelete.bind(this),ht.on("session_delete",ct)))},async connect({chainId:ht,...pt}={}){var mt,ft;try{const yt=await this.getProvider();if(!yt)throw new ProviderNotFoundError;at||(at=this.onDisplayUri,yt.on("display_uri",at));let gt=ht;if(!gt){const Et=await((mt=dt.storage)==null?void 0:mt.getItem("state"))??{};dt.chains.some(kt=>kt.id===Et.chainId)?gt=Et.chainId:gt=(ft=dt.chains[0])==null?void 0:ft.id}if(!gt)throw new Error("No chains found on connector.");const xt=await this.isChainsStale();if(yt.session&&xt&&await yt.disconnect(),!yt.session||xt){const Et=dt.chains.filter(wt=>wt.id!==gt).map(wt=>wt.id);await yt.connect({optionalChains:[gt,...Et],..."pairingTopic"in pt?{pairingTopic:pt.pairingTopic}:{}}),this.setRequestedChainsIds(dt.chains.map(wt=>wt.id))}const vt=(await yt.enable()).map(Et=>getAddress(Et)),bt=await this.getChainId();return at&&(yt.removeListener("display_uri",at),at=void 0),st&&(yt.removeListener("connect",st),st=void 0),ot||(ot=this.onAccountsChanged.bind(this),yt.on("accountsChanged",ot)),it||(it=this.onChainChanged.bind(this),yt.on("chainChanged",it)),lt||(lt=this.onDisconnect.bind(this),yt.on("disconnect",lt)),ct||(ct=this.onSessionDelete.bind(this),yt.on("session_delete",ct)),{accounts:vt,chainId:bt}}catch(yt){throw/(user rejected|connection request reset)/i.test(yt==null?void 0:yt.message)?new UserRejectedRequestError(yt):yt}},async disconnect(){const ht=await this.getProvider();try{await(ht==null?void 0:ht.disconnect())}catch(pt){if(!/No matching key/i.test(pt.message))throw pt}finally{it&&(ht==null||ht.removeListener("chainChanged",it),it=void 0),lt&&(ht==null||ht.removeListener("disconnect",lt),lt=void 0),st||(st=this.onConnect.bind(this),ht==null||ht.on("connect",st)),ot&&(ht==null||ht.removeListener("accountsChanged",ot),ot=void 0),ct&&(ht==null||ht.removeListener("session_delete",ct),ct=void 0),this.setRequestedChainsIds([])}},async getAccounts(){return(await this.getProvider()).accounts.map(pt=>getAddress(pt))},async getProvider({chainId:ht}={}){var mt;async function pt(){const ft=dt.chains.map(gt=>gt.id);if(!ft.length)return;const{EthereumProvider:yt}=await __vitePreload(async()=>{const{EthereumProvider:gt}=await import("./index.es-BocJIoGE.js");return{EthereumProvider:gt}},__vite__mapDeps([6,4,3]));return await yt.init({...o,disableProviderPing:!0,optionalChains:ft,projectId:o.projectId,rpcMap:Object.fromEntries(dt.chains.map(gt=>{const[xt]=extractRpcUrls({chain:gt,transports:dt.transports});return[gt.id,xt]})),showQrModal:o.showQrModal??!0})}return tt||(nt||(nt=pt()),tt=await nt,tt==null||tt.events.setMaxListeners(Number.POSITIVE_INFINITY)),ht&&await((mt=this.switchChain)==null?void 0:mt.call(this,{chainId:ht})),tt},async getChainId(){return(await this.getProvider()).chainId},async isAuthorized(){try{const[ht,pt]=await Promise.all([this.getAccounts(),this.getProvider()]);return ht.length?await this.isChainsStale()&&pt.session?(await pt.disconnect().catch(()=>{}),!1):!0:!1}catch{return!1}},async switchChain({addEthereumChainParameter:ht,chainId:pt}){var yt,gt,xt;const mt=await this.getProvider();if(!mt)throw new ProviderNotFoundError;const ft=dt.chains.find(vt=>vt.id===pt);if(!ft)throw new SwitchChainError(new ChainNotConfiguredError);try{await Promise.all([new Promise(bt=>{const Et=({chainId:wt})=>{wt===pt&&(dt.emitter.off("change",Et),bt())};dt.emitter.on("change",Et)}),mt.request({method:"wallet_switchEthereumChain",params:[{chainId:numberToHex(pt)}]})]);const vt=await this.getRequestedChainsIds();return this.setRequestedChainsIds([...vt,pt]),ft}catch(vt){const bt=vt;if(/(user rejected)/i.test(bt.message))throw new UserRejectedRequestError(bt);try{let Et;ht!=null&&ht.blockExplorerUrls?Et=ht.blockExplorerUrls:Et=(yt=ft.blockExplorers)!=null&&yt.default.url?[(gt=ft.blockExplorers)==null?void 0:gt.default.url]:[];let wt;(xt=ht==null?void 0:ht.rpcUrls)!=null&&xt.length?wt=ht.rpcUrls:wt=[...ft.rpcUrls.default.http];const kt={blockExplorerUrls:Et,chainId:numberToHex(pt),chainName:(ht==null?void 0:ht.chainName)??ft.name,iconUrls:ht==null?void 0:ht.iconUrls,nativeCurrency:(ht==null?void 0:ht.nativeCurrency)??ft.nativeCurrency,rpcUrls:wt};await mt.request({method:"wallet_addEthereumChain",params:[kt]});const Tt=await this.getRequestedChainsIds();return this.setRequestedChainsIds([...Tt,pt]),ft}catch(Et){throw new UserRejectedRequestError(Et)}}},onAccountsChanged(ht){ht.length===0?this.onDisconnect():dt.emitter.emit("change",{accounts:ht.map(pt=>getAddress(pt))})},onChainChanged(ht){const pt=Number(ht);dt.emitter.emit("change",{chainId:pt})},async onConnect(ht){const pt=Number(ht.chainId),mt=await this.getAccounts();dt.emitter.emit("connect",{accounts:mt,chainId:pt})},async onDisconnect(ht){this.setRequestedChainsIds([]),dt.emitter.emit("disconnect");const pt=await this.getProvider();ot&&(pt.removeListener("accountsChanged",ot),ot=void 0),it&&(pt.removeListener("chainChanged",it),it=void 0),lt&&(pt.removeListener("disconnect",lt),lt=void 0),ct&&(pt.removeListener("session_delete",ct),ct=void 0),st||(st=this.onConnect.bind(this),pt.on("connect",st))},onDisplayUri(ht){dt.emitter.emit("message",{type:"display_uri",data:ht})},onSessionDelete(){this.onDisconnect()},getNamespaceChainsIds(){var pt,mt,ft;return tt?((ft=(mt=(pt=tt.session)==null?void 0:pt.namespaces[rt])==null?void 0:mt.accounts)==null?void 0:ft.map(yt=>Number.parseInt(yt.split(":")[1]||"")))??[]:[]},async getRequestedChainsIds(){var ht;return await((ht=dt.storage)==null?void 0:ht.getItem(this.requestedChainsStorageKey))??[]},async isChainsStale(){if(!et)return!1;const ht=dt.chains.map(ft=>ft.id),pt=this.getNamespaceChainsIds();if(pt.length&&!pt.some(ft=>ht.includes(ft)))return!1;const mt=await this.getRequestedChainsIds();return!ht.every(ft=>mt.includes(ft))},async setRequestedChainsIds(ht){var pt;await((pt=dt.storage)==null?void 0:pt.setItem(this.requestedChainsStorageKey,ht))},get requestedChainsStorageKey(){return`${this.id}.requestedChains`}})}var define_process_default$3={env:{NODE_ENV:'"production"',VITE_WALLETCONNECT_PROJECT_ID:'"1d93edc21291f98e3bed6ff7617ff539"'},nextTick:"setImmediate",platform:'"browser"',version:'"v16.0.0"',browser:!0},__spreadArray$1=function(o,et,tt){for(var nt=0,rt=et.length,ot;nt"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"?new ReactNativeInfo:typeof navigator<"u"?parseUserAgent(navigator.userAgent):getNodeVersion()}function matchUserAgent(o){return o!==""&&userAgentRules.reduce(function(et,tt){var nt=tt[0],rt=tt[1];if(et)return et;var ot=rt.exec(o);return!!ot&&[nt,ot]},!1)}function parseUserAgent(o){var et=matchUserAgent(o);if(!et)return null;var tt=et[0],nt=et[1];if(tt==="searchbot")return new BotInfo;var rt=nt[1]&&nt[1].split(".").join("_").split("_").slice(0,3);rt?rt.length=0;st--)(it=o[st])&&(ot=(rt<3?it(ot):rt>3?it(et,tt,ot):it(et,tt))||ot);return rt>3&&ot&&Object.defineProperty(et,tt,ot),ot}function __param(o,et){return function(tt,nt){et(tt,nt,o)}}function __esDecorate(o,et,tt,nt,rt,ot){function it(gt){if(gt!==void 0&&typeof gt!="function")throw new TypeError("Function expected");return gt}for(var st=nt.kind,at=st==="getter"?"get":st==="setter"?"set":"value",ct=!et&&o?nt.static?o:o.prototype:null,lt=et||(ct?Object.getOwnPropertyDescriptor(ct,nt.name):{}),dt,ht=!1,pt=tt.length-1;pt>=0;pt--){var mt={};for(var ft in nt)mt[ft]=ft==="access"?{}:nt[ft];for(var ft in nt.access)mt.access[ft]=nt.access[ft];mt.addInitializer=function(gt){if(ht)throw new TypeError("Cannot add initializers after decoration has completed");ot.push(it(gt||null))};var yt=(0,tt[pt])(st==="accessor"?{get:lt.get,set:lt.set}:lt[at],mt);if(st==="accessor"){if(yt===void 0)continue;if(yt===null||typeof yt!="object")throw new TypeError("Object expected");(dt=it(yt.get))&&(lt.get=dt),(dt=it(yt.set))&&(lt.set=dt),(dt=it(yt.init))&&rt.unshift(dt)}else(dt=it(yt))&&(st==="field"?rt.unshift(dt):lt[at]=dt)}ct&&Object.defineProperty(ct,nt.name,lt),ht=!0}function __runInitializers(o,et,tt){for(var nt=arguments.length>2,rt=0;rt0&&ot[ot.length-1])&&(ct[0]===6||ct[0]===2)){tt=0;continue}if(ct[0]===3&&(!ot||ct[1]>ot[0]&&ct[1]=o.length&&(o=void 0),{value:o&&o[nt++],done:!o}}};throw new TypeError(et?"Object is not iterable.":"Symbol.iterator is not defined.")}function __read(o,et){var tt=typeof Symbol=="function"&&o[Symbol.iterator];if(!tt)return o;var nt=tt.call(o),rt,ot=[],it;try{for(;(et===void 0||et-- >0)&&!(rt=nt.next()).done;)ot.push(rt.value)}catch(st){it={error:st}}finally{try{rt&&!rt.done&&(tt=nt.return)&&tt.call(nt)}finally{if(it)throw it.error}}return ot}function __spread(){for(var o=[],et=0;et1||at(pt,ft)})},mt&&(rt[pt]=mt(rt[pt])))}function at(pt,mt){try{ct(nt[pt](mt))}catch(ft){ht(ot[0][3],ft)}}function ct(pt){pt.value instanceof __await?Promise.resolve(pt.value.v).then(lt,dt):ht(ot[0][2],pt)}function lt(pt){at("next",pt)}function dt(pt){at("throw",pt)}function ht(pt,mt){pt(mt),ot.shift(),ot.length&&at(ot[0][0],ot[0][1])}}function __asyncDelegator(o){var et,tt;return et={},nt("next"),nt("throw",function(rt){throw rt}),nt("return"),et[Symbol.iterator]=function(){return this},et;function nt(rt,ot){et[rt]=o[rt]?function(it){return(tt=!tt)?{value:__await(o[rt](it)),done:!1}:ot?ot(it):it}:ot}}function __asyncValues(o){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var et=o[Symbol.asyncIterator],tt;return et?et.call(o):(o=typeof __values=="function"?__values(o):o[Symbol.iterator](),tt={},nt("next"),nt("throw"),nt("return"),tt[Symbol.asyncIterator]=function(){return this},tt);function nt(ot){tt[ot]=o[ot]&&function(it){return new Promise(function(st,at){it=o[ot](it),rt(st,at,it.done,it.value)})}}function rt(ot,it,st,at){Promise.resolve(at).then(function(ct){ot({value:ct,done:st})},it)}}function __makeTemplateObject(o,et){return Object.defineProperty?Object.defineProperty(o,"raw",{value:et}):o.raw=et,o}var __setModuleDefault=Object.create?function(o,et){Object.defineProperty(o,"default",{enumerable:!0,value:et})}:function(o,et){o.default=et},ownKeys=function(o){return ownKeys=Object.getOwnPropertyNames||function(et){var tt=[];for(var nt in et)Object.prototype.hasOwnProperty.call(et,nt)&&(tt[tt.length]=nt);return tt},ownKeys(o)};function __importStar(o){if(o&&o.__esModule)return o;var et={};if(o!=null)for(var tt=ownKeys(o),nt=0;nt"u"||define_process_env_default$1===void 0?defaultEnvironment:"production",createDefinition=function(o){return{isEnabled:function(et){return o.some(function(tt){return!!et[tt]})}}},featureDefinitions={measureLayout:createDefinition(["layout","layoutId","drag"]),animation:createDefinition(["animate","exit","variants","whileHover","whileTap","whileFocus","whileDrag","whileInView"]),exit:createDefinition(["exit"]),drag:createDefinition(["drag","dragControls"]),focus:createDefinition(["whileFocus"]),hover:createDefinition(["whileHover","onHoverStart","onHoverEnd"]),tap:createDefinition(["whileTap","onTap","onTapStart","onTapCancel"]),pan:createDefinition(["onPan","onPanStart","onPanSessionStart","onPanEnd"]),inView:createDefinition(["whileInView","onViewportEnter","onViewportLeave"])};function loadFeatures(o){for(var et in o)o[et]!==null&&(et==="projectionNodeConstructor"?featureDefinitions.projectionNodeConstructor=o[et]:featureDefinitions[et].Component=o[et])}var invariant$1=function(){},LazyContext=reactExports.createContext({strict:!1}),featureNames=Object.keys(featureDefinitions),numFeatures=featureNames.length;function useFeatures(o,et,tt){var nt=[],rt=reactExports.useContext(LazyContext);if(!et)return null;env$1!=="production"&&tt&&rt.strict;for(var ot=0;ot"u")return et;var tt=new Map;return new Proxy(et,{get:function(nt,rt){return tt.has(rt)||tt.set(rt,et(rt)),tt.get(rt)}})}var lowercaseSVGElements=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","svg","switch","symbol","text","tspan","use","view"];function isSVGComponent(o){return typeof o!="string"||o.includes("-")?!1:!!(lowercaseSVGElements.indexOf(o)>-1||/[A-Z]/.test(o))}var scaleCorrectors={};function addScaleCorrector(o){Object.assign(scaleCorrectors,o)}var transformAxes=["","X","Y","Z"],order$1=["translate","scale","rotate","skew"],transformProps=["transformPerspective","x","y","z"];order$1.forEach(function(o){return transformAxes.forEach(function(et){return transformProps.push(o+et)})});function sortTransformProps(o,et){return transformProps.indexOf(o)-transformProps.indexOf(et)}var transformPropSet=new Set(transformProps);function isTransformProp(o){return transformPropSet.has(o)}var transformOriginProps=new Set(["originX","originY","originZ"]);function isTransformOriginProp(o){return transformOriginProps.has(o)}function isForcedMotionValue(o,et){var tt=et.layout,nt=et.layoutId;return isTransformProp(o)||isTransformOriginProp(o)||(tt||nt!==void 0)&&(!!scaleCorrectors[o]||o==="opacity")}var isMotionValue=function(o){return!!(o!==null&&typeof o=="object"&&o.getVelocity)},translateAlias={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"};function buildTransform(o,et,tt,nt){var rt=o.transform,ot=o.transformKeys,it=et.enableHardwareAcceleration,st=it===void 0?!0:it,at=et.allowTransformNone,ct=at===void 0?!0:at,lt="";ot.sort(sortTransformProps);for(var dt=!1,ht=ot.length,pt=0;pttt=>Math.max(Math.min(tt,et),o),sanitize=o=>o%1?Number(o.toFixed(5)):o,floatRegex=/(-)?([\d]*\.?[\d])+/g,colorRegex=/(#[0-9a-f]{6}|#[0-9a-f]{3}|#(?:[0-9a-f]{2}){2,4}|(rgb|hsl)a?\((-?[\d\.]+%?[,\s]+){2,3}\s*\/*\s*[\d\.]+%?\))/gi,singleColorRegex=/^(#[0-9a-f]{3}|#(?:[0-9a-f]{2}){2,4}|(rgb|hsl)a?\((-?[\d\.]+%?[,\s]+){2,3}\s*\/*\s*[\d\.]+%?\))$/i;function isString(o){return typeof o=="string"}const number$3={test:o=>typeof o=="number",parse:parseFloat,transform:o=>o},alpha=Object.assign(Object.assign({},number$3),{transform:clamp$2(0,1)}),scale=Object.assign(Object.assign({},number$3),{default:1}),createUnitType=o=>({test:et=>isString(et)&&et.endsWith(o)&&et.split(" ").length===1,parse:parseFloat,transform:et=>`${et}${o}`}),degrees=createUnitType("deg"),percent=createUnitType("%"),px=createUnitType("px"),vh=createUnitType("vh"),vw=createUnitType("vw"),progressPercentage=Object.assign(Object.assign({},percent),{parse:o=>percent.parse(o)/100,transform:o=>percent.transform(o*100)}),isColorString=(o,et)=>tt=>!!(isString(tt)&&singleColorRegex.test(tt)&&tt.startsWith(o)||et&&Object.prototype.hasOwnProperty.call(tt,et)),splitColor=(o,et,tt)=>nt=>{if(!isString(nt))return nt;const[rt,ot,it,st]=nt.match(floatRegex);return{[o]:parseFloat(rt),[et]:parseFloat(ot),[tt]:parseFloat(it),alpha:st!==void 0?parseFloat(st):1}},hsla={test:isColorString("hsl","hue"),parse:splitColor("hue","saturation","lightness"),transform:({hue:o,saturation:et,lightness:tt,alpha:nt=1})=>"hsla("+Math.round(o)+", "+percent.transform(sanitize(et))+", "+percent.transform(sanitize(tt))+", "+sanitize(alpha.transform(nt))+")"},clampRgbUnit=clamp$2(0,255),rgbUnit=Object.assign(Object.assign({},number$3),{transform:o=>Math.round(clampRgbUnit(o))}),rgba={test:isColorString("rgb","red"),parse:splitColor("red","green","blue"),transform:({red:o,green:et,blue:tt,alpha:nt=1})=>"rgba("+rgbUnit.transform(o)+", "+rgbUnit.transform(et)+", "+rgbUnit.transform(tt)+", "+sanitize(alpha.transform(nt))+")"};function parseHex(o){let et="",tt="",nt="",rt="";return o.length>5?(et=o.substr(1,2),tt=o.substr(3,2),nt=o.substr(5,2),rt=o.substr(7,2)):(et=o.substr(1,1),tt=o.substr(2,1),nt=o.substr(3,1),rt=o.substr(4,1),et+=et,tt+=tt,nt+=nt,rt+=rt),{red:parseInt(et,16),green:parseInt(tt,16),blue:parseInt(nt,16),alpha:rt?parseInt(rt,16)/255:1}}const hex={test:isColorString("#"),parse:parseHex,transform:rgba.transform},color$1={test:o=>rgba.test(o)||hex.test(o)||hsla.test(o),parse:o=>rgba.test(o)?rgba.parse(o):hsla.test(o)?hsla.parse(o):hex.parse(o),transform:o=>isString(o)?o:o.hasOwnProperty("red")?rgba.transform(o):hsla.transform(o)},colorToken="${c}",numberToken="${n}";function test(o){var et,tt,nt,rt;return isNaN(o)&&isString(o)&&((tt=(et=o.match(floatRegex))===null||et===void 0?void 0:et.length)!==null&&tt!==void 0?tt:0)+((rt=(nt=o.match(colorRegex))===null||nt===void 0?void 0:nt.length)!==null&&rt!==void 0?rt:0)>0}function analyse$1(o){typeof o=="number"&&(o=`${o}`);const et=[];let tt=0;const nt=o.match(colorRegex);nt&&(tt=nt.length,o=o.replace(colorRegex,colorToken),et.push(...nt.map(color$1.parse)));const rt=o.match(floatRegex);return rt&&(o=o.replace(floatRegex,numberToken),et.push(...rt.map(number$3.parse))),{values:et,numColors:tt,tokenised:o}}function parse$4(o){return analyse$1(o).values}function createTransformer(o){const{values:et,numColors:tt,tokenised:nt}=analyse$1(o),rt=et.length;return ot=>{let it=nt;for(let st=0;sttypeof o=="number"?0:o;function getAnimatableNone$1(o){const et=parse$4(o);return createTransformer(o)(et.map(convertNumbersToZero))}const complex={test,parse:parse$4,createTransformer,getAnimatableNone:getAnimatableNone$1},maxDefaults=new Set(["brightness","contrast","saturate","opacity"]);function applyDefaultFilter(o){let[et,tt]=o.slice(0,-1).split("(");if(et==="drop-shadow")return o;const[nt]=tt.match(floatRegex)||[];if(!nt)return o;const rt=tt.replace(nt,"");let ot=maxDefaults.has(et)?1:0;return nt!==tt&&(ot*=100),et+"("+ot+rt+")"}const functionRegex=/([a-z-]*)\(.*?\)/g,filter$1=Object.assign(Object.assign({},complex),{getAnimatableNone:o=>{const et=o.match(functionRegex);return et?et.map(applyDefaultFilter).join(" "):o}});var int=__assign(__assign({},number$3),{transform:Math.round}),numberValueTypes={borderWidth:px,borderTopWidth:px,borderRightWidth:px,borderBottomWidth:px,borderLeftWidth:px,borderRadius:px,radius:px,borderTopLeftRadius:px,borderTopRightRadius:px,borderBottomRightRadius:px,borderBottomLeftRadius:px,width:px,maxWidth:px,height:px,maxHeight:px,size:px,top:px,right:px,bottom:px,left:px,padding:px,paddingTop:px,paddingRight:px,paddingBottom:px,paddingLeft:px,margin:px,marginTop:px,marginRight:px,marginBottom:px,marginLeft:px,rotate:degrees,rotateX:degrees,rotateY:degrees,rotateZ:degrees,scale,scaleX:scale,scaleY:scale,scaleZ:scale,skew:degrees,skewX:degrees,skewY:degrees,distance:px,translateX:px,translateY:px,translateZ:px,x:px,y:px,z:px,perspective:px,transformPerspective:px,opacity:alpha,originX:progressPercentage,originY:progressPercentage,originZ:px,zIndex:int,fillOpacity:alpha,strokeOpacity:alpha,numOctaves:int};function buildHTMLStyles(o,et,tt,nt){var rt,ot=o.style,it=o.vars,st=o.transform,at=o.transformKeys,ct=o.transformOrigin;at.length=0;var lt=!1,dt=!1,ht=!0;for(var pt in et){var mt=et[pt];if(isCSSVariable$1(pt)){it[pt]=mt;continue}var ft=numberValueTypes[pt],yt=getValueAsType(mt,ft);if(isTransformProp(pt)){if(lt=!0,st[pt]=yt,at.push(pt),!ht)continue;mt!==((rt=ft.default)!==null&&rt!==void 0?rt:0)&&(ht=!1)}else isTransformOriginProp(pt)?(ct[pt]=yt,dt=!0):ot[pt]=yt}lt?ot.transform=buildTransform(o,tt,ht,nt):nt?ot.transform=nt({},""):!et.transform&&ot.transform&&(ot.transform="none"),dt&&(ot.transformOrigin=buildTransformOrigin(ct))}var createHtmlRenderState=function(){return{style:{},transform:{},transformKeys:[],transformOrigin:{},vars:{}}};function copyRawValuesOnly(o,et,tt){for(var nt in et)!isMotionValue(et[nt])&&!isForcedMotionValue(nt,tt)&&(o[nt]=et[nt])}function useInitialMotionValues(o,et,tt){var nt=o.transformTemplate;return reactExports.useMemo(function(){var rt=createHtmlRenderState();buildHTMLStyles(rt,et,{enableHardwareAcceleration:!tt},nt);var ot=rt.vars,it=rt.style;return __assign(__assign({},ot),it)},[et])}function useStyle(o,et,tt){var nt=o.style||{},rt={};return copyRawValuesOnly(rt,nt,o),Object.assign(rt,useInitialMotionValues(o,et,tt)),o.transformValues&&(rt=o.transformValues(rt)),rt}function useHTMLProps(o,et,tt){var nt={},rt=useStyle(o,et,tt);return o.drag&&o.dragListener!==!1&&(nt.draggable=!1,rt.userSelect=rt.WebkitUserSelect=rt.WebkitTouchCallout="none",rt.touchAction=o.drag===!0?"none":"pan-".concat(o.drag==="x"?"y":"x")),nt.style=rt,nt}var validMotionProps=new Set(["initial","animate","exit","style","variants","transition","transformTemplate","transformValues","custom","inherit","layout","layoutId","layoutDependency","onLayoutAnimationStart","onLayoutAnimationComplete","onLayoutMeasure","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","drag","dragControls","dragListener","dragConstraints","dragDirectionLock","dragSnapToOrigin","_dragX","_dragY","dragElastic","dragMomentum","dragPropagation","dragTransition","whileDrag","onPan","onPanStart","onPanEnd","onPanSessionStart","onTap","onTapStart","onTapCancel","onHoverStart","onHoverEnd","whileFocus","whileTap","whileHover","whileInView","onViewportEnter","onViewportLeave","viewport","layoutScroll"]);function isValidMotionProp(o){return validMotionProps.has(o)}var shouldForward=function(o){return!isValidMotionProp(o)};function loadExternalIsValidProp(o){o&&(shouldForward=function(et){return et.startsWith("on")?!isValidMotionProp(et):o(et)})}try{loadExternalIsValidProp(require("@emotion/is-prop-valid").default)}catch{}function filterProps(o,et,tt){var nt={};for(var rt in o)(shouldForward(rt)||tt===!0&&isValidMotionProp(rt)||!et&&!isValidMotionProp(rt)||o.draggable&&rt.startsWith("onDrag"))&&(nt[rt]=o[rt]);return nt}function calcOrigin$1(o,et,tt){return typeof o=="string"?o:px.transform(et+tt*o)}function calcSVGTransformOrigin(o,et,tt){var nt=calcOrigin$1(et,o.x,o.width),rt=calcOrigin$1(tt,o.y,o.height);return"".concat(nt," ").concat(rt)}var camelKeys={offset:"strokeDashoffset",array:"strokeDasharray"};function buildSVGPath(o,et,tt,nt,rt){tt===void 0&&(tt=1),nt===void 0&&(nt=0),o.pathLength=1;var ot=camelKeys;o[ot.offset]=px.transform(-nt);var it=px.transform(et),st=px.transform(tt);o[ot.array]="".concat(it," ").concat(st)}function buildSVGAttrs(o,et,tt,nt){var rt=et.attrX,ot=et.attrY,it=et.originX,st=et.originY,at=et.pathLength,ct=et.pathSpacing,lt=ct===void 0?1:ct,dt=et.pathOffset,ht=dt===void 0?0:dt,pt=__rest(et,["attrX","attrY","originX","originY","pathLength","pathSpacing","pathOffset"]);buildHTMLStyles(o,pt,tt,nt),o.attrs=o.style,o.style={};var mt=o.attrs,ft=o.style,yt=o.dimensions;mt.transform&&(yt&&(ft.transform=mt.transform),delete mt.transform),yt&&(it!==void 0||st!==void 0||ft.transform)&&(ft.transformOrigin=calcSVGTransformOrigin(yt,it!==void 0?it:.5,st!==void 0?st:.5)),rt!==void 0&&(mt.x=rt),ot!==void 0&&(mt.y=ot),at!==void 0&&buildSVGPath(mt,at,lt,ht)}var createSvgRenderState=function(){return __assign(__assign({},createHtmlRenderState()),{attrs:{}})};function useSVGProps(o,et){var tt=reactExports.useMemo(function(){var rt=createSvgRenderState();return buildSVGAttrs(rt,et,{enableHardwareAcceleration:!1},o.transformTemplate),__assign(__assign({},rt.attrs),{style:__assign({},rt.style)})},[et]);if(o.style){var nt={};copyRawValuesOnly(nt,o.style,o),tt.style=__assign(__assign({},nt),tt.style)}return tt}function createUseRender(o){o===void 0&&(o=!1);var et=function(tt,nt,rt,ot,it,st){var at=it.latestValues,ct=isSVGComponent(tt)?useSVGProps:useHTMLProps,lt=ct(nt,at,st),dt=filterProps(nt,typeof tt=="string",o),ht=__assign(__assign(__assign({},dt),lt),{ref:ot});return rt&&(ht["data-projection-id"]=rt),reactExports.createElement(tt,ht)};return et}var CAMEL_CASE_PATTERN=/([a-z])([A-Z])/g,REPLACE_TEMPLATE="$1-$2",camelToDash=function(o){return o.replace(CAMEL_CASE_PATTERN,REPLACE_TEMPLATE).toLowerCase()};function renderHTML(o,et,tt,nt){var rt=et.style,ot=et.vars;Object.assign(o.style,rt,nt&&nt.getProjectionStyles(tt));for(var it in ot)o.style.setProperty(it,ot[it])}var camelCaseAttributes=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength"]);function renderSVG(o,et,tt,nt){renderHTML(o,et,void 0,nt);for(var rt in et.attrs)o.setAttribute(camelCaseAttributes.has(rt)?rt:camelToDash(rt),et.attrs[rt])}function scrapeMotionValuesFromProps$1(o){var et=o.style,tt={};for(var nt in et)(isMotionValue(et[nt])||isForcedMotionValue(nt,o))&&(tt[nt]=et[nt]);return tt}function scrapeMotionValuesFromProps(o){var et=scrapeMotionValuesFromProps$1(o);for(var tt in o)if(isMotionValue(o[tt])){var nt=tt==="x"||tt==="y"?"attr"+tt.toUpperCase():tt;et[nt]=o[tt]}return et}function isAnimationControls(o){return typeof o=="object"&&typeof o.start=="function"}var isKeyframesTarget=function(o){return Array.isArray(o)},isCustomValue=function(o){return!!(o&&typeof o=="object"&&o.mix&&o.toValue)},resolveFinalValueInKeyframes=function(o){return isKeyframesTarget(o)?o[o.length-1]||0:o};function resolveMotionValue(o){var et=isMotionValue(o)?o.get():o;return isCustomValue(et)?et.toValue():et}function makeState(o,et,tt,nt){var rt=o.scrapeMotionValuesFromProps,ot=o.createRenderState,it=o.onMount,st={latestValues:makeLatestValues(et,tt,nt,rt),renderState:ot()};return it&&(st.mount=function(at){return it(et,at,st)}),st}var makeUseVisualState=function(o){return function(et,tt){var nt=reactExports.useContext(MotionContext),rt=reactExports.useContext(PresenceContext);return tt?makeState(o,et,nt,rt):useConstant(function(){return makeState(o,et,nt,rt)})}};function makeLatestValues(o,et,tt,nt){var rt={},ot=(tt==null?void 0:tt.initial)===!1,it=nt(o);for(var st in it)rt[st]=resolveMotionValue(it[st]);var at=o.initial,ct=o.animate,lt=checkIfControllingVariants(o),dt=checkIfVariantNode(o);et&&dt&&!lt&&o.inherit!==!1&&(at??(at=et.initial),ct??(ct=et.animate));var ht=ot||at===!1,pt=ht?ct:at;if(pt&&typeof pt!="boolean"&&!isAnimationControls(pt)){var mt=Array.isArray(pt)?pt:[pt];mt.forEach(function(ft){var yt=resolveVariantFromProps(o,ft);if(yt){var gt=yt.transitionEnd;yt.transition;var xt=__rest(yt,["transitionEnd","transition"]);for(var vt in xt){var bt=xt[vt];if(Array.isArray(bt)){var Et=ht?bt.length-1:0;bt=bt[Et]}bt!==null&&(rt[vt]=bt)}for(var vt in gt)rt[vt]=gt[vt]}})}return rt}var svgMotionConfig={useVisualState:makeUseVisualState({scrapeMotionValuesFromProps,createRenderState:createSvgRenderState,onMount:function(o,et,tt){var nt=tt.renderState,rt=tt.latestValues;try{nt.dimensions=typeof et.getBBox=="function"?et.getBBox():et.getBoundingClientRect()}catch{nt.dimensions={x:0,y:0,width:0,height:0}}buildSVGAttrs(nt,rt,{enableHardwareAcceleration:!1},o.transformTemplate),renderSVG(et,nt)}})},htmlMotionConfig={useVisualState:makeUseVisualState({scrapeMotionValuesFromProps:scrapeMotionValuesFromProps$1,createRenderState:createHtmlRenderState})};function createDomMotionConfig(o,et,tt,nt,rt){var ot=et.forwardMotionProps,it=ot===void 0?!1:ot,st=isSVGComponent(o)?svgMotionConfig:htmlMotionConfig;return __assign(__assign({},st),{preloadedFeatures:tt,useRender:createUseRender(it),createVisualElement:nt,projectionNodeConstructor:rt,Component:o})}var AnimationType;(function(o){o.Animate="animate",o.Hover="whileHover",o.Tap="whileTap",o.Drag="whileDrag",o.Focus="whileFocus",o.InView="whileInView",o.Exit="exit"})(AnimationType||(AnimationType={}));function addDomEvent(o,et,tt,nt){return nt===void 0&&(nt={passive:!0}),o.addEventListener(et,tt,nt),function(){return o.removeEventListener(et,tt)}}function useDomEvent(o,et,tt,nt){reactExports.useEffect(function(){var rt=o.current;if(tt&&rt)return addDomEvent(rt,et,tt,nt)},[o,et,tt,nt])}function useFocusGesture(o){var et=o.whileFocus,tt=o.visualElement,nt=function(){var ot;(ot=tt.animationState)===null||ot===void 0||ot.setActive(AnimationType.Focus,!0)},rt=function(){var ot;(ot=tt.animationState)===null||ot===void 0||ot.setActive(AnimationType.Focus,!1)};useDomEvent(tt,"focus",et?nt:void 0),useDomEvent(tt,"blur",et?rt:void 0)}function isMouseEvent(o){return typeof PointerEvent<"u"&&o instanceof PointerEvent?o.pointerType==="mouse":o instanceof MouseEvent}function isTouchEvent(o){var et=!!o.touches;return et}function filterPrimaryPointer(o){return function(et){var tt=et instanceof MouseEvent,nt=!tt||tt&&et.button===0;nt&&o(et)}}var defaultPagePoint={pageX:0,pageY:0};function pointFromTouch(o,et){et===void 0&&(et="page");var tt=o.touches[0]||o.changedTouches[0],nt=tt||defaultPagePoint;return{x:nt[et+"X"],y:nt[et+"Y"]}}function pointFromMouse(o,et){return et===void 0&&(et="page"),{x:o[et+"X"],y:o[et+"Y"]}}function extractEventInfo(o,et){return et===void 0&&(et="page"),{point:isTouchEvent(o)?pointFromTouch(o,et):pointFromMouse(o,et)}}var wrapHandler=function(o,et){et===void 0&&(et=!1);var tt=function(nt){return o(nt,extractEventInfo(nt))};return et?filterPrimaryPointer(tt):tt},supportsPointerEvents=function(){return isBrowser$3&&window.onpointerdown===null},supportsTouchEvents=function(){return isBrowser$3&&window.ontouchstart===null},supportsMouseEvents=function(){return isBrowser$3&&window.onmousedown===null},mouseEventNames={pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointercancel:"mousecancel",pointerover:"mouseover",pointerout:"mouseout",pointerenter:"mouseenter",pointerleave:"mouseleave"},touchEventNames={pointerdown:"touchstart",pointermove:"touchmove",pointerup:"touchend",pointercancel:"touchcancel"};function getPointerEventName(o){return supportsPointerEvents()?o:supportsTouchEvents()?touchEventNames[o]:supportsMouseEvents()?mouseEventNames[o]:o}function addPointerEvent(o,et,tt,nt){return addDomEvent(o,getPointerEventName(et),wrapHandler(tt,et==="pointerdown"),nt)}function usePointerEvent(o,et,tt,nt){return useDomEvent(o,getPointerEventName(et),tt&&wrapHandler(tt,et==="pointerdown"),nt)}function createLock(o){var et=null;return function(){var tt=function(){et=null};return et===null?(et=o,tt):!1}}var globalHorizontalLock=createLock("dragHorizontal"),globalVerticalLock=createLock("dragVertical");function getGlobalLock(o){var et=!1;if(o==="y")et=globalVerticalLock();else if(o==="x")et=globalHorizontalLock();else{var tt=globalHorizontalLock(),nt=globalVerticalLock();tt&&nt?et=function(){tt(),nt()}:(tt&&tt(),nt&&nt())}return et}function isDragActive(){var o=getGlobalLock(!0);return o?(o(),!1):!0}function createHoverEvent(o,et,tt){return function(nt,rt){var ot;!isMouseEvent(nt)||isDragActive()||((ot=o.animationState)===null||ot===void 0||ot.setActive(AnimationType.Hover,et),tt==null||tt(nt,rt))}}function useHoverGesture(o){var et=o.onHoverStart,tt=o.onHoverEnd,nt=o.whileHover,rt=o.visualElement;usePointerEvent(rt,"pointerenter",et||nt?createHoverEvent(rt,!0,et):void 0,{passive:!et}),usePointerEvent(rt,"pointerleave",tt||nt?createHoverEvent(rt,!1,tt):void 0,{passive:!tt})}var isNodeOrChild=function(o,et){return et?o===et?!0:isNodeOrChild(o,et.parentElement):!1};function useUnmountEffect(o){return reactExports.useEffect(function(){return function(){return o()}},[])}const clamp$1=(o,et,tt)=>Math.min(Math.max(tt,o),et),safeMin=.001,minDuration=.01,maxDuration=10,minDamping=.05,maxDamping=1;function findSpring({duration:o=800,bounce:et=.25,velocity:tt=0,mass:nt=1}){let rt,ot,it=1-et;it=clamp$1(minDamping,maxDamping,it),o=clamp$1(minDuration,maxDuration,o/1e3),it<1?(rt=ct=>{const lt=ct*it,dt=lt*o,ht=lt-tt,pt=calcAngularFreq(ct,it),mt=Math.exp(-dt);return safeMin-ht/pt*mt},ot=ct=>{const dt=ct*it*o,ht=dt*tt+tt,pt=Math.pow(it,2)*Math.pow(ct,2)*o,mt=Math.exp(-dt),ft=calcAngularFreq(Math.pow(ct,2),it);return(-rt(ct)+safeMin>0?-1:1)*((ht-pt)*mt)/ft}):(rt=ct=>{const lt=Math.exp(-ct*o),dt=(ct-tt)*o+1;return-safeMin+lt*dt},ot=ct=>{const lt=Math.exp(-ct*o),dt=(tt-ct)*(o*o);return lt*dt});const st=5/o,at=approximateRoot(rt,ot,st);if(o=o*1e3,isNaN(at))return{stiffness:100,damping:10,duration:o};{const ct=Math.pow(at,2)*nt;return{stiffness:ct,damping:it*2*Math.sqrt(nt*ct),duration:o}}}const rootIterations=12;function approximateRoot(o,et,tt){let nt=tt;for(let rt=1;rto[tt]!==void 0)}function getSpringOptions(o){let et=Object.assign({velocity:0,stiffness:100,damping:10,mass:1,isResolvedFromDuration:!1},o);if(!isSpringType(o,physicsKeys)&&isSpringType(o,durationKeys)){const tt=findSpring(o);et=Object.assign(Object.assign(Object.assign({},et),tt),{velocity:0,mass:1}),et.isResolvedFromDuration=!0}return et}function spring(o){var{from:et=0,to:tt=1,restSpeed:nt=2,restDelta:rt}=o,ot=__rest(o,["from","to","restSpeed","restDelta"]);const it={done:!1,value:et};let{stiffness:st,damping:at,mass:ct,velocity:lt,duration:dt,isResolvedFromDuration:ht}=getSpringOptions(ot),pt=zero$1,mt=zero$1;function ft(){const yt=lt?-(lt/1e3):0,gt=tt-et,xt=at/(2*Math.sqrt(st*ct)),vt=Math.sqrt(st/ct)/1e3;if(rt===void 0&&(rt=Math.min(Math.abs(tt-et)/100,.4)),xt<1){const bt=calcAngularFreq(vt,xt);pt=Et=>{const wt=Math.exp(-xt*vt*Et);return tt-wt*((yt+xt*vt*gt)/bt*Math.sin(bt*Et)+gt*Math.cos(bt*Et))},mt=Et=>{const wt=Math.exp(-xt*vt*Et);return xt*vt*wt*(Math.sin(bt*Et)*(yt+xt*vt*gt)/bt+gt*Math.cos(bt*Et))-wt*(Math.cos(bt*Et)*(yt+xt*vt*gt)-bt*gt*Math.sin(bt*Et))}}else if(xt===1)pt=bt=>tt-Math.exp(-vt*bt)*(gt+(yt+vt*gt)*bt);else{const bt=vt*Math.sqrt(xt*xt-1);pt=Et=>{const wt=Math.exp(-xt*vt*Et),kt=Math.min(bt*Et,300);return tt-wt*((yt+xt*vt*gt)*Math.sinh(kt)+bt*gt*Math.cosh(kt))/bt}}}return ft(),{next:yt=>{const gt=pt(yt);if(ht)it.done=yt>=dt;else{const xt=mt(yt)*1e3,vt=Math.abs(xt)<=nt,bt=Math.abs(tt-gt)<=rt;it.done=vt&&bt}return it.value=it.done?tt:gt,it},flipTarget:()=>{lt=-lt,[et,tt]=[tt,et],ft()}}}spring.needsInterpolation=(o,et)=>typeof o=="string"||typeof et=="string";const zero$1=o=>0,progress=(o,et,tt)=>{const nt=et-o;return nt===0?1:(tt-o)/nt},mix=(o,et,tt)=>-tt*o+tt*et+o;function hueToRgb(o,et,tt){return tt<0&&(tt+=1),tt>1&&(tt-=1),tt<1/6?o+(et-o)*6*tt:tt<1/2?et:tt<2/3?o+(et-o)*(2/3-tt)*6:o}function hslaToRgba({hue:o,saturation:et,lightness:tt,alpha:nt}){o/=360,et/=100,tt/=100;let rt=0,ot=0,it=0;if(!et)rt=ot=it=tt;else{const st=tt<.5?tt*(1+et):tt+et-tt*et,at=2*tt-st;rt=hueToRgb(at,st,o+1/3),ot=hueToRgb(at,st,o),it=hueToRgb(at,st,o-1/3)}return{red:Math.round(rt*255),green:Math.round(ot*255),blue:Math.round(it*255),alpha:nt}}const mixLinearColor=(o,et,tt)=>{const nt=o*o,rt=et*et;return Math.sqrt(Math.max(0,tt*(rt-nt)+nt))},colorTypes=[hex,rgba,hsla],getColorType=o=>colorTypes.find(et=>et.test(o)),mixColor=(o,et)=>{let tt=getColorType(o),nt=getColorType(et),rt=tt.parse(o),ot=nt.parse(et);tt===hsla&&(rt=hslaToRgba(rt),tt=rgba),nt===hsla&&(ot=hslaToRgba(ot),nt=rgba);const it=Object.assign({},rt);return st=>{for(const at in it)at!=="alpha"&&(it[at]=mixLinearColor(rt[at],ot[at],st));return it.alpha=mix(rt.alpha,ot.alpha,st),tt.transform(it)}},isNum=o=>typeof o=="number",combineFunctions=(o,et)=>tt=>et(o(tt)),pipe$1=(...o)=>o.reduce(combineFunctions);function getMixer(o,et){return isNum(o)?tt=>mix(o,et,tt):color$1.test(o)?mixColor(o,et):mixComplex(o,et)}const mixArray=(o,et)=>{const tt=[...o],nt=tt.length,rt=o.map((ot,it)=>getMixer(ot,et[it]));return ot=>{for(let it=0;it{const tt=Object.assign(Object.assign({},o),et),nt={};for(const rt in tt)o[rt]!==void 0&&et[rt]!==void 0&&(nt[rt]=getMixer(o[rt],et[rt]));return rt=>{for(const ot in nt)tt[ot]=nt[ot](rt);return tt}};function analyse(o){const et=complex.parse(o),tt=et.length;let nt=0,rt=0,ot=0;for(let it=0;it{const tt=complex.createTransformer(et),nt=analyse(o),rt=analyse(et);return nt.numHSL===rt.numHSL&&nt.numRGB===rt.numRGB&&nt.numNumbers>=rt.numNumbers?pipe$1(mixArray(nt.parsed,rt.parsed),tt):it=>`${it>0?et:o}`},mixNumber=(o,et)=>tt=>mix(o,et,tt);function detectMixerFactory(o){if(typeof o=="number")return mixNumber;if(typeof o=="string")return color$1.test(o)?mixColor:mixComplex;if(Array.isArray(o))return mixArray;if(typeof o=="object")return mixObject}function createMixers(o,et,tt){const nt=[],rt=tt||detectMixerFactory(o[0]),ot=o.length-1;for(let it=0;ittt(progress(o,et,nt))}function slowInterpolate(o,et){const tt=o.length,nt=tt-1;return rt=>{let ot=0,it=!1;if(rt<=o[0]?it=!0:rt>=o[nt]&&(ot=nt-1,it=!0),!it){let at=1;for(;atrt||at===nt);at++);ot=at-1}const st=progress(o[ot],o[ot+1],rt);return et[ot](st)}}function interpolate(o,et,{clamp:tt=!0,ease:nt,mixer:rt}={}){const ot=o.length;invariant$1(ot===et.length),invariant$1(!nt||!Array.isArray(nt)||nt.length===ot-1),o[0]>o[ot-1]&&(o=[].concat(o),et=[].concat(et),o.reverse(),et.reverse());const it=createMixers(et,nt,rt),st=ot===2?fastInterpolate(o,it):slowInterpolate(o,it);return tt?at=>st(clamp$1(o[0],o[ot-1],at)):st}const reverseEasing=o=>et=>1-o(1-et),mirrorEasing=o=>et=>et<=.5?o(2*et)/2:(2-o(2*(1-et)))/2,createExpoIn=o=>et=>Math.pow(et,o),createBackIn=o=>et=>et*et*((o+1)*et-o),createAnticipate=o=>{const et=createBackIn(o);return tt=>(tt*=2)<1?.5*et(tt):.5*(2-Math.pow(2,-10*(tt-1)))},DEFAULT_OVERSHOOT_STRENGTH=1.525,BOUNCE_FIRST_THRESHOLD=4/11,BOUNCE_SECOND_THRESHOLD=8/11,BOUNCE_THIRD_THRESHOLD=9/10,linear=o=>o,easeIn=createExpoIn(2),easeOut=reverseEasing(easeIn),easeInOut=mirrorEasing(easeIn),circIn=o=>1-Math.sin(Math.acos(o)),circOut=reverseEasing(circIn),circInOut=mirrorEasing(circOut),backIn=createBackIn(DEFAULT_OVERSHOOT_STRENGTH),backOut=reverseEasing(backIn),backInOut=mirrorEasing(backIn),anticipate=createAnticipate(DEFAULT_OVERSHOOT_STRENGTH),ca=4356/361,cb=35442/1805,cc=16061/1805,bounceOut=o=>{if(o===1||o===0)return o;const et=o*o;return oo<.5?.5*(1-bounceOut(1-o*2)):.5*bounceOut(o*2-1)+.5;function defaultEasing(o,et){return o.map(()=>et||easeInOut).splice(0,o.length-1)}function defaultOffset(o){const et=o.length;return o.map((tt,nt)=>nt!==0?nt/(et-1):0)}function convertOffsetToTimes(o,et){return o.map(tt=>tt*et)}function keyframes$1({from:o=0,to:et=1,ease:tt,offset:nt,duration:rt=300}){const ot={done:!1,value:o},it=Array.isArray(et)?et:[o,et],st=convertOffsetToTimes(nt&&nt.length===it.length?nt:defaultOffset(it),rt);function at(){return interpolate(st,it,{ease:Array.isArray(tt)?tt:defaultEasing(it,tt)})}let ct=at();return{next:lt=>(ot.value=ct(lt),ot.done=lt>=rt,ot),flipTarget:()=>{it.reverse(),ct=at()}}}function decay({velocity:o=0,from:et=0,power:tt=.8,timeConstant:nt=350,restDelta:rt=.5,modifyTarget:ot}){const it={done:!1,value:et};let st=tt*o;const at=et+st,ct=ot===void 0?at:ot(at);return ct!==at&&(st=ct-et),{next:lt=>{const dt=-st*Math.exp(-lt/nt);return it.done=!(dt>rt||dt<-rt),it.value=it.done?ct:ct+dt,it},flipTarget:()=>{}}}const types$3={keyframes:keyframes$1,spring,decay};function detectAnimationFromOptions(o){if(Array.isArray(o.to))return keyframes$1;if(types$3[o.type])return types$3[o.type];const et=new Set(Object.keys(o));return et.has("ease")||et.has("duration")&&!et.has("dampingRatio")?keyframes$1:et.has("dampingRatio")||et.has("stiffness")||et.has("mass")||et.has("damping")||et.has("restSpeed")||et.has("restDelta")?spring:keyframes$1}const defaultTimestep=1/60*1e3,getCurrentTime=typeof performance<"u"?()=>performance.now():()=>Date.now(),onNextFrame=typeof window<"u"?o=>window.requestAnimationFrame(o):o=>setTimeout(()=>o(getCurrentTime()),defaultTimestep);function createRenderStep(o){let et=[],tt=[],nt=0,rt=!1,ot=!1;const it=new WeakSet,st={schedule:(at,ct=!1,lt=!1)=>{const dt=lt&&rt,ht=dt?et:tt;return ct&&it.add(at),ht.indexOf(at)===-1&&(ht.push(at),dt&&rt&&(nt=et.length)),at},cancel:at=>{const ct=tt.indexOf(at);ct!==-1&&tt.splice(ct,1),it.delete(at)},process:at=>{if(rt){ot=!0;return}if(rt=!0,[et,tt]=[tt,et],tt.length=0,nt=et.length,nt)for(let ct=0;ct(o[et]=createRenderStep(()=>runNextFrame=!0),o),{}),sync=stepsOrder.reduce((o,et)=>{const tt=steps[et];return o[et]=(nt,rt=!1,ot=!1)=>(runNextFrame||startLoop(),tt.schedule(nt,rt,ot)),o},{}),cancelSync=stepsOrder.reduce((o,et)=>(o[et]=steps[et].cancel,o),{}),flushSync=stepsOrder.reduce((o,et)=>(o[et]=()=>steps[et].process(frame),o),{}),processStep=o=>steps[o].process(frame),processFrame=o=>{runNextFrame=!1,frame.delta=useDefaultElapsed?defaultTimestep:Math.max(Math.min(o-frame.timestamp,maxElapsed),1),frame.timestamp=o,isProcessing=!0,stepsOrder.forEach(processStep),isProcessing=!1,runNextFrame&&(useDefaultElapsed=!1,onNextFrame(processFrame))},startLoop=()=>{runNextFrame=!0,useDefaultElapsed=!0,isProcessing||onNextFrame(processFrame)},getFrameData=()=>frame;function loopElapsed(o,et,tt=0){return o-et-tt}function reverseElapsed(o,et,tt=0,nt=!0){return nt?loopElapsed(et+-o,et,tt):et-(o-et)+tt}function hasRepeatDelayElapsed(o,et,tt,nt){return nt?o>=et+tt:o<=-tt}const framesync=o=>{const et=({delta:tt})=>o(tt);return{start:()=>sync.update(et,!0),stop:()=>cancelSync.update(et)}};function animate$1(o){var et,tt,{from:nt,autoplay:rt=!0,driver:ot=framesync,elapsed:it=0,repeat:st=0,repeatType:at="loop",repeatDelay:ct=0,onPlay:lt,onStop:dt,onComplete:ht,onRepeat:pt,onUpdate:mt}=o,ft=__rest(o,["from","autoplay","driver","elapsed","repeat","repeatType","repeatDelay","onPlay","onStop","onComplete","onRepeat","onUpdate"]);let{to:yt}=ft,gt,xt=0,vt=ft.duration,bt,Et=!1,wt=!0,kt;const Tt=detectAnimationFromOptions(ft);!((tt=(et=Tt).needsInterpolation)===null||tt===void 0)&&tt.call(et,nt,yt)&&(kt=interpolate([0,100],[nt,yt],{clamp:!1}),nt=0,yt=100);const Rt=Tt(Object.assign(Object.assign({},ft),{from:nt,to:yt}));function Pt(){xt++,at==="reverse"?(wt=xt%2===0,it=reverseElapsed(it,vt,ct,wt)):(it=loopElapsed(it,vt,ct),at==="mirror"&&Rt.flipTarget()),Et=!1,pt&&pt()}function $t(){gt.stop(),ht&&ht()}function Ot(zt){if(wt||(zt=-zt),it+=zt,!Et){const Ft=Rt.next(Math.max(0,it));bt=Ft.value,kt&&(bt=kt(bt)),Et=wt?Ft.done:it<=0}mt==null||mt(bt),Et&&(xt===0&&(vt??(vt=it)),xt{dt==null||dt(),gt.stop()}}}function velocityPerSecond(o,et){return et?o*(1e3/et):0}function inertia({from:o=0,velocity:et=0,min:tt,max:nt,power:rt=.8,timeConstant:ot=750,bounceStiffness:it=500,bounceDamping:st=10,restDelta:at=1,modifyTarget:ct,driver:lt,onUpdate:dt,onComplete:ht,onStop:pt}){let mt;function ft(vt){return tt!==void 0&&vtnt}function yt(vt){return tt===void 0?nt:nt===void 0||Math.abs(tt-vt){var Et;dt==null||dt(bt),(Et=vt.onUpdate)===null||Et===void 0||Et.call(vt,bt)},onComplete:ht,onStop:pt}))}function xt(vt){gt(Object.assign({type:"spring",stiffness:it,damping:st,restDelta:at},vt))}if(ft(o))xt({from:o,velocity:et,to:yt(o)});else{let vt=rt*et+o;typeof ct<"u"&&(vt=ct(vt));const bt=yt(vt),Et=bt===tt?-1:1;let wt,kt;const Tt=Rt=>{wt=kt,kt=Rt,et=velocityPerSecond(Rt-wt,getFrameData().delta),(Et===1&&Rt>bt||Et===-1&&Rtmt==null?void 0:mt.stop()}}const isPoint=o=>o.hasOwnProperty("x")&&o.hasOwnProperty("y"),isPoint3D=o=>isPoint(o)&&o.hasOwnProperty("z"),distance1D=(o,et)=>Math.abs(o-et);function distance(o,et){if(isNum(o)&&isNum(et))return distance1D(o,et);if(isPoint(o)&&isPoint(et)){const tt=distance1D(o.x,et.x),nt=distance1D(o.y,et.y),rt=isPoint3D(o)&&isPoint3D(et)?distance1D(o.z,et.z):0;return Math.sqrt(Math.pow(tt,2)+Math.pow(nt,2)+Math.pow(rt,2))}}const a=(o,et)=>1-3*et+3*o,b$3=(o,et)=>3*et-6*o,c$2=o=>3*o,calcBezier=(o,et,tt)=>((a(et,tt)*o+b$3(et,tt))*o+c$2(et))*o,getSlope=(o,et,tt)=>3*a(et,tt)*o*o+2*b$3(et,tt)*o+c$2(et),subdivisionPrecision=1e-7,subdivisionMaxIterations=10;function binarySubdivide(o,et,tt,nt,rt){let ot,it,st=0;do it=et+(tt-et)/2,ot=calcBezier(it,nt,rt)-o,ot>0?tt=it:et=it;while(Math.abs(ot)>subdivisionPrecision&&++st=newtonMinSlope?newtonRaphsonIterate(it,dt,o,tt):ht===0?dt:binarySubdivide(it,st,st+kSampleStepSize,o,tt)}return it=>it===0||it===1?it:calcBezier(ot(it),et,nt)}function useTapGesture(o){var et=o.onTap,tt=o.onTapStart,nt=o.onTapCancel,rt=o.whileTap,ot=o.visualElement,it=et||tt||nt||rt,st=reactExports.useRef(!1),at=reactExports.useRef(null),ct={passive:!(tt||et||nt||mt)};function lt(){var ft;(ft=at.current)===null||ft===void 0||ft.call(at),at.current=null}function dt(){var ft;return lt(),st.current=!1,(ft=ot.animationState)===null||ft===void 0||ft.setActive(AnimationType.Tap,!1),!isDragActive()}function ht(ft,yt){dt()&&(isNodeOrChild(ot.getInstance(),ft.target)?et==null||et(ft,yt):nt==null||nt(ft,yt))}function pt(ft,yt){dt()&&(nt==null||nt(ft,yt))}function mt(ft,yt){var gt;lt(),!st.current&&(st.current=!0,at.current=pipe$1(addPointerEvent(window,"pointerup",ht,ct),addPointerEvent(window,"pointercancel",pt,ct)),(gt=ot.animationState)===null||gt===void 0||gt.setActive(AnimationType.Tap,!0),tt==null||tt(ft,yt))}usePointerEvent(ot,"pointerdown",it?mt:void 0,ct),useUnmountEffect(lt)}var warned=new Set;function warnOnce$1(o,et,tt){warned.has(et)||(console.warn(et),warned.add(et))}var observerCallbacks=new WeakMap,observers$1=new WeakMap,fireObserverCallback=function(o){var et;(et=observerCallbacks.get(o.target))===null||et===void 0||et(o)},fireAllObserverCallbacks=function(o){o.forEach(fireObserverCallback)};function initIntersectionObserver(o){var et=o.root,tt=__rest(o,["root"]),nt=et||document;observers$1.has(nt)||observers$1.set(nt,{});var rt=observers$1.get(nt),ot=JSON.stringify(tt);return rt[ot]||(rt[ot]=new IntersectionObserver(fireAllObserverCallbacks,__assign({root:et},tt))),rt[ot]}function observeIntersection(o,et,tt){var nt=initIntersectionObserver(et);return observerCallbacks.set(o,tt),nt.observe(o),function(){observerCallbacks.delete(o),nt.unobserve(o)}}function useViewport(o){var et=o.visualElement,tt=o.whileInView,nt=o.onViewportEnter,rt=o.onViewportLeave,ot=o.viewport,it=ot===void 0?{}:ot,st=reactExports.useRef({hasEnteredView:!1,isInView:!1}),at=!!(tt||nt||rt);it.once&&st.current.hasEnteredView&&(at=!1);var ct=typeof IntersectionObserver>"u"?useMissingIntersectionObserver:useIntersectionObserver;ct(at,st.current,et,it)}var thresholdNames={some:0,all:1};function useIntersectionObserver(o,et,tt,nt){var rt=nt.root,ot=nt.margin,it=nt.amount,st=it===void 0?"some":it,at=nt.once;reactExports.useEffect(function(){if(o){var ct={root:rt==null?void 0:rt.current,rootMargin:ot,threshold:typeof st=="number"?st:thresholdNames[st]},lt=function(dt){var ht,pt=dt.isIntersecting;if(et.isInView!==pt&&(et.isInView=pt,!(at&&!pt&&et.hasEnteredView))){pt&&(et.hasEnteredView=!0),(ht=tt.animationState)===null||ht===void 0||ht.setActive(AnimationType.InView,pt);var mt=tt.getProps(),ft=pt?mt.onViewportEnter:mt.onViewportLeave;ft==null||ft(dt)}};return observeIntersection(tt.getInstance(),ct,lt)}},[o,rt,ot,st])}function useMissingIntersectionObserver(o,et,tt,nt){var rt=nt.fallback,ot=rt===void 0?!0:rt;reactExports.useEffect(function(){!o||!ot||(env$1!=="production"&&warnOnce$1(!1,"IntersectionObserver not available on this device. whileInView animations will trigger on mount."),requestAnimationFrame(function(){var it;et.hasEnteredView=!0;var st=tt.getProps().onViewportEnter;st==null||st(null),(it=tt.animationState)===null||it===void 0||it.setActive(AnimationType.InView,!0)}))},[o])}var makeRenderlessComponent=function(o){return function(et){return o(et),null}},gestureAnimations={inView:makeRenderlessComponent(useViewport),tap:makeRenderlessComponent(useTapGesture),focus:makeRenderlessComponent(useFocusGesture),hover:makeRenderlessComponent(useHoverGesture)},counter=0,incrementId=function(){return counter++},useId$1=function(){return useConstant(incrementId)};function usePresence$1(){var o=reactExports.useContext(PresenceContext);if(o===null)return[!0,null];var et=o.isPresent,tt=o.onExitComplete,nt=o.register,rt=useId$1();reactExports.useEffect(function(){return nt(rt)},[]);var ot=function(){return tt==null?void 0:tt(rt)};return!et&&tt?[!1,ot]:[!0]}function shallowCompare(o,et){if(!Array.isArray(et))return!1;var tt=et.length;if(tt!==o.length)return!1;for(var nt=0;nt-1&&o.splice(tt,1)}var SubscriptionManager$1=function(){function o(){this.subscriptions=[]}return o.prototype.add=function(et){var tt=this;return addUniqueItem(this.subscriptions,et),function(){return removeItem(tt.subscriptions,et)}},o.prototype.notify=function(et,tt,nt){var rt=this.subscriptions.length;if(rt)if(rt===1)this.subscriptions[0](et,tt,nt);else for(var ot=0;otxt&&$t,Yt=Array.isArray(Pt)?Pt:[Pt],Ht=Yt.reduce(ot,{});Ot===!1&&(Ht={});var Ut=Rt.prevResolvedValues,qt=Ut===void 0?{}:Ut,Lt=__assign(__assign({},qt),Ht),Zt=function(nn){Ft=!0,yt.delete(nn),Rt.needsAnimating[nn]=!0};for(var Qt in Lt){var Nt=Ht[Qt],Gt=qt[Qt];gt.hasOwnProperty(Qt)||(Nt!==Gt?isKeyframesTarget(Nt)&&isKeyframesTarget(Gt)?!shallowCompare(Nt,Gt)||zt?Zt(Qt):Rt.protectedKeys[Qt]=!0:Nt!==void 0?Zt(Qt):yt.add(Qt):Nt!==void 0&&yt.has(Qt)?Zt(Qt):Rt.protectedKeys[Qt]=!0)}Rt.prevProp=Pt,Rt.prevResolvedValues=Ht,Rt.isActive&&(gt=__assign(__assign({},gt),Ht)),rt&&o.blockInitialAnimation&&(Ft=!1),Ft&&!Bt&&ft.push.apply(ft,__spreadArray([],__read(Yt.map(function(nn){return{animation:nn,options:__assign({type:Tt},lt)}})),!1))},bt=0;bt=3;if(!(!pt&&!mt)){var ft=ht.point,yt=getFrameData().timestamp;rt.history.push(__assign(__assign({},ft),{timestamp:yt}));var gt=rt.handlers,xt=gt.onStart,vt=gt.onMove;pt||(xt&&xt(rt.lastMoveEvent,ht),rt.startEvent=rt.lastMoveEvent),vt&&vt(rt.lastMoveEvent,ht)}}},this.handlePointerMove=function(ht,pt){if(rt.lastMoveEvent=ht,rt.lastMoveEventInfo=transformPoint(pt,rt.transformPagePoint),isMouseEvent(ht)&&ht.buttons===0){rt.handlePointerUp(ht,pt);return}sync.update(rt.updatePoint,!0)},this.handlePointerUp=function(ht,pt){rt.end();var mt=rt.handlers,ft=mt.onEnd,yt=mt.onSessionEnd,gt=getPanInfo(transformPoint(pt,rt.transformPagePoint),rt.history);rt.startEvent&&ft&&ft(ht,gt),yt&&yt(ht,gt)},!(isTouchEvent(et)&&et.touches.length>1)){this.handlers=tt,this.transformPagePoint=it;var st=extractEventInfo(et),at=transformPoint(st,this.transformPagePoint),ct=at.point,lt=getFrameData().timestamp;this.history=[__assign(__assign({},ct),{timestamp:lt})];var dt=tt.onSessionStart;dt&&dt(et,getPanInfo(at,this.history)),this.removeListeners=pipe$1(addPointerEvent(window,"pointermove",this.handlePointerMove),addPointerEvent(window,"pointerup",this.handlePointerUp),addPointerEvent(window,"pointercancel",this.handlePointerUp))}}return o.prototype.updateHandlers=function(et){this.handlers=et},o.prototype.end=function(){this.removeListeners&&this.removeListeners(),cancelSync.update(this.updatePoint)},o}();function transformPoint(o,et){return et?{point:et(o.point)}:o}function subtractPoint(o,et){return{x:o.x-et.x,y:o.y-et.y}}function getPanInfo(o,et){var tt=o.point;return{point:tt,delta:subtractPoint(tt,lastDevicePoint(et)),offset:subtractPoint(tt,startDevicePoint(et)),velocity:getVelocity(et,.1)}}function startDevicePoint(o){return o[0]}function lastDevicePoint(o){return o[o.length-1]}function getVelocity(o,et){if(o.length<2)return{x:0,y:0};for(var tt=o.length-1,nt=null,rt=lastDevicePoint(o);tt>=0&&(nt=o[tt],!(rt.timestamp-nt.timestamp>secondsToMilliseconds(et)));)tt--;if(!nt)return{x:0,y:0};var ot=(rt.timestamp-nt.timestamp)/1e3;if(ot===0)return{x:0,y:0};var it={x:(rt.x-nt.x)/ot,y:(rt.y-nt.y)/ot};return it.x===1/0&&(it.x=0),it.y===1/0&&(it.y=0),it}function calcLength(o){return o.max-o.min}function isNear(o,et,tt){return et===void 0&&(et=0),tt===void 0&&(tt=.01),distance(o,et)rt&&(o=tt?mix(rt,o,tt.max):Math.min(o,rt)),o}function calcRelativeAxisConstraints(o,et,tt){return{min:et!==void 0?o.min+et:void 0,max:tt!==void 0?o.max+tt-(o.max-o.min):void 0}}function calcRelativeConstraints(o,et){var tt=et.top,nt=et.left,rt=et.bottom,ot=et.right;return{x:calcRelativeAxisConstraints(o.x,nt,ot),y:calcRelativeAxisConstraints(o.y,tt,rt)}}function calcViewportAxisConstraints(o,et){var tt,nt=et.min-o.min,rt=et.max-o.max;return et.max-et.minnt?tt=progress(et.min,et.max-nt,o.min):nt>rt&&(tt=progress(o.min,o.max-rt,et.min)),clamp$1(0,1,tt)}function rebaseAxisConstraints(o,et){var tt={};return et.min!==void 0&&(tt.min=et.min-o.min),et.max!==void 0&&(tt.max=et.max-o.min),tt}var defaultElastic=.35;function resolveDragElastic(o){return o===void 0&&(o=defaultElastic),o===!1?o=0:o===!0&&(o=defaultElastic),{x:resolveAxisElastic(o,"left","right"),y:resolveAxisElastic(o,"top","bottom")}}function resolveAxisElastic(o,et,tt){return{min:resolvePointElastic(o,et),max:resolvePointElastic(o,tt)}}function resolvePointElastic(o,et){var tt;return typeof o=="number"?o:(tt=o[et])!==null&&tt!==void 0?tt:0}var createAxisDelta=function(){return{translate:0,scale:1,origin:0,originPoint:0}},createDelta=function(){return{x:createAxisDelta(),y:createAxisDelta()}},createAxis=function(){return{min:0,max:0}},createBox=function(){return{x:createAxis(),y:createAxis()}};function eachAxis(o){return[o("x"),o("y")]}function convertBoundingBoxToBox(o){var et=o.top,tt=o.left,nt=o.right,rt=o.bottom;return{x:{min:tt,max:nt},y:{min:et,max:rt}}}function convertBoxToBoundingBox(o){var et=o.x,tt=o.y;return{top:tt.min,right:et.max,bottom:tt.max,left:et.min}}function transformBoxPoints(o,et){if(!et)return o;var tt=et({x:o.left,y:o.top}),nt=et({x:o.right,y:o.bottom});return{top:tt.y,left:tt.x,bottom:nt.y,right:nt.x}}function isIdentityScale(o){return o===void 0||o===1}function hasScale(o){var et=o.scale,tt=o.scaleX,nt=o.scaleY;return!isIdentityScale(et)||!isIdentityScale(tt)||!isIdentityScale(nt)}function hasTransform(o){return hasScale(o)||hasTranslate(o.x)||hasTranslate(o.y)||o.z||o.rotate||o.rotateX||o.rotateY}function hasTranslate(o){return o&&o!=="0%"}function scalePoint(o,et,tt){var nt=o-tt,rt=et*nt;return tt+rt}function applyPointDelta(o,et,tt,nt,rt){return rt!==void 0&&(o=scalePoint(o,rt,nt)),scalePoint(o,tt,nt)+et}function applyAxisDelta(o,et,tt,nt,rt){et===void 0&&(et=0),tt===void 0&&(tt=1),o.min=applyPointDelta(o.min,et,tt,nt,rt),o.max=applyPointDelta(o.max,et,tt,nt,rt)}function applyBoxDelta(o,et){var tt=et.x,nt=et.y;applyAxisDelta(o.x,tt.translate,tt.scale,tt.originPoint),applyAxisDelta(o.y,nt.translate,nt.scale,nt.originPoint)}function applyTreeDeltas(o,et,tt,nt){var rt,ot;nt===void 0&&(nt=!1);var it=tt.length;if(it){et.x=et.y=1;for(var st,at,ct=0;ctet?tt="y":Math.abs(o.x)>et&&(tt="x"),tt}function useDrag(o){var et=o.dragControls,tt=o.visualElement,nt=useConstant(function(){return new VisualElementDragControls(tt)});reactExports.useEffect(function(){return et&&et.subscribe(nt)},[nt,et]),reactExports.useEffect(function(){return nt.addListeners()},[nt])}function usePanGesture(o){var et=o.onPan,tt=o.onPanStart,nt=o.onPanEnd,rt=o.onPanSessionStart,ot=o.visualElement,it=et||tt||nt||rt,st=reactExports.useRef(null),at=reactExports.useContext(MotionConfigContext).transformPagePoint,ct={onSessionStart:rt,onStart:tt,onMove:et,onEnd:function(dt,ht){st.current=null,nt&&nt(dt,ht)}};reactExports.useEffect(function(){st.current!==null&&st.current.updateHandlers(ct)});function lt(dt){st.current=new PanSession(dt,ct,{transformPagePoint:at})}usePointerEvent(ot,"pointerdown",it&<),useUnmountEffect(function(){return st.current&&st.current.end()})}var drag={pan:makeRenderlessComponent(usePanGesture),drag:makeRenderlessComponent(useDrag)},names$1=["LayoutMeasure","BeforeLayoutMeasure","LayoutUpdate","ViewportBoxUpdate","Update","Render","AnimationComplete","LayoutAnimationComplete","AnimationStart","LayoutAnimationStart","SetAxisTarget","Unmount"];function createLifecycles(){var o=names$1.map(function(){return new SubscriptionManager$1}),et={},tt={clearAllListeners:function(){return o.forEach(function(nt){return nt.clear()})},updatePropListeners:function(nt){names$1.forEach(function(rt){var ot,it="on"+rt,st=nt[it];(ot=et[rt])===null||ot===void 0||ot.call(et),st&&(et[rt]=tt[it](st))})}};return o.forEach(function(nt,rt){tt["on"+names$1[rt]]=function(ot){return nt.add(ot)},tt["notify"+names$1[rt]]=function(){for(var ot=[],it=0;it=0?window.pageYOffset:null,ct=convertChangedValueTypes(et,o,st);return ot.length&&ot.forEach(function(lt){var dt=__read(lt,2),ht=dt[0],pt=dt[1];o.getValue(ht).set(pt)}),o.syncRender(),at!==null&&window.scrollTo({top:at}),{target:ct,transitionEnd:nt}}else return{target:et,transitionEnd:nt}};function unitConversion(o,et,tt,nt){return hasPositionalKey(et)?checkAndConvertChangedValueTypes(o,et,tt,nt):{target:et,transitionEnd:nt}}var parseDomVariant=function(o,et,tt,nt){var rt=resolveCSSVariables(o,et,nt);return et=rt.target,nt=rt.transitionEnd,unitConversion(o,et,tt,nt)};function getComputedStyle$1(o){return window.getComputedStyle(o)}var htmlConfig={treeType:"dom",readValueFromInstance:function(o,et){if(isTransformProp(et)){var tt=getDefaultValueType(et);return tt&&tt.default||0}else{var nt=getComputedStyle$1(o);return(isCSSVariable$1(et)?nt.getPropertyValue(et):nt[et])||0}},sortNodePosition:function(o,et){return o.compareDocumentPosition(et)&2?1:-1},getBaseTarget:function(o,et){var tt;return(tt=o.style)===null||tt===void 0?void 0:tt[et]},measureViewportBox:function(o,et){var tt=et.transformPagePoint;return measureViewportBox(o,tt)},resetTransform:function(o,et,tt){var nt=tt.transformTemplate;et.style.transform=nt?nt({},""):"none",o.scheduleRender()},restoreTransform:function(o,et){o.style.transform=et.style.transform},removeValueFromRenderState:function(o,et){var tt=et.vars,nt=et.style;delete tt[o],delete nt[o]},makeTargetAnimatable:function(o,et,tt,nt){var rt=tt.transformValues;nt===void 0&&(nt=!0);var ot=et.transition,it=et.transitionEnd,st=__rest(et,["transition","transitionEnd"]),at=getOrigin(st,ot||{},o);if(rt&&(it&&(it=rt(it)),st&&(st=rt(st)),at&&(at=rt(at))),nt){checkTargetForNewValues(o,st,at);var ct=parseDomVariant(o,st,at,it);it=ct.transitionEnd,st=ct.target}return __assign({transition:ot,transitionEnd:it},st)},scrapeMotionValuesFromProps:scrapeMotionValuesFromProps$1,build:function(o,et,tt,nt,rt){o.isVisible!==void 0&&(et.style.visibility=o.isVisible?"visible":"hidden"),buildHTMLStyles(et,tt,nt,rt.transformTemplate)},render:renderHTML},htmlVisualElement=visualElement(htmlConfig),svgVisualElement=visualElement(__assign(__assign({},htmlConfig),{getBaseTarget:function(o,et){return o[et]},readValueFromInstance:function(o,et){var tt;return isTransformProp(et)?((tt=getDefaultValueType(et))===null||tt===void 0?void 0:tt.default)||0:(et=camelCaseAttributes.has(et)?et:camelToDash(et),o.getAttribute(et))},scrapeMotionValuesFromProps,build:function(o,et,tt,nt,rt){buildSVGAttrs(et,tt,nt,rt.transformTemplate)},render:renderSVG})),createDomVisualElement=function(o,et){return isSVGComponent(o)?svgVisualElement(et,{enableHardwareAcceleration:!1}):htmlVisualElement(et,{enableHardwareAcceleration:!0})};function pixelsToPercent(o,et){return et.max===et.min?0:o/(et.max-et.min)*100}var correctBorderRadius={correct:function(o,et){if(!et.target)return o;if(typeof o=="string")if(px.test(o))o=parseFloat(o);else return o;var tt=pixelsToPercent(o,et.target.x),nt=pixelsToPercent(o,et.target.y);return"".concat(tt,"% ").concat(nt,"%")}},varToken="_$css",correctBoxShadow={correct:function(o,et){var tt=et.treeScale,nt=et.projectionDelta,rt=o,ot=o.includes("var("),it=[];ot&&(o=o.replace(cssVariableRegex,function(ft){return it.push(ft),varToken}));var st=complex.parse(o);if(st.length>5)return rt;var at=complex.createTransformer(o),ct=typeof st[0]!="number"?1:0,lt=nt.x.scale*tt.x,dt=nt.y.scale*tt.y;st[0+ct]/=lt,st[1+ct]/=dt;var ht=mix(lt,dt,.5);typeof st[2+ct]=="number"&&(st[2+ct]/=ht),typeof st[3+ct]=="number"&&(st[3+ct]/=ht);var pt=at(st);if(ot){var mt=0;pt=pt.replace(varToken,function(){var ft=it[mt];return mt++,ft})}return pt}},MeasureLayoutWithContext=function(o){__extends(et,o);function et(){return o!==null&&o.apply(this,arguments)||this}return et.prototype.componentDidMount=function(){var tt=this,nt=this.props,rt=nt.visualElement,ot=nt.layoutGroup,it=nt.switchLayoutGroup,st=nt.layoutId,at=rt.projection;addScaleCorrector(defaultScaleCorrectors),at&&(ot!=null&&ot.group&&ot.group.add(at),it!=null&&it.register&&st&&it.register(at),at.root.didUpdate(),at.addEventListener("animationComplete",function(){tt.safeToRemove()}),at.setOptions(__assign(__assign({},at.options),{onExitComplete:function(){return tt.safeToRemove()}}))),globalProjectionState.hasEverUpdated=!0},et.prototype.getSnapshotBeforeUpdate=function(tt){var nt=this,rt=this.props,ot=rt.layoutDependency,it=rt.visualElement,st=rt.drag,at=rt.isPresent,ct=it.projection;return ct&&(ct.isPresent=at,st||tt.layoutDependency!==ot||ot===void 0?ct.willUpdate():this.safeToRemove(),tt.isPresent!==at&&(at?ct.promote():ct.relegate()||sync.postRender(function(){var lt;!((lt=ct.getStack())===null||lt===void 0)&<.members.length||nt.safeToRemove()}))),null},et.prototype.componentDidUpdate=function(){var tt=this.props.visualElement.projection;tt&&(tt.root.didUpdate(),!tt.currentAnimation&&tt.isLead()&&this.safeToRemove())},et.prototype.componentWillUnmount=function(){var tt=this.props,nt=tt.visualElement,rt=tt.layoutGroup,ot=tt.switchLayoutGroup,it=nt.projection;it&&(it.scheduleCheckAfterUnmount(),rt!=null&&rt.group&&rt.group.remove(it),ot!=null&&ot.deregister&&ot.deregister(it))},et.prototype.safeToRemove=function(){var tt=this.props.safeToRemove;tt==null||tt()},et.prototype.render=function(){return null},et}(React.Component);function MeasureLayout(o){var et=__read(usePresence$1(),2),tt=et[0],nt=et[1],rt=reactExports.useContext(LayoutGroupContext);return React.createElement(MeasureLayoutWithContext,__assign({},o,{layoutGroup:rt,switchLayoutGroup:reactExports.useContext(SwitchLayoutGroupContext),isPresent:tt,safeToRemove:nt}))}var defaultScaleCorrectors={borderRadius:__assign(__assign({},correctBorderRadius),{applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]}),borderTopLeftRadius:correctBorderRadius,borderTopRightRadius:correctBorderRadius,borderBottomLeftRadius:correctBorderRadius,borderBottomRightRadius:correctBorderRadius,boxShadow:correctBoxShadow},layoutFeatures={measureLayout:MeasureLayout};function animate(o,et,tt){tt===void 0&&(tt={});var nt=isMotionValue(o)?o:motionValue(o);return startAnimation("",nt,et,tt),{stop:function(){return nt.stop()},isAnimating:function(){return nt.isAnimating()}}}var borders=["TopLeft","TopRight","BottomLeft","BottomRight"],numBorders=borders.length,asNumber=function(o){return typeof o=="string"?parseFloat(o):o},isPx=function(o){return typeof o=="number"||px.test(o)};function mixValues(o,et,tt,nt,rt,ot){var it,st,at,ct;rt?(o.opacity=mix(0,(it=tt.opacity)!==null&&it!==void 0?it:1,easeCrossfadeIn(nt)),o.opacityExit=mix((st=et.opacity)!==null&&st!==void 0?st:1,0,easeCrossfadeOut(nt))):ot&&(o.opacity=mix((at=et.opacity)!==null&&at!==void 0?at:1,(ct=tt.opacity)!==null&&ct!==void 0?ct:1,nt));for(var lt=0;ltet?1:tt(progress(o,et,nt))}}function copyAxisInto(o,et){o.min=et.min,o.max=et.max}function copyBoxInto(o,et){copyAxisInto(o.x,et.x),copyAxisInto(o.y,et.y)}function removePointDelta(o,et,tt,nt,rt){return o-=et,o=scalePoint(o,1/tt,nt),rt!==void 0&&(o=scalePoint(o,1/rt,nt)),o}function removeAxisDelta(o,et,tt,nt,rt,ot,it){if(et===void 0&&(et=0),tt===void 0&&(tt=1),nt===void 0&&(nt=.5),ot===void 0&&(ot=o),it===void 0&&(it=o),percent.test(et)){et=parseFloat(et);var st=mix(it.min,it.max,et/100);et=st-it.min}if(typeof et=="number"){var at=mix(ot.min,ot.max,nt);o===ot&&(at-=et),o.min=removePointDelta(o.min,et,tt,at,rt),o.max=removePointDelta(o.max,et,tt,at,rt)}}function removeAxisTransforms(o,et,tt,nt,rt){var ot=__read(tt,3),it=ot[0],st=ot[1],at=ot[2];removeAxisDelta(o,et[it],et[st],et[at],et.scale,nt,rt)}var xKeys=["x","scaleX","originX"],yKeys=["y","scaleY","originY"];function removeBoxTransforms(o,et,tt,nt){removeAxisTransforms(o.x,et,xKeys,tt==null?void 0:tt.x,nt==null?void 0:nt.x),removeAxisTransforms(o.y,et,yKeys,tt==null?void 0:tt.y,nt==null?void 0:nt.y)}function isAxisDeltaZero(o){return o.translate===0&&o.scale===1}function isDeltaZero(o){return isAxisDeltaZero(o.x)&&isAxisDeltaZero(o.y)}function boxEquals(o,et){return o.x.min===et.x.min&&o.x.max===et.x.max&&o.y.min===et.y.min&&o.y.max===et.y.max}var NodeStack=function(){function o(){this.members=[]}return o.prototype.add=function(et){addUniqueItem(this.members,et),et.scheduleRender()},o.prototype.remove=function(et){if(removeItem(this.members,et),et===this.prevLead&&(this.prevLead=void 0),et===this.lead){var tt=this.members[this.members.length-1];tt&&this.promote(tt)}},o.prototype.relegate=function(et){var tt=this.members.findIndex(function(it){return et===it});if(tt===0)return!1;for(var nt,rt=tt;rt>=0;rt--){var ot=this.members[rt];if(ot.isPresent!==!1){nt=ot;break}}return nt?(this.promote(nt),!0):!1},o.prototype.promote=function(et,tt){var nt,rt=this.lead;if(et!==rt&&(this.prevLead=rt,this.lead=et,et.show(),rt)){rt.instance&&rt.scheduleRender(),et.scheduleRender(),et.resumeFrom=rt,tt&&(et.resumeFrom.preserveOpacity=!0),rt.snapshot&&(et.snapshot=rt.snapshot,et.snapshot.latestValues=rt.animationValues||rt.latestValues,et.snapshot.isShared=!0),!((nt=et.root)===null||nt===void 0)&&nt.isUpdating&&(et.isLayoutDirty=!0);var ot=et.options.crossfade;ot===!1&&rt.hide()}},o.prototype.exitAnimationComplete=function(){this.members.forEach(function(et){var tt,nt,rt,ot,it;(nt=(tt=et.options).onExitComplete)===null||nt===void 0||nt.call(tt),(it=(rt=et.resumingFrom)===null||rt===void 0?void 0:(ot=rt.options).onExitComplete)===null||it===void 0||it.call(ot)})},o.prototype.scheduleRender=function(){this.members.forEach(function(et){et.instance&&et.scheduleRender(!1)})},o.prototype.removeLeadSnapshot=function(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)},o}(),identityProjection="translate3d(0px, 0px, 0) scale(1, 1) scale(1, 1)";function buildProjectionTransform(o,et,tt){var nt=o.x.translate/et.x,rt=o.y.translate/et.y,ot="translate3d(".concat(nt,"px, ").concat(rt,"px, 0) ");if(ot+="scale(".concat(1/et.x,", ").concat(1/et.y,") "),tt){var it=tt.rotate,st=tt.rotateX,at=tt.rotateY;it&&(ot+="rotate(".concat(it,"deg) ")),st&&(ot+="rotateX(".concat(st,"deg) ")),at&&(ot+="rotateY(".concat(at,"deg) "))}var ct=o.x.scale*et.x,lt=o.y.scale*et.y;return ot+="scale(".concat(ct,", ").concat(lt,")"),ot===identityProjection?"none":ot}var compareByDepth=function(o,et){return o.depth-et.depth},FlatTree=function(){function o(){this.children=[],this.isDirty=!1}return o.prototype.add=function(et){addUniqueItem(this.children,et),this.isDirty=!0},o.prototype.remove=function(et){removeItem(this.children,et),this.isDirty=!0},o.prototype.forEach=function(et){this.isDirty&&this.children.sort(compareByDepth),this.isDirty=!1,this.children.forEach(et)},o}(),animationTarget=1e3;function createProjectionNode(o){var et=o.attachResizeListener,tt=o.defaultParent,nt=o.measureScroll,rt=o.checkIsScrollRoot,ot=o.resetTransform;return function(){function it(st,at,ct){var lt=this;at===void 0&&(at={}),ct===void 0&&(ct=tt==null?void 0:tt()),this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.potentialNodes=new Map,this.checkUpdateFailed=function(){lt.isUpdating&&(lt.isUpdating=!1,lt.clearAllSnapshots())},this.updateProjection=function(){lt.nodes.forEach(resolveTargetDelta),lt.nodes.forEach(calcProjection)},this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.id=st,this.latestValues=at,this.root=ct?ct.root||ct:this,this.path=ct?__spreadArray(__spreadArray([],__read(ct.path),!1),[ct],!1):[],this.parent=ct,this.depth=ct?ct.depth+1:0,st&&this.root.registerPotentialNode(st,this);for(var dt=0;dt=0;nt--)if(o.path[nt].instance){tt=o.path[nt];break}var rt=tt&&tt!==o.root?tt.instance:document,ot=rt.querySelector('[data-projection-id="'.concat(et,'"]'));ot&&o.mount(ot,!0)}function roundAxis(o){o.min=Math.round(o.min),o.max=Math.round(o.max)}function roundBox(o){roundAxis(o.x),roundAxis(o.y)}var DocumentProjectionNode=createProjectionNode({attachResizeListener:function(o,et){return addDomEvent(o,"resize",et)},measureScroll:function(){return{x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}},checkIsScrollRoot:function(){return!0}}),rootProjectionNode={current:void 0},HTMLProjectionNode=createProjectionNode({measureScroll:function(o){return{x:o.scrollLeft,y:o.scrollTop}},defaultParent:function(){if(!rootProjectionNode.current){var o=new DocumentProjectionNode(0,{});o.mount(window),o.setOptions({layoutScroll:!0}),rootProjectionNode.current=o}return rootProjectionNode.current},resetTransform:function(o,et){o.style.transform=et??"none"},checkIsScrollRoot:function(o){return window.getComputedStyle(o).position==="fixed"}}),featureBundle=__assign(__assign(__assign(__assign({},animations),gestureAnimations),drag),layoutFeatures),motion=createMotionProxy(function(o,et){return createDomMotionConfig(o,et,featureBundle,createDomVisualElement,HTMLProjectionNode)});function useIsMounted$1(){var o=reactExports.useRef(!1);return useIsomorphicLayoutEffect$3(function(){return o.current=!0,function(){o.current=!1}},[]),o}function useForceUpdate(){var o=useIsMounted$1(),et=__read(reactExports.useState(0),2),tt=et[0],nt=et[1],rt=reactExports.useCallback(function(){o.current&&nt(tt+1)},[tt]),ot=reactExports.useCallback(function(){return sync.postRender(rt)},[rt]);return[ot,tt]}var PresenceChild=function(o){var et=o.children,tt=o.initial,nt=o.isPresent,rt=o.onExitComplete,ot=o.custom,it=o.presenceAffectsLayout,st=useConstant(newChildrenMap),at=useId$1(),ct=reactExports.useMemo(function(){return{id:at,initial:tt,isPresent:nt,custom:ot,onExitComplete:function(lt){var dt,ht;st.set(lt,!0);try{for(var pt=__values(st.values()),mt=pt.next();!mt.done;mt=pt.next()){var ft=mt.value;if(!ft)return}}catch(yt){dt={error:yt}}finally{try{mt&&!mt.done&&(ht=pt.return)&&ht.call(pt)}finally{if(dt)throw dt.error}}rt==null||rt()},register:function(lt){return st.set(lt,!1),function(){return st.delete(lt)}}}},it?void 0:[nt]);return reactExports.useMemo(function(){st.forEach(function(lt,dt){return st.set(dt,!1)})},[nt]),reactExports.useEffect(function(){!nt&&!st.size&&(rt==null||rt())},[nt]),reactExports.createElement(PresenceContext.Provider,{value:ct},et)};function newChildrenMap(){return new Map}var getChildKey=function(o){return o.key||""};function updateChildLookup(o,et){o.forEach(function(tt){var nt=getChildKey(tt);et.set(nt,tt)})}function onlyElements(o){var et=[];return reactExports.Children.forEach(o,function(tt){reactExports.isValidElement(tt)&&et.push(tt)}),et}var AnimatePresence=function(o){var et=o.children,tt=o.custom,nt=o.initial,rt=nt===void 0?!0:nt,ot=o.onExitComplete,it=o.exitBeforeEnter,st=o.presenceAffectsLayout,at=st===void 0?!0:st,ct=__read(useForceUpdate(),1),lt=ct[0],dt=reactExports.useContext(LayoutGroupContext).forceRender;dt&&(lt=dt);var ht=useIsMounted$1(),pt=onlyElements(et),mt=pt,ft=new Set,yt=reactExports.useRef(mt),gt=reactExports.useRef(new Map).current,xt=reactExports.useRef(!0);if(useIsomorphicLayoutEffect$3(function(){xt.current=!1,updateChildLookup(pt,gt),yt.current=mt}),useUnmountEffect(function(){xt.current=!0,gt.clear(),ft.clear()}),xt.current)return reactExports.createElement(reactExports.Fragment,null,mt.map(function(Tt){return reactExports.createElement(PresenceChild,{key:getChildKey(Tt),isPresent:!0,initial:rt?void 0:!1,presenceAffectsLayout:at},Tt)}));mt=__spreadArray([],__read(mt),!1);for(var vt=yt.current.map(getChildKey),bt=pt.map(getChildKey),Et=vt.length,wt=0;wt1&&console.warn("You're attempting to animate multiple children within AnimatePresence, but its exitBeforeEnter prop is set to true. This will lead to odd visual behaviour."),reactExports.createElement(reactExports.Fragment,null,ft.size?mt:mt.map(function(Tt){return reactExports.cloneElement(Tt)}))};function MotionConfig(o){var et=o.children,tt=o.isValidProp,nt=__rest(o,["children","isValidProp"]);tt&&loadExternalIsValidProp(tt),nt=__assign(__assign({},reactExports.useContext(MotionConfigContext)),nt),nt.isStatic=useConstant(function(){return nt.isStatic});var rt=reactExports.useMemo(function(){return nt},[JSON.stringify(nt.transition),nt.transformPagePoint,nt.reducedMotion]);return reactExports.createElement(MotionConfigContext.Provider,{value:rt},et)}var reactIs$2={exports:{}},reactIs_production_min$1={};/** + */var h$3=reactExports,n$2=shimExports;function p$2(o,et){return o===et&&(o!==0||1/o===1/et)||o!==o&&et!==et}var q$3=typeof Object.is=="function"?Object.is:p$2,r$3=n$2.useSyncExternalStore,t$2=h$3.useRef,u$1=h$3.useEffect,v$3=h$3.useMemo,w$3=h$3.useDebugValue;withSelector_production_min.useSyncExternalStoreWithSelector=function(o,et,tt,nt,rt){var ot=t$2(null);if(ot.current===null){var it={hasValue:!1,value:null};ot.current=it}else it=ot.current;ot=v$3(function(){function at(pt){if(!ct){if(ct=!0,lt=pt,pt=nt(pt),rt!==void 0&&it.hasValue){var mt=it.value;if(rt(mt,pt))return dt=mt}return dt=pt}if(mt=dt,q$3(lt,pt))return mt;var ft=nt(pt);return rt!==void 0&&rt(mt,ft)?mt:(lt=pt,dt=ft)}var ct=!1,lt,dt,ht=tt===void 0?null:tt;return[function(){return at(et())},ht===null?void 0:function(){return at(ht())}]},[et,tt,nt,rt]);var st=r$3(o,ot[0],ot[1]);return u$1(function(){it.hasValue=!0,it.value=st},[st]),w$3(st),st};withSelector.exports=withSelector_production_min;var withSelectorExports=withSelector.exports;const isPlainObject$4=o=>typeof o=="object"&&!Array.isArray(o);function useSyncExternalStoreWithTracked(o,et,tt=et,nt=deepEqual){const rt=reactExports.useRef([]),ot=withSelectorExports.useSyncExternalStoreWithSelector(o,et,tt,it=>it,(it,st)=>{if(isPlainObject$4(it)&&isPlainObject$4(st)&&rt.current.length){for(const at of rt.current)if(!nt(it[at],st[at]))return!1;return!0}return nt(it,st)});return reactExports.useMemo(()=>{if(isPlainObject$4(ot)){const it={...ot};let st={};for(const[at,ct]of Object.entries(it))st={...st,[at]:{configurable:!1,enumerable:!0,get:()=>(rt.current.includes(at)||rt.current.push(at),ct)}};return Object.defineProperties(it,st),it}return ot},[ot])}function useAccount(o={}){const et=useConfig(o);return useSyncExternalStoreWithTracked(tt=>watchAccount(et,{onChange:tt}),()=>getAccount(et))}function useAccountEffect(o={}){const{onConnect:et,onDisconnect:tt}=o,nt=useConfig(o);reactExports.useEffect(()=>watchAccount(nt,{onChange(rt,ot){if((ot.status==="reconnecting"||ot.status==="connecting"&&ot.address===void 0)&&rt.status==="connected"){const{address:it,addresses:st,chain:at,chainId:ct,connector:lt}=rt,dt=ot.status==="reconnecting"||ot.status===void 0;et==null||et({address:it,addresses:st,chain:at,chainId:ct,connector:lt,isReconnected:dt})}else ot.status==="connected"&&rt.status==="disconnected"&&(tt==null||tt())}}),[nt,et,tt])}var Subscribable=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(o){return this.listeners.add(o),this.onSubscribe(),()=>{this.listeners.delete(o),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},isServer=typeof window>"u"||"Deno"in globalThis;function noop$4(){}function functionalUpdate(o,et){return typeof o=="function"?o(et):o}function isValidTimeout(o){return typeof o=="number"&&o>=0&&o!==1/0}function timeUntilStale(o,et){return Math.max(o+(et||0)-Date.now(),0)}function resolveStaleTime(o,et){return typeof o=="function"?o(et):o}function resolveEnabled(o,et){return typeof o=="function"?o(et):o}function matchQuery(o,et){const{type:tt="all",exact:nt,fetchStatus:rt,predicate:ot,queryKey:it,stale:st}=o;if(it){if(nt){if(et.queryHash!==hashQueryKeyByOptions(it,et.options))return!1}else if(!partialMatchKey(et.queryKey,it))return!1}if(tt!=="all"){const at=et.isActive();if(tt==="active"&&!at||tt==="inactive"&&at)return!1}return!(typeof st=="boolean"&&et.isStale()!==st||rt&&rt!==et.state.fetchStatus||ot&&!ot(et))}function matchMutation(o,et){const{exact:tt,status:nt,predicate:rt,mutationKey:ot}=o;if(ot){if(!et.options.mutationKey)return!1;if(tt){if(hashKey(et.options.mutationKey)!==hashKey(ot))return!1}else if(!partialMatchKey(et.options.mutationKey,ot))return!1}return!(nt&&et.state.status!==nt||rt&&!rt(et))}function hashQueryKeyByOptions(o,et){return((et==null?void 0:et.queryKeyHashFn)||hashKey)(o)}function hashKey(o){return JSON.stringify(o,(et,tt)=>isPlainObject$3(tt)?Object.keys(tt).sort().reduce((nt,rt)=>(nt[rt]=tt[rt],nt),{}):tt)}function partialMatchKey(o,et){return o===et?!0:typeof o!=typeof et?!1:o&&et&&typeof o=="object"&&typeof et=="object"?!Object.keys(et).some(tt=>!partialMatchKey(o[tt],et[tt])):!1}function replaceEqualDeep(o,et){if(o===et)return o;const tt=isPlainArray(o)&&isPlainArray(et);if(tt||isPlainObject$3(o)&&isPlainObject$3(et)){const nt=tt?o:Object.keys(o),rt=nt.length,ot=tt?et:Object.keys(et),it=ot.length,st=tt?[]:{};let at=0;for(let ct=0;ct{setTimeout(et,o)})}function replaceData(o,et,tt){return typeof tt.structuralSharing=="function"?tt.structuralSharing(o,et):tt.structuralSharing!==!1?replaceEqualDeep(o,et):et}function addToEnd(o,et,tt=0){const nt=[...o,et];return tt&&nt.length>tt?nt.slice(1):nt}function addToStart(o,et,tt=0){const nt=[et,...o];return tt&&nt.length>tt?nt.slice(0,-1):nt}var skipToken=Symbol();function ensureQueryFn(o,et){return!o.queryFn&&(et!=null&&et.initialPromise)?()=>et.initialPromise:!o.queryFn||o.queryFn===skipToken?()=>Promise.reject(new Error(`Missing queryFn: '${o.queryHash}'`)):o.queryFn}var Sr,lr,$r,Ds,FocusManager=(Ds=class extends Subscribable{constructor(){super();fn(this,Sr);fn(this,lr);fn(this,$r);un(this,$r,et=>{if(!isServer&&window.addEventListener){const tt=()=>et();return window.addEventListener("visibilitychange",tt,!1),()=>{window.removeEventListener("visibilitychange",tt)}}})}onSubscribe(){Mt(this,lr)||this.setEventListener(Mt(this,$r))}onUnsubscribe(){var et;this.hasListeners()||((et=Mt(this,lr))==null||et.call(this),un(this,lr,void 0))}setEventListener(et){var tt;un(this,$r,et),(tt=Mt(this,lr))==null||tt.call(this),un(this,lr,et(nt=>{typeof nt=="boolean"?this.setFocused(nt):this.onFocus()}))}setFocused(et){Mt(this,Sr)!==et&&(un(this,Sr,et),this.onFocus())}onFocus(){const et=this.isFocused();this.listeners.forEach(tt=>{tt(et)})}isFocused(){var et;return typeof Mt(this,Sr)=="boolean"?Mt(this,Sr):((et=globalThis.document)==null?void 0:et.visibilityState)!=="hidden"}},Sr=new WeakMap,lr=new WeakMap,$r=new WeakMap,Ds),focusManager=new FocusManager,Or,ur,Mr,Fs,OnlineManager=(Fs=class extends Subscribable{constructor(){super();fn(this,Or,!0);fn(this,ur);fn(this,Mr);un(this,Mr,et=>{if(!isServer&&window.addEventListener){const tt=()=>et(!0),nt=()=>et(!1);return window.addEventListener("online",tt,!1),window.addEventListener("offline",nt,!1),()=>{window.removeEventListener("online",tt),window.removeEventListener("offline",nt)}}})}onSubscribe(){Mt(this,ur)||this.setEventListener(Mt(this,Mr))}onUnsubscribe(){var et;this.hasListeners()||((et=Mt(this,ur))==null||et.call(this),un(this,ur,void 0))}setEventListener(et){var tt;un(this,Mr,et),(tt=Mt(this,ur))==null||tt.call(this),un(this,ur,et(this.setOnline.bind(this)))}setOnline(et){Mt(this,Or)!==et&&(un(this,Or,et),this.listeners.forEach(nt=>{nt(et)}))}isOnline(){return Mt(this,Or)}},Or=new WeakMap,ur=new WeakMap,Mr=new WeakMap,Fs),onlineManager=new OnlineManager;function pendingThenable(){let o,et;const tt=new Promise((rt,ot)=>{o=rt,et=ot});tt.status="pending",tt.catch(()=>{});function nt(rt){Object.assign(tt,rt),delete tt.resolve,delete tt.reject}return tt.resolve=rt=>{nt({status:"fulfilled",value:rt}),o(rt)},tt.reject=rt=>{nt({status:"rejected",reason:rt}),et(rt)},tt}function defaultRetryDelay(o){return Math.min(1e3*2**o,3e4)}function canFetch(o){return(o??"online")==="online"?onlineManager.isOnline():!0}var CancelledError=class extends Error{constructor(o){super("CancelledError"),this.revert=o==null?void 0:o.revert,this.silent=o==null?void 0:o.silent}};function isCancelledError(o){return o instanceof CancelledError}function createRetryer(o){let et=!1,tt=0,nt=!1,rt;const ot=pendingThenable(),it=ft=>{var yt;nt||(ht(new CancelledError(ft)),(yt=o.abort)==null||yt.call(o))},st=()=>{et=!0},at=()=>{et=!1},ct=()=>focusManager.isFocused()&&(o.networkMode==="always"||onlineManager.isOnline())&&o.canRun(),lt=()=>canFetch(o.networkMode)&&o.canRun(),dt=ft=>{var yt;nt||(nt=!0,(yt=o.onSuccess)==null||yt.call(o,ft),rt==null||rt(),ot.resolve(ft))},ht=ft=>{var yt;nt||(nt=!0,(yt=o.onError)==null||yt.call(o,ft),rt==null||rt(),ot.reject(ft))},pt=()=>new Promise(ft=>{var yt;rt=gt=>{(nt||ct())&&ft(gt)},(yt=o.onPause)==null||yt.call(o)}).then(()=>{var ft;rt=void 0,nt||(ft=o.onContinue)==null||ft.call(o)}),mt=()=>{if(nt)return;let ft;const yt=tt===0?o.initialPromise:void 0;try{ft=yt??o.fn()}catch(gt){ft=Promise.reject(gt)}Promise.resolve(ft).then(dt).catch(gt=>{var wt;if(nt)return;const xt=o.retry??(isServer?0:3),vt=o.retryDelay??defaultRetryDelay,bt=typeof vt=="function"?vt(tt,gt):vt,Et=xt===!0||typeof xt=="number"&&ttct()?void 0:pt()).then(()=>{et?ht(gt):mt()})})};return{promise:ot,cancel:it,continue:()=>(rt==null||rt(),ot),cancelRetry:st,continueRetry:at,canStart:lt,start:()=>(lt()?mt():pt().then(mt),ot)}}function createNotifyManager(){let o=[],et=0,tt=st=>{st()},nt=st=>{st()},rt=st=>setTimeout(st,0);const ot=st=>{et?o.push(st):rt(()=>{tt(st)})},it=()=>{const st=o;o=[],st.length&&rt(()=>{nt(()=>{st.forEach(at=>{tt(at)})})})};return{batch:st=>{let at;et++;try{at=st()}finally{et--,et||it()}return at},batchCalls:st=>(...at)=>{ot(()=>{st(...at)})},schedule:ot,setNotifyFunction:st=>{tt=st},setBatchNotifyFunction:st=>{nt=st},setScheduler:st=>{rt=st}}}var notifyManager=createNotifyManager(),kr,Us,Removable=(Us=class{constructor(){fn(this,kr)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),isValidTimeout(this.gcTime)&&un(this,kr,setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(o){this.gcTime=Math.max(this.gcTime||0,o??(isServer?1/0:5*60*1e3))}clearGcTimeout(){Mt(this,kr)&&(clearTimeout(Mt(this,kr)),un(this,kr,void 0))}},kr=new WeakMap,Us),Br,Dr,Un,jn,no,Ar,Hn,tr,zs,Query=(zs=class extends Removable{constructor(et){super();fn(this,Hn);fn(this,Br);fn(this,Dr);fn(this,Un);fn(this,jn);fn(this,no);fn(this,Ar);un(this,Ar,!1),un(this,no,et.defaultOptions),this.setOptions(et.options),this.observers=[],un(this,Un,et.cache),this.queryKey=et.queryKey,this.queryHash=et.queryHash,un(this,Br,getDefaultState$1(this.options)),this.state=et.state??Mt(this,Br),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var et;return(et=Mt(this,jn))==null?void 0:et.promise}setOptions(et){this.options={...Mt(this,no),...et},this.updateGcTime(this.options.gcTime)}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&Mt(this,Un).remove(this)}setData(et,tt){const nt=replaceData(this.state.data,et,this.options);return gn(this,Hn,tr).call(this,{data:nt,type:"success",dataUpdatedAt:tt==null?void 0:tt.updatedAt,manual:tt==null?void 0:tt.manual}),nt}setState(et,tt){gn(this,Hn,tr).call(this,{type:"setState",state:et,setStateOptions:tt})}cancel(et){var nt,rt;const tt=(nt=Mt(this,jn))==null?void 0:nt.promise;return(rt=Mt(this,jn))==null||rt.cancel(et),tt?tt.then(noop$4).catch(noop$4):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(Mt(this,Br))}isActive(){return this.observers.some(et=>resolveEnabled(et.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===skipToken||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStale(){return this.state.isInvalidated?!0:this.getObserversCount()>0?this.observers.some(et=>et.getCurrentResult().isStale):this.state.data===void 0}isStaleByTime(et=0){return this.state.isInvalidated||this.state.data===void 0||!timeUntilStale(this.state.dataUpdatedAt,et)}onFocus(){var tt;const et=this.observers.find(nt=>nt.shouldFetchOnWindowFocus());et==null||et.refetch({cancelRefetch:!1}),(tt=Mt(this,jn))==null||tt.continue()}onOnline(){var tt;const et=this.observers.find(nt=>nt.shouldFetchOnReconnect());et==null||et.refetch({cancelRefetch:!1}),(tt=Mt(this,jn))==null||tt.continue()}addObserver(et){this.observers.includes(et)||(this.observers.push(et),this.clearGcTimeout(),Mt(this,Un).notify({type:"observerAdded",query:this,observer:et}))}removeObserver(et){this.observers.includes(et)&&(this.observers=this.observers.filter(tt=>tt!==et),this.observers.length||(Mt(this,jn)&&(Mt(this,Ar)?Mt(this,jn).cancel({revert:!0}):Mt(this,jn).cancelRetry()),this.scheduleGc()),Mt(this,Un).notify({type:"observerRemoved",query:this,observer:et}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||gn(this,Hn,tr).call(this,{type:"invalidate"})}fetch(et,tt){var at,ct,lt;if(this.state.fetchStatus!=="idle"){if(this.state.data!==void 0&&(tt!=null&&tt.cancelRefetch))this.cancel({silent:!0});else if(Mt(this,jn))return Mt(this,jn).continueRetry(),Mt(this,jn).promise}if(et&&this.setOptions(et),!this.options.queryFn){const dt=this.observers.find(ht=>ht.options.queryFn);dt&&this.setOptions(dt.options)}const nt=new AbortController,rt=dt=>{Object.defineProperty(dt,"signal",{enumerable:!0,get:()=>(un(this,Ar,!0),nt.signal)})},ot=()=>{const dt=ensureQueryFn(this.options,tt),ht={queryKey:this.queryKey,meta:this.meta};return rt(ht),un(this,Ar,!1),this.options.persister?this.options.persister(dt,ht,this):dt(ht)},it={fetchOptions:tt,options:this.options,queryKey:this.queryKey,state:this.state,fetchFn:ot};rt(it),(at=this.options.behavior)==null||at.onFetch(it,this),un(this,Dr,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((ct=it.fetchOptions)==null?void 0:ct.meta))&&gn(this,Hn,tr).call(this,{type:"fetch",meta:(lt=it.fetchOptions)==null?void 0:lt.meta});const st=dt=>{var ht,pt,mt,ft;isCancelledError(dt)&&dt.silent||gn(this,Hn,tr).call(this,{type:"error",error:dt}),isCancelledError(dt)||((pt=(ht=Mt(this,Un).config).onError)==null||pt.call(ht,dt,this),(ft=(mt=Mt(this,Un).config).onSettled)==null||ft.call(mt,this.state.data,dt,this)),this.scheduleGc()};return un(this,jn,createRetryer({initialPromise:tt==null?void 0:tt.initialPromise,fn:it.fetchFn,abort:nt.abort.bind(nt),onSuccess:dt=>{var ht,pt,mt,ft;if(dt===void 0){st(new Error(`${this.queryHash} data is undefined`));return}try{this.setData(dt)}catch(yt){st(yt);return}(pt=(ht=Mt(this,Un).config).onSuccess)==null||pt.call(ht,dt,this),(ft=(mt=Mt(this,Un).config).onSettled)==null||ft.call(mt,dt,this.state.error,this),this.scheduleGc()},onError:st,onFail:(dt,ht)=>{gn(this,Hn,tr).call(this,{type:"failed",failureCount:dt,error:ht})},onPause:()=>{gn(this,Hn,tr).call(this,{type:"pause"})},onContinue:()=>{gn(this,Hn,tr).call(this,{type:"continue"})},retry:it.options.retry,retryDelay:it.options.retryDelay,networkMode:it.options.networkMode,canRun:()=>!0})),Mt(this,jn).start()}},Br=new WeakMap,Dr=new WeakMap,Un=new WeakMap,jn=new WeakMap,no=new WeakMap,Ar=new WeakMap,Hn=new WeakSet,tr=function(et){const tt=nt=>{switch(et.type){case"failed":return{...nt,fetchFailureCount:et.failureCount,fetchFailureReason:et.error};case"pause":return{...nt,fetchStatus:"paused"};case"continue":return{...nt,fetchStatus:"fetching"};case"fetch":return{...nt,...fetchState(nt.data,this.options),fetchMeta:et.meta??null};case"success":return{...nt,data:et.data,dataUpdateCount:nt.dataUpdateCount+1,dataUpdatedAt:et.dataUpdatedAt??Date.now(),error:null,isInvalidated:!1,status:"success",...!et.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};case"error":const rt=et.error;return isCancelledError(rt)&&rt.revert&&Mt(this,Dr)?{...Mt(this,Dr),fetchStatus:"idle"}:{...nt,error:rt,errorUpdateCount:nt.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:nt.fetchFailureCount+1,fetchFailureReason:rt,fetchStatus:"idle",status:"error"};case"invalidate":return{...nt,isInvalidated:!0};case"setState":return{...nt,...et.state}}};this.state=tt(this.state),notifyManager.batch(()=>{this.observers.forEach(nt=>{nt.onQueryUpdate()}),Mt(this,Un).notify({query:this,type:"updated",action:et})})},zs);function fetchState(o,et){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:canFetch(et.networkMode)?"fetching":"paused",...o===void 0&&{error:null,status:"pending"}}}function getDefaultState$1(o){const et=typeof o.initialData=="function"?o.initialData():o.initialData,tt=et!==void 0,nt=tt?typeof o.initialDataUpdatedAt=="function"?o.initialDataUpdatedAt():o.initialDataUpdatedAt:0;return{data:et,dataUpdateCount:0,dataUpdatedAt:tt?nt??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:tt?"success":"pending",fetchStatus:"idle"}}var Wn,Vs,QueryCache=(Vs=class extends Subscribable{constructor(et={}){super();fn(this,Wn);this.config=et,un(this,Wn,new Map)}build(et,tt,nt){const rt=tt.queryKey,ot=tt.queryHash??hashQueryKeyByOptions(rt,tt);let it=this.get(ot);return it||(it=new Query({cache:this,queryKey:rt,queryHash:ot,options:et.defaultQueryOptions(tt),state:nt,defaultOptions:et.getQueryDefaults(rt)}),this.add(it)),it}add(et){Mt(this,Wn).has(et.queryHash)||(Mt(this,Wn).set(et.queryHash,et),this.notify({type:"added",query:et}))}remove(et){const tt=Mt(this,Wn).get(et.queryHash);tt&&(et.destroy(),tt===et&&Mt(this,Wn).delete(et.queryHash),this.notify({type:"removed",query:et}))}clear(){notifyManager.batch(()=>{this.getAll().forEach(et=>{this.remove(et)})})}get(et){return Mt(this,Wn).get(et)}getAll(){return[...Mt(this,Wn).values()]}find(et){const tt={exact:!0,...et};return this.getAll().find(nt=>matchQuery(tt,nt))}findAll(et={}){const tt=this.getAll();return Object.keys(et).length>0?tt.filter(nt=>matchQuery(et,nt)):tt}notify(et){notifyManager.batch(()=>{this.listeners.forEach(tt=>{tt(et)})})}onFocus(){notifyManager.batch(()=>{this.getAll().forEach(et=>{et.onFocus()})})}onOnline(){notifyManager.batch(()=>{this.getAll().forEach(et=>{et.onOnline()})})}},Wn=new WeakMap,Vs),Gn,$n,Rr,qn,ar,Hs,Mutation=(Hs=class extends Removable{constructor(et){super();fn(this,qn);fn(this,Gn);fn(this,$n);fn(this,Rr);this.mutationId=et.mutationId,un(this,$n,et.mutationCache),un(this,Gn,[]),this.state=et.state||getDefaultState(),this.setOptions(et.options),this.scheduleGc()}setOptions(et){this.options=et,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(et){Mt(this,Gn).includes(et)||(Mt(this,Gn).push(et),this.clearGcTimeout(),Mt(this,$n).notify({type:"observerAdded",mutation:this,observer:et}))}removeObserver(et){un(this,Gn,Mt(this,Gn).filter(tt=>tt!==et)),this.scheduleGc(),Mt(this,$n).notify({type:"observerRemoved",mutation:this,observer:et})}optionalRemove(){Mt(this,Gn).length||(this.state.status==="pending"?this.scheduleGc():Mt(this,$n).remove(this))}continue(){var et;return((et=Mt(this,Rr))==null?void 0:et.continue())??this.execute(this.state.variables)}async execute(et){var rt,ot,it,st,at,ct,lt,dt,ht,pt,mt,ft,yt,gt,xt,vt,bt,Et,wt,kt;un(this,Rr,createRetryer({fn:()=>this.options.mutationFn?this.options.mutationFn(et):Promise.reject(new Error("No mutationFn found")),onFail:(It,Rt)=>{gn(this,qn,ar).call(this,{type:"failed",failureCount:It,error:Rt})},onPause:()=>{gn(this,qn,ar).call(this,{type:"pause"})},onContinue:()=>{gn(this,qn,ar).call(this,{type:"continue"})},retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>Mt(this,$n).canRun(this)}));const tt=this.state.status==="pending",nt=!Mt(this,Rr).canStart();try{if(!tt){gn(this,qn,ar).call(this,{type:"pending",variables:et,isPaused:nt}),await((ot=(rt=Mt(this,$n).config).onMutate)==null?void 0:ot.call(rt,et,this));const Rt=await((st=(it=this.options).onMutate)==null?void 0:st.call(it,et));Rt!==this.state.context&&gn(this,qn,ar).call(this,{type:"pending",context:Rt,variables:et,isPaused:nt})}const It=await Mt(this,Rr).start();return await((ct=(at=Mt(this,$n).config).onSuccess)==null?void 0:ct.call(at,It,et,this.state.context,this)),await((dt=(lt=this.options).onSuccess)==null?void 0:dt.call(lt,It,et,this.state.context)),await((pt=(ht=Mt(this,$n).config).onSettled)==null?void 0:pt.call(ht,It,null,this.state.variables,this.state.context,this)),await((ft=(mt=this.options).onSettled)==null?void 0:ft.call(mt,It,null,et,this.state.context)),gn(this,qn,ar).call(this,{type:"success",data:It}),It}catch(It){try{throw await((gt=(yt=Mt(this,$n).config).onError)==null?void 0:gt.call(yt,It,et,this.state.context,this)),await((vt=(xt=this.options).onError)==null?void 0:vt.call(xt,It,et,this.state.context)),await((Et=(bt=Mt(this,$n).config).onSettled)==null?void 0:Et.call(bt,void 0,It,this.state.variables,this.state.context,this)),await((kt=(wt=this.options).onSettled)==null?void 0:kt.call(wt,void 0,It,et,this.state.context)),It}finally{gn(this,qn,ar).call(this,{type:"error",error:It})}}finally{Mt(this,$n).runNext(this)}}},Gn=new WeakMap,$n=new WeakMap,Rr=new WeakMap,qn=new WeakSet,ar=function(et){const tt=nt=>{switch(et.type){case"failed":return{...nt,failureCount:et.failureCount,failureReason:et.error};case"pause":return{...nt,isPaused:!0};case"continue":return{...nt,isPaused:!1};case"pending":return{...nt,context:et.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:et.isPaused,status:"pending",variables:et.variables,submittedAt:Date.now()};case"success":return{...nt,data:et.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...nt,data:void 0,error:et.error,failureCount:nt.failureCount+1,failureReason:et.error,isPaused:!1,status:"error"}}};this.state=tt(this.state),notifyManager.batch(()=>{Mt(this,Gn).forEach(nt=>{nt.onMutationUpdate(et)}),Mt(this,$n).notify({mutation:this,type:"updated",action:et})})},Hs);function getDefaultState(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var Fn,ro,Ws,MutationCache=(Ws=class extends Subscribable{constructor(et={}){super();fn(this,Fn);fn(this,ro);this.config=et,un(this,Fn,new Map),un(this,ro,Date.now())}build(et,tt,nt){const rt=new Mutation({mutationCache:this,mutationId:++br(this,ro)._,options:et.defaultMutationOptions(tt),state:nt});return this.add(rt),rt}add(et){const tt=scopeFor(et),nt=Mt(this,Fn).get(tt)??[];nt.push(et),Mt(this,Fn).set(tt,nt),this.notify({type:"added",mutation:et})}remove(et){var nt;const tt=scopeFor(et);if(Mt(this,Fn).has(tt)){const rt=(nt=Mt(this,Fn).get(tt))==null?void 0:nt.filter(ot=>ot!==et);rt&&(rt.length===0?Mt(this,Fn).delete(tt):Mt(this,Fn).set(tt,rt))}this.notify({type:"removed",mutation:et})}canRun(et){var nt;const tt=(nt=Mt(this,Fn).get(scopeFor(et)))==null?void 0:nt.find(rt=>rt.state.status==="pending");return!tt||tt===et}runNext(et){var nt;const tt=(nt=Mt(this,Fn).get(scopeFor(et)))==null?void 0:nt.find(rt=>rt!==et&&rt.state.isPaused);return(tt==null?void 0:tt.continue())??Promise.resolve()}clear(){notifyManager.batch(()=>{this.getAll().forEach(et=>{this.remove(et)})})}getAll(){return[...Mt(this,Fn).values()].flat()}find(et){const tt={exact:!0,...et};return this.getAll().find(nt=>matchMutation(tt,nt))}findAll(et={}){return this.getAll().filter(tt=>matchMutation(et,tt))}notify(et){notifyManager.batch(()=>{this.listeners.forEach(tt=>{tt(et)})})}resumePausedMutations(){const et=this.getAll().filter(tt=>tt.state.isPaused);return notifyManager.batch(()=>Promise.all(et.map(tt=>tt.continue().catch(noop$4))))}},Fn=new WeakMap,ro=new WeakMap,Ws);function scopeFor(o){var et;return((et=o.options.scope)==null?void 0:et.id)??String(o.mutationId)}function infiniteQueryBehavior(o){return{onFetch:(et,tt)=>{var lt,dt,ht,pt,mt;const nt=et.options,rt=(ht=(dt=(lt=et.fetchOptions)==null?void 0:lt.meta)==null?void 0:dt.fetchMore)==null?void 0:ht.direction,ot=((pt=et.state.data)==null?void 0:pt.pages)||[],it=((mt=et.state.data)==null?void 0:mt.pageParams)||[];let st={pages:[],pageParams:[]},at=0;const ct=async()=>{let ft=!1;const yt=vt=>{Object.defineProperty(vt,"signal",{enumerable:!0,get:()=>(et.signal.aborted?ft=!0:et.signal.addEventListener("abort",()=>{ft=!0}),et.signal)})},gt=ensureQueryFn(et.options,et.fetchOptions),xt=async(vt,bt,Et)=>{if(ft)return Promise.reject();if(bt==null&&vt.pages.length)return Promise.resolve(vt);const wt={queryKey:et.queryKey,pageParam:bt,direction:Et?"backward":"forward",meta:et.options.meta};yt(wt);const kt=await gt(wt),{maxPages:It}=et.options,Rt=Et?addToStart:addToEnd;return{pages:Rt(vt.pages,kt,It),pageParams:Rt(vt.pageParams,bt,It)}};if(rt&&ot.length){const vt=rt==="backward",bt=vt?getPreviousPageParam:getNextPageParam,Et={pages:ot,pageParams:it},wt=bt(nt,Et);st=await xt(Et,wt,vt)}else{const vt=o??ot.length;do{const bt=at===0?it[0]??nt.initialPageParam:getNextPageParam(nt,st);if(at>0&&bt==null)break;st=await xt(st,bt),at++}while(at{var ft,yt;return(yt=(ft=et.options).persister)==null?void 0:yt.call(ft,ct,{queryKey:et.queryKey,meta:et.options.meta,signal:et.signal},tt)}:et.fetchFn=ct}}}function getNextPageParam(o,{pages:et,pageParams:tt}){const nt=et.length-1;return et.length>0?o.getNextPageParam(et[nt],et,tt[nt],tt):void 0}function getPreviousPageParam(o,{pages:et,pageParams:tt}){var nt;return et.length>0?(nt=o.getPreviousPageParam)==null?void 0:nt.call(o,et[0],et,tt[0],tt):void 0}var Nn,dr,hr,Fr,Ur,pr,zr,Vr,Gs,QueryClient=(Gs=class{constructor(o={}){fn(this,Nn);fn(this,dr);fn(this,hr);fn(this,Fr);fn(this,Ur);fn(this,pr);fn(this,zr);fn(this,Vr);un(this,Nn,o.queryCache||new QueryCache),un(this,dr,o.mutationCache||new MutationCache),un(this,hr,o.defaultOptions||{}),un(this,Fr,new Map),un(this,Ur,new Map),un(this,pr,0)}mount(){br(this,pr)._++,Mt(this,pr)===1&&(un(this,zr,focusManager.subscribe(async o=>{o&&(await this.resumePausedMutations(),Mt(this,Nn).onFocus())})),un(this,Vr,onlineManager.subscribe(async o=>{o&&(await this.resumePausedMutations(),Mt(this,Nn).onOnline())})))}unmount(){var o,et;br(this,pr)._--,Mt(this,pr)===0&&((o=Mt(this,zr))==null||o.call(this),un(this,zr,void 0),(et=Mt(this,Vr))==null||et.call(this),un(this,Vr,void 0))}isFetching(o){return Mt(this,Nn).findAll({...o,fetchStatus:"fetching"}).length}isMutating(o){return Mt(this,dr).findAll({...o,status:"pending"}).length}getQueryData(o){var tt;const et=this.defaultQueryOptions({queryKey:o});return(tt=Mt(this,Nn).get(et.queryHash))==null?void 0:tt.state.data}ensureQueryData(o){const et=this.getQueryData(o.queryKey);if(et===void 0)return this.fetchQuery(o);{const tt=this.defaultQueryOptions(o),nt=Mt(this,Nn).build(this,tt);return o.revalidateIfStale&&nt.isStaleByTime(resolveStaleTime(tt.staleTime,nt))&&this.prefetchQuery(tt),Promise.resolve(et)}}getQueriesData(o){return Mt(this,Nn).findAll(o).map(({queryKey:et,state:tt})=>{const nt=tt.data;return[et,nt]})}setQueryData(o,et,tt){const nt=this.defaultQueryOptions({queryKey:o}),rt=Mt(this,Nn).get(nt.queryHash),ot=rt==null?void 0:rt.state.data,it=functionalUpdate(et,ot);if(it!==void 0)return Mt(this,Nn).build(this,nt).setData(it,{...tt,manual:!0})}setQueriesData(o,et,tt){return notifyManager.batch(()=>Mt(this,Nn).findAll(o).map(({queryKey:nt})=>[nt,this.setQueryData(nt,et,tt)]))}getQueryState(o){var tt;const et=this.defaultQueryOptions({queryKey:o});return(tt=Mt(this,Nn).get(et.queryHash))==null?void 0:tt.state}removeQueries(o){const et=Mt(this,Nn);notifyManager.batch(()=>{et.findAll(o).forEach(tt=>{et.remove(tt)})})}resetQueries(o,et){const tt=Mt(this,Nn),nt={type:"active",...o};return notifyManager.batch(()=>(tt.findAll(o).forEach(rt=>{rt.reset()}),this.refetchQueries(nt,et)))}cancelQueries(o={},et={}){const tt={revert:!0,...et},nt=notifyManager.batch(()=>Mt(this,Nn).findAll(o).map(rt=>rt.cancel(tt)));return Promise.all(nt).then(noop$4).catch(noop$4)}invalidateQueries(o={},et={}){return notifyManager.batch(()=>{if(Mt(this,Nn).findAll(o).forEach(nt=>{nt.invalidate()}),o.refetchType==="none")return Promise.resolve();const tt={...o,type:o.refetchType??o.type??"active"};return this.refetchQueries(tt,et)})}refetchQueries(o={},et){const tt={...et,cancelRefetch:(et==null?void 0:et.cancelRefetch)??!0},nt=notifyManager.batch(()=>Mt(this,Nn).findAll(o).filter(rt=>!rt.isDisabled()).map(rt=>{let ot=rt.fetch(void 0,tt);return tt.throwOnError||(ot=ot.catch(noop$4)),rt.state.fetchStatus==="paused"?Promise.resolve():ot}));return Promise.all(nt).then(noop$4)}fetchQuery(o){const et=this.defaultQueryOptions(o);et.retry===void 0&&(et.retry=!1);const tt=Mt(this,Nn).build(this,et);return tt.isStaleByTime(resolveStaleTime(et.staleTime,tt))?tt.fetch(et):Promise.resolve(tt.state.data)}prefetchQuery(o){return this.fetchQuery(o).then(noop$4).catch(noop$4)}fetchInfiniteQuery(o){return o.behavior=infiniteQueryBehavior(o.pages),this.fetchQuery(o)}prefetchInfiniteQuery(o){return this.fetchInfiniteQuery(o).then(noop$4).catch(noop$4)}ensureInfiniteQueryData(o){return o.behavior=infiniteQueryBehavior(o.pages),this.ensureQueryData(o)}resumePausedMutations(){return onlineManager.isOnline()?Mt(this,dr).resumePausedMutations():Promise.resolve()}getQueryCache(){return Mt(this,Nn)}getMutationCache(){return Mt(this,dr)}getDefaultOptions(){return Mt(this,hr)}setDefaultOptions(o){un(this,hr,o)}setQueryDefaults(o,et){Mt(this,Fr).set(hashKey(o),{queryKey:o,defaultOptions:et})}getQueryDefaults(o){const et=[...Mt(this,Fr).values()];let tt={};return et.forEach(nt=>{partialMatchKey(o,nt.queryKey)&&(tt={...tt,...nt.defaultOptions})}),tt}setMutationDefaults(o,et){Mt(this,Ur).set(hashKey(o),{mutationKey:o,defaultOptions:et})}getMutationDefaults(o){const et=[...Mt(this,Ur).values()];let tt={};return et.forEach(nt=>{partialMatchKey(o,nt.mutationKey)&&(tt={...tt,...nt.defaultOptions})}),tt}defaultQueryOptions(o){if(o._defaulted)return o;const et={...Mt(this,hr).queries,...this.getQueryDefaults(o.queryKey),...o,_defaulted:!0};return et.queryHash||(et.queryHash=hashQueryKeyByOptions(et.queryKey,et)),et.refetchOnReconnect===void 0&&(et.refetchOnReconnect=et.networkMode!=="always"),et.throwOnError===void 0&&(et.throwOnError=!!et.suspense),!et.networkMode&&et.persister&&(et.networkMode="offlineFirst"),et.enabled!==!0&&et.queryFn===skipToken&&(et.enabled=!1),et}defaultMutationOptions(o){return o!=null&&o._defaulted?o:{...Mt(this,hr).mutations,...(o==null?void 0:o.mutationKey)&&this.getMutationDefaults(o.mutationKey),...o,_defaulted:!0}}clear(){Mt(this,Nn).clear(),Mt(this,dr).clear()}},Nn=new WeakMap,dr=new WeakMap,hr=new WeakMap,Fr=new WeakMap,Ur=new WeakMap,pr=new WeakMap,zr=new WeakMap,Vr=new WeakMap,Gs),Mn,Sn,oo,On,_r,Hr,fr,Kn,io,Wr,Gr,Ir,Tr,mr,qr,In,to,Rs,_s,Is,Ts,Ps,Ls,Ns,Ql,qs,QueryObserver=(qs=class extends Subscribable{constructor(et,tt){super();fn(this,In);fn(this,Mn);fn(this,Sn);fn(this,oo);fn(this,On);fn(this,_r);fn(this,Hr);fn(this,fr);fn(this,Kn);fn(this,io);fn(this,Wr);fn(this,Gr);fn(this,Ir);fn(this,Tr);fn(this,mr);fn(this,qr,new Set);this.options=tt,un(this,Mn,et),un(this,Kn,null),un(this,fr,pendingThenable()),this.options.experimental_prefetchInRender||Mt(this,fr).reject(new Error("experimental_prefetchInRender feature flag is not enabled")),this.bindMethods(),this.setOptions(tt)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(Mt(this,Sn).addObserver(this),shouldFetchOnMount(Mt(this,Sn),this.options)?gn(this,In,to).call(this):this.updateResult(),gn(this,In,Ts).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return shouldFetchOn(Mt(this,Sn),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return shouldFetchOn(Mt(this,Sn),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,gn(this,In,Ps).call(this),gn(this,In,Ls).call(this),Mt(this,Sn).removeObserver(this)}setOptions(et,tt){const nt=this.options,rt=Mt(this,Sn);if(this.options=Mt(this,Mn).defaultQueryOptions(et),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof resolveEnabled(this.options.enabled,Mt(this,Sn))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");gn(this,In,Ns).call(this),Mt(this,Sn).setOptions(this.options),nt._defaulted&&!shallowEqualObjects(this.options,nt)&&Mt(this,Mn).getQueryCache().notify({type:"observerOptionsUpdated",query:Mt(this,Sn),observer:this});const ot=this.hasListeners();ot&&shouldFetchOptionally(Mt(this,Sn),rt,this.options,nt)&&gn(this,In,to).call(this),this.updateResult(tt),ot&&(Mt(this,Sn)!==rt||resolveEnabled(this.options.enabled,Mt(this,Sn))!==resolveEnabled(nt.enabled,Mt(this,Sn))||resolveStaleTime(this.options.staleTime,Mt(this,Sn))!==resolveStaleTime(nt.staleTime,Mt(this,Sn)))&&gn(this,In,Rs).call(this);const it=gn(this,In,_s).call(this);ot&&(Mt(this,Sn)!==rt||resolveEnabled(this.options.enabled,Mt(this,Sn))!==resolveEnabled(nt.enabled,Mt(this,Sn))||it!==Mt(this,mr))&&gn(this,In,Is).call(this,it)}getOptimisticResult(et){const tt=Mt(this,Mn).getQueryCache().build(Mt(this,Mn),et),nt=this.createResult(tt,et);return shouldAssignObserverCurrentProperties(this,nt)&&(un(this,On,nt),un(this,Hr,this.options),un(this,_r,Mt(this,Sn).state)),nt}getCurrentResult(){return Mt(this,On)}trackResult(et,tt){const nt={};return Object.keys(et).forEach(rt=>{Object.defineProperty(nt,rt,{configurable:!1,enumerable:!0,get:()=>(this.trackProp(rt),tt==null||tt(rt),et[rt])})}),nt}trackProp(et){Mt(this,qr).add(et)}getCurrentQuery(){return Mt(this,Sn)}refetch({...et}={}){return this.fetch({...et})}fetchOptimistic(et){const tt=Mt(this,Mn).defaultQueryOptions(et),nt=Mt(this,Mn).getQueryCache().build(Mt(this,Mn),tt);return nt.fetch().then(()=>this.createResult(nt,tt))}fetch(et){return gn(this,In,to).call(this,{...et,cancelRefetch:et.cancelRefetch??!0}).then(()=>(this.updateResult(),Mt(this,On)))}createResult(et,tt){var It;const nt=Mt(this,Sn),rt=this.options,ot=Mt(this,On),it=Mt(this,_r),st=Mt(this,Hr),ct=et!==nt?et.state:Mt(this,oo),{state:lt}=et;let dt={...lt},ht=!1,pt;if(tt._optimisticResults){const Rt=this.hasListeners(),Pt=!Rt&&shouldFetchOnMount(et,tt),jt=Rt&&shouldFetchOptionally(et,nt,tt,rt);(Pt||jt)&&(dt={...dt,...fetchState(lt.data,et.options)}),tt._optimisticResults==="isRestoring"&&(dt.fetchStatus="idle")}let{error:mt,errorUpdatedAt:ft,status:yt}=dt;if(tt.select&&dt.data!==void 0)if(ot&&dt.data===(it==null?void 0:it.data)&&tt.select===Mt(this,io))pt=Mt(this,Wr);else try{un(this,io,tt.select),pt=tt.select(dt.data),pt=replaceData(ot==null?void 0:ot.data,pt,tt),un(this,Wr,pt),un(this,Kn,null)}catch(Rt){un(this,Kn,Rt)}else pt=dt.data;if(tt.placeholderData!==void 0&&pt===void 0&&yt==="pending"){let Rt;if(ot!=null&&ot.isPlaceholderData&&tt.placeholderData===(st==null?void 0:st.placeholderData))Rt=ot.data;else if(Rt=typeof tt.placeholderData=="function"?tt.placeholderData((It=Mt(this,Gr))==null?void 0:It.state.data,Mt(this,Gr)):tt.placeholderData,tt.select&&Rt!==void 0)try{Rt=tt.select(Rt),un(this,Kn,null)}catch(Pt){un(this,Kn,Pt)}Rt!==void 0&&(yt="success",pt=replaceData(ot==null?void 0:ot.data,Rt,tt),ht=!0)}Mt(this,Kn)&&(mt=Mt(this,Kn),pt=Mt(this,Wr),ft=Date.now(),yt="error");const gt=dt.fetchStatus==="fetching",xt=yt==="pending",vt=yt==="error",bt=xt&>,Et=pt!==void 0,kt={status:yt,fetchStatus:dt.fetchStatus,isPending:xt,isSuccess:yt==="success",isError:vt,isInitialLoading:bt,isLoading:bt,data:pt,dataUpdatedAt:dt.dataUpdatedAt,error:mt,errorUpdatedAt:ft,failureCount:dt.fetchFailureCount,failureReason:dt.fetchFailureReason,errorUpdateCount:dt.errorUpdateCount,isFetched:dt.dataUpdateCount>0||dt.errorUpdateCount>0,isFetchedAfterMount:dt.dataUpdateCount>ct.dataUpdateCount||dt.errorUpdateCount>ct.errorUpdateCount,isFetching:gt,isRefetching:gt&&!xt,isLoadingError:vt&&!Et,isPaused:dt.fetchStatus==="paused",isPlaceholderData:ht,isRefetchError:vt&&Et,isStale:isStale(et,tt),refetch:this.refetch,promise:Mt(this,fr)};if(this.options.experimental_prefetchInRender){const Rt=Ot=>{kt.status==="error"?Ot.reject(kt.error):kt.data!==void 0&&Ot.resolve(kt.data)},Pt=()=>{const Ot=un(this,fr,kt.promise=pendingThenable());Rt(Ot)},jt=Mt(this,fr);switch(jt.status){case"pending":et.queryHash===nt.queryHash&&Rt(jt);break;case"fulfilled":(kt.status==="error"||kt.data!==jt.value)&&Pt();break;case"rejected":(kt.status!=="error"||kt.error!==jt.reason)&&Pt();break}}return kt}updateResult(et){const tt=Mt(this,On),nt=this.createResult(Mt(this,Sn),this.options);if(un(this,_r,Mt(this,Sn).state),un(this,Hr,this.options),Mt(this,_r).data!==void 0&&un(this,Gr,Mt(this,Sn)),shallowEqualObjects(nt,tt))return;un(this,On,nt);const rt={},ot=()=>{if(!tt)return!0;const{notifyOnChangeProps:it}=this.options,st=typeof it=="function"?it():it;if(st==="all"||!st&&!Mt(this,qr).size)return!0;const at=new Set(st??Mt(this,qr));return this.options.throwOnError&&at.add("error"),Object.keys(Mt(this,On)).some(ct=>{const lt=ct;return Mt(this,On)[lt]!==tt[lt]&&at.has(lt)})};(et==null?void 0:et.listeners)!==!1&&ot()&&(rt.listeners=!0),gn(this,In,Ql).call(this,{...rt,...et})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&gn(this,In,Ts).call(this)}},Mn=new WeakMap,Sn=new WeakMap,oo=new WeakMap,On=new WeakMap,_r=new WeakMap,Hr=new WeakMap,fr=new WeakMap,Kn=new WeakMap,io=new WeakMap,Wr=new WeakMap,Gr=new WeakMap,Ir=new WeakMap,Tr=new WeakMap,mr=new WeakMap,qr=new WeakMap,In=new WeakSet,to=function(et){gn(this,In,Ns).call(this);let tt=Mt(this,Sn).fetch(this.options,et);return et!=null&&et.throwOnError||(tt=tt.catch(noop$4)),tt},Rs=function(){gn(this,In,Ps).call(this);const et=resolveStaleTime(this.options.staleTime,Mt(this,Sn));if(isServer||Mt(this,On).isStale||!isValidTimeout(et))return;const nt=timeUntilStale(Mt(this,On).dataUpdatedAt,et)+1;un(this,Ir,setTimeout(()=>{Mt(this,On).isStale||this.updateResult()},nt))},_s=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(Mt(this,Sn)):this.options.refetchInterval)??!1},Is=function(et){gn(this,In,Ls).call(this),un(this,mr,et),!(isServer||resolveEnabled(this.options.enabled,Mt(this,Sn))===!1||!isValidTimeout(Mt(this,mr))||Mt(this,mr)===0)&&un(this,Tr,setInterval(()=>{(this.options.refetchIntervalInBackground||focusManager.isFocused())&&gn(this,In,to).call(this)},Mt(this,mr)))},Ts=function(){gn(this,In,Rs).call(this),gn(this,In,Is).call(this,gn(this,In,_s).call(this))},Ps=function(){Mt(this,Ir)&&(clearTimeout(Mt(this,Ir)),un(this,Ir,void 0))},Ls=function(){Mt(this,Tr)&&(clearInterval(Mt(this,Tr)),un(this,Tr,void 0))},Ns=function(){const et=Mt(this,Mn).getQueryCache().build(Mt(this,Mn),this.options);if(et===Mt(this,Sn))return;const tt=Mt(this,Sn);un(this,Sn,et),un(this,oo,et.state),this.hasListeners()&&(tt==null||tt.removeObserver(this),et.addObserver(this))},Ql=function(et){notifyManager.batch(()=>{et.listeners&&this.listeners.forEach(tt=>{tt(Mt(this,On))}),Mt(this,Mn).getQueryCache().notify({query:Mt(this,Sn),type:"observerResultsUpdated"})})},qs);function shouldLoadOnMount(o,et){return resolveEnabled(et.enabled,o)!==!1&&o.state.data===void 0&&!(o.state.status==="error"&&et.retryOnMount===!1)}function shouldFetchOnMount(o,et){return shouldLoadOnMount(o,et)||o.state.data!==void 0&&shouldFetchOn(o,et,et.refetchOnMount)}function shouldFetchOn(o,et,tt){if(resolveEnabled(et.enabled,o)!==!1){const nt=typeof tt=="function"?tt(o):tt;return nt==="always"||nt!==!1&&isStale(o,et)}return!1}function shouldFetchOptionally(o,et,tt,nt){return(o!==et||resolveEnabled(nt.enabled,o)===!1)&&(!tt.suspense||o.state.status!=="error")&&isStale(o,tt)}function isStale(o,et){return resolveEnabled(et.enabled,o)!==!1&&o.isStaleByTime(resolveStaleTime(et.staleTime,o))}function shouldAssignObserverCurrentProperties(o,et){return!shallowEqualObjects(o.getCurrentResult(),et)}var gr,yr,Bn,rr,sr,Yo,js,Ks,MutationObserver$1=(Ks=class extends Subscribable{constructor(tt,nt){super();fn(this,sr);fn(this,gr);fn(this,yr);fn(this,Bn);fn(this,rr);un(this,gr,tt),this.setOptions(nt),this.bindMethods(),gn(this,sr,Yo).call(this)}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(tt){var rt;const nt=this.options;this.options=Mt(this,gr).defaultMutationOptions(tt),shallowEqualObjects(this.options,nt)||Mt(this,gr).getMutationCache().notify({type:"observerOptionsUpdated",mutation:Mt(this,Bn),observer:this}),nt!=null&&nt.mutationKey&&this.options.mutationKey&&hashKey(nt.mutationKey)!==hashKey(this.options.mutationKey)?this.reset():((rt=Mt(this,Bn))==null?void 0:rt.state.status)==="pending"&&Mt(this,Bn).setOptions(this.options)}onUnsubscribe(){var tt;this.hasListeners()||(tt=Mt(this,Bn))==null||tt.removeObserver(this)}onMutationUpdate(tt){gn(this,sr,Yo).call(this),gn(this,sr,js).call(this,tt)}getCurrentResult(){return Mt(this,yr)}reset(){var tt;(tt=Mt(this,Bn))==null||tt.removeObserver(this),un(this,Bn,void 0),gn(this,sr,Yo).call(this),gn(this,sr,js).call(this)}mutate(tt,nt){var rt;return un(this,rr,nt),(rt=Mt(this,Bn))==null||rt.removeObserver(this),un(this,Bn,Mt(this,gr).getMutationCache().build(Mt(this,gr),this.options)),Mt(this,Bn).addObserver(this),Mt(this,Bn).execute(tt)}},gr=new WeakMap,yr=new WeakMap,Bn=new WeakMap,rr=new WeakMap,sr=new WeakSet,Yo=function(){var nt;const tt=((nt=Mt(this,Bn))==null?void 0:nt.state)??getDefaultState();un(this,yr,{...tt,isPending:tt.status==="pending",isSuccess:tt.status==="success",isError:tt.status==="error",isIdle:tt.status==="idle",mutate:this.mutate,reset:this.reset})},js=function(tt){notifyManager.batch(()=>{var nt,rt,ot,it,st,at,ct,lt;if(Mt(this,rr)&&this.hasListeners()){const dt=Mt(this,yr).variables,ht=Mt(this,yr).context;(tt==null?void 0:tt.type)==="success"?((rt=(nt=Mt(this,rr)).onSuccess)==null||rt.call(nt,tt.data,dt,ht),(it=(ot=Mt(this,rr)).onSettled)==null||it.call(ot,tt.data,null,dt,ht)):(tt==null?void 0:tt.type)==="error"&&((at=(st=Mt(this,rr)).onError)==null||at.call(st,tt.error,dt,ht),(lt=(ct=Mt(this,rr)).onSettled)==null||lt.call(ct,void 0,tt.error,dt,ht))}this.listeners.forEach(dt=>{dt(Mt(this,yr))})})},Ks);function hashFn(o){return JSON.stringify(o,(et,tt)=>isPlainObject$2(tt)?Object.keys(tt).sort().reduce((nt,rt)=>(nt[rt]=tt[rt],nt),{}):typeof tt=="bigint"?tt.toString():tt)}function isPlainObject$2(o){if(!hasObjectPrototype(o))return!1;const et=o.constructor;if(typeof et>"u")return!0;const tt=et.prototype;return!(!hasObjectPrototype(tt)||!tt.hasOwnProperty("isPrototypeOf"))}function hasObjectPrototype(o){return Object.prototype.toString.call(o)==="[object Object]"}function filterQueryOptions(o){const{_defaulted:et,behavior:tt,gcTime:nt,initialData:rt,initialDataUpdatedAt:ot,maxPages:it,meta:st,networkMode:at,queryFn:ct,queryHash:lt,queryKey:dt,queryKeyHashFn:ht,retry:pt,retryDelay:mt,structuralSharing:ft,getPreviousPageParam:yt,getNextPageParam:gt,initialPageParam:xt,_optimisticResults:vt,enabled:bt,notifyOnChangeProps:Et,placeholderData:wt,refetchInterval:kt,refetchIntervalInBackground:It,refetchOnMount:Rt,refetchOnReconnect:Pt,refetchOnWindowFocus:jt,retryOnMount:Ot,select:Bt,staleTime:zt,suspense:Ft,throwOnError:Yt,config:Ht,connector:Ut,query:qt,...Lt}=o;return Lt}function connectMutationOptions(o){return{mutationFn(et){return connect$1(o,et)},mutationKey:["connect"]}}function disconnectMutationOptions(o){return{mutationFn(et){return disconnect(o,et)},mutationKey:["disconnect"]}}function getBalanceQueryOptions(o,et={}){return{async queryFn({queryKey:tt}){const{address:nt,scopeKey:rt,...ot}=tt[1];if(!nt)throw new Error("address is required");return await getBalance(o,{...ot,address:nt})??null},queryKey:getBalanceQueryKey(et)}}function getBalanceQueryKey(o={}){return["balance",filterQueryOptions(o)]}function getBlockNumberQueryOptions(o,et={}){return{gcTime:0,async queryFn({queryKey:tt}){const{scopeKey:nt,...rt}=tt[1];return await getBlockNumber(o,rt)??null},queryKey:getBlockNumberQueryKey(et)}}function getBlockNumberQueryKey(o={}){return["blockNumber",filterQueryOptions(o)]}function getEnsAddressQueryOptions(o,et={}){return{async queryFn({queryKey:tt}){const{name:nt,scopeKey:rt,...ot}=tt[1];if(!nt)throw new Error("name is required");return getEnsAddress(o,{...ot,name:nt})},queryKey:getEnsAddressQueryKey(et)}}function getEnsAddressQueryKey(o={}){return["ensAddress",filterQueryOptions(o)]}function getEnsAvatarQueryOptions(o,et={}){return{async queryFn({queryKey:tt}){const{name:nt,scopeKey:rt,...ot}=tt[1];if(!nt)throw new Error("name is required");return getEnsAvatar(o,{...ot,name:nt})},queryKey:getEnsAvatarQueryKey(et)}}function getEnsAvatarQueryKey(o={}){return["ensAvatar",filterQueryOptions(o)]}function getEnsNameQueryOptions(o,et={}){return{async queryFn({queryKey:tt}){const{address:nt,scopeKey:rt,...ot}=tt[1];if(!nt)throw new Error("address is required");return getEnsName(o,{...ot,address:nt})},queryKey:getEnsNameQueryKey(et)}}function getEnsNameQueryKey(o={}){return["ensName",filterQueryOptions(o)]}function signMessageMutationOptions(o){return{mutationFn(et){return signMessage(o,et)},mutationKey:["signMessage"]}}function switchChainMutationOptions(o){return{mutationFn(et){return switchChain(o,et)},mutationKey:["switchChain"]}}var QueryClientContext=reactExports.createContext(void 0),useQueryClient=o=>{const et=reactExports.useContext(QueryClientContext);if(!et)throw new Error("No QueryClient set, use QueryClientProvider to set one");return et},QueryClientProvider=({client:o,children:et})=>(reactExports.useEffect(()=>(o.mount(),()=>{o.unmount()}),[o]),jsxRuntimeExports.jsx(QueryClientContext.Provider,{value:o,children:et})),IsRestoringContext=reactExports.createContext(!1),useIsRestoring=()=>reactExports.useContext(IsRestoringContext);IsRestoringContext.Provider;function createValue(){let o=!1;return{clearReset:()=>{o=!1},reset:()=>{o=!0},isReset:()=>o}}var QueryErrorResetBoundaryContext=reactExports.createContext(createValue()),useQueryErrorResetBoundary=()=>reactExports.useContext(QueryErrorResetBoundaryContext);function shouldThrowError(o,et){return typeof o=="function"?o(...et):!!o}function noop$3(){}var ensurePreventErrorBoundaryRetry=(o,et)=>{(o.suspense||o.throwOnError||o.experimental_prefetchInRender)&&(et.isReset()||(o.retryOnMount=!1))},useClearResetErrorBoundary=o=>{reactExports.useEffect(()=>{o.clearReset()},[o])},getHasError=({result:o,errorResetBoundary:et,throwOnError:tt,query:nt})=>o.isError&&!et.isReset()&&!o.isFetching&&nt&&shouldThrowError(tt,[o.error,nt]),ensureSuspenseTimers=o=>{o.suspense&&(o.staleTime===void 0&&(o.staleTime=1e3),typeof o.gcTime=="number"&&(o.gcTime=Math.max(o.gcTime,1e3)))},willFetch=(o,et)=>o.isLoading&&o.isFetching&&!et,shouldSuspend=(o,et)=>(o==null?void 0:o.suspense)&&et.isPending,fetchOptimistic=(o,et,tt)=>et.fetchOptimistic(o).catch(()=>{tt.clearReset()});function useBaseQuery(o,et,tt){var lt,dt,ht,pt,mt;const nt=useQueryClient(),rt=useIsRestoring(),ot=useQueryErrorResetBoundary(),it=nt.defaultQueryOptions(o);(dt=(lt=nt.getDefaultOptions().queries)==null?void 0:lt._experimental_beforeQuery)==null||dt.call(lt,it),it._optimisticResults=rt?"isRestoring":"optimistic",ensureSuspenseTimers(it),ensurePreventErrorBoundaryRetry(it,ot),useClearResetErrorBoundary(ot);const st=!nt.getQueryCache().get(it.queryHash),[at]=reactExports.useState(()=>new et(nt,it)),ct=at.getOptimisticResult(it);if(reactExports.useSyncExternalStore(reactExports.useCallback(ft=>{const yt=rt?()=>{}:at.subscribe(notifyManager.batchCalls(ft));return at.updateResult(),yt},[at,rt]),()=>at.getCurrentResult(),()=>at.getCurrentResult()),reactExports.useEffect(()=>{at.setOptions(it,{listeners:!1})},[it,at]),shouldSuspend(it,ct))throw fetchOptimistic(it,at,ot);if(getHasError({result:ct,errorResetBoundary:ot,throwOnError:it.throwOnError,query:nt.getQueryCache().get(it.queryHash)}))throw ct.error;if((pt=(ht=nt.getDefaultOptions().queries)==null?void 0:ht._experimental_afterQuery)==null||pt.call(ht,it,ct),it.experimental_prefetchInRender&&!isServer&&willFetch(ct,rt)){const ft=st?fetchOptimistic(it,at,ot):(mt=nt.getQueryCache().get(it.queryHash))==null?void 0:mt.promise;ft==null||ft.catch(noop$3).finally(()=>{at.updateResult()})}return it.notifyOnChangeProps?ct:at.trackResult(ct)}function useQuery$1(o,et){return useBaseQuery(o,QueryObserver)}function useMutation(o,et){const tt=useQueryClient(),[nt]=reactExports.useState(()=>new MutationObserver$1(tt,o));reactExports.useEffect(()=>{nt.setOptions(o)},[nt,o]);const rt=reactExports.useSyncExternalStore(reactExports.useCallback(it=>nt.subscribe(notifyManager.batchCalls(it)),[nt]),()=>nt.getCurrentResult(),()=>nt.getCurrentResult()),ot=reactExports.useCallback((it,st)=>{nt.mutate(it,st).catch(noop$3)},[nt]);if(rt.error&&shouldThrowError(nt.options.throwOnError,[rt.error]))throw rt.error;return{...rt,mutate:ot,mutateAsync:rt.mutate}}function useQuery(o){const et=useQuery$1({...o,queryKeyHashFn:hashFn});return et.queryKey=o.queryKey,et}function useChainId(o={}){const et=useConfig(o);return reactExports.useSyncExternalStore(tt=>watchChainId(et,{onChange:tt}),()=>getChainId(et),()=>getChainId(et))}function useBalance(o={}){const{address:et,query:tt={}}=o,nt=useConfig(o),rt=useChainId({config:nt}),ot=getBalanceQueryOptions(nt,{...o,chainId:o.chainId??rt}),it=!!(et&&(tt.enabled??!0));return useQuery({...tt,...ot,enabled:it})}function useWatchBlockNumber(o={}){const{enabled:et=!0,onBlockNumber:tt,config:nt,...rt}=o,ot=useConfig(o),it=useChainId({config:ot}),st=o.chainId??it;reactExports.useEffect(()=>{if(et&&tt)return watchBlockNumber(ot,{...rt,chainId:st,onBlockNumber:tt})},[st,ot,et,tt,rt.onError,rt.emitMissed,rt.emitOnBegin,rt.poll,rt.pollingInterval,rt.syncConnectedChain])}function useBlockNumber(o={}){const{query:et={},watch:tt}=o,nt=useConfig(o),rt=useQueryClient(),ot=useChainId({config:nt}),it=o.chainId??ot,st=getBlockNumberQueryOptions(nt,{...o,chainId:it});return useWatchBlockNumber({config:o.config,chainId:o.chainId,...typeof tt=="object"?tt:{},enabled:!!((et.enabled??!0)&&(typeof tt=="object"?tt.enabled:tt)),onBlockNumber(at){rt.setQueryData(st.queryKey,at)}}),useQuery({...et,...st})}function useChains$1(o={}){const et=useConfig(o);return reactExports.useSyncExternalStore(tt=>watchChains(et,{onChange:tt}),()=>getChains(et),()=>getChains(et))}function useConnectors$1(o={}){const et=useConfig(o);return reactExports.useSyncExternalStore(tt=>watchConnectors(et,{onChange:tt}),()=>getConnectors(et),()=>getConnectors(et))}function useConnect$1(o={}){const{mutation:et}=o,tt=useConfig(o),nt=connectMutationOptions(tt),{mutate:rt,mutateAsync:ot,...it}=useMutation({...et,...nt});return reactExports.useEffect(()=>tt.subscribe(({status:st})=>st,(st,at)=>{at==="connected"&&st==="disconnected"&&it.reset()}),[tt,it.reset]),{...it,connect:rt,connectAsync:ot,connectors:useConnectors$1({config:tt})}}function useConnections(o={}){const et=useConfig(o);return reactExports.useSyncExternalStore(tt=>watchConnections(et,{onChange:tt}),()=>getConnections(et),()=>getConnections(et))}function useDisconnect(o={}){const{mutation:et}=o,tt=useConfig(o),nt=disconnectMutationOptions(tt),{mutate:rt,mutateAsync:ot,...it}=useMutation({...et,...nt});return{...it,connectors:useConnections({config:tt}).map(st=>st.connector),disconnect:rt,disconnectAsync:ot}}function useEnsAddress(o={}){const{name:et,query:tt={}}=o,nt=useConfig(o),rt=useChainId({config:nt}),ot=getEnsAddressQueryOptions(nt,{...o,chainId:o.chainId??rt}),it=!!(et&&(tt.enabled??!0));return useQuery({...tt,...ot,enabled:it})}function useEnsAvatar(o={}){const{name:et,query:tt={}}=o,nt=useConfig(o),rt=useChainId({config:nt}),ot=getEnsAvatarQueryOptions(nt,{...o,chainId:o.chainId??rt}),it=!!(et&&(tt.enabled??!0));return useQuery({...tt,...ot,enabled:it})}function useEnsName(o={}){const{address:et,query:tt={}}=o,nt=useConfig(o),rt=useChainId({config:nt}),ot=getEnsNameQueryOptions(nt,{...o,chainId:o.chainId??rt}),it=!!(et&&(tt.enabled??!0));return useQuery({...tt,...ot,enabled:it})}function useSignMessage(o={}){const{mutation:et}=o,tt=useConfig(o),nt=signMessageMutationOptions(tt),{mutate:rt,mutateAsync:ot,...it}=useMutation({...et,...nt});return{...it,signMessage:rt,signMessageAsync:ot}}function useSwitchChain(o={}){const{mutation:et}=o,tt=useConfig(o),nt=switchChainMutationOptions(tt),{mutate:rt,mutateAsync:ot,...it}=useMutation({...et,...nt});return{...it,chains:useChains$1({config:tt}),switchChain:rt,switchChainAsync:ot}}const contracts={gasPriceOracle:{address:"0x420000000000000000000000000000000000000F"},l1Block:{address:"0x4200000000000000000000000000000000000015"},l2CrossDomainMessenger:{address:"0x4200000000000000000000000000000000000007"},l2Erc721Bridge:{address:"0x4200000000000000000000000000000000000014"},l2StandardBridge:{address:"0x4200000000000000000000000000000000000010"},l2ToL1MessagePasser:{address:"0x4200000000000000000000000000000000000016"}},formatters={block:defineBlock({format(o){var tt;return{transactions:(tt=o.transactions)==null?void 0:tt.map(nt=>{if(typeof nt=="string")return nt;const rt=formatTransaction(nt);return rt.typeHex==="0x7e"&&(rt.isSystemTx=nt.isSystemTx,rt.mint=nt.mint?hexToBigInt(nt.mint):void 0,rt.sourceHash=nt.sourceHash,rt.type="deposit"),rt}),stateRoot:o.stateRoot}}}),transaction:defineTransaction({format(o){const et={};return o.type==="0x7e"&&(et.isSystemTx=o.isSystemTx,et.mint=o.mint?hexToBigInt(o.mint):void 0,et.sourceHash=o.sourceHash,et.type="deposit"),et}}),transactionReceipt:defineTransactionReceipt({format(o){return{l1GasPrice:o.l1GasPrice?hexToBigInt(o.l1GasPrice):null,l1GasUsed:o.l1GasUsed?hexToBigInt(o.l1GasUsed):null,l1Fee:o.l1Fee?hexToBigInt(o.l1Fee):null,l1FeeScalar:o.l1FeeScalar?Number(o.l1FeeScalar):null}}})};function serializeTransaction(o,et){return isDeposit(o)?serializeTransactionDeposit(o):serializeTransaction$1(o,et)}const serializers={transaction:serializeTransaction};function serializeTransactionDeposit(o){assertTransactionDeposit(o);const{sourceHash:et,data:tt,from:nt,gas:rt,isSystemTx:ot,mint:it,to:st,value:at}=o,ct=[et,nt,st??"0x",it?toHex(it):"0x",at?toHex(at):"0x",rt?toHex(rt):"0x",ot?"0x1":"0x",tt??"0x"];return concatHex(["0x7e",toRlp(ct)])}function isDeposit(o){return o.type==="deposit"||typeof o.sourceHash<"u"}function assertTransactionDeposit(o){const{from:et,to:tt}=o;if(et&&!isAddress(et))throw new InvalidAddressError({address:et});if(tt&&!isAddress(tt))throw new InvalidAddressError({address:tt})}const chainConfig={contracts,formatters,serializers},arbitrum=defineChain({id:42161,name:"Arbitrum One",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://arb1.arbitrum.io/rpc"]}},blockExplorers:{default:{name:"Arbiscan",url:"https://arbiscan.io",apiUrl:"https://api.arbiscan.io/api"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:7654707}}}),mainnet=defineChain({id:1,name:"Ethereum",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://cloudflare-eth.com"]}},blockExplorers:{default:{name:"Etherscan",url:"https://etherscan.io",apiUrl:"https://api.etherscan.io/api"}},contracts:{ensRegistry:{address:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e"},ensUniversalResolver:{address:"0xce01f8eee7E479C928F8919abD53E553a36CeF67",blockCreated:19258213},multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:14353601}}}),sourceId=1,optimism=defineChain({...chainConfig,id:10,name:"OP Mainnet",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://mainnet.optimism.io"]}},blockExplorers:{default:{name:"Optimism Explorer",url:"https://optimistic.etherscan.io",apiUrl:"https://api-optimistic.etherscan.io/api"}},contracts:{...chainConfig.contracts,disputeGameFactory:{[sourceId]:{address:"0xe5965Ab5962eDc7477C8520243A95517CD252fA9"}},l2OutputOracle:{[sourceId]:{address:"0xdfe97868233d1aa22e815a266982f2cf17685a27"}},multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:4286263},portal:{[sourceId]:{address:"0xbEb5Fc579115071764c7423A4f12eDde41f106Ed"}},l1StandardBridge:{[sourceId]:{address:"0x99C9fc46f92E8a1c0deC1b1747d010903E884bE1"}}},sourceId}),polygon=defineChain({id:137,name:"Polygon",nativeCurrency:{name:"POL",symbol:"POL",decimals:18},rpcUrls:{default:{http:["https://polygon-rpc.com"]}},blockExplorers:{default:{name:"PolygonScan",url:"https://polygonscan.com",apiUrl:"https://api.polygonscan.com/api"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:25770160}}});coinbaseWallet.type="coinbaseWallet";function coinbaseWallet(o={}){return o.version==="3"||o.headlessMode?version3(o):version4(o)}function version4(o){let et,tt,nt,rt,ot;return it=>({id:"coinbaseWalletSDK",name:"Coinbase Wallet",rdns:"com.coinbase.wallet",supportsSimulation:!0,type:coinbaseWallet.type,async connect({chainId:st}={}){try{const at=await this.getProvider(),ct=(await at.request({method:"eth_requestAccounts"})).map(dt=>getAddress(dt));nt||(nt=this.onAccountsChanged.bind(this),at.on("accountsChanged",nt)),rt||(rt=this.onChainChanged.bind(this),at.on("chainChanged",rt)),ot||(ot=this.onDisconnect.bind(this),at.on("disconnect",ot));let lt=await this.getChainId();if(st&<!==st){const dt=await this.switchChain({chainId:st}).catch(ht=>{if(ht.code===UserRejectedRequestError.code)throw ht;return{id:lt}});lt=(dt==null?void 0:dt.id)??lt}return{accounts:ct,chainId:lt}}catch(at){throw/(user closed modal|accounts received is empty|user denied account|request rejected)/i.test(at.message)?new UserRejectedRequestError(at):at}},async disconnect(){var at;const st=await this.getProvider();nt&&(st.removeListener("accountsChanged",nt),nt=void 0),rt&&(st.removeListener("chainChanged",rt),rt=void 0),ot&&(st.removeListener("disconnect",ot),ot=void 0),st.disconnect(),(at=st.close)==null||at.call(st)},async getAccounts(){return(await(await this.getProvider()).request({method:"eth_accounts"})).map(at=>getAddress(at))},async getChainId(){const at=await(await this.getProvider()).request({method:"eth_chainId"});return Number(at)},async getProvider(){if(!tt){const st=await(async()=>{const at=await __vitePreload(()=>import("./index-xz6stGwY.js"),__vite__mapDeps([0,1]));return typeof at.CoinbaseWalletSDK!="function"&&typeof at.default=="function"?at.default:at.CoinbaseWalletSDK})();et=new st({...o,appChainIds:it.chains.map(at=>at.id)}),tt=et.makeWeb3Provider({...o,options:o.preference??"all"})}return tt},async isAuthorized(){try{return!!(await this.getAccounts()).length}catch{return!1}},async switchChain({addEthereumChainParameter:st,chainId:at}){var dt,ht,pt,mt;const ct=it.chains.find(ft=>ft.id===at);if(!ct)throw new SwitchChainError(new ChainNotConfiguredError);const lt=await this.getProvider();try{return await lt.request({method:"wallet_switchEthereumChain",params:[{chainId:numberToHex(ct.id)}]}),ct}catch(ft){if(ft.code===4902)try{let yt;st!=null&&st.blockExplorerUrls?yt=st.blockExplorerUrls:yt=(dt=ct.blockExplorers)!=null&&dt.default.url?[(ht=ct.blockExplorers)==null?void 0:ht.default.url]:[];let gt;(pt=st==null?void 0:st.rpcUrls)!=null&&pt.length?gt=st.rpcUrls:gt=[((mt=ct.rpcUrls.default)==null?void 0:mt.http[0])??""];const xt={blockExplorerUrls:yt,chainId:numberToHex(at),chainName:(st==null?void 0:st.chainName)??ct.name,iconUrls:st==null?void 0:st.iconUrls,nativeCurrency:(st==null?void 0:st.nativeCurrency)??ct.nativeCurrency,rpcUrls:gt};return await lt.request({method:"wallet_addEthereumChain",params:[xt]}),ct}catch(yt){throw new UserRejectedRequestError(yt)}throw new SwitchChainError(ft)}},onAccountsChanged(st){st.length===0?this.onDisconnect():it.emitter.emit("change",{accounts:st.map(at=>getAddress(at))})},onChainChanged(st){const at=Number(st);it.emitter.emit("change",{chainId:at})},async onDisconnect(st){it.emitter.emit("disconnect");const at=await this.getProvider();nt&&(at.removeListener("accountsChanged",nt),nt=void 0),rt&&(at.removeListener("chainChanged",rt),rt=void 0),ot&&(at.removeListener("disconnect",ot),ot=void 0)}})}function version3(o){let tt,nt,rt,ot,it;return st=>({id:"coinbaseWalletSDK",name:"Coinbase Wallet",supportsSimulation:!0,type:coinbaseWallet.type,async connect({chainId:at}={}){try{const ct=await this.getProvider(),lt=(await ct.request({method:"eth_requestAccounts"})).map(ht=>getAddress(ht));rt||(rt=this.onAccountsChanged.bind(this),ct.on("accountsChanged",rt)),ot||(ot=this.onChainChanged.bind(this),ct.on("chainChanged",ot)),it||(it=this.onDisconnect.bind(this),ct.on("disconnect",it));let dt=await this.getChainId();if(at&&dt!==at){const ht=await this.switchChain({chainId:at}).catch(pt=>{if(pt.code===UserRejectedRequestError.code)throw pt;return{id:dt}});dt=(ht==null?void 0:ht.id)??dt}return{accounts:lt,chainId:dt}}catch(ct){throw/(user closed modal|accounts received is empty|user denied account)/i.test(ct.message)?new UserRejectedRequestError(ct):ct}},async disconnect(){const at=await this.getProvider();rt&&(at.removeListener("accountsChanged",rt),rt=void 0),ot&&(at.removeListener("chainChanged",ot),ot=void 0),it&&(at.removeListener("disconnect",it),it=void 0),at.disconnect(),at.close()},async getAccounts(){return(await(await this.getProvider()).request({method:"eth_accounts"})).map(ct=>getAddress(ct))},async getChainId(){const ct=await(await this.getProvider()).request({method:"eth_chainId"});return Number(ct)},async getProvider(){var at;if(!nt){const ct=await(async()=>{const{default:mt}=await __vitePreload(async()=>{const{default:ft}=await import("./index-Cu6T4rb4.js").then(yt=>yt.i);return{default:ft}},__vite__mapDeps([2,3,1,4]));return typeof mt!="function"&&typeof mt.default=="function"?mt.default:mt})();tt=new ct({...o,reloadOnDisconnect:!1});const lt=(at=tt.walletExtension)==null?void 0:at.getChainId(),dt=st.chains.find(mt=>o.chainId?mt.id===o.chainId:mt.id===lt)||st.chains[0],ht=o.chainId||(dt==null?void 0:dt.id),pt=o.jsonRpcUrl||(dt==null?void 0:dt.rpcUrls.default.http[0]);nt=tt.makeWeb3Provider(pt,ht)}return nt},async isAuthorized(){try{return!!(await this.getAccounts()).length}catch{return!1}},async switchChain({addEthereumChainParameter:at,chainId:ct}){var ht,pt,mt,ft;const lt=st.chains.find(yt=>yt.id===ct);if(!lt)throw new SwitchChainError(new ChainNotConfiguredError);const dt=await this.getProvider();try{return await dt.request({method:"wallet_switchEthereumChain",params:[{chainId:numberToHex(lt.id)}]}),lt}catch(yt){if(yt.code===4902)try{let gt;at!=null&&at.blockExplorerUrls?gt=at.blockExplorerUrls:gt=(ht=lt.blockExplorers)!=null&&ht.default.url?[(pt=lt.blockExplorers)==null?void 0:pt.default.url]:[];let xt;(mt=at==null?void 0:at.rpcUrls)!=null&&mt.length?xt=at.rpcUrls:xt=[((ft=lt.rpcUrls.default)==null?void 0:ft.http[0])??""];const vt={blockExplorerUrls:gt,chainId:numberToHex(ct),chainName:(at==null?void 0:at.chainName)??lt.name,iconUrls:at==null?void 0:at.iconUrls,nativeCurrency:(at==null?void 0:at.nativeCurrency)??lt.nativeCurrency,rpcUrls:xt};return await dt.request({method:"wallet_addEthereumChain",params:[vt]}),lt}catch(gt){throw new UserRejectedRequestError(gt)}throw new SwitchChainError(yt)}},onAccountsChanged(at){at.length===0?this.onDisconnect():st.emitter.emit("change",{accounts:at.map(ct=>getAddress(ct))})},onChainChanged(at){const ct=Number(at);st.emitter.emit("change",{chainId:ct})},async onDisconnect(at){st.emitter.emit("disconnect");const ct=await this.getProvider();rt&&(ct.removeListener("accountsChanged",rt),rt=void 0),ot&&(ct.removeListener("chainChanged",ot),ot=void 0),it&&(ct.removeListener("disconnect",it),it=void 0)}})}safe.type="safe";function safe(o={}){const{shimDisconnect:et=!1}=o;let tt,nt;return rt=>({id:"safe",name:"Safe",type:safe.type,async connect(){var at;const ot=await this.getProvider();if(!ot)throw new ProviderNotFoundError;const it=await this.getAccounts(),st=await this.getChainId();return nt||(nt=this.onDisconnect.bind(this),ot.on("disconnect",nt)),et&&await((at=rt.storage)==null?void 0:at.removeItem("safe.disconnected")),{accounts:it,chainId:st}},async disconnect(){var it;const ot=await this.getProvider();if(!ot)throw new ProviderNotFoundError;nt&&(ot.removeListener("disconnect",nt),nt=void 0),et&&await((it=rt.storage)==null?void 0:it.setItem("safe.disconnected",!0))},async getAccounts(){const ot=await this.getProvider();if(!ot)throw new ProviderNotFoundError;return(await ot.request({method:"eth_accounts"})).map(getAddress)},async getProvider(){if(typeof window<"u"&&(window==null?void 0:window.parent)!==window){if(!tt){const{default:it}=await __vitePreload(async()=>{const{default:lt}=await import("./index-DlENImLn.js");return{default:lt}},[]),st=new it(o),at=await withTimeout(()=>st.safe.getInfo(),{timeout:o.unstable_getInfoTimeout??10});if(!at)throw new Error("Could not load Safe information");const ct=await(async()=>{const lt=await __vitePreload(()=>import("./index-BpmIcSNW.js").then(dt=>dt.i),__vite__mapDeps([5,4]));return typeof lt.SafeAppProvider!="function"&&typeof lt.default.SafeAppProvider=="function"?lt.default.SafeAppProvider:lt.SafeAppProvider})();tt=new ct(at,st)}return tt}},async getChainId(){const ot=await this.getProvider();if(!ot)throw new ProviderNotFoundError;return Number(ot.chainId)},async isAuthorized(){var ot;try{return et&&await((ot=rt.storage)==null?void 0:ot.getItem("safe.disconnected"))?!1:!!(await this.getAccounts()).length}catch{return!1}},onAccountsChanged(){},onChainChanged(){},onDisconnect(){rt.emitter.emit("disconnect")}})}walletConnect.type="walletConnect";function walletConnect(o){const et=o.isNewChainsStale??!0;let tt,nt;const rt="eip155";let ot,it,st,at,ct,lt;return dt=>({id:"walletConnect",name:"WalletConnect",type:walletConnect.type,async setup(){const ht=await this.getProvider().catch(()=>null);ht&&(st||(st=this.onConnect.bind(this),ht.on("connect",st)),ct||(ct=this.onSessionDelete.bind(this),ht.on("session_delete",ct)))},async connect({chainId:ht,...pt}={}){var mt,ft;try{const yt=await this.getProvider();if(!yt)throw new ProviderNotFoundError;at||(at=this.onDisplayUri,yt.on("display_uri",at));let gt=ht;if(!gt){const Et=await((mt=dt.storage)==null?void 0:mt.getItem("state"))??{};dt.chains.some(kt=>kt.id===Et.chainId)?gt=Et.chainId:gt=(ft=dt.chains[0])==null?void 0:ft.id}if(!gt)throw new Error("No chains found on connector.");const xt=await this.isChainsStale();if(yt.session&&xt&&await yt.disconnect(),!yt.session||xt){const Et=dt.chains.filter(wt=>wt.id!==gt).map(wt=>wt.id);await yt.connect({optionalChains:[gt,...Et],..."pairingTopic"in pt?{pairingTopic:pt.pairingTopic}:{}}),this.setRequestedChainsIds(dt.chains.map(wt=>wt.id))}const vt=(await yt.enable()).map(Et=>getAddress(Et)),bt=await this.getChainId();return at&&(yt.removeListener("display_uri",at),at=void 0),st&&(yt.removeListener("connect",st),st=void 0),ot||(ot=this.onAccountsChanged.bind(this),yt.on("accountsChanged",ot)),it||(it=this.onChainChanged.bind(this),yt.on("chainChanged",it)),lt||(lt=this.onDisconnect.bind(this),yt.on("disconnect",lt)),ct||(ct=this.onSessionDelete.bind(this),yt.on("session_delete",ct)),{accounts:vt,chainId:bt}}catch(yt){throw/(user rejected|connection request reset)/i.test(yt==null?void 0:yt.message)?new UserRejectedRequestError(yt):yt}},async disconnect(){const ht=await this.getProvider();try{await(ht==null?void 0:ht.disconnect())}catch(pt){if(!/No matching key/i.test(pt.message))throw pt}finally{it&&(ht==null||ht.removeListener("chainChanged",it),it=void 0),lt&&(ht==null||ht.removeListener("disconnect",lt),lt=void 0),st||(st=this.onConnect.bind(this),ht==null||ht.on("connect",st)),ot&&(ht==null||ht.removeListener("accountsChanged",ot),ot=void 0),ct&&(ht==null||ht.removeListener("session_delete",ct),ct=void 0),this.setRequestedChainsIds([])}},async getAccounts(){return(await this.getProvider()).accounts.map(pt=>getAddress(pt))},async getProvider({chainId:ht}={}){var mt;async function pt(){const ft=dt.chains.map(gt=>gt.id);if(!ft.length)return;const{EthereumProvider:yt}=await __vitePreload(async()=>{const{EthereumProvider:gt}=await import("./index.es-C5jEvyUt.js");return{EthereumProvider:gt}},__vite__mapDeps([6,4,3]));return await yt.init({...o,disableProviderPing:!0,optionalChains:ft,projectId:o.projectId,rpcMap:Object.fromEntries(dt.chains.map(gt=>{const[xt]=extractRpcUrls({chain:gt,transports:dt.transports});return[gt.id,xt]})),showQrModal:o.showQrModal??!0})}return tt||(nt||(nt=pt()),tt=await nt,tt==null||tt.events.setMaxListeners(Number.POSITIVE_INFINITY)),ht&&await((mt=this.switchChain)==null?void 0:mt.call(this,{chainId:ht})),tt},async getChainId(){return(await this.getProvider()).chainId},async isAuthorized(){try{const[ht,pt]=await Promise.all([this.getAccounts(),this.getProvider()]);return ht.length?await this.isChainsStale()&&pt.session?(await pt.disconnect().catch(()=>{}),!1):!0:!1}catch{return!1}},async switchChain({addEthereumChainParameter:ht,chainId:pt}){var yt,gt,xt;const mt=await this.getProvider();if(!mt)throw new ProviderNotFoundError;const ft=dt.chains.find(vt=>vt.id===pt);if(!ft)throw new SwitchChainError(new ChainNotConfiguredError);try{await Promise.all([new Promise(bt=>{const Et=({chainId:wt})=>{wt===pt&&(dt.emitter.off("change",Et),bt())};dt.emitter.on("change",Et)}),mt.request({method:"wallet_switchEthereumChain",params:[{chainId:numberToHex(pt)}]})]);const vt=await this.getRequestedChainsIds();return this.setRequestedChainsIds([...vt,pt]),ft}catch(vt){const bt=vt;if(/(user rejected)/i.test(bt.message))throw new UserRejectedRequestError(bt);try{let Et;ht!=null&&ht.blockExplorerUrls?Et=ht.blockExplorerUrls:Et=(yt=ft.blockExplorers)!=null&&yt.default.url?[(gt=ft.blockExplorers)==null?void 0:gt.default.url]:[];let wt;(xt=ht==null?void 0:ht.rpcUrls)!=null&&xt.length?wt=ht.rpcUrls:wt=[...ft.rpcUrls.default.http];const kt={blockExplorerUrls:Et,chainId:numberToHex(pt),chainName:(ht==null?void 0:ht.chainName)??ft.name,iconUrls:ht==null?void 0:ht.iconUrls,nativeCurrency:(ht==null?void 0:ht.nativeCurrency)??ft.nativeCurrency,rpcUrls:wt};await mt.request({method:"wallet_addEthereumChain",params:[kt]});const It=await this.getRequestedChainsIds();return this.setRequestedChainsIds([...It,pt]),ft}catch(Et){throw new UserRejectedRequestError(Et)}}},onAccountsChanged(ht){ht.length===0?this.onDisconnect():dt.emitter.emit("change",{accounts:ht.map(pt=>getAddress(pt))})},onChainChanged(ht){const pt=Number(ht);dt.emitter.emit("change",{chainId:pt})},async onConnect(ht){const pt=Number(ht.chainId),mt=await this.getAccounts();dt.emitter.emit("connect",{accounts:mt,chainId:pt})},async onDisconnect(ht){this.setRequestedChainsIds([]),dt.emitter.emit("disconnect");const pt=await this.getProvider();ot&&(pt.removeListener("accountsChanged",ot),ot=void 0),it&&(pt.removeListener("chainChanged",it),it=void 0),lt&&(pt.removeListener("disconnect",lt),lt=void 0),ct&&(pt.removeListener("session_delete",ct),ct=void 0),st||(st=this.onConnect.bind(this),pt.on("connect",st))},onDisplayUri(ht){dt.emitter.emit("message",{type:"display_uri",data:ht})},onSessionDelete(){this.onDisconnect()},getNamespaceChainsIds(){var pt,mt,ft;return tt?((ft=(mt=(pt=tt.session)==null?void 0:pt.namespaces[rt])==null?void 0:mt.accounts)==null?void 0:ft.map(yt=>Number.parseInt(yt.split(":")[1]||"")))??[]:[]},async getRequestedChainsIds(){var ht;return await((ht=dt.storage)==null?void 0:ht.getItem(this.requestedChainsStorageKey))??[]},async isChainsStale(){if(!et)return!1;const ht=dt.chains.map(ft=>ft.id),pt=this.getNamespaceChainsIds();if(pt.length&&!pt.some(ft=>ht.includes(ft)))return!1;const mt=await this.getRequestedChainsIds();return!ht.every(ft=>mt.includes(ft))},async setRequestedChainsIds(ht){var pt;await((pt=dt.storage)==null?void 0:pt.setItem(this.requestedChainsStorageKey,ht))},get requestedChainsStorageKey(){return`${this.id}.requestedChains`}})}var define_process_default$3={env:{NODE_ENV:'"production"',VITE_WALLETCONNECT_PROJECT_ID:'"1d93edc21291f98e3bed6ff7617ff539"'},nextTick:"setImmediate",platform:'"browser"',version:'"v16.0.0"',browser:!0},__spreadArray$1=function(o,et,tt){for(var nt=0,rt=et.length,ot;nt"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"?new ReactNativeInfo:typeof navigator<"u"?parseUserAgent(navigator.userAgent):getNodeVersion()}function matchUserAgent(o){return o!==""&&userAgentRules.reduce(function(et,tt){var nt=tt[0],rt=tt[1];if(et)return et;var ot=rt.exec(o);return!!ot&&[nt,ot]},!1)}function parseUserAgent(o){var et=matchUserAgent(o);if(!et)return null;var tt=et[0],nt=et[1];if(tt==="searchbot")return new BotInfo;var rt=nt[1]&&nt[1].split(".").join("_").split("_").slice(0,3);rt?rt.length=0;st--)(it=o[st])&&(ot=(rt<3?it(ot):rt>3?it(et,tt,ot):it(et,tt))||ot);return rt>3&&ot&&Object.defineProperty(et,tt,ot),ot}function __param(o,et){return function(tt,nt){et(tt,nt,o)}}function __esDecorate(o,et,tt,nt,rt,ot){function it(gt){if(gt!==void 0&&typeof gt!="function")throw new TypeError("Function expected");return gt}for(var st=nt.kind,at=st==="getter"?"get":st==="setter"?"set":"value",ct=!et&&o?nt.static?o:o.prototype:null,lt=et||(ct?Object.getOwnPropertyDescriptor(ct,nt.name):{}),dt,ht=!1,pt=tt.length-1;pt>=0;pt--){var mt={};for(var ft in nt)mt[ft]=ft==="access"?{}:nt[ft];for(var ft in nt.access)mt.access[ft]=nt.access[ft];mt.addInitializer=function(gt){if(ht)throw new TypeError("Cannot add initializers after decoration has completed");ot.push(it(gt||null))};var yt=(0,tt[pt])(st==="accessor"?{get:lt.get,set:lt.set}:lt[at],mt);if(st==="accessor"){if(yt===void 0)continue;if(yt===null||typeof yt!="object")throw new TypeError("Object expected");(dt=it(yt.get))&&(lt.get=dt),(dt=it(yt.set))&&(lt.set=dt),(dt=it(yt.init))&&rt.unshift(dt)}else(dt=it(yt))&&(st==="field"?rt.unshift(dt):lt[at]=dt)}ct&&Object.defineProperty(ct,nt.name,lt),ht=!0}function __runInitializers(o,et,tt){for(var nt=arguments.length>2,rt=0;rt0&&ot[ot.length-1])&&(ct[0]===6||ct[0]===2)){tt=0;continue}if(ct[0]===3&&(!ot||ct[1]>ot[0]&&ct[1]=o.length&&(o=void 0),{value:o&&o[nt++],done:!o}}};throw new TypeError(et?"Object is not iterable.":"Symbol.iterator is not defined.")}function __read(o,et){var tt=typeof Symbol=="function"&&o[Symbol.iterator];if(!tt)return o;var nt=tt.call(o),rt,ot=[],it;try{for(;(et===void 0||et-- >0)&&!(rt=nt.next()).done;)ot.push(rt.value)}catch(st){it={error:st}}finally{try{rt&&!rt.done&&(tt=nt.return)&&tt.call(nt)}finally{if(it)throw it.error}}return ot}function __spread(){for(var o=[],et=0;et1||at(pt,ft)})},mt&&(rt[pt]=mt(rt[pt])))}function at(pt,mt){try{ct(nt[pt](mt))}catch(ft){ht(ot[0][3],ft)}}function ct(pt){pt.value instanceof __await?Promise.resolve(pt.value.v).then(lt,dt):ht(ot[0][2],pt)}function lt(pt){at("next",pt)}function dt(pt){at("throw",pt)}function ht(pt,mt){pt(mt),ot.shift(),ot.length&&at(ot[0][0],ot[0][1])}}function __asyncDelegator(o){var et,tt;return et={},nt("next"),nt("throw",function(rt){throw rt}),nt("return"),et[Symbol.iterator]=function(){return this},et;function nt(rt,ot){et[rt]=o[rt]?function(it){return(tt=!tt)?{value:__await(o[rt](it)),done:!1}:ot?ot(it):it}:ot}}function __asyncValues(o){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var et=o[Symbol.asyncIterator],tt;return et?et.call(o):(o=typeof __values=="function"?__values(o):o[Symbol.iterator](),tt={},nt("next"),nt("throw"),nt("return"),tt[Symbol.asyncIterator]=function(){return this},tt);function nt(ot){tt[ot]=o[ot]&&function(it){return new Promise(function(st,at){it=o[ot](it),rt(st,at,it.done,it.value)})}}function rt(ot,it,st,at){Promise.resolve(at).then(function(ct){ot({value:ct,done:st})},it)}}function __makeTemplateObject(o,et){return Object.defineProperty?Object.defineProperty(o,"raw",{value:et}):o.raw=et,o}var __setModuleDefault=Object.create?function(o,et){Object.defineProperty(o,"default",{enumerable:!0,value:et})}:function(o,et){o.default=et},ownKeys=function(o){return ownKeys=Object.getOwnPropertyNames||function(et){var tt=[];for(var nt in et)Object.prototype.hasOwnProperty.call(et,nt)&&(tt[tt.length]=nt);return tt},ownKeys(o)};function __importStar(o){if(o&&o.__esModule)return o;var et={};if(o!=null)for(var tt=ownKeys(o),nt=0;nt"u"||define_process_env_default$1===void 0?defaultEnvironment:"production",createDefinition=function(o){return{isEnabled:function(et){return o.some(function(tt){return!!et[tt]})}}},featureDefinitions={measureLayout:createDefinition(["layout","layoutId","drag"]),animation:createDefinition(["animate","exit","variants","whileHover","whileTap","whileFocus","whileDrag","whileInView"]),exit:createDefinition(["exit"]),drag:createDefinition(["drag","dragControls"]),focus:createDefinition(["whileFocus"]),hover:createDefinition(["whileHover","onHoverStart","onHoverEnd"]),tap:createDefinition(["whileTap","onTap","onTapStart","onTapCancel"]),pan:createDefinition(["onPan","onPanStart","onPanSessionStart","onPanEnd"]),inView:createDefinition(["whileInView","onViewportEnter","onViewportLeave"])};function loadFeatures(o){for(var et in o)o[et]!==null&&(et==="projectionNodeConstructor"?featureDefinitions.projectionNodeConstructor=o[et]:featureDefinitions[et].Component=o[et])}var invariant$1=function(){},LazyContext=reactExports.createContext({strict:!1}),featureNames=Object.keys(featureDefinitions),numFeatures=featureNames.length;function useFeatures(o,et,tt){var nt=[],rt=reactExports.useContext(LazyContext);if(!et)return null;env$1!=="production"&&tt&&rt.strict;for(var ot=0;ot"u")return et;var tt=new Map;return new Proxy(et,{get:function(nt,rt){return tt.has(rt)||tt.set(rt,et(rt)),tt.get(rt)}})}var lowercaseSVGElements=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","svg","switch","symbol","text","tspan","use","view"];function isSVGComponent(o){return typeof o!="string"||o.includes("-")?!1:!!(lowercaseSVGElements.indexOf(o)>-1||/[A-Z]/.test(o))}var scaleCorrectors={};function addScaleCorrector(o){Object.assign(scaleCorrectors,o)}var transformAxes=["","X","Y","Z"],order$1=["translate","scale","rotate","skew"],transformProps=["transformPerspective","x","y","z"];order$1.forEach(function(o){return transformAxes.forEach(function(et){return transformProps.push(o+et)})});function sortTransformProps(o,et){return transformProps.indexOf(o)-transformProps.indexOf(et)}var transformPropSet=new Set(transformProps);function isTransformProp(o){return transformPropSet.has(o)}var transformOriginProps=new Set(["originX","originY","originZ"]);function isTransformOriginProp(o){return transformOriginProps.has(o)}function isForcedMotionValue(o,et){var tt=et.layout,nt=et.layoutId;return isTransformProp(o)||isTransformOriginProp(o)||(tt||nt!==void 0)&&(!!scaleCorrectors[o]||o==="opacity")}var isMotionValue=function(o){return!!(o!==null&&typeof o=="object"&&o.getVelocity)},translateAlias={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"};function buildTransform(o,et,tt,nt){var rt=o.transform,ot=o.transformKeys,it=et.enableHardwareAcceleration,st=it===void 0?!0:it,at=et.allowTransformNone,ct=at===void 0?!0:at,lt="";ot.sort(sortTransformProps);for(var dt=!1,ht=ot.length,pt=0;pttt=>Math.max(Math.min(tt,et),o),sanitize=o=>o%1?Number(o.toFixed(5)):o,floatRegex=/(-)?([\d]*\.?[\d])+/g,colorRegex=/(#[0-9a-f]{6}|#[0-9a-f]{3}|#(?:[0-9a-f]{2}){2,4}|(rgb|hsl)a?\((-?[\d\.]+%?[,\s]+){2,3}\s*\/*\s*[\d\.]+%?\))/gi,singleColorRegex=/^(#[0-9a-f]{3}|#(?:[0-9a-f]{2}){2,4}|(rgb|hsl)a?\((-?[\d\.]+%?[,\s]+){2,3}\s*\/*\s*[\d\.]+%?\))$/i;function isString(o){return typeof o=="string"}const number$3={test:o=>typeof o=="number",parse:parseFloat,transform:o=>o},alpha=Object.assign(Object.assign({},number$3),{transform:clamp$2(0,1)}),scale=Object.assign(Object.assign({},number$3),{default:1}),createUnitType=o=>({test:et=>isString(et)&&et.endsWith(o)&&et.split(" ").length===1,parse:parseFloat,transform:et=>`${et}${o}`}),degrees=createUnitType("deg"),percent=createUnitType("%"),px=createUnitType("px"),vh=createUnitType("vh"),vw=createUnitType("vw"),progressPercentage=Object.assign(Object.assign({},percent),{parse:o=>percent.parse(o)/100,transform:o=>percent.transform(o*100)}),isColorString=(o,et)=>tt=>!!(isString(tt)&&singleColorRegex.test(tt)&&tt.startsWith(o)||et&&Object.prototype.hasOwnProperty.call(tt,et)),splitColor=(o,et,tt)=>nt=>{if(!isString(nt))return nt;const[rt,ot,it,st]=nt.match(floatRegex);return{[o]:parseFloat(rt),[et]:parseFloat(ot),[tt]:parseFloat(it),alpha:st!==void 0?parseFloat(st):1}},hsla={test:isColorString("hsl","hue"),parse:splitColor("hue","saturation","lightness"),transform:({hue:o,saturation:et,lightness:tt,alpha:nt=1})=>"hsla("+Math.round(o)+", "+percent.transform(sanitize(et))+", "+percent.transform(sanitize(tt))+", "+sanitize(alpha.transform(nt))+")"},clampRgbUnit=clamp$2(0,255),rgbUnit=Object.assign(Object.assign({},number$3),{transform:o=>Math.round(clampRgbUnit(o))}),rgba={test:isColorString("rgb","red"),parse:splitColor("red","green","blue"),transform:({red:o,green:et,blue:tt,alpha:nt=1})=>"rgba("+rgbUnit.transform(o)+", "+rgbUnit.transform(et)+", "+rgbUnit.transform(tt)+", "+sanitize(alpha.transform(nt))+")"};function parseHex(o){let et="",tt="",nt="",rt="";return o.length>5?(et=o.substr(1,2),tt=o.substr(3,2),nt=o.substr(5,2),rt=o.substr(7,2)):(et=o.substr(1,1),tt=o.substr(2,1),nt=o.substr(3,1),rt=o.substr(4,1),et+=et,tt+=tt,nt+=nt,rt+=rt),{red:parseInt(et,16),green:parseInt(tt,16),blue:parseInt(nt,16),alpha:rt?parseInt(rt,16)/255:1}}const hex={test:isColorString("#"),parse:parseHex,transform:rgba.transform},color$1={test:o=>rgba.test(o)||hex.test(o)||hsla.test(o),parse:o=>rgba.test(o)?rgba.parse(o):hsla.test(o)?hsla.parse(o):hex.parse(o),transform:o=>isString(o)?o:o.hasOwnProperty("red")?rgba.transform(o):hsla.transform(o)},colorToken="${c}",numberToken="${n}";function test(o){var et,tt,nt,rt;return isNaN(o)&&isString(o)&&((tt=(et=o.match(floatRegex))===null||et===void 0?void 0:et.length)!==null&&tt!==void 0?tt:0)+((rt=(nt=o.match(colorRegex))===null||nt===void 0?void 0:nt.length)!==null&&rt!==void 0?rt:0)>0}function analyse$1(o){typeof o=="number"&&(o=`${o}`);const et=[];let tt=0;const nt=o.match(colorRegex);nt&&(tt=nt.length,o=o.replace(colorRegex,colorToken),et.push(...nt.map(color$1.parse)));const rt=o.match(floatRegex);return rt&&(o=o.replace(floatRegex,numberToken),et.push(...rt.map(number$3.parse))),{values:et,numColors:tt,tokenised:o}}function parse$4(o){return analyse$1(o).values}function createTransformer(o){const{values:et,numColors:tt,tokenised:nt}=analyse$1(o),rt=et.length;return ot=>{let it=nt;for(let st=0;sttypeof o=="number"?0:o;function getAnimatableNone$1(o){const et=parse$4(o);return createTransformer(o)(et.map(convertNumbersToZero))}const complex={test,parse:parse$4,createTransformer,getAnimatableNone:getAnimatableNone$1},maxDefaults=new Set(["brightness","contrast","saturate","opacity"]);function applyDefaultFilter(o){let[et,tt]=o.slice(0,-1).split("(");if(et==="drop-shadow")return o;const[nt]=tt.match(floatRegex)||[];if(!nt)return o;const rt=tt.replace(nt,"");let ot=maxDefaults.has(et)?1:0;return nt!==tt&&(ot*=100),et+"("+ot+rt+")"}const functionRegex=/([a-z-]*)\(.*?\)/g,filter$1=Object.assign(Object.assign({},complex),{getAnimatableNone:o=>{const et=o.match(functionRegex);return et?et.map(applyDefaultFilter).join(" "):o}});var int=__assign(__assign({},number$3),{transform:Math.round}),numberValueTypes={borderWidth:px,borderTopWidth:px,borderRightWidth:px,borderBottomWidth:px,borderLeftWidth:px,borderRadius:px,radius:px,borderTopLeftRadius:px,borderTopRightRadius:px,borderBottomRightRadius:px,borderBottomLeftRadius:px,width:px,maxWidth:px,height:px,maxHeight:px,size:px,top:px,right:px,bottom:px,left:px,padding:px,paddingTop:px,paddingRight:px,paddingBottom:px,paddingLeft:px,margin:px,marginTop:px,marginRight:px,marginBottom:px,marginLeft:px,rotate:degrees,rotateX:degrees,rotateY:degrees,rotateZ:degrees,scale,scaleX:scale,scaleY:scale,scaleZ:scale,skew:degrees,skewX:degrees,skewY:degrees,distance:px,translateX:px,translateY:px,translateZ:px,x:px,y:px,z:px,perspective:px,transformPerspective:px,opacity:alpha,originX:progressPercentage,originY:progressPercentage,originZ:px,zIndex:int,fillOpacity:alpha,strokeOpacity:alpha,numOctaves:int};function buildHTMLStyles(o,et,tt,nt){var rt,ot=o.style,it=o.vars,st=o.transform,at=o.transformKeys,ct=o.transformOrigin;at.length=0;var lt=!1,dt=!1,ht=!0;for(var pt in et){var mt=et[pt];if(isCSSVariable$1(pt)){it[pt]=mt;continue}var ft=numberValueTypes[pt],yt=getValueAsType(mt,ft);if(isTransformProp(pt)){if(lt=!0,st[pt]=yt,at.push(pt),!ht)continue;mt!==((rt=ft.default)!==null&&rt!==void 0?rt:0)&&(ht=!1)}else isTransformOriginProp(pt)?(ct[pt]=yt,dt=!0):ot[pt]=yt}lt?ot.transform=buildTransform(o,tt,ht,nt):nt?ot.transform=nt({},""):!et.transform&&ot.transform&&(ot.transform="none"),dt&&(ot.transformOrigin=buildTransformOrigin(ct))}var createHtmlRenderState=function(){return{style:{},transform:{},transformKeys:[],transformOrigin:{},vars:{}}};function copyRawValuesOnly(o,et,tt){for(var nt in et)!isMotionValue(et[nt])&&!isForcedMotionValue(nt,tt)&&(o[nt]=et[nt])}function useInitialMotionValues(o,et,tt){var nt=o.transformTemplate;return reactExports.useMemo(function(){var rt=createHtmlRenderState();buildHTMLStyles(rt,et,{enableHardwareAcceleration:!tt},nt);var ot=rt.vars,it=rt.style;return __assign(__assign({},ot),it)},[et])}function useStyle(o,et,tt){var nt=o.style||{},rt={};return copyRawValuesOnly(rt,nt,o),Object.assign(rt,useInitialMotionValues(o,et,tt)),o.transformValues&&(rt=o.transformValues(rt)),rt}function useHTMLProps(o,et,tt){var nt={},rt=useStyle(o,et,tt);return o.drag&&o.dragListener!==!1&&(nt.draggable=!1,rt.userSelect=rt.WebkitUserSelect=rt.WebkitTouchCallout="none",rt.touchAction=o.drag===!0?"none":"pan-".concat(o.drag==="x"?"y":"x")),nt.style=rt,nt}var validMotionProps=new Set(["initial","animate","exit","style","variants","transition","transformTemplate","transformValues","custom","inherit","layout","layoutId","layoutDependency","onLayoutAnimationStart","onLayoutAnimationComplete","onLayoutMeasure","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","drag","dragControls","dragListener","dragConstraints","dragDirectionLock","dragSnapToOrigin","_dragX","_dragY","dragElastic","dragMomentum","dragPropagation","dragTransition","whileDrag","onPan","onPanStart","onPanEnd","onPanSessionStart","onTap","onTapStart","onTapCancel","onHoverStart","onHoverEnd","whileFocus","whileTap","whileHover","whileInView","onViewportEnter","onViewportLeave","viewport","layoutScroll"]);function isValidMotionProp(o){return validMotionProps.has(o)}var shouldForward=function(o){return!isValidMotionProp(o)};function loadExternalIsValidProp(o){o&&(shouldForward=function(et){return et.startsWith("on")?!isValidMotionProp(et):o(et)})}try{loadExternalIsValidProp(require("@emotion/is-prop-valid").default)}catch{}function filterProps(o,et,tt){var nt={};for(var rt in o)(shouldForward(rt)||tt===!0&&isValidMotionProp(rt)||!et&&!isValidMotionProp(rt)||o.draggable&&rt.startsWith("onDrag"))&&(nt[rt]=o[rt]);return nt}function calcOrigin$1(o,et,tt){return typeof o=="string"?o:px.transform(et+tt*o)}function calcSVGTransformOrigin(o,et,tt){var nt=calcOrigin$1(et,o.x,o.width),rt=calcOrigin$1(tt,o.y,o.height);return"".concat(nt," ").concat(rt)}var camelKeys={offset:"strokeDashoffset",array:"strokeDasharray"};function buildSVGPath(o,et,tt,nt,rt){tt===void 0&&(tt=1),nt===void 0&&(nt=0),o.pathLength=1;var ot=camelKeys;o[ot.offset]=px.transform(-nt);var it=px.transform(et),st=px.transform(tt);o[ot.array]="".concat(it," ").concat(st)}function buildSVGAttrs(o,et,tt,nt){var rt=et.attrX,ot=et.attrY,it=et.originX,st=et.originY,at=et.pathLength,ct=et.pathSpacing,lt=ct===void 0?1:ct,dt=et.pathOffset,ht=dt===void 0?0:dt,pt=__rest(et,["attrX","attrY","originX","originY","pathLength","pathSpacing","pathOffset"]);buildHTMLStyles(o,pt,tt,nt),o.attrs=o.style,o.style={};var mt=o.attrs,ft=o.style,yt=o.dimensions;mt.transform&&(yt&&(ft.transform=mt.transform),delete mt.transform),yt&&(it!==void 0||st!==void 0||ft.transform)&&(ft.transformOrigin=calcSVGTransformOrigin(yt,it!==void 0?it:.5,st!==void 0?st:.5)),rt!==void 0&&(mt.x=rt),ot!==void 0&&(mt.y=ot),at!==void 0&&buildSVGPath(mt,at,lt,ht)}var createSvgRenderState=function(){return __assign(__assign({},createHtmlRenderState()),{attrs:{}})};function useSVGProps(o,et){var tt=reactExports.useMemo(function(){var rt=createSvgRenderState();return buildSVGAttrs(rt,et,{enableHardwareAcceleration:!1},o.transformTemplate),__assign(__assign({},rt.attrs),{style:__assign({},rt.style)})},[et]);if(o.style){var nt={};copyRawValuesOnly(nt,o.style,o),tt.style=__assign(__assign({},nt),tt.style)}return tt}function createUseRender(o){o===void 0&&(o=!1);var et=function(tt,nt,rt,ot,it,st){var at=it.latestValues,ct=isSVGComponent(tt)?useSVGProps:useHTMLProps,lt=ct(nt,at,st),dt=filterProps(nt,typeof tt=="string",o),ht=__assign(__assign(__assign({},dt),lt),{ref:ot});return rt&&(ht["data-projection-id"]=rt),reactExports.createElement(tt,ht)};return et}var CAMEL_CASE_PATTERN=/([a-z])([A-Z])/g,REPLACE_TEMPLATE="$1-$2",camelToDash=function(o){return o.replace(CAMEL_CASE_PATTERN,REPLACE_TEMPLATE).toLowerCase()};function renderHTML(o,et,tt,nt){var rt=et.style,ot=et.vars;Object.assign(o.style,rt,nt&&nt.getProjectionStyles(tt));for(var it in ot)o.style.setProperty(it,ot[it])}var camelCaseAttributes=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength"]);function renderSVG(o,et,tt,nt){renderHTML(o,et,void 0,nt);for(var rt in et.attrs)o.setAttribute(camelCaseAttributes.has(rt)?rt:camelToDash(rt),et.attrs[rt])}function scrapeMotionValuesFromProps$1(o){var et=o.style,tt={};for(var nt in et)(isMotionValue(et[nt])||isForcedMotionValue(nt,o))&&(tt[nt]=et[nt]);return tt}function scrapeMotionValuesFromProps(o){var et=scrapeMotionValuesFromProps$1(o);for(var tt in o)if(isMotionValue(o[tt])){var nt=tt==="x"||tt==="y"?"attr"+tt.toUpperCase():tt;et[nt]=o[tt]}return et}function isAnimationControls(o){return typeof o=="object"&&typeof o.start=="function"}var isKeyframesTarget=function(o){return Array.isArray(o)},isCustomValue=function(o){return!!(o&&typeof o=="object"&&o.mix&&o.toValue)},resolveFinalValueInKeyframes=function(o){return isKeyframesTarget(o)?o[o.length-1]||0:o};function resolveMotionValue(o){var et=isMotionValue(o)?o.get():o;return isCustomValue(et)?et.toValue():et}function makeState(o,et,tt,nt){var rt=o.scrapeMotionValuesFromProps,ot=o.createRenderState,it=o.onMount,st={latestValues:makeLatestValues(et,tt,nt,rt),renderState:ot()};return it&&(st.mount=function(at){return it(et,at,st)}),st}var makeUseVisualState=function(o){return function(et,tt){var nt=reactExports.useContext(MotionContext),rt=reactExports.useContext(PresenceContext);return tt?makeState(o,et,nt,rt):useConstant(function(){return makeState(o,et,nt,rt)})}};function makeLatestValues(o,et,tt,nt){var rt={},ot=(tt==null?void 0:tt.initial)===!1,it=nt(o);for(var st in it)rt[st]=resolveMotionValue(it[st]);var at=o.initial,ct=o.animate,lt=checkIfControllingVariants(o),dt=checkIfVariantNode(o);et&&dt&&!lt&&o.inherit!==!1&&(at??(at=et.initial),ct??(ct=et.animate));var ht=ot||at===!1,pt=ht?ct:at;if(pt&&typeof pt!="boolean"&&!isAnimationControls(pt)){var mt=Array.isArray(pt)?pt:[pt];mt.forEach(function(ft){var yt=resolveVariantFromProps(o,ft);if(yt){var gt=yt.transitionEnd;yt.transition;var xt=__rest(yt,["transitionEnd","transition"]);for(var vt in xt){var bt=xt[vt];if(Array.isArray(bt)){var Et=ht?bt.length-1:0;bt=bt[Et]}bt!==null&&(rt[vt]=bt)}for(var vt in gt)rt[vt]=gt[vt]}})}return rt}var svgMotionConfig={useVisualState:makeUseVisualState({scrapeMotionValuesFromProps,createRenderState:createSvgRenderState,onMount:function(o,et,tt){var nt=tt.renderState,rt=tt.latestValues;try{nt.dimensions=typeof et.getBBox=="function"?et.getBBox():et.getBoundingClientRect()}catch{nt.dimensions={x:0,y:0,width:0,height:0}}buildSVGAttrs(nt,rt,{enableHardwareAcceleration:!1},o.transformTemplate),renderSVG(et,nt)}})},htmlMotionConfig={useVisualState:makeUseVisualState({scrapeMotionValuesFromProps:scrapeMotionValuesFromProps$1,createRenderState:createHtmlRenderState})};function createDomMotionConfig(o,et,tt,nt,rt){var ot=et.forwardMotionProps,it=ot===void 0?!1:ot,st=isSVGComponent(o)?svgMotionConfig:htmlMotionConfig;return __assign(__assign({},st),{preloadedFeatures:tt,useRender:createUseRender(it),createVisualElement:nt,projectionNodeConstructor:rt,Component:o})}var AnimationType;(function(o){o.Animate="animate",o.Hover="whileHover",o.Tap="whileTap",o.Drag="whileDrag",o.Focus="whileFocus",o.InView="whileInView",o.Exit="exit"})(AnimationType||(AnimationType={}));function addDomEvent(o,et,tt,nt){return nt===void 0&&(nt={passive:!0}),o.addEventListener(et,tt,nt),function(){return o.removeEventListener(et,tt)}}function useDomEvent(o,et,tt,nt){reactExports.useEffect(function(){var rt=o.current;if(tt&&rt)return addDomEvent(rt,et,tt,nt)},[o,et,tt,nt])}function useFocusGesture(o){var et=o.whileFocus,tt=o.visualElement,nt=function(){var ot;(ot=tt.animationState)===null||ot===void 0||ot.setActive(AnimationType.Focus,!0)},rt=function(){var ot;(ot=tt.animationState)===null||ot===void 0||ot.setActive(AnimationType.Focus,!1)};useDomEvent(tt,"focus",et?nt:void 0),useDomEvent(tt,"blur",et?rt:void 0)}function isMouseEvent(o){return typeof PointerEvent<"u"&&o instanceof PointerEvent?o.pointerType==="mouse":o instanceof MouseEvent}function isTouchEvent(o){var et=!!o.touches;return et}function filterPrimaryPointer(o){return function(et){var tt=et instanceof MouseEvent,nt=!tt||tt&&et.button===0;nt&&o(et)}}var defaultPagePoint={pageX:0,pageY:0};function pointFromTouch(o,et){et===void 0&&(et="page");var tt=o.touches[0]||o.changedTouches[0],nt=tt||defaultPagePoint;return{x:nt[et+"X"],y:nt[et+"Y"]}}function pointFromMouse(o,et){return et===void 0&&(et="page"),{x:o[et+"X"],y:o[et+"Y"]}}function extractEventInfo(o,et){return et===void 0&&(et="page"),{point:isTouchEvent(o)?pointFromTouch(o,et):pointFromMouse(o,et)}}var wrapHandler=function(o,et){et===void 0&&(et=!1);var tt=function(nt){return o(nt,extractEventInfo(nt))};return et?filterPrimaryPointer(tt):tt},supportsPointerEvents=function(){return isBrowser$3&&window.onpointerdown===null},supportsTouchEvents=function(){return isBrowser$3&&window.ontouchstart===null},supportsMouseEvents=function(){return isBrowser$3&&window.onmousedown===null},mouseEventNames={pointerdown:"mousedown",pointermove:"mousemove",pointerup:"mouseup",pointercancel:"mousecancel",pointerover:"mouseover",pointerout:"mouseout",pointerenter:"mouseenter",pointerleave:"mouseleave"},touchEventNames={pointerdown:"touchstart",pointermove:"touchmove",pointerup:"touchend",pointercancel:"touchcancel"};function getPointerEventName(o){return supportsPointerEvents()?o:supportsTouchEvents()?touchEventNames[o]:supportsMouseEvents()?mouseEventNames[o]:o}function addPointerEvent(o,et,tt,nt){return addDomEvent(o,getPointerEventName(et),wrapHandler(tt,et==="pointerdown"),nt)}function usePointerEvent(o,et,tt,nt){return useDomEvent(o,getPointerEventName(et),tt&&wrapHandler(tt,et==="pointerdown"),nt)}function createLock(o){var et=null;return function(){var tt=function(){et=null};return et===null?(et=o,tt):!1}}var globalHorizontalLock=createLock("dragHorizontal"),globalVerticalLock=createLock("dragVertical");function getGlobalLock(o){var et=!1;if(o==="y")et=globalVerticalLock();else if(o==="x")et=globalHorizontalLock();else{var tt=globalHorizontalLock(),nt=globalVerticalLock();tt&&nt?et=function(){tt(),nt()}:(tt&&tt(),nt&&nt())}return et}function isDragActive(){var o=getGlobalLock(!0);return o?(o(),!1):!0}function createHoverEvent(o,et,tt){return function(nt,rt){var ot;!isMouseEvent(nt)||isDragActive()||((ot=o.animationState)===null||ot===void 0||ot.setActive(AnimationType.Hover,et),tt==null||tt(nt,rt))}}function useHoverGesture(o){var et=o.onHoverStart,tt=o.onHoverEnd,nt=o.whileHover,rt=o.visualElement;usePointerEvent(rt,"pointerenter",et||nt?createHoverEvent(rt,!0,et):void 0,{passive:!et}),usePointerEvent(rt,"pointerleave",tt||nt?createHoverEvent(rt,!1,tt):void 0,{passive:!tt})}var isNodeOrChild=function(o,et){return et?o===et?!0:isNodeOrChild(o,et.parentElement):!1};function useUnmountEffect(o){return reactExports.useEffect(function(){return function(){return o()}},[])}const clamp$1=(o,et,tt)=>Math.min(Math.max(tt,o),et),safeMin=.001,minDuration=.01,maxDuration=10,minDamping=.05,maxDamping=1;function findSpring({duration:o=800,bounce:et=.25,velocity:tt=0,mass:nt=1}){let rt,ot,it=1-et;it=clamp$1(minDamping,maxDamping,it),o=clamp$1(minDuration,maxDuration,o/1e3),it<1?(rt=ct=>{const lt=ct*it,dt=lt*o,ht=lt-tt,pt=calcAngularFreq(ct,it),mt=Math.exp(-dt);return safeMin-ht/pt*mt},ot=ct=>{const dt=ct*it*o,ht=dt*tt+tt,pt=Math.pow(it,2)*Math.pow(ct,2)*o,mt=Math.exp(-dt),ft=calcAngularFreq(Math.pow(ct,2),it);return(-rt(ct)+safeMin>0?-1:1)*((ht-pt)*mt)/ft}):(rt=ct=>{const lt=Math.exp(-ct*o),dt=(ct-tt)*o+1;return-safeMin+lt*dt},ot=ct=>{const lt=Math.exp(-ct*o),dt=(tt-ct)*(o*o);return lt*dt});const st=5/o,at=approximateRoot(rt,ot,st);if(o=o*1e3,isNaN(at))return{stiffness:100,damping:10,duration:o};{const ct=Math.pow(at,2)*nt;return{stiffness:ct,damping:it*2*Math.sqrt(nt*ct),duration:o}}}const rootIterations=12;function approximateRoot(o,et,tt){let nt=tt;for(let rt=1;rto[tt]!==void 0)}function getSpringOptions(o){let et=Object.assign({velocity:0,stiffness:100,damping:10,mass:1,isResolvedFromDuration:!1},o);if(!isSpringType(o,physicsKeys)&&isSpringType(o,durationKeys)){const tt=findSpring(o);et=Object.assign(Object.assign(Object.assign({},et),tt),{velocity:0,mass:1}),et.isResolvedFromDuration=!0}return et}function spring(o){var{from:et=0,to:tt=1,restSpeed:nt=2,restDelta:rt}=o,ot=__rest(o,["from","to","restSpeed","restDelta"]);const it={done:!1,value:et};let{stiffness:st,damping:at,mass:ct,velocity:lt,duration:dt,isResolvedFromDuration:ht}=getSpringOptions(ot),pt=zero$1,mt=zero$1;function ft(){const yt=lt?-(lt/1e3):0,gt=tt-et,xt=at/(2*Math.sqrt(st*ct)),vt=Math.sqrt(st/ct)/1e3;if(rt===void 0&&(rt=Math.min(Math.abs(tt-et)/100,.4)),xt<1){const bt=calcAngularFreq(vt,xt);pt=Et=>{const wt=Math.exp(-xt*vt*Et);return tt-wt*((yt+xt*vt*gt)/bt*Math.sin(bt*Et)+gt*Math.cos(bt*Et))},mt=Et=>{const wt=Math.exp(-xt*vt*Et);return xt*vt*wt*(Math.sin(bt*Et)*(yt+xt*vt*gt)/bt+gt*Math.cos(bt*Et))-wt*(Math.cos(bt*Et)*(yt+xt*vt*gt)-bt*gt*Math.sin(bt*Et))}}else if(xt===1)pt=bt=>tt-Math.exp(-vt*bt)*(gt+(yt+vt*gt)*bt);else{const bt=vt*Math.sqrt(xt*xt-1);pt=Et=>{const wt=Math.exp(-xt*vt*Et),kt=Math.min(bt*Et,300);return tt-wt*((yt+xt*vt*gt)*Math.sinh(kt)+bt*gt*Math.cosh(kt))/bt}}}return ft(),{next:yt=>{const gt=pt(yt);if(ht)it.done=yt>=dt;else{const xt=mt(yt)*1e3,vt=Math.abs(xt)<=nt,bt=Math.abs(tt-gt)<=rt;it.done=vt&&bt}return it.value=it.done?tt:gt,it},flipTarget:()=>{lt=-lt,[et,tt]=[tt,et],ft()}}}spring.needsInterpolation=(o,et)=>typeof o=="string"||typeof et=="string";const zero$1=o=>0,progress=(o,et,tt)=>{const nt=et-o;return nt===0?1:(tt-o)/nt},mix=(o,et,tt)=>-tt*o+tt*et+o;function hueToRgb(o,et,tt){return tt<0&&(tt+=1),tt>1&&(tt-=1),tt<1/6?o+(et-o)*6*tt:tt<1/2?et:tt<2/3?o+(et-o)*(2/3-tt)*6:o}function hslaToRgba({hue:o,saturation:et,lightness:tt,alpha:nt}){o/=360,et/=100,tt/=100;let rt=0,ot=0,it=0;if(!et)rt=ot=it=tt;else{const st=tt<.5?tt*(1+et):tt+et-tt*et,at=2*tt-st;rt=hueToRgb(at,st,o+1/3),ot=hueToRgb(at,st,o),it=hueToRgb(at,st,o-1/3)}return{red:Math.round(rt*255),green:Math.round(ot*255),blue:Math.round(it*255),alpha:nt}}const mixLinearColor=(o,et,tt)=>{const nt=o*o,rt=et*et;return Math.sqrt(Math.max(0,tt*(rt-nt)+nt))},colorTypes=[hex,rgba,hsla],getColorType=o=>colorTypes.find(et=>et.test(o)),mixColor=(o,et)=>{let tt=getColorType(o),nt=getColorType(et),rt=tt.parse(o),ot=nt.parse(et);tt===hsla&&(rt=hslaToRgba(rt),tt=rgba),nt===hsla&&(ot=hslaToRgba(ot),nt=rgba);const it=Object.assign({},rt);return st=>{for(const at in it)at!=="alpha"&&(it[at]=mixLinearColor(rt[at],ot[at],st));return it.alpha=mix(rt.alpha,ot.alpha,st),tt.transform(it)}},isNum=o=>typeof o=="number",combineFunctions=(o,et)=>tt=>et(o(tt)),pipe$1=(...o)=>o.reduce(combineFunctions);function getMixer(o,et){return isNum(o)?tt=>mix(o,et,tt):color$1.test(o)?mixColor(o,et):mixComplex(o,et)}const mixArray=(o,et)=>{const tt=[...o],nt=tt.length,rt=o.map((ot,it)=>getMixer(ot,et[it]));return ot=>{for(let it=0;it{const tt=Object.assign(Object.assign({},o),et),nt={};for(const rt in tt)o[rt]!==void 0&&et[rt]!==void 0&&(nt[rt]=getMixer(o[rt],et[rt]));return rt=>{for(const ot in nt)tt[ot]=nt[ot](rt);return tt}};function analyse(o){const et=complex.parse(o),tt=et.length;let nt=0,rt=0,ot=0;for(let it=0;it{const tt=complex.createTransformer(et),nt=analyse(o),rt=analyse(et);return nt.numHSL===rt.numHSL&&nt.numRGB===rt.numRGB&&nt.numNumbers>=rt.numNumbers?pipe$1(mixArray(nt.parsed,rt.parsed),tt):it=>`${it>0?et:o}`},mixNumber=(o,et)=>tt=>mix(o,et,tt);function detectMixerFactory(o){if(typeof o=="number")return mixNumber;if(typeof o=="string")return color$1.test(o)?mixColor:mixComplex;if(Array.isArray(o))return mixArray;if(typeof o=="object")return mixObject}function createMixers(o,et,tt){const nt=[],rt=tt||detectMixerFactory(o[0]),ot=o.length-1;for(let it=0;ittt(progress(o,et,nt))}function slowInterpolate(o,et){const tt=o.length,nt=tt-1;return rt=>{let ot=0,it=!1;if(rt<=o[0]?it=!0:rt>=o[nt]&&(ot=nt-1,it=!0),!it){let at=1;for(;atrt||at===nt);at++);ot=at-1}const st=progress(o[ot],o[ot+1],rt);return et[ot](st)}}function interpolate(o,et,{clamp:tt=!0,ease:nt,mixer:rt}={}){const ot=o.length;invariant$1(ot===et.length),invariant$1(!nt||!Array.isArray(nt)||nt.length===ot-1),o[0]>o[ot-1]&&(o=[].concat(o),et=[].concat(et),o.reverse(),et.reverse());const it=createMixers(et,nt,rt),st=ot===2?fastInterpolate(o,it):slowInterpolate(o,it);return tt?at=>st(clamp$1(o[0],o[ot-1],at)):st}const reverseEasing=o=>et=>1-o(1-et),mirrorEasing=o=>et=>et<=.5?o(2*et)/2:(2-o(2*(1-et)))/2,createExpoIn=o=>et=>Math.pow(et,o),createBackIn=o=>et=>et*et*((o+1)*et-o),createAnticipate=o=>{const et=createBackIn(o);return tt=>(tt*=2)<1?.5*et(tt):.5*(2-Math.pow(2,-10*(tt-1)))},DEFAULT_OVERSHOOT_STRENGTH=1.525,BOUNCE_FIRST_THRESHOLD=4/11,BOUNCE_SECOND_THRESHOLD=8/11,BOUNCE_THIRD_THRESHOLD=9/10,linear=o=>o,easeIn=createExpoIn(2),easeOut=reverseEasing(easeIn),easeInOut=mirrorEasing(easeIn),circIn=o=>1-Math.sin(Math.acos(o)),circOut=reverseEasing(circIn),circInOut=mirrorEasing(circOut),backIn=createBackIn(DEFAULT_OVERSHOOT_STRENGTH),backOut=reverseEasing(backIn),backInOut=mirrorEasing(backIn),anticipate=createAnticipate(DEFAULT_OVERSHOOT_STRENGTH),ca=4356/361,cb=35442/1805,cc=16061/1805,bounceOut=o=>{if(o===1||o===0)return o;const et=o*o;return oo<.5?.5*(1-bounceOut(1-o*2)):.5*bounceOut(o*2-1)+.5;function defaultEasing(o,et){return o.map(()=>et||easeInOut).splice(0,o.length-1)}function defaultOffset(o){const et=o.length;return o.map((tt,nt)=>nt!==0?nt/(et-1):0)}function convertOffsetToTimes(o,et){return o.map(tt=>tt*et)}function keyframes$1({from:o=0,to:et=1,ease:tt,offset:nt,duration:rt=300}){const ot={done:!1,value:o},it=Array.isArray(et)?et:[o,et],st=convertOffsetToTimes(nt&&nt.length===it.length?nt:defaultOffset(it),rt);function at(){return interpolate(st,it,{ease:Array.isArray(tt)?tt:defaultEasing(it,tt)})}let ct=at();return{next:lt=>(ot.value=ct(lt),ot.done=lt>=rt,ot),flipTarget:()=>{it.reverse(),ct=at()}}}function decay({velocity:o=0,from:et=0,power:tt=.8,timeConstant:nt=350,restDelta:rt=.5,modifyTarget:ot}){const it={done:!1,value:et};let st=tt*o;const at=et+st,ct=ot===void 0?at:ot(at);return ct!==at&&(st=ct-et),{next:lt=>{const dt=-st*Math.exp(-lt/nt);return it.done=!(dt>rt||dt<-rt),it.value=it.done?ct:ct+dt,it},flipTarget:()=>{}}}const types$3={keyframes:keyframes$1,spring,decay};function detectAnimationFromOptions(o){if(Array.isArray(o.to))return keyframes$1;if(types$3[o.type])return types$3[o.type];const et=new Set(Object.keys(o));return et.has("ease")||et.has("duration")&&!et.has("dampingRatio")?keyframes$1:et.has("dampingRatio")||et.has("stiffness")||et.has("mass")||et.has("damping")||et.has("restSpeed")||et.has("restDelta")?spring:keyframes$1}const defaultTimestep=1/60*1e3,getCurrentTime=typeof performance<"u"?()=>performance.now():()=>Date.now(),onNextFrame=typeof window<"u"?o=>window.requestAnimationFrame(o):o=>setTimeout(()=>o(getCurrentTime()),defaultTimestep);function createRenderStep(o){let et=[],tt=[],nt=0,rt=!1,ot=!1;const it=new WeakSet,st={schedule:(at,ct=!1,lt=!1)=>{const dt=lt&&rt,ht=dt?et:tt;return ct&&it.add(at),ht.indexOf(at)===-1&&(ht.push(at),dt&&rt&&(nt=et.length)),at},cancel:at=>{const ct=tt.indexOf(at);ct!==-1&&tt.splice(ct,1),it.delete(at)},process:at=>{if(rt){ot=!0;return}if(rt=!0,[et,tt]=[tt,et],tt.length=0,nt=et.length,nt)for(let ct=0;ct(o[et]=createRenderStep(()=>runNextFrame=!0),o),{}),sync=stepsOrder.reduce((o,et)=>{const tt=steps[et];return o[et]=(nt,rt=!1,ot=!1)=>(runNextFrame||startLoop(),tt.schedule(nt,rt,ot)),o},{}),cancelSync=stepsOrder.reduce((o,et)=>(o[et]=steps[et].cancel,o),{}),flushSync=stepsOrder.reduce((o,et)=>(o[et]=()=>steps[et].process(frame),o),{}),processStep=o=>steps[o].process(frame),processFrame=o=>{runNextFrame=!1,frame.delta=useDefaultElapsed?defaultTimestep:Math.max(Math.min(o-frame.timestamp,maxElapsed),1),frame.timestamp=o,isProcessing=!0,stepsOrder.forEach(processStep),isProcessing=!1,runNextFrame&&(useDefaultElapsed=!1,onNextFrame(processFrame))},startLoop=()=>{runNextFrame=!0,useDefaultElapsed=!0,isProcessing||onNextFrame(processFrame)},getFrameData=()=>frame;function loopElapsed(o,et,tt=0){return o-et-tt}function reverseElapsed(o,et,tt=0,nt=!0){return nt?loopElapsed(et+-o,et,tt):et-(o-et)+tt}function hasRepeatDelayElapsed(o,et,tt,nt){return nt?o>=et+tt:o<=-tt}const framesync=o=>{const et=({delta:tt})=>o(tt);return{start:()=>sync.update(et,!0),stop:()=>cancelSync.update(et)}};function animate$1(o){var et,tt,{from:nt,autoplay:rt=!0,driver:ot=framesync,elapsed:it=0,repeat:st=0,repeatType:at="loop",repeatDelay:ct=0,onPlay:lt,onStop:dt,onComplete:ht,onRepeat:pt,onUpdate:mt}=o,ft=__rest(o,["from","autoplay","driver","elapsed","repeat","repeatType","repeatDelay","onPlay","onStop","onComplete","onRepeat","onUpdate"]);let{to:yt}=ft,gt,xt=0,vt=ft.duration,bt,Et=!1,wt=!0,kt;const It=detectAnimationFromOptions(ft);!((tt=(et=It).needsInterpolation)===null||tt===void 0)&&tt.call(et,nt,yt)&&(kt=interpolate([0,100],[nt,yt],{clamp:!1}),nt=0,yt=100);const Rt=It(Object.assign(Object.assign({},ft),{from:nt,to:yt}));function Pt(){xt++,at==="reverse"?(wt=xt%2===0,it=reverseElapsed(it,vt,ct,wt)):(it=loopElapsed(it,vt,ct),at==="mirror"&&Rt.flipTarget()),Et=!1,pt&&pt()}function jt(){gt.stop(),ht&&ht()}function Ot(zt){if(wt||(zt=-zt),it+=zt,!Et){const Ft=Rt.next(Math.max(0,it));bt=Ft.value,kt&&(bt=kt(bt)),Et=wt?Ft.done:it<=0}mt==null||mt(bt),Et&&(xt===0&&(vt??(vt=it)),xt{dt==null||dt(),gt.stop()}}}function velocityPerSecond(o,et){return et?o*(1e3/et):0}function inertia({from:o=0,velocity:et=0,min:tt,max:nt,power:rt=.8,timeConstant:ot=750,bounceStiffness:it=500,bounceDamping:st=10,restDelta:at=1,modifyTarget:ct,driver:lt,onUpdate:dt,onComplete:ht,onStop:pt}){let mt;function ft(vt){return tt!==void 0&&vtnt}function yt(vt){return tt===void 0?nt:nt===void 0||Math.abs(tt-vt){var Et;dt==null||dt(bt),(Et=vt.onUpdate)===null||Et===void 0||Et.call(vt,bt)},onComplete:ht,onStop:pt}))}function xt(vt){gt(Object.assign({type:"spring",stiffness:it,damping:st,restDelta:at},vt))}if(ft(o))xt({from:o,velocity:et,to:yt(o)});else{let vt=rt*et+o;typeof ct<"u"&&(vt=ct(vt));const bt=yt(vt),Et=bt===tt?-1:1;let wt,kt;const It=Rt=>{wt=kt,kt=Rt,et=velocityPerSecond(Rt-wt,getFrameData().delta),(Et===1&&Rt>bt||Et===-1&&Rtmt==null?void 0:mt.stop()}}const isPoint=o=>o.hasOwnProperty("x")&&o.hasOwnProperty("y"),isPoint3D=o=>isPoint(o)&&o.hasOwnProperty("z"),distance1D=(o,et)=>Math.abs(o-et);function distance(o,et){if(isNum(o)&&isNum(et))return distance1D(o,et);if(isPoint(o)&&isPoint(et)){const tt=distance1D(o.x,et.x),nt=distance1D(o.y,et.y),rt=isPoint3D(o)&&isPoint3D(et)?distance1D(o.z,et.z):0;return Math.sqrt(Math.pow(tt,2)+Math.pow(nt,2)+Math.pow(rt,2))}}const a=(o,et)=>1-3*et+3*o,b$3=(o,et)=>3*et-6*o,c$2=o=>3*o,calcBezier=(o,et,tt)=>((a(et,tt)*o+b$3(et,tt))*o+c$2(et))*o,getSlope=(o,et,tt)=>3*a(et,tt)*o*o+2*b$3(et,tt)*o+c$2(et),subdivisionPrecision=1e-7,subdivisionMaxIterations=10;function binarySubdivide(o,et,tt,nt,rt){let ot,it,st=0;do it=et+(tt-et)/2,ot=calcBezier(it,nt,rt)-o,ot>0?tt=it:et=it;while(Math.abs(ot)>subdivisionPrecision&&++st=newtonMinSlope?newtonRaphsonIterate(it,dt,o,tt):ht===0?dt:binarySubdivide(it,st,st+kSampleStepSize,o,tt)}return it=>it===0||it===1?it:calcBezier(ot(it),et,nt)}function useTapGesture(o){var et=o.onTap,tt=o.onTapStart,nt=o.onTapCancel,rt=o.whileTap,ot=o.visualElement,it=et||tt||nt||rt,st=reactExports.useRef(!1),at=reactExports.useRef(null),ct={passive:!(tt||et||nt||mt)};function lt(){var ft;(ft=at.current)===null||ft===void 0||ft.call(at),at.current=null}function dt(){var ft;return lt(),st.current=!1,(ft=ot.animationState)===null||ft===void 0||ft.setActive(AnimationType.Tap,!1),!isDragActive()}function ht(ft,yt){dt()&&(isNodeOrChild(ot.getInstance(),ft.target)?et==null||et(ft,yt):nt==null||nt(ft,yt))}function pt(ft,yt){dt()&&(nt==null||nt(ft,yt))}function mt(ft,yt){var gt;lt(),!st.current&&(st.current=!0,at.current=pipe$1(addPointerEvent(window,"pointerup",ht,ct),addPointerEvent(window,"pointercancel",pt,ct)),(gt=ot.animationState)===null||gt===void 0||gt.setActive(AnimationType.Tap,!0),tt==null||tt(ft,yt))}usePointerEvent(ot,"pointerdown",it?mt:void 0,ct),useUnmountEffect(lt)}var warned=new Set;function warnOnce$1(o,et,tt){warned.has(et)||(console.warn(et),warned.add(et))}var observerCallbacks=new WeakMap,observers$1=new WeakMap,fireObserverCallback=function(o){var et;(et=observerCallbacks.get(o.target))===null||et===void 0||et(o)},fireAllObserverCallbacks=function(o){o.forEach(fireObserverCallback)};function initIntersectionObserver(o){var et=o.root,tt=__rest(o,["root"]),nt=et||document;observers$1.has(nt)||observers$1.set(nt,{});var rt=observers$1.get(nt),ot=JSON.stringify(tt);return rt[ot]||(rt[ot]=new IntersectionObserver(fireAllObserverCallbacks,__assign({root:et},tt))),rt[ot]}function observeIntersection(o,et,tt){var nt=initIntersectionObserver(et);return observerCallbacks.set(o,tt),nt.observe(o),function(){observerCallbacks.delete(o),nt.unobserve(o)}}function useViewport(o){var et=o.visualElement,tt=o.whileInView,nt=o.onViewportEnter,rt=o.onViewportLeave,ot=o.viewport,it=ot===void 0?{}:ot,st=reactExports.useRef({hasEnteredView:!1,isInView:!1}),at=!!(tt||nt||rt);it.once&&st.current.hasEnteredView&&(at=!1);var ct=typeof IntersectionObserver>"u"?useMissingIntersectionObserver:useIntersectionObserver;ct(at,st.current,et,it)}var thresholdNames={some:0,all:1};function useIntersectionObserver(o,et,tt,nt){var rt=nt.root,ot=nt.margin,it=nt.amount,st=it===void 0?"some":it,at=nt.once;reactExports.useEffect(function(){if(o){var ct={root:rt==null?void 0:rt.current,rootMargin:ot,threshold:typeof st=="number"?st:thresholdNames[st]},lt=function(dt){var ht,pt=dt.isIntersecting;if(et.isInView!==pt&&(et.isInView=pt,!(at&&!pt&&et.hasEnteredView))){pt&&(et.hasEnteredView=!0),(ht=tt.animationState)===null||ht===void 0||ht.setActive(AnimationType.InView,pt);var mt=tt.getProps(),ft=pt?mt.onViewportEnter:mt.onViewportLeave;ft==null||ft(dt)}};return observeIntersection(tt.getInstance(),ct,lt)}},[o,rt,ot,st])}function useMissingIntersectionObserver(o,et,tt,nt){var rt=nt.fallback,ot=rt===void 0?!0:rt;reactExports.useEffect(function(){!o||!ot||(env$1!=="production"&&warnOnce$1(!1,"IntersectionObserver not available on this device. whileInView animations will trigger on mount."),requestAnimationFrame(function(){var it;et.hasEnteredView=!0;var st=tt.getProps().onViewportEnter;st==null||st(null),(it=tt.animationState)===null||it===void 0||it.setActive(AnimationType.InView,!0)}))},[o])}var makeRenderlessComponent=function(o){return function(et){return o(et),null}},gestureAnimations={inView:makeRenderlessComponent(useViewport),tap:makeRenderlessComponent(useTapGesture),focus:makeRenderlessComponent(useFocusGesture),hover:makeRenderlessComponent(useHoverGesture)},counter=0,incrementId=function(){return counter++},useId$1=function(){return useConstant(incrementId)};function usePresence$1(){var o=reactExports.useContext(PresenceContext);if(o===null)return[!0,null];var et=o.isPresent,tt=o.onExitComplete,nt=o.register,rt=useId$1();reactExports.useEffect(function(){return nt(rt)},[]);var ot=function(){return tt==null?void 0:tt(rt)};return!et&&tt?[!1,ot]:[!0]}function shallowCompare(o,et){if(!Array.isArray(et))return!1;var tt=et.length;if(tt!==o.length)return!1;for(var nt=0;nt-1&&o.splice(tt,1)}var SubscriptionManager$1=function(){function o(){this.subscriptions=[]}return o.prototype.add=function(et){var tt=this;return addUniqueItem(this.subscriptions,et),function(){return removeItem(tt.subscriptions,et)}},o.prototype.notify=function(et,tt,nt){var rt=this.subscriptions.length;if(rt)if(rt===1)this.subscriptions[0](et,tt,nt);else for(var ot=0;otxt&&jt,Yt=Array.isArray(Pt)?Pt:[Pt],Ht=Yt.reduce(ot,{});Ot===!1&&(Ht={});var Ut=Rt.prevResolvedValues,qt=Ut===void 0?{}:Ut,Lt=__assign(__assign({},qt),Ht),Zt=function(nn){Ft=!0,yt.delete(nn),Rt.needsAnimating[nn]=!0};for(var Qt in Lt){var Nt=Ht[Qt],Gt=qt[Qt];gt.hasOwnProperty(Qt)||(Nt!==Gt?isKeyframesTarget(Nt)&&isKeyframesTarget(Gt)?!shallowCompare(Nt,Gt)||zt?Zt(Qt):Rt.protectedKeys[Qt]=!0:Nt!==void 0?Zt(Qt):yt.add(Qt):Nt!==void 0&&yt.has(Qt)?Zt(Qt):Rt.protectedKeys[Qt]=!0)}Rt.prevProp=Pt,Rt.prevResolvedValues=Ht,Rt.isActive&&(gt=__assign(__assign({},gt),Ht)),rt&&o.blockInitialAnimation&&(Ft=!1),Ft&&!Bt&&ft.push.apply(ft,__spreadArray([],__read(Yt.map(function(nn){return{animation:nn,options:__assign({type:It},lt)}})),!1))},bt=0;bt=3;if(!(!pt&&!mt)){var ft=ht.point,yt=getFrameData().timestamp;rt.history.push(__assign(__assign({},ft),{timestamp:yt}));var gt=rt.handlers,xt=gt.onStart,vt=gt.onMove;pt||(xt&&xt(rt.lastMoveEvent,ht),rt.startEvent=rt.lastMoveEvent),vt&&vt(rt.lastMoveEvent,ht)}}},this.handlePointerMove=function(ht,pt){if(rt.lastMoveEvent=ht,rt.lastMoveEventInfo=transformPoint(pt,rt.transformPagePoint),isMouseEvent(ht)&&ht.buttons===0){rt.handlePointerUp(ht,pt);return}sync.update(rt.updatePoint,!0)},this.handlePointerUp=function(ht,pt){rt.end();var mt=rt.handlers,ft=mt.onEnd,yt=mt.onSessionEnd,gt=getPanInfo(transformPoint(pt,rt.transformPagePoint),rt.history);rt.startEvent&&ft&&ft(ht,gt),yt&&yt(ht,gt)},!(isTouchEvent(et)&&et.touches.length>1)){this.handlers=tt,this.transformPagePoint=it;var st=extractEventInfo(et),at=transformPoint(st,this.transformPagePoint),ct=at.point,lt=getFrameData().timestamp;this.history=[__assign(__assign({},ct),{timestamp:lt})];var dt=tt.onSessionStart;dt&&dt(et,getPanInfo(at,this.history)),this.removeListeners=pipe$1(addPointerEvent(window,"pointermove",this.handlePointerMove),addPointerEvent(window,"pointerup",this.handlePointerUp),addPointerEvent(window,"pointercancel",this.handlePointerUp))}}return o.prototype.updateHandlers=function(et){this.handlers=et},o.prototype.end=function(){this.removeListeners&&this.removeListeners(),cancelSync.update(this.updatePoint)},o}();function transformPoint(o,et){return et?{point:et(o.point)}:o}function subtractPoint(o,et){return{x:o.x-et.x,y:o.y-et.y}}function getPanInfo(o,et){var tt=o.point;return{point:tt,delta:subtractPoint(tt,lastDevicePoint(et)),offset:subtractPoint(tt,startDevicePoint(et)),velocity:getVelocity(et,.1)}}function startDevicePoint(o){return o[0]}function lastDevicePoint(o){return o[o.length-1]}function getVelocity(o,et){if(o.length<2)return{x:0,y:0};for(var tt=o.length-1,nt=null,rt=lastDevicePoint(o);tt>=0&&(nt=o[tt],!(rt.timestamp-nt.timestamp>secondsToMilliseconds(et)));)tt--;if(!nt)return{x:0,y:0};var ot=(rt.timestamp-nt.timestamp)/1e3;if(ot===0)return{x:0,y:0};var it={x:(rt.x-nt.x)/ot,y:(rt.y-nt.y)/ot};return it.x===1/0&&(it.x=0),it.y===1/0&&(it.y=0),it}function calcLength(o){return o.max-o.min}function isNear(o,et,tt){return et===void 0&&(et=0),tt===void 0&&(tt=.01),distance(o,et)rt&&(o=tt?mix(rt,o,tt.max):Math.min(o,rt)),o}function calcRelativeAxisConstraints(o,et,tt){return{min:et!==void 0?o.min+et:void 0,max:tt!==void 0?o.max+tt-(o.max-o.min):void 0}}function calcRelativeConstraints(o,et){var tt=et.top,nt=et.left,rt=et.bottom,ot=et.right;return{x:calcRelativeAxisConstraints(o.x,nt,ot),y:calcRelativeAxisConstraints(o.y,tt,rt)}}function calcViewportAxisConstraints(o,et){var tt,nt=et.min-o.min,rt=et.max-o.max;return et.max-et.minnt?tt=progress(et.min,et.max-nt,o.min):nt>rt&&(tt=progress(o.min,o.max-rt,et.min)),clamp$1(0,1,tt)}function rebaseAxisConstraints(o,et){var tt={};return et.min!==void 0&&(tt.min=et.min-o.min),et.max!==void 0&&(tt.max=et.max-o.min),tt}var defaultElastic=.35;function resolveDragElastic(o){return o===void 0&&(o=defaultElastic),o===!1?o=0:o===!0&&(o=defaultElastic),{x:resolveAxisElastic(o,"left","right"),y:resolveAxisElastic(o,"top","bottom")}}function resolveAxisElastic(o,et,tt){return{min:resolvePointElastic(o,et),max:resolvePointElastic(o,tt)}}function resolvePointElastic(o,et){var tt;return typeof o=="number"?o:(tt=o[et])!==null&&tt!==void 0?tt:0}var createAxisDelta=function(){return{translate:0,scale:1,origin:0,originPoint:0}},createDelta=function(){return{x:createAxisDelta(),y:createAxisDelta()}},createAxis=function(){return{min:0,max:0}},createBox=function(){return{x:createAxis(),y:createAxis()}};function eachAxis(o){return[o("x"),o("y")]}function convertBoundingBoxToBox(o){var et=o.top,tt=o.left,nt=o.right,rt=o.bottom;return{x:{min:tt,max:nt},y:{min:et,max:rt}}}function convertBoxToBoundingBox(o){var et=o.x,tt=o.y;return{top:tt.min,right:et.max,bottom:tt.max,left:et.min}}function transformBoxPoints(o,et){if(!et)return o;var tt=et({x:o.left,y:o.top}),nt=et({x:o.right,y:o.bottom});return{top:tt.y,left:tt.x,bottom:nt.y,right:nt.x}}function isIdentityScale(o){return o===void 0||o===1}function hasScale(o){var et=o.scale,tt=o.scaleX,nt=o.scaleY;return!isIdentityScale(et)||!isIdentityScale(tt)||!isIdentityScale(nt)}function hasTransform(o){return hasScale(o)||hasTranslate(o.x)||hasTranslate(o.y)||o.z||o.rotate||o.rotateX||o.rotateY}function hasTranslate(o){return o&&o!=="0%"}function scalePoint(o,et,tt){var nt=o-tt,rt=et*nt;return tt+rt}function applyPointDelta(o,et,tt,nt,rt){return rt!==void 0&&(o=scalePoint(o,rt,nt)),scalePoint(o,tt,nt)+et}function applyAxisDelta(o,et,tt,nt,rt){et===void 0&&(et=0),tt===void 0&&(tt=1),o.min=applyPointDelta(o.min,et,tt,nt,rt),o.max=applyPointDelta(o.max,et,tt,nt,rt)}function applyBoxDelta(o,et){var tt=et.x,nt=et.y;applyAxisDelta(o.x,tt.translate,tt.scale,tt.originPoint),applyAxisDelta(o.y,nt.translate,nt.scale,nt.originPoint)}function applyTreeDeltas(o,et,tt,nt){var rt,ot;nt===void 0&&(nt=!1);var it=tt.length;if(it){et.x=et.y=1;for(var st,at,ct=0;ctet?tt="y":Math.abs(o.x)>et&&(tt="x"),tt}function useDrag(o){var et=o.dragControls,tt=o.visualElement,nt=useConstant(function(){return new VisualElementDragControls(tt)});reactExports.useEffect(function(){return et&&et.subscribe(nt)},[nt,et]),reactExports.useEffect(function(){return nt.addListeners()},[nt])}function usePanGesture(o){var et=o.onPan,tt=o.onPanStart,nt=o.onPanEnd,rt=o.onPanSessionStart,ot=o.visualElement,it=et||tt||nt||rt,st=reactExports.useRef(null),at=reactExports.useContext(MotionConfigContext).transformPagePoint,ct={onSessionStart:rt,onStart:tt,onMove:et,onEnd:function(dt,ht){st.current=null,nt&&nt(dt,ht)}};reactExports.useEffect(function(){st.current!==null&&st.current.updateHandlers(ct)});function lt(dt){st.current=new PanSession(dt,ct,{transformPagePoint:at})}usePointerEvent(ot,"pointerdown",it&<),useUnmountEffect(function(){return st.current&&st.current.end()})}var drag={pan:makeRenderlessComponent(usePanGesture),drag:makeRenderlessComponent(useDrag)},names$1=["LayoutMeasure","BeforeLayoutMeasure","LayoutUpdate","ViewportBoxUpdate","Update","Render","AnimationComplete","LayoutAnimationComplete","AnimationStart","LayoutAnimationStart","SetAxisTarget","Unmount"];function createLifecycles(){var o=names$1.map(function(){return new SubscriptionManager$1}),et={},tt={clearAllListeners:function(){return o.forEach(function(nt){return nt.clear()})},updatePropListeners:function(nt){names$1.forEach(function(rt){var ot,it="on"+rt,st=nt[it];(ot=et[rt])===null||ot===void 0||ot.call(et),st&&(et[rt]=tt[it](st))})}};return o.forEach(function(nt,rt){tt["on"+names$1[rt]]=function(ot){return nt.add(ot)},tt["notify"+names$1[rt]]=function(){for(var ot=[],it=0;it=0?window.pageYOffset:null,ct=convertChangedValueTypes(et,o,st);return ot.length&&ot.forEach(function(lt){var dt=__read(lt,2),ht=dt[0],pt=dt[1];o.getValue(ht).set(pt)}),o.syncRender(),at!==null&&window.scrollTo({top:at}),{target:ct,transitionEnd:nt}}else return{target:et,transitionEnd:nt}};function unitConversion(o,et,tt,nt){return hasPositionalKey(et)?checkAndConvertChangedValueTypes(o,et,tt,nt):{target:et,transitionEnd:nt}}var parseDomVariant=function(o,et,tt,nt){var rt=resolveCSSVariables(o,et,nt);return et=rt.target,nt=rt.transitionEnd,unitConversion(o,et,tt,nt)};function getComputedStyle$1(o){return window.getComputedStyle(o)}var htmlConfig={treeType:"dom",readValueFromInstance:function(o,et){if(isTransformProp(et)){var tt=getDefaultValueType(et);return tt&&tt.default||0}else{var nt=getComputedStyle$1(o);return(isCSSVariable$1(et)?nt.getPropertyValue(et):nt[et])||0}},sortNodePosition:function(o,et){return o.compareDocumentPosition(et)&2?1:-1},getBaseTarget:function(o,et){var tt;return(tt=o.style)===null||tt===void 0?void 0:tt[et]},measureViewportBox:function(o,et){var tt=et.transformPagePoint;return measureViewportBox(o,tt)},resetTransform:function(o,et,tt){var nt=tt.transformTemplate;et.style.transform=nt?nt({},""):"none",o.scheduleRender()},restoreTransform:function(o,et){o.style.transform=et.style.transform},removeValueFromRenderState:function(o,et){var tt=et.vars,nt=et.style;delete tt[o],delete nt[o]},makeTargetAnimatable:function(o,et,tt,nt){var rt=tt.transformValues;nt===void 0&&(nt=!0);var ot=et.transition,it=et.transitionEnd,st=__rest(et,["transition","transitionEnd"]),at=getOrigin(st,ot||{},o);if(rt&&(it&&(it=rt(it)),st&&(st=rt(st)),at&&(at=rt(at))),nt){checkTargetForNewValues(o,st,at);var ct=parseDomVariant(o,st,at,it);it=ct.transitionEnd,st=ct.target}return __assign({transition:ot,transitionEnd:it},st)},scrapeMotionValuesFromProps:scrapeMotionValuesFromProps$1,build:function(o,et,tt,nt,rt){o.isVisible!==void 0&&(et.style.visibility=o.isVisible?"visible":"hidden"),buildHTMLStyles(et,tt,nt,rt.transformTemplate)},render:renderHTML},htmlVisualElement=visualElement(htmlConfig),svgVisualElement=visualElement(__assign(__assign({},htmlConfig),{getBaseTarget:function(o,et){return o[et]},readValueFromInstance:function(o,et){var tt;return isTransformProp(et)?((tt=getDefaultValueType(et))===null||tt===void 0?void 0:tt.default)||0:(et=camelCaseAttributes.has(et)?et:camelToDash(et),o.getAttribute(et))},scrapeMotionValuesFromProps,build:function(o,et,tt,nt,rt){buildSVGAttrs(et,tt,nt,rt.transformTemplate)},render:renderSVG})),createDomVisualElement=function(o,et){return isSVGComponent(o)?svgVisualElement(et,{enableHardwareAcceleration:!1}):htmlVisualElement(et,{enableHardwareAcceleration:!0})};function pixelsToPercent(o,et){return et.max===et.min?0:o/(et.max-et.min)*100}var correctBorderRadius={correct:function(o,et){if(!et.target)return o;if(typeof o=="string")if(px.test(o))o=parseFloat(o);else return o;var tt=pixelsToPercent(o,et.target.x),nt=pixelsToPercent(o,et.target.y);return"".concat(tt,"% ").concat(nt,"%")}},varToken="_$css",correctBoxShadow={correct:function(o,et){var tt=et.treeScale,nt=et.projectionDelta,rt=o,ot=o.includes("var("),it=[];ot&&(o=o.replace(cssVariableRegex,function(ft){return it.push(ft),varToken}));var st=complex.parse(o);if(st.length>5)return rt;var at=complex.createTransformer(o),ct=typeof st[0]!="number"?1:0,lt=nt.x.scale*tt.x,dt=nt.y.scale*tt.y;st[0+ct]/=lt,st[1+ct]/=dt;var ht=mix(lt,dt,.5);typeof st[2+ct]=="number"&&(st[2+ct]/=ht),typeof st[3+ct]=="number"&&(st[3+ct]/=ht);var pt=at(st);if(ot){var mt=0;pt=pt.replace(varToken,function(){var ft=it[mt];return mt++,ft})}return pt}},MeasureLayoutWithContext=function(o){__extends(et,o);function et(){return o!==null&&o.apply(this,arguments)||this}return et.prototype.componentDidMount=function(){var tt=this,nt=this.props,rt=nt.visualElement,ot=nt.layoutGroup,it=nt.switchLayoutGroup,st=nt.layoutId,at=rt.projection;addScaleCorrector(defaultScaleCorrectors),at&&(ot!=null&&ot.group&&ot.group.add(at),it!=null&&it.register&&st&&it.register(at),at.root.didUpdate(),at.addEventListener("animationComplete",function(){tt.safeToRemove()}),at.setOptions(__assign(__assign({},at.options),{onExitComplete:function(){return tt.safeToRemove()}}))),globalProjectionState.hasEverUpdated=!0},et.prototype.getSnapshotBeforeUpdate=function(tt){var nt=this,rt=this.props,ot=rt.layoutDependency,it=rt.visualElement,st=rt.drag,at=rt.isPresent,ct=it.projection;return ct&&(ct.isPresent=at,st||tt.layoutDependency!==ot||ot===void 0?ct.willUpdate():this.safeToRemove(),tt.isPresent!==at&&(at?ct.promote():ct.relegate()||sync.postRender(function(){var lt;!((lt=ct.getStack())===null||lt===void 0)&<.members.length||nt.safeToRemove()}))),null},et.prototype.componentDidUpdate=function(){var tt=this.props.visualElement.projection;tt&&(tt.root.didUpdate(),!tt.currentAnimation&&tt.isLead()&&this.safeToRemove())},et.prototype.componentWillUnmount=function(){var tt=this.props,nt=tt.visualElement,rt=tt.layoutGroup,ot=tt.switchLayoutGroup,it=nt.projection;it&&(it.scheduleCheckAfterUnmount(),rt!=null&&rt.group&&rt.group.remove(it),ot!=null&&ot.deregister&&ot.deregister(it))},et.prototype.safeToRemove=function(){var tt=this.props.safeToRemove;tt==null||tt()},et.prototype.render=function(){return null},et}(React.Component);function MeasureLayout(o){var et=__read(usePresence$1(),2),tt=et[0],nt=et[1],rt=reactExports.useContext(LayoutGroupContext);return React.createElement(MeasureLayoutWithContext,__assign({},o,{layoutGroup:rt,switchLayoutGroup:reactExports.useContext(SwitchLayoutGroupContext),isPresent:tt,safeToRemove:nt}))}var defaultScaleCorrectors={borderRadius:__assign(__assign({},correctBorderRadius),{applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]}),borderTopLeftRadius:correctBorderRadius,borderTopRightRadius:correctBorderRadius,borderBottomLeftRadius:correctBorderRadius,borderBottomRightRadius:correctBorderRadius,boxShadow:correctBoxShadow},layoutFeatures={measureLayout:MeasureLayout};function animate(o,et,tt){tt===void 0&&(tt={});var nt=isMotionValue(o)?o:motionValue(o);return startAnimation("",nt,et,tt),{stop:function(){return nt.stop()},isAnimating:function(){return nt.isAnimating()}}}var borders=["TopLeft","TopRight","BottomLeft","BottomRight"],numBorders=borders.length,asNumber=function(o){return typeof o=="string"?parseFloat(o):o},isPx=function(o){return typeof o=="number"||px.test(o)};function mixValues(o,et,tt,nt,rt,ot){var it,st,at,ct;rt?(o.opacity=mix(0,(it=tt.opacity)!==null&&it!==void 0?it:1,easeCrossfadeIn(nt)),o.opacityExit=mix((st=et.opacity)!==null&&st!==void 0?st:1,0,easeCrossfadeOut(nt))):ot&&(o.opacity=mix((at=et.opacity)!==null&&at!==void 0?at:1,(ct=tt.opacity)!==null&&ct!==void 0?ct:1,nt));for(var lt=0;ltet?1:tt(progress(o,et,nt))}}function copyAxisInto(o,et){o.min=et.min,o.max=et.max}function copyBoxInto(o,et){copyAxisInto(o.x,et.x),copyAxisInto(o.y,et.y)}function removePointDelta(o,et,tt,nt,rt){return o-=et,o=scalePoint(o,1/tt,nt),rt!==void 0&&(o=scalePoint(o,1/rt,nt)),o}function removeAxisDelta(o,et,tt,nt,rt,ot,it){if(et===void 0&&(et=0),tt===void 0&&(tt=1),nt===void 0&&(nt=.5),ot===void 0&&(ot=o),it===void 0&&(it=o),percent.test(et)){et=parseFloat(et);var st=mix(it.min,it.max,et/100);et=st-it.min}if(typeof et=="number"){var at=mix(ot.min,ot.max,nt);o===ot&&(at-=et),o.min=removePointDelta(o.min,et,tt,at,rt),o.max=removePointDelta(o.max,et,tt,at,rt)}}function removeAxisTransforms(o,et,tt,nt,rt){var ot=__read(tt,3),it=ot[0],st=ot[1],at=ot[2];removeAxisDelta(o,et[it],et[st],et[at],et.scale,nt,rt)}var xKeys=["x","scaleX","originX"],yKeys=["y","scaleY","originY"];function removeBoxTransforms(o,et,tt,nt){removeAxisTransforms(o.x,et,xKeys,tt==null?void 0:tt.x,nt==null?void 0:nt.x),removeAxisTransforms(o.y,et,yKeys,tt==null?void 0:tt.y,nt==null?void 0:nt.y)}function isAxisDeltaZero(o){return o.translate===0&&o.scale===1}function isDeltaZero(o){return isAxisDeltaZero(o.x)&&isAxisDeltaZero(o.y)}function boxEquals(o,et){return o.x.min===et.x.min&&o.x.max===et.x.max&&o.y.min===et.y.min&&o.y.max===et.y.max}var NodeStack=function(){function o(){this.members=[]}return o.prototype.add=function(et){addUniqueItem(this.members,et),et.scheduleRender()},o.prototype.remove=function(et){if(removeItem(this.members,et),et===this.prevLead&&(this.prevLead=void 0),et===this.lead){var tt=this.members[this.members.length-1];tt&&this.promote(tt)}},o.prototype.relegate=function(et){var tt=this.members.findIndex(function(it){return et===it});if(tt===0)return!1;for(var nt,rt=tt;rt>=0;rt--){var ot=this.members[rt];if(ot.isPresent!==!1){nt=ot;break}}return nt?(this.promote(nt),!0):!1},o.prototype.promote=function(et,tt){var nt,rt=this.lead;if(et!==rt&&(this.prevLead=rt,this.lead=et,et.show(),rt)){rt.instance&&rt.scheduleRender(),et.scheduleRender(),et.resumeFrom=rt,tt&&(et.resumeFrom.preserveOpacity=!0),rt.snapshot&&(et.snapshot=rt.snapshot,et.snapshot.latestValues=rt.animationValues||rt.latestValues,et.snapshot.isShared=!0),!((nt=et.root)===null||nt===void 0)&&nt.isUpdating&&(et.isLayoutDirty=!0);var ot=et.options.crossfade;ot===!1&&rt.hide()}},o.prototype.exitAnimationComplete=function(){this.members.forEach(function(et){var tt,nt,rt,ot,it;(nt=(tt=et.options).onExitComplete)===null||nt===void 0||nt.call(tt),(it=(rt=et.resumingFrom)===null||rt===void 0?void 0:(ot=rt.options).onExitComplete)===null||it===void 0||it.call(ot)})},o.prototype.scheduleRender=function(){this.members.forEach(function(et){et.instance&&et.scheduleRender(!1)})},o.prototype.removeLeadSnapshot=function(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)},o}(),identityProjection="translate3d(0px, 0px, 0) scale(1, 1) scale(1, 1)";function buildProjectionTransform(o,et,tt){var nt=o.x.translate/et.x,rt=o.y.translate/et.y,ot="translate3d(".concat(nt,"px, ").concat(rt,"px, 0) ");if(ot+="scale(".concat(1/et.x,", ").concat(1/et.y,") "),tt){var it=tt.rotate,st=tt.rotateX,at=tt.rotateY;it&&(ot+="rotate(".concat(it,"deg) ")),st&&(ot+="rotateX(".concat(st,"deg) ")),at&&(ot+="rotateY(".concat(at,"deg) "))}var ct=o.x.scale*et.x,lt=o.y.scale*et.y;return ot+="scale(".concat(ct,", ").concat(lt,")"),ot===identityProjection?"none":ot}var compareByDepth=function(o,et){return o.depth-et.depth},FlatTree=function(){function o(){this.children=[],this.isDirty=!1}return o.prototype.add=function(et){addUniqueItem(this.children,et),this.isDirty=!0},o.prototype.remove=function(et){removeItem(this.children,et),this.isDirty=!0},o.prototype.forEach=function(et){this.isDirty&&this.children.sort(compareByDepth),this.isDirty=!1,this.children.forEach(et)},o}(),animationTarget=1e3;function createProjectionNode(o){var et=o.attachResizeListener,tt=o.defaultParent,nt=o.measureScroll,rt=o.checkIsScrollRoot,ot=o.resetTransform;return function(){function it(st,at,ct){var lt=this;at===void 0&&(at={}),ct===void 0&&(ct=tt==null?void 0:tt()),this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.potentialNodes=new Map,this.checkUpdateFailed=function(){lt.isUpdating&&(lt.isUpdating=!1,lt.clearAllSnapshots())},this.updateProjection=function(){lt.nodes.forEach(resolveTargetDelta),lt.nodes.forEach(calcProjection)},this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.id=st,this.latestValues=at,this.root=ct?ct.root||ct:this,this.path=ct?__spreadArray(__spreadArray([],__read(ct.path),!1),[ct],!1):[],this.parent=ct,this.depth=ct?ct.depth+1:0,st&&this.root.registerPotentialNode(st,this);for(var dt=0;dt=0;nt--)if(o.path[nt].instance){tt=o.path[nt];break}var rt=tt&&tt!==o.root?tt.instance:document,ot=rt.querySelector('[data-projection-id="'.concat(et,'"]'));ot&&o.mount(ot,!0)}function roundAxis(o){o.min=Math.round(o.min),o.max=Math.round(o.max)}function roundBox(o){roundAxis(o.x),roundAxis(o.y)}var DocumentProjectionNode=createProjectionNode({attachResizeListener:function(o,et){return addDomEvent(o,"resize",et)},measureScroll:function(){return{x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}},checkIsScrollRoot:function(){return!0}}),rootProjectionNode={current:void 0},HTMLProjectionNode=createProjectionNode({measureScroll:function(o){return{x:o.scrollLeft,y:o.scrollTop}},defaultParent:function(){if(!rootProjectionNode.current){var o=new DocumentProjectionNode(0,{});o.mount(window),o.setOptions({layoutScroll:!0}),rootProjectionNode.current=o}return rootProjectionNode.current},resetTransform:function(o,et){o.style.transform=et??"none"},checkIsScrollRoot:function(o){return window.getComputedStyle(o).position==="fixed"}}),featureBundle=__assign(__assign(__assign(__assign({},animations),gestureAnimations),drag),layoutFeatures),motion=createMotionProxy(function(o,et){return createDomMotionConfig(o,et,featureBundle,createDomVisualElement,HTMLProjectionNode)});function useIsMounted$1(){var o=reactExports.useRef(!1);return useIsomorphicLayoutEffect$3(function(){return o.current=!0,function(){o.current=!1}},[]),o}function useForceUpdate(){var o=useIsMounted$1(),et=__read(reactExports.useState(0),2),tt=et[0],nt=et[1],rt=reactExports.useCallback(function(){o.current&&nt(tt+1)},[tt]),ot=reactExports.useCallback(function(){return sync.postRender(rt)},[rt]);return[ot,tt]}var PresenceChild=function(o){var et=o.children,tt=o.initial,nt=o.isPresent,rt=o.onExitComplete,ot=o.custom,it=o.presenceAffectsLayout,st=useConstant(newChildrenMap),at=useId$1(),ct=reactExports.useMemo(function(){return{id:at,initial:tt,isPresent:nt,custom:ot,onExitComplete:function(lt){var dt,ht;st.set(lt,!0);try{for(var pt=__values(st.values()),mt=pt.next();!mt.done;mt=pt.next()){var ft=mt.value;if(!ft)return}}catch(yt){dt={error:yt}}finally{try{mt&&!mt.done&&(ht=pt.return)&&ht.call(pt)}finally{if(dt)throw dt.error}}rt==null||rt()},register:function(lt){return st.set(lt,!1),function(){return st.delete(lt)}}}},it?void 0:[nt]);return reactExports.useMemo(function(){st.forEach(function(lt,dt){return st.set(dt,!1)})},[nt]),reactExports.useEffect(function(){!nt&&!st.size&&(rt==null||rt())},[nt]),reactExports.createElement(PresenceContext.Provider,{value:ct},et)};function newChildrenMap(){return new Map}var getChildKey=function(o){return o.key||""};function updateChildLookup(o,et){o.forEach(function(tt){var nt=getChildKey(tt);et.set(nt,tt)})}function onlyElements(o){var et=[];return reactExports.Children.forEach(o,function(tt){reactExports.isValidElement(tt)&&et.push(tt)}),et}var AnimatePresence=function(o){var et=o.children,tt=o.custom,nt=o.initial,rt=nt===void 0?!0:nt,ot=o.onExitComplete,it=o.exitBeforeEnter,st=o.presenceAffectsLayout,at=st===void 0?!0:st,ct=__read(useForceUpdate(),1),lt=ct[0],dt=reactExports.useContext(LayoutGroupContext).forceRender;dt&&(lt=dt);var ht=useIsMounted$1(),pt=onlyElements(et),mt=pt,ft=new Set,yt=reactExports.useRef(mt),gt=reactExports.useRef(new Map).current,xt=reactExports.useRef(!0);if(useIsomorphicLayoutEffect$3(function(){xt.current=!1,updateChildLookup(pt,gt),yt.current=mt}),useUnmountEffect(function(){xt.current=!0,gt.clear(),ft.clear()}),xt.current)return reactExports.createElement(reactExports.Fragment,null,mt.map(function(It){return reactExports.createElement(PresenceChild,{key:getChildKey(It),isPresent:!0,initial:rt?void 0:!1,presenceAffectsLayout:at},It)}));mt=__spreadArray([],__read(mt),!1);for(var vt=yt.current.map(getChildKey),bt=pt.map(getChildKey),Et=vt.length,wt=0;wt1&&console.warn("You're attempting to animate multiple children within AnimatePresence, but its exitBeforeEnter prop is set to true. This will lead to odd visual behaviour."),reactExports.createElement(reactExports.Fragment,null,ft.size?mt:mt.map(function(It){return reactExports.cloneElement(It)}))};function MotionConfig(o){var et=o.children,tt=o.isValidProp,nt=__rest(o,["children","isValidProp"]);tt&&loadExternalIsValidProp(tt),nt=__assign(__assign({},reactExports.useContext(MotionConfigContext)),nt),nt.isStatic=useConstant(function(){return nt.isStatic});var rt=reactExports.useMemo(function(){return nt},[JSON.stringify(nt.transition),nt.transformPagePoint,nt.reducedMotion]);return reactExports.createElement(MotionConfigContext.Provider,{value:rt},et)}var reactIs$2={exports:{}},reactIs_production_min$1={};/** * @license React * react-is.production.min.js * @@ -100,7 +100,7 @@ ${prettyStateOverride(pt)}`),super(et.shortMessage,{cause:et,docsPath:nt,metaMes * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var b$2=Symbol.for("react.element"),c$1=Symbol.for("react.portal"),d$2=Symbol.for("react.fragment"),e$1=Symbol.for("react.strict_mode"),f$1=Symbol.for("react.profiler"),g$2=Symbol.for("react.provider"),h$2=Symbol.for("react.context"),k$2=Symbol.for("react.server_context"),l$1=Symbol.for("react.forward_ref"),m$3=Symbol.for("react.suspense"),n$1=Symbol.for("react.suspense_list"),p$1=Symbol.for("react.memo"),q$2=Symbol.for("react.lazy"),t$1=Symbol.for("react.offscreen"),u;u=Symbol.for("react.module.reference");function v$2(o){if(typeof o=="object"&&o!==null){var et=o.$$typeof;switch(et){case b$2:switch(o=o.type,o){case d$2:case f$1:case e$1:case m$3:case n$1:return o;default:switch(o=o&&o.$$typeof,o){case k$2:case h$2:case l$1:case q$2:case p$1:case g$2:return o;default:return et}}case c$1:return et}}}reactIs_production_min$1.ContextConsumer=h$2;reactIs_production_min$1.ContextProvider=g$2;reactIs_production_min$1.Element=b$2;reactIs_production_min$1.ForwardRef=l$1;reactIs_production_min$1.Fragment=d$2;reactIs_production_min$1.Lazy=q$2;reactIs_production_min$1.Memo=p$1;reactIs_production_min$1.Portal=c$1;reactIs_production_min$1.Profiler=f$1;reactIs_production_min$1.StrictMode=e$1;reactIs_production_min$1.Suspense=m$3;reactIs_production_min$1.SuspenseList=n$1;reactIs_production_min$1.isAsyncMode=function(){return!1};reactIs_production_min$1.isConcurrentMode=function(){return!1};reactIs_production_min$1.isContextConsumer=function(o){return v$2(o)===h$2};reactIs_production_min$1.isContextProvider=function(o){return v$2(o)===g$2};reactIs_production_min$1.isElement=function(o){return typeof o=="object"&&o!==null&&o.$$typeof===b$2};reactIs_production_min$1.isForwardRef=function(o){return v$2(o)===l$1};reactIs_production_min$1.isFragment=function(o){return v$2(o)===d$2};reactIs_production_min$1.isLazy=function(o){return v$2(o)===q$2};reactIs_production_min$1.isMemo=function(o){return v$2(o)===p$1};reactIs_production_min$1.isPortal=function(o){return v$2(o)===c$1};reactIs_production_min$1.isProfiler=function(o){return v$2(o)===f$1};reactIs_production_min$1.isStrictMode=function(o){return v$2(o)===e$1};reactIs_production_min$1.isSuspense=function(o){return v$2(o)===m$3};reactIs_production_min$1.isSuspenseList=function(o){return v$2(o)===n$1};reactIs_production_min$1.isValidElementType=function(o){return typeof o=="string"||typeof o=="function"||o===d$2||o===f$1||o===e$1||o===m$3||o===n$1||o===t$1||typeof o=="object"&&o!==null&&(o.$$typeof===q$2||o.$$typeof===p$1||o.$$typeof===g$2||o.$$typeof===h$2||o.$$typeof===l$1||o.$$typeof===u||o.getModuleId!==void 0)};reactIs_production_min$1.typeOf=v$2;reactIs$2.exports=reactIs_production_min$1;var reactIsExports$1=reactIs$2.exports;function stylis_min(o){function et(Qt,Nt,Gt,nn,Wt){for(var hn=0,Xt=0,Jt=0,tn=0,_t,Dt,Vt=0,en=0,an,dn=an=_t=0,ln=0,pn=0,kn=0,mn=0,wn=Gt.length,In=wn-1,Pn,yn="",En="",on="",It="",St;ln_t)&&(mn=(yn=yn.replace(" ",":")).length),0nn&&(nn=(Nt=Nt.trim()).charCodeAt(0)),nn){case 38:return Nt.replace(gt,"$1"+Qt.trim());case 58:return Qt.trim()+Nt.replace(gt,"$1"+Qt.trim());default:if(0<1*Gt&&0Xt.charCodeAt(8))break;case 115:Wt=Wt.replace(Xt,"-webkit-"+Xt)+";"+Wt;break;case 207:case 102:Wt=Wt.replace(Xt,"-webkit-"+(102Gt.charCodeAt(0)&&(Gt=Gt.trim()),Zt=Gt,Gt=[Zt],0_t)&&(mn=(yn=yn.replace(" ",":")).length),0nn&&(nn=(Nt=Nt.trim()).charCodeAt(0)),nn){case 38:return Nt.replace(gt,"$1"+Qt.trim());case 58:return Qt.trim()+Nt.replace(gt,"$1"+Qt.trim());default:if(0<1*Gt&&0Xt.charCodeAt(8))break;case 115:Wt=Wt.replace(Xt,"-webkit-"+Xt)+";"+Wt;break;case 207:case 102:Wt=Wt.replace(Xt,"-webkit-"+(102Gt.charCodeAt(0)&&(Gt=Gt.trim()),Zt=Gt,Gt=[Zt],01?et-1:0),nt=1;nt0?" Args: "+tt.join(", "):""))}var j=function(){function o(tt){this.groupSizes=new Uint32Array(512),this.length=512,this.tag=tt}var et=o.prototype;return et.indexOfGroup=function(tt){for(var nt=0,rt=0;rt=this.groupSizes.length){for(var rt=this.groupSizes,ot=rt.length,it=ot;tt>=it;)(it<<=1)<0&&D(16,""+tt);this.groupSizes=new Uint32Array(it),this.groupSizes.set(rt),this.length=it;for(var st=ot;st=this.length||this.groupSizes[tt]===0)return nt;for(var rt=this.groupSizes[tt],ot=this.indexOfGroup(tt),it=ot+rt,st=ot;st=k&&(k=et+1),T.set(o,et),x.set(et,o)},M="style["+N+'][data-styled-version="5.3.11"]',G=new RegExp("^"+N+'\\.g(\\d+)\\[id="([\\w\\d-]+)"\\].*?"([^"]*)'),L=function(o,et,tt){for(var nt,rt=tt.split(","),ot=0,it=rt.length;ot=0;ct--){var lt=at[ct];if(lt&<.nodeType===1&<.hasAttribute(N))return lt}}(tt),ot=rt!==void 0?rt.nextSibling:null;nt.setAttribute(N,"active"),nt.setAttribute("data-styled-version","5.3.11");var it=Y();return it&&nt.setAttribute("nonce",it),tt.insertBefore(nt,ot),nt},H=function(){function o(tt){var nt=this.element=q(tt);nt.appendChild(document.createTextNode("")),this.sheet=function(rt){if(rt.sheet)return rt.sheet;for(var ot=document.styleSheets,it=0,st=ot.length;it=0){var rt=document.createTextNode(nt),ot=this.nodes[tt];return this.element.insertBefore(rt,ot||null),this.length++,!0}return!1},et.deleteRule=function(tt){this.element.removeChild(this.nodes[tt]),this.length--},et.getRule=function(tt){return tt0&&(dt+=ht+",")}),ot+=""+ct+lt+'{content:"'+dt+`"}/*!sc*/ -`}}}return ot}(this)},o}(),Z=/(a)(d)/gi,K=function(o){return String.fromCharCode(o+(o>25?39:97))};function Q(o){var et,tt="";for(et=Math.abs(o);et>52;et=et/52|0)tt=K(et%52)+tt;return(K(et%52)+tt).replace(Z,"$1-$2")}var ee=function(o,et){for(var tt=et.length;tt;)o=33*o^et.charCodeAt(--tt);return o},te=function(o){return ee(5381,o)};function ne(o){for(var et=0;et>>0);if(!tt.hasNameForId(rt,st)){var at=nt(it,"."+st,void 0,rt);tt.insertRules(rt,st,at)}ot.push(st),this.staticRulesId=st}else{for(var ct=this.rules.length,lt=ee(this.baseHash,nt.hash),dt="",ht=0;ht>>0);if(!tt.hasNameForId(rt,yt)){var gt=nt(dt,"."+yt,void 0,rt);tt.insertRules(rt,yt,gt)}ot.push(yt)}}return ot.join(" ")},o}(),se=/^\s*\/\/.*$/gm,ie=[":","[",".","#"];function ae(o){var et,tt,nt,rt,ot=w$1,it=ot.options,st=it===void 0?w$1:it,at=ot.plugins,ct=at===void 0?S:at,lt=new stylis_min(st),dt=[],ht=function(ft){function yt(gt){if(gt)try{ft(gt+"}")}catch{}}return function(gt,xt,vt,bt,Et,wt,kt,Tt,Rt,Pt){switch(gt){case 1:if(Rt===0&&xt.charCodeAt(0)===64)return ft(xt+";"),"";break;case 2:if(Tt===0)return xt+"/*|*/";break;case 3:switch(Tt){case 102:case 112:return ft(vt[0]+xt),"";default:return xt+(Pt===0?"/*|*/":"")}case-2:xt.split("/*|*/}").forEach(yt)}}}(function(ft){dt.push(ft)}),pt=function(ft,yt,gt){return yt===0&&ie.indexOf(gt[tt.length])!==-1||gt.match(rt)?ft:"."+et};function mt(ft,yt,gt,xt){xt===void 0&&(xt="&");var vt=ft.replace(se,""),bt=yt&>?gt+" "+yt+" { "+vt+" }":vt;return et=xt,tt=yt,nt=new RegExp("\\"+tt+"\\b","g"),rt=new RegExp("(\\"+tt+"\\b){2,}"),lt(gt||!yt?"":yt,bt)}return lt.use([].concat(ct,[function(ft,yt,gt){ft===2&>.length&>[0].lastIndexOf(tt)>0&&(gt[0]=gt[0].replace(nt,pt))},ht,function(ft){if(ft===-2){var yt=dt;return dt=[],yt}}])),mt.hash=ct.length?ct.reduce(function(ft,yt){return yt.name||D(15),ee(ft,yt.name)},5381).toString():"",mt}var ce=React.createContext();ce.Consumer;var le=React.createContext(),de=(le.Consumer,new X),he=ae();function pe(){return reactExports.useContext(ce)||de}function fe(){return reactExports.useContext(le)||he}var ye=function(){function o(et,tt){var nt=this;this.inject=function(rt,ot){ot===void 0&&(ot=he);var it=nt.name+ot.hash;rt.hasNameForId(nt.id,it)||rt.insertRules(nt.id,it,ot(nt.rules,it,"@keyframes"))},this.toString=function(){return D(12,String(nt.name))},this.name=et,this.id="sc-keyframes-"+et,this.rules=tt}return o.prototype.getName=function(et){return et===void 0&&(et=he),this.name+et.hash},o}(),ve=/([A-Z])/,ge=/([A-Z])/g,Se=/^ms-/,we=function(o){return"-"+o.toLowerCase()};function Ee(o){return ve.test(o)?o.replace(ge,we).replace(Se,"-ms-"):o}var be=function(o){return o==null||o===!1||o===""};function _e(o,et,tt,nt){if(Array.isArray(o)){for(var rt,ot=[],it=0,st=o.length;it1?et-1:0),nt=1;nt?@[\\\]^`{|}~-]+/g,De=/(^-|-$)/g;function je(o){return o.replace(Re,"-").replace(De,"")}var Te=function(o){return Q(te(o)>>>0)};function xe(o){return typeof o=="string"&&!0}var ke=function(o){return typeof o=="function"||typeof o=="object"&&o!==null&&!Array.isArray(o)},Ve=function(o){return o!=="__proto__"&&o!=="constructor"&&o!=="prototype"};function Be(o,et,tt){var nt=o[tt];ke(et)&&ke(nt)?ze(nt,et):o[tt]=et}function ze(o){for(var et=arguments.length,tt=new Array(et>1?et-1:0),nt=1;nt=0||(Pt[Tt]=wt[Tt]);return Pt}(et,["componentId"]),Et=vt&&vt+"-"+(xe(xt)?xt:je(b(xt)));return Ye(xt,y$1({},bt,{attrs:ht,componentId:Et}),tt)},Object.defineProperty(mt,"defaultProps",{get:function(){return this._foldedDefaultProps},set:function(xt){this._foldedDefaultProps=nt?ze({},o.defaultProps,xt):xt}}),Object.defineProperty(mt,"toString",{value:function(){return"."+mt.styledComponentId}}),rt&&m$1(mt,o,{attrs:!0,componentStyle:!0,displayName:!0,foldedComponentIds:!0,shouldForwardProp:!0,styledComponentId:!0,target:!0,withComponent:!0}),mt}var qe=function(o){return function et(tt,nt,rt){if(rt===void 0&&(rt=w$1),!reactIsExports$1.isValidElementType(nt))return D(1,String(nt));var ot=function(){return tt(nt,rt,Ae.apply(void 0,arguments))};return ot.withConfig=function(it){return et(tt,nt,y$1({},rt,{},it))},ot.attrs=function(it){return et(tt,nt,y$1({},rt,{attrs:Array.prototype.concat(rt.attrs,it).filter(Boolean)}))},ot}(Ye,o)};["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","big","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","keygen","label","legend","li","link","main","map","mark","marquee","menu","menuitem","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","small","source","span","strong","style","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr","circle","clipPath","defs","ellipse","foreignObject","g","image","line","linearGradient","marker","mask","path","pattern","polygon","polyline","radialGradient","rect","stop","svg","text","textPath","tspan"].forEach(function(o){qe[o]=qe(o)});function We(o){for(var et=arguments.length,tt=new Array(et>1?et-1:0),nt=1;nt>--at&1}const dt=31,ht=2**dt,pt=ht>>>1,mt=pt>>1,ft=ht-1;let yt=0;for(let Et=0;Et1;){let Pt=wt+kt>>>1;Et>>1|lt(),Tt=Tt<<1^pt,Rt=(Rt^pt)<<1|pt|1;xt=Tt,vt=1+Rt-Tt}let bt=nt-4;return gt.map(Et=>{switch(Et-bt){case 3:return bt+65792+(o[st++]<<16|o[st++]<<8|o[st++]);case 2:return bt+256+(o[st++]<<8|o[st++]);case 1:return bt+o[st++];default:return Et-1}})}function read_payload(o){let et=0;return()=>o[et++]}function read_compressed_payload(o){return read_payload(decode_arithmetic(unsafe_atob(o)))}function unsafe_atob(o){let et=[];[..."ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"].forEach((rt,ot)=>et[rt.charCodeAt(0)]=ot);let tt=o.length,nt=new Uint8Array(6*tt>>3);for(let rt=0,ot=0,it=0,st=0;rt=8&&(nt[ot++]=st>>(it-=8));return nt}function signed(o){return o&1?~o>>1:o>>1}function read_deltas(o,et){let tt=Array(o);for(let nt=0,rt=0;nt{let et=read_sorted(o);if(et.length)return et})}function read_mapped(o){let et=[];for(;;){let tt=o();if(tt==0)break;et.push(read_linear_table(tt,o))}for(;;){let tt=o()-1;if(tt<0)break;et.push(read_replacement_table(tt,o))}return et.flat()}function read_array_while(o){let et=[];for(;;){let tt=o(et.length);if(!tt)break;et.push(tt)}return et}function read_transposed(o,et,tt){let nt=Array(o).fill().map(()=>[]);for(let rt=0;rtnt[it].push(ot));return nt}function read_linear_table(o,et){let tt=1+et(),nt=et(),rt=read_array_while(et);return read_transposed(rt.length,1+o,et).flatMap((it,st)=>{let[at,...ct]=it;return Array(rt[st]).fill().map((lt,dt)=>{let ht=dt*nt;return[at+dt*tt,ct.map(pt=>pt+ht)]})})}function read_replacement_table(o,et){let tt=1+et();return read_transposed(tt,1+o,et).map(rt=>[rt[0],rt.slice(1)])}function read_trie(o){let et=[],tt=read_sorted(o);return rt(nt([]),[]),et;function nt(ot){let it=o(),st=read_array_while(()=>{let at=read_sorted(o).map(ct=>tt[ct]);if(at.length)return nt(at)});return{S:it,B:st,Q:ot}}function rt({S:ot,B:it},st,at){if(!(ot&4&&at===st[st.length-1])){ot&2&&(at=st[st.length-1]),ot&1&&et.push(st);for(let ct of it)for(let lt of ct.Q)rt(ct,[...st,lt],at)}}}function hex_cp(o){return o.toString(16).toUpperCase().padStart(2,"0")}function quote_cp(o){return`{${hex_cp(o)}}`}function explode_cp(o){let et=[];for(let tt=0,nt=o.length;tt>24&255}function unpack_cp(o){return o&16777215}let SHIFTED_RANK,EXCLUSIONS,DECOMP,RECOMP;function init$1(){let o=read_compressed_payload(COMPRESSED);SHIFTED_RANK=new Map(read_sorted_arrays(o).flatMap((et,tt)=>et.map(nt=>[nt,tt+1<<24]))),EXCLUSIONS=new Set(read_sorted(o)),DECOMP=new Map,RECOMP=new Map;for(let[et,tt]of read_mapped(o)){if(!EXCLUSIONS.has(et)&&tt.length==2){let[nt,rt]=tt,ot=RECOMP.get(nt);ot||(ot=new Map,RECOMP.set(nt,ot)),ot.set(rt,et)}DECOMP.set(et,tt.reverse())}}function is_hangul(o){return o>=S0&&o=L0&&o=V0&&etT0&&et0&&rt(T0+ct)}else{let it=DECOMP.get(ot);it?tt.push(...it):rt(ot)}if(!tt.length)break;ot=tt.pop()}if(nt&&et.length>1){let ot=unpack_cc(et[0]);for(let it=1;it0&&rt>=it)it==0?(et.push(nt,...tt),tt.length=0,nt=st):tt.push(st),rt=it;else{let at=compose_pair(nt,st);at>=0?nt=at:rt==0&&it==0?(et.push(nt),nt=st):(tt.push(st),rt=it)}}return nt>=0&&et.push(nt,...tt),et}function nfd(o){return decomposed(o).map(unpack_cp)}function nfc(o){return composed_from_decomposed(decomposed(o))}const HYPHEN=45,STOP_CH=".",FE0F=65039,UNIQUE_PH=1,Array_from=o=>Array.from(o);function group_has_cp(o,et){return o.P.has(et)||o.Q.has(et)}class Emoji extends Array{get is_emoji(){return!0}}let MAPPED,IGNORED,CM,NSM,ESCAPE,GROUPS,WHOLE_VALID,WHOLE_MAP,VALID,EMOJI_LIST,EMOJI_ROOT;function init(){if(MAPPED)return;let o=read_compressed_payload(COMPRESSED$1);const et=()=>read_sorted(o),tt=()=>new Set(et()),nt=(lt,dt)=>dt.forEach(ht=>lt.add(ht));MAPPED=new Map(read_mapped(o)),IGNORED=tt(),CM=et(),NSM=new Set(et().map(lt=>CM[lt])),CM=new Set(CM),ESCAPE=tt(),tt();let rt=read_sorted_arrays(o),ot=o();const it=()=>{let lt=new Set;return et().forEach(dt=>nt(lt,rt[dt])),nt(lt,et()),lt};GROUPS=read_array_while(lt=>{let dt=read_array_while(o).map(ht=>ht+96);if(dt.length){let ht=lt>=ot;dt[0]-=32,dt=str_from_cps(dt),ht&&(dt=`Restricted[${dt}]`);let pt=it(),mt=it(),ft=!o();return{N:dt,P:pt,Q:mt,M:ft,R:ht}}}),WHOLE_VALID=tt(),WHOLE_MAP=new Map;let st=et().concat(Array_from(WHOLE_VALID)).sort((lt,dt)=>lt-dt);st.forEach((lt,dt)=>{let ht=o(),pt=st[dt]=ht?st[dt-ht]:{V:[],M:new Map};pt.V.push(lt),WHOLE_VALID.has(lt)||WHOLE_MAP.set(lt,pt)});for(let{V:lt,M:dt}of new Set(WHOLE_MAP.values())){let ht=[];for(let mt of lt){let ft=GROUPS.filter(gt=>group_has_cp(gt,mt)),yt=ht.find(({G:gt})=>ft.some(xt=>gt.has(xt)));yt||(yt={G:new Set,V:[]},ht.push(yt)),yt.V.push(mt),nt(yt.G,ft)}let pt=ht.flatMap(mt=>Array_from(mt.G));for(let{G:mt,V:ft}of ht){let yt=new Set(pt.filter(gt=>!mt.has(gt)));for(let gt of ft)dt.set(gt,yt)}}VALID=new Set;let at=new Set;const ct=lt=>VALID.has(lt)?at.add(lt):VALID.add(lt);for(let lt of GROUPS){for(let dt of lt.P)ct(dt);for(let dt of lt.Q)ct(dt)}for(let lt of VALID)!WHOLE_MAP.has(lt)&&!at.has(lt)&&WHOLE_MAP.set(lt,UNIQUE_PH);nt(VALID,nfd(VALID)),EMOJI_LIST=read_trie(o).map(lt=>Emoji.from(lt)).sort(compare_arrays),EMOJI_ROOT=new Map;for(let lt of EMOJI_LIST){let dt=[EMOJI_ROOT];for(let ht of lt){let pt=dt.map(mt=>{let ft=mt.get(ht);return ft||(ft=new Map,mt.set(ht,ft)),ft});ht===FE0F?dt.push(...pt):dt=pt}for(let ht of dt)ht.V=lt}}function quoted_cp(o){return(should_escape(o)?"":`${bidi_qq(safe_str_from_cps([o]))} `)+quote_cp(o)}function bidi_qq(o){return`"${o}"‎`}function check_label_extension(o){if(o.length>=4&&o[2]==HYPHEN&&o[3]==HYPHEN)throw new Error(`invalid label extension: "${str_from_cps(o.slice(0,4))}"`)}function check_leading_underscore(o){for(let tt=o.lastIndexOf(95);tt>0;)if(o[--tt]!==95)throw new Error("underscore allowed only at start")}function check_fenced(o){let et=o[0],tt=FENCED.get(et);if(tt)throw error_placement(`leading ${tt}`);let nt=o.length,rt=-1;for(let ot=1;otet&&(et>>=1,o=[...o.slice(0,et),8230,...o.slice(-et)]);let rt=0,ot=o.length;for(let it=0;it{let ot=explode_cp(rt),it={input:ot,offset:nt};nt+=ot.length+1;try{let st=it.tokens=tokens_from_str(ot,et,tt),at=st.length,ct;if(!at)throw new Error("empty label");let lt=it.output=st.flat();if(check_leading_underscore(lt),!(it.emoji=at>1||st[0].is_emoji)&<.every(ht=>ht<128))check_label_extension(lt),ct="ASCII";else{let ht=st.flatMap(pt=>pt.is_emoji?[]:pt);if(!ht.length)ct="Emoji";else{if(CM.has(lt[0]))throw error_placement("leading combining mark");for(let ft=1;ftit.has(st)):Array_from(it),!tt.length)return}else nt.push(rt)}if(tt){for(let rt of tt)if(nt.every(ot=>group_has_cp(rt,ot)))throw new Error(`whole-script confusable: ${o.N}/${rt.N}`)}}function determine_group(o){let et=GROUPS;for(let tt of o){let nt=et.filter(rt=>group_has_cp(rt,tt));if(!nt.length)throw GROUPS.some(rt=>group_has_cp(rt,tt))?error_group_member(et[0],tt):error_disallowed(tt);if(et=nt,nt.length==1)break}return et}function flatten$1(o){return o.map(({input:et,error:tt,output:nt})=>{if(tt){let rt=tt.message;throw new Error(o.length==1?rt:`Invalid label ${bidi_qq(safe_str_from_cps(et,63))}: ${rt}`)}return str_from_cps(nt)}).join(STOP_CH)}function error_disallowed(o){return new Error(`disallowed character: ${quoted_cp(o)}`)}function error_group_member(o,et){let tt=quoted_cp(et),nt=GROUPS.find(rt=>rt.P.has(et));return nt&&(tt=`${nt.N} ${tt}`),new Error(`illegal mixture: ${o.N} + ${tt}`)}function error_placement(o){return new Error(`illegal placement: ${o}`)}function check_group(o,et){for(let tt of et)if(!group_has_cp(o,tt))throw error_group_member(o,tt);if(o.M){let tt=nfd(et);for(let nt=1,rt=tt.length;ntNSM_MAX)throw new Error(`excessive non-spacing marks: ${bidi_qq(safe_str_from_cps(tt.slice(nt-1,ot)))} (${ot-nt}/${NSM_MAX})`);nt=ot}}}function tokens_from_str(o,et,tt){let nt=[],rt=[];for(o=o.slice().reverse();o.length;){let ot=consume_emoji_reversed(o);if(ot)rt.length&&(nt.push(et(rt)),rt=[]),nt.push(tt(ot));else{let it=o.pop();if(VALID.has(it))rt.push(it);else{let st=MAPPED.get(it);if(st)rt.push(...st);else if(!IGNORED.has(it))throw error_disallowed(it)}}}return rt.length&&nt.push(et(rt)),nt}function filter_fe0f(o){return o.filter(et=>et!=FE0F)}function consume_emoji_reversed(o,et){let tt=EMOJI_ROOT,nt,rt=o.length;for(;rt&&(tt=tt.get(o[--rt]),!!tt);){let{V:ot}=tt;ot&&(nt=ot,o.length=rt)}return nt}const[SHA512_Kh,SHA512_Kl]=u64.split(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map(o=>BigInt(o))),SHA512_W_H=new Uint32Array(80),SHA512_W_L=new Uint32Array(80);class SHA512 extends HashMD{constructor(){super(128,64,16,!1),this.Ah=1779033703,this.Al=-205731576,this.Bh=-1150833019,this.Bl=-2067093701,this.Ch=1013904242,this.Cl=-23791573,this.Dh=-1521486534,this.Dl=1595750129,this.Eh=1359893119,this.El=-1377402159,this.Fh=-1694144372,this.Fl=725511199,this.Gh=528734635,this.Gl=-79577749,this.Hh=1541459225,this.Hl=327033209}get(){const{Ah:et,Al:tt,Bh:nt,Bl:rt,Ch:ot,Cl:it,Dh:st,Dl:at,Eh:ct,El:lt,Fh:dt,Fl:ht,Gh:pt,Gl:mt,Hh:ft,Hl:yt}=this;return[et,tt,nt,rt,ot,it,st,at,ct,lt,dt,ht,pt,mt,ft,yt]}set(et,tt,nt,rt,ot,it,st,at,ct,lt,dt,ht,pt,mt,ft,yt){this.Ah=et|0,this.Al=tt|0,this.Bh=nt|0,this.Bl=rt|0,this.Ch=ot|0,this.Cl=it|0,this.Dh=st|0,this.Dl=at|0,this.Eh=ct|0,this.El=lt|0,this.Fh=dt|0,this.Fl=ht|0,this.Gh=pt|0,this.Gl=mt|0,this.Hh=ft|0,this.Hl=yt|0}process(et,tt){for(let vt=0;vt<16;vt++,tt+=4)SHA512_W_H[vt]=et.getUint32(tt),SHA512_W_L[vt]=et.getUint32(tt+=4);for(let vt=16;vt<80;vt++){const bt=SHA512_W_H[vt-15]|0,Et=SHA512_W_L[vt-15]|0,wt=u64.rotrSH(bt,Et,1)^u64.rotrSH(bt,Et,8)^u64.shrSH(bt,Et,7),kt=u64.rotrSL(bt,Et,1)^u64.rotrSL(bt,Et,8)^u64.shrSL(bt,Et,7),Tt=SHA512_W_H[vt-2]|0,Rt=SHA512_W_L[vt-2]|0,Pt=u64.rotrSH(Tt,Rt,19)^u64.rotrBH(Tt,Rt,61)^u64.shrSH(Tt,Rt,6),$t=u64.rotrSL(Tt,Rt,19)^u64.rotrBL(Tt,Rt,61)^u64.shrSL(Tt,Rt,6),Ot=u64.add4L(kt,$t,SHA512_W_L[vt-7],SHA512_W_L[vt-16]),Bt=u64.add4H(Ot,wt,Pt,SHA512_W_H[vt-7],SHA512_W_H[vt-16]);SHA512_W_H[vt]=Bt|0,SHA512_W_L[vt]=Ot|0}let{Ah:nt,Al:rt,Bh:ot,Bl:it,Ch:st,Cl:at,Dh:ct,Dl:lt,Eh:dt,El:ht,Fh:pt,Fl:mt,Gh:ft,Gl:yt,Hh:gt,Hl:xt}=this;for(let vt=0;vt<80;vt++){const bt=u64.rotrSH(dt,ht,14)^u64.rotrSH(dt,ht,18)^u64.rotrBH(dt,ht,41),Et=u64.rotrSL(dt,ht,14)^u64.rotrSL(dt,ht,18)^u64.rotrBL(dt,ht,41),wt=dt&pt^~dt&ft,kt=ht&mt^~ht&yt,Tt=u64.add5L(xt,Et,kt,SHA512_Kl[vt],SHA512_W_L[vt]),Rt=u64.add5H(Tt,gt,bt,wt,SHA512_Kh[vt],SHA512_W_H[vt]),Pt=Tt|0,$t=u64.rotrSH(nt,rt,28)^u64.rotrBH(nt,rt,34)^u64.rotrBH(nt,rt,39),Ot=u64.rotrSL(nt,rt,28)^u64.rotrBL(nt,rt,34)^u64.rotrBL(nt,rt,39),Bt=nt&ot^nt&st^ot&st,zt=rt&it^rt&at^it&at;gt=ft|0,xt=yt|0,ft=pt|0,yt=mt|0,pt=dt|0,mt=ht|0,{h:dt,l:ht}=u64.add(ct|0,lt|0,Rt|0,Pt|0),ct=st|0,lt=at|0,st=ot|0,at=it|0,ot=nt|0,it=rt|0;const Ft=u64.add3L(Pt,Ot,zt);nt=u64.add3H(Ft,Rt,$t,Bt),rt=Ft|0}({h:nt,l:rt}=u64.add(this.Ah|0,this.Al|0,nt|0,rt|0)),{h:ot,l:it}=u64.add(this.Bh|0,this.Bl|0,ot|0,it|0),{h:st,l:at}=u64.add(this.Ch|0,this.Cl|0,st|0,at|0),{h:ct,l:lt}=u64.add(this.Dh|0,this.Dl|0,ct|0,lt|0),{h:dt,l:ht}=u64.add(this.Eh|0,this.El|0,dt|0,ht|0),{h:pt,l:mt}=u64.add(this.Fh|0,this.Fl|0,pt|0,mt|0),{h:ft,l:yt}=u64.add(this.Gh|0,this.Gl|0,ft|0,yt|0),{h:gt,l:xt}=u64.add(this.Hh|0,this.Hl|0,gt|0,xt|0),this.set(nt,rt,ot,it,st,at,ct,lt,dt,ht,pt,mt,ft,yt,gt,xt)}roundClean(){SHA512_W_H.fill(0),SHA512_W_L.fill(0)}destroy(){this.buffer.fill(0),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}const sha512=wrapConstructor(()=>new SHA512);function normalize$3(o){return ens_normalize(o)}normalize$3.parseError=o=>o;function normalize$2(o){return normalize$3(o)}function debounce$1(o,et,tt){var nt,rt,ot,it,st;et==null&&(et=100);function at(){var lt=Date.now()-it;lt=0?nt=setTimeout(at,et-lt):(nt=null,tt||(st=o.apply(ot,rt),ot=rt=null))}var ct=function(){ot=this,rt=arguments,it=Date.now();var lt=tt&&!nt;return nt||(nt=setTimeout(at,et)),lt&&(st=o.apply(ot,rt),ot=rt=null),st};return ct.clear=function(){nt&&(clearTimeout(nt),nt=null)},ct.flush=function(){nt&&(st=o.apply(ot,rt),ot=rt=null,clearTimeout(nt),nt=null)},ct}debounce$1.debounce=debounce$1;var debounce_1=debounce$1;const createDebounce=getDefaultExportFromCjs(debounce_1);function useMeasure(o){let{debounce:et,scroll:tt,polyfill:nt,offsetSize:rt}=o===void 0?{debounce:0,scroll:!1,offsetSize:!1}:o;const ot=nt||(typeof window>"u"?class{}:window.ResizeObserver);if(!ot)throw new Error("This browser does not support ResizeObserver out of the box. See: https://github.com/react-spring/react-use-measure/#resize-observer-polyfills");const[it,st]=reactExports.useState({left:0,top:0,width:0,height:0,bottom:0,right:0,x:0,y:0}),at=reactExports.useRef({element:null,scrollContainers:null,resizeObserver:null,lastBounds:it}),ct=et?typeof et=="number"?et:et.scroll:null,lt=et?typeof et=="number"?et:et.resize:null,dt=reactExports.useRef(!1);reactExports.useEffect(()=>(dt.current=!0,()=>void(dt.current=!1)));const[ht,pt,mt]=reactExports.useMemo(()=>{const xt=()=>{if(!at.current.element)return;const{left:vt,top:bt,width:Et,height:wt,bottom:kt,right:Tt,x:Rt,y:Pt}=at.current.element.getBoundingClientRect(),$t={left:vt,top:bt,width:Et,height:wt,bottom:kt,right:Tt,x:Rt,y:Pt};at.current.element instanceof HTMLElement&&rt&&($t.height=at.current.element.offsetHeight,$t.width=at.current.element.offsetWidth),Object.freeze($t),dt.current&&!areBoundsEqual(at.current.lastBounds,$t)&&st(at.current.lastBounds=$t)};return[xt,lt?createDebounce(xt,lt):xt,ct?createDebounce(xt,ct):xt]},[st,rt,ct,lt]);function ft(){at.current.scrollContainers&&(at.current.scrollContainers.forEach(xt=>xt.removeEventListener("scroll",mt,!0)),at.current.scrollContainers=null),at.current.resizeObserver&&(at.current.resizeObserver.disconnect(),at.current.resizeObserver=null)}function yt(){at.current.element&&(at.current.resizeObserver=new ot(mt),at.current.resizeObserver.observe(at.current.element),tt&&at.current.scrollContainers&&at.current.scrollContainers.forEach(xt=>xt.addEventListener("scroll",mt,{capture:!0,passive:!0})))}const gt=xt=>{!xt||xt===at.current.element||(ft(),at.current.element=xt,at.current.scrollContainers=findScrollContainers(xt),yt())};return useOnWindowScroll(mt,!!tt),useOnWindowResize(pt),reactExports.useEffect(()=>{ft(),yt()},[tt,mt,pt]),reactExports.useEffect(()=>ft,[]),[gt,it,ht]}function useOnWindowResize(o){reactExports.useEffect(()=>{const et=o;return window.addEventListener("resize",et),()=>void window.removeEventListener("resize",et)},[o])}function useOnWindowScroll(o,et){reactExports.useEffect(()=>{if(et){const tt=o;return window.addEventListener("scroll",tt,{capture:!0,passive:!0}),()=>void window.removeEventListener("scroll",tt,!0)}},[o,et])}function findScrollContainers(o){const et=[];if(!o||o===document.body)return et;const{overflow:tt,overflowX:nt,overflowY:rt}=window.getComputedStyle(o);return[tt,nt,rt].some(ot=>ot==="auto"||ot==="scroll")&&et.push(o),[...et,...findScrollContainers(o.parentElement)]}const keys$1=["x","y","top","bottom","left","right","width","height"],areBoundsEqual=(o,et)=>keys$1.every(tt=>o[tt]===et[tt]);var MapShim=function(){if(typeof Map<"u")return Map;function o(et,tt){var nt=-1;return et.some(function(rt,ot){return rt[0]===tt?(nt=ot,!0):!1}),nt}return function(){function et(){this.__entries__=[]}return Object.defineProperty(et.prototype,"size",{get:function(){return this.__entries__.length},enumerable:!0,configurable:!0}),et.prototype.get=function(tt){var nt=o(this.__entries__,tt),rt=this.__entries__[nt];return rt&&rt[1]},et.prototype.set=function(tt,nt){var rt=o(this.__entries__,tt);~rt?this.__entries__[rt][1]=nt:this.__entries__.push([tt,nt])},et.prototype.delete=function(tt){var nt=this.__entries__,rt=o(nt,tt);~rt&&nt.splice(rt,1)},et.prototype.has=function(tt){return!!~o(this.__entries__,tt)},et.prototype.clear=function(){this.__entries__.splice(0)},et.prototype.forEach=function(tt,nt){nt===void 0&&(nt=null);for(var rt=0,ot=this.__entries__;rt0},o.prototype.connect_=function(){!isBrowser$2||this.connected_||(document.addEventListener("transitionend",this.onTransitionEnd_),window.addEventListener("resize",this.refresh),mutationObserverSupported?(this.mutationsObserver_=new MutationObserver(this.refresh),this.mutationsObserver_.observe(document,{attributes:!0,childList:!0,characterData:!0,subtree:!0})):(document.addEventListener("DOMSubtreeModified",this.refresh),this.mutationEventsAdded_=!0),this.connected_=!0)},o.prototype.disconnect_=function(){!isBrowser$2||!this.connected_||(document.removeEventListener("transitionend",this.onTransitionEnd_),window.removeEventListener("resize",this.refresh),this.mutationsObserver_&&this.mutationsObserver_.disconnect(),this.mutationEventsAdded_&&document.removeEventListener("DOMSubtreeModified",this.refresh),this.mutationsObserver_=null,this.mutationEventsAdded_=!1,this.connected_=!1)},o.prototype.onTransitionEnd_=function(et){var tt=et.propertyName,nt=tt===void 0?"":tt,rt=transitionKeys.some(function(ot){return!!~nt.indexOf(ot)});rt&&this.refresh()},o.getInstance=function(){return this.instance_||(this.instance_=new o),this.instance_},o.instance_=null,o}(),defineConfigurable=function(o,et){for(var tt=0,nt=Object.keys(et);tt"u"||!(Element instanceof Object))){if(!(et instanceof getWindowOf(et).Element))throw new TypeError('parameter 1 is not of type "Element".');var tt=this.observations_;tt.has(et)||(tt.set(et,new ResizeObservation(et)),this.controller_.addObserver(this),this.controller_.refresh())}},o.prototype.unobserve=function(et){if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");if(!(typeof Element>"u"||!(Element instanceof Object))){if(!(et instanceof getWindowOf(et).Element))throw new TypeError('parameter 1 is not of type "Element".');var tt=this.observations_;tt.has(et)&&(tt.delete(et),tt.size||this.controller_.removeObserver(this))}},o.prototype.disconnect=function(){this.clearActive(),this.observations_.clear(),this.controller_.removeObserver(this)},o.prototype.gatherActive=function(){var et=this;this.clearActive(),this.observations_.forEach(function(tt){tt.isActive()&&et.activeObservations_.push(tt)})},o.prototype.broadcastActive=function(){if(this.hasActive()){var et=this.callbackCtx_,tt=this.activeObservations_.map(function(nt){return new ResizeObserverEntry(nt.target,nt.broadcastRect())});this.callback_.call(et,tt,et),this.clearActive()}},o.prototype.clearActive=function(){this.activeObservations_.splice(0)},o.prototype.hasActive=function(){return this.activeObservations_.length>0},o}(),observers=typeof WeakMap<"u"?new WeakMap:new MapShim,ResizeObserver$1=function(){function o(et){if(!(this instanceof o))throw new TypeError("Cannot call a class as a function.");if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");var tt=ResizeObserverController.getInstance(),nt=new ResizeObserverSPI(et,tt,this);observers.set(this,nt)}return o}();["observe","unobserve","disconnect"].forEach(function(o){ResizeObserver$1.prototype[o]=function(){var et;return(et=observers.get(this))[o].apply(et,arguments)}});var index$1=function(){return typeof global$1.ResizeObserver<"u"?global$1.ResizeObserver:ResizeObserver$1}(),browser$1={},canPromise$1=function(){return typeof Promise=="function"&&Promise.prototype&&Promise.prototype.then},qrcode={},utils$2={};let toSJISFunction;const CODEWORDS_COUNT=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];utils$2.getSymbolSize=function(et){if(!et)throw new Error('"version" cannot be null or undefined');if(et<1||et>40)throw new Error('"version" should be in range from 1 to 40');return et*4+17};utils$2.getSymbolTotalCodewords=function(et){return CODEWORDS_COUNT[et]};utils$2.getBCHDigit=function(o){let et=0;for(;o!==0;)et++,o>>>=1;return et};utils$2.setToSJISFunction=function(et){if(typeof et!="function")throw new Error('"toSJISFunc" is not a valid function.');toSJISFunction=et};utils$2.isKanjiModeEnabled=function(){return typeof toSJISFunction<"u"};utils$2.toSJIS=function(et){return toSJISFunction(et)};var errorCorrectionLevel={};(function(o){o.L={bit:1},o.M={bit:0},o.Q={bit:3},o.H={bit:2};function et(tt){if(typeof tt!="string")throw new Error("Param is not a string");switch(tt.toLowerCase()){case"l":case"low":return o.L;case"m":case"medium":return o.M;case"q":case"quartile":return o.Q;case"h":case"high":return o.H;default:throw new Error("Unknown EC Level: "+tt)}}o.isValid=function(nt){return nt&&typeof nt.bit<"u"&&nt.bit>=0&&nt.bit<4},o.from=function(nt,rt){if(o.isValid(nt))return nt;try{return et(nt)}catch{return rt}}})(errorCorrectionLevel);function BitBuffer$1(){this.buffer=[],this.length=0}BitBuffer$1.prototype={get:function(o){const et=Math.floor(o/8);return(this.buffer[et]>>>7-o%8&1)===1},put:function(o,et){for(let tt=0;tt>>et-tt-1&1)===1)},getLengthInBits:function(){return this.length},putBit:function(o){const et=Math.floor(this.length/8);this.buffer.length<=et&&this.buffer.push(0),o&&(this.buffer[et]|=128>>>this.length%8),this.length++}};var bitBuffer=BitBuffer$1;function BitMatrix$1(o){if(!o||o<1)throw new Error("BitMatrix size must be defined and greater than 0");this.size=o,this.data=new Uint8Array(o*o),this.reservedBit=new Uint8Array(o*o)}BitMatrix$1.prototype.set=function(o,et,tt,nt){const rt=o*this.size+et;this.data[rt]=tt,nt&&(this.reservedBit[rt]=!0)};BitMatrix$1.prototype.get=function(o,et){return this.data[o*this.size+et]};BitMatrix$1.prototype.xor=function(o,et,tt){this.data[o*this.size+et]^=tt};BitMatrix$1.prototype.isReserved=function(o,et){return this.reservedBit[o*this.size+et]};var bitMatrix=BitMatrix$1,alignmentPattern={};(function(o){const et=utils$2.getSymbolSize;o.getRowColCoords=function(nt){if(nt===1)return[];const rt=Math.floor(nt/7)+2,ot=et(nt),it=ot===145?26:Math.ceil((ot-13)/(2*rt-2))*2,st=[ot-7];for(let at=1;at=0&&rt<=7},o.from=function(rt){return o.isValid(rt)?parseInt(rt,10):void 0},o.getPenaltyN1=function(rt){const ot=rt.size;let it=0,st=0,at=0,ct=null,lt=null;for(let dt=0;dt=5&&(it+=et.N1+(st-5)),ct=pt,st=1),pt=rt.get(ht,dt),pt===lt?at++:(at>=5&&(it+=et.N1+(at-5)),lt=pt,at=1)}st>=5&&(it+=et.N1+(st-5)),at>=5&&(it+=et.N1+(at-5))}return it},o.getPenaltyN2=function(rt){const ot=rt.size;let it=0;for(let st=0;st=10&&(st===1488||st===93)&&it++,at=at<<1&2047|rt.get(lt,ct),lt>=10&&(at===1488||at===93)&&it++}return it*et.N3},o.getPenaltyN4=function(rt){let ot=0;const it=rt.data.length;for(let at=0;at=0;){const it=ot[0];for(let at=0;at0){const ot=new Uint8Array(this.degree);return ot.set(nt,rt),ot}return nt};var reedSolomonEncoder=ReedSolomonEncoder$1,version$4={},mode$1={},versionCheck={};versionCheck.isValid=function(et){return!isNaN(et)&&et>=1&&et<=40};var regex={};const numeric="[0-9]+",alphanumeric="[A-Z $%*+\\-./:]+";let kanji="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";kanji=kanji.replace(/u/g,"\\u");const byte="(?:(?![A-Z0-9 $%*+\\-./:]|"+kanji+`)(?:.|[\r +`}}}return ot}(this)},o}(),Z=/(a)(d)/gi,K=function(o){return String.fromCharCode(o+(o>25?39:97))};function Q(o){var et,tt="";for(et=Math.abs(o);et>52;et=et/52|0)tt=K(et%52)+tt;return(K(et%52)+tt).replace(Z,"$1-$2")}var ee=function(o,et){for(var tt=et.length;tt;)o=33*o^et.charCodeAt(--tt);return o},te=function(o){return ee(5381,o)};function ne(o){for(var et=0;et>>0);if(!tt.hasNameForId(rt,st)){var at=nt(it,"."+st,void 0,rt);tt.insertRules(rt,st,at)}ot.push(st),this.staticRulesId=st}else{for(var ct=this.rules.length,lt=ee(this.baseHash,nt.hash),dt="",ht=0;ht>>0);if(!tt.hasNameForId(rt,yt)){var gt=nt(dt,"."+yt,void 0,rt);tt.insertRules(rt,yt,gt)}ot.push(yt)}}return ot.join(" ")},o}(),se=/^\s*\/\/.*$/gm,ie=[":","[",".","#"];function ae(o){var et,tt,nt,rt,ot=w$1,it=ot.options,st=it===void 0?w$1:it,at=ot.plugins,ct=at===void 0?S:at,lt=new stylis_min(st),dt=[],ht=function(ft){function yt(gt){if(gt)try{ft(gt+"}")}catch{}}return function(gt,xt,vt,bt,Et,wt,kt,It,Rt,Pt){switch(gt){case 1:if(Rt===0&&xt.charCodeAt(0)===64)return ft(xt+";"),"";break;case 2:if(It===0)return xt+"/*|*/";break;case 3:switch(It){case 102:case 112:return ft(vt[0]+xt),"";default:return xt+(Pt===0?"/*|*/":"")}case-2:xt.split("/*|*/}").forEach(yt)}}}(function(ft){dt.push(ft)}),pt=function(ft,yt,gt){return yt===0&&ie.indexOf(gt[tt.length])!==-1||gt.match(rt)?ft:"."+et};function mt(ft,yt,gt,xt){xt===void 0&&(xt="&");var vt=ft.replace(se,""),bt=yt&>?gt+" "+yt+" { "+vt+" }":vt;return et=xt,tt=yt,nt=new RegExp("\\"+tt+"\\b","g"),rt=new RegExp("(\\"+tt+"\\b){2,}"),lt(gt||!yt?"":yt,bt)}return lt.use([].concat(ct,[function(ft,yt,gt){ft===2&>.length&>[0].lastIndexOf(tt)>0&&(gt[0]=gt[0].replace(nt,pt))},ht,function(ft){if(ft===-2){var yt=dt;return dt=[],yt}}])),mt.hash=ct.length?ct.reduce(function(ft,yt){return yt.name||D(15),ee(ft,yt.name)},5381).toString():"",mt}var ce=React.createContext();ce.Consumer;var le=React.createContext(),de=(le.Consumer,new X),he=ae();function pe(){return reactExports.useContext(ce)||de}function fe(){return reactExports.useContext(le)||he}var ye=function(){function o(et,tt){var nt=this;this.inject=function(rt,ot){ot===void 0&&(ot=he);var it=nt.name+ot.hash;rt.hasNameForId(nt.id,it)||rt.insertRules(nt.id,it,ot(nt.rules,it,"@keyframes"))},this.toString=function(){return D(12,String(nt.name))},this.name=et,this.id="sc-keyframes-"+et,this.rules=tt}return o.prototype.getName=function(et){return et===void 0&&(et=he),this.name+et.hash},o}(),ve=/([A-Z])/,ge=/([A-Z])/g,Se=/^ms-/,we=function(o){return"-"+o.toLowerCase()};function Ee(o){return ve.test(o)?o.replace(ge,we).replace(Se,"-ms-"):o}var be=function(o){return o==null||o===!1||o===""};function _e(o,et,tt,nt){if(Array.isArray(o)){for(var rt,ot=[],it=0,st=o.length;it1?et-1:0),nt=1;nt?@[\\\]^`{|}~-]+/g,De=/(^-|-$)/g;function je(o){return o.replace(Re,"-").replace(De,"")}var Te=function(o){return Q(te(o)>>>0)};function xe(o){return typeof o=="string"&&!0}var ke=function(o){return typeof o=="function"||typeof o=="object"&&o!==null&&!Array.isArray(o)},Ve=function(o){return o!=="__proto__"&&o!=="constructor"&&o!=="prototype"};function Be(o,et,tt){var nt=o[tt];ke(et)&&ke(nt)?ze(nt,et):o[tt]=et}function ze(o){for(var et=arguments.length,tt=new Array(et>1?et-1:0),nt=1;nt=0||(Pt[It]=wt[It]);return Pt}(et,["componentId"]),Et=vt&&vt+"-"+(xe(xt)?xt:je(b(xt)));return Ye(xt,y$1({},bt,{attrs:ht,componentId:Et}),tt)},Object.defineProperty(mt,"defaultProps",{get:function(){return this._foldedDefaultProps},set:function(xt){this._foldedDefaultProps=nt?ze({},o.defaultProps,xt):xt}}),Object.defineProperty(mt,"toString",{value:function(){return"."+mt.styledComponentId}}),rt&&m$1(mt,o,{attrs:!0,componentStyle:!0,displayName:!0,foldedComponentIds:!0,shouldForwardProp:!0,styledComponentId:!0,target:!0,withComponent:!0}),mt}var qe=function(o){return function et(tt,nt,rt){if(rt===void 0&&(rt=w$1),!reactIsExports$1.isValidElementType(nt))return D(1,String(nt));var ot=function(){return tt(nt,rt,Ae.apply(void 0,arguments))};return ot.withConfig=function(it){return et(tt,nt,y$1({},rt,{},it))},ot.attrs=function(it){return et(tt,nt,y$1({},rt,{attrs:Array.prototype.concat(rt.attrs,it).filter(Boolean)}))},ot}(Ye,o)};["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","big","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","keygen","label","legend","li","link","main","map","mark","marquee","menu","menuitem","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","small","source","span","strong","style","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr","circle","clipPath","defs","ellipse","foreignObject","g","image","line","linearGradient","marker","mask","path","pattern","polygon","polyline","radialGradient","rect","stop","svg","text","textPath","tspan"].forEach(function(o){qe[o]=qe(o)});function We(o){for(var et=arguments.length,tt=new Array(et>1?et-1:0),nt=1;nt>--at&1}const dt=31,ht=2**dt,pt=ht>>>1,mt=pt>>1,ft=ht-1;let yt=0;for(let Et=0;Et1;){let Pt=wt+kt>>>1;Et>>1|lt(),It=It<<1^pt,Rt=(Rt^pt)<<1|pt|1;xt=It,vt=1+Rt-It}let bt=nt-4;return gt.map(Et=>{switch(Et-bt){case 3:return bt+65792+(o[st++]<<16|o[st++]<<8|o[st++]);case 2:return bt+256+(o[st++]<<8|o[st++]);case 1:return bt+o[st++];default:return Et-1}})}function read_payload(o){let et=0;return()=>o[et++]}function read_compressed_payload(o){return read_payload(decode_arithmetic(unsafe_atob(o)))}function unsafe_atob(o){let et=[];[..."ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"].forEach((rt,ot)=>et[rt.charCodeAt(0)]=ot);let tt=o.length,nt=new Uint8Array(6*tt>>3);for(let rt=0,ot=0,it=0,st=0;rt=8&&(nt[ot++]=st>>(it-=8));return nt}function signed(o){return o&1?~o>>1:o>>1}function read_deltas(o,et){let tt=Array(o);for(let nt=0,rt=0;nt{let et=read_sorted(o);if(et.length)return et})}function read_mapped(o){let et=[];for(;;){let tt=o();if(tt==0)break;et.push(read_linear_table(tt,o))}for(;;){let tt=o()-1;if(tt<0)break;et.push(read_replacement_table(tt,o))}return et.flat()}function read_array_while(o){let et=[];for(;;){let tt=o(et.length);if(!tt)break;et.push(tt)}return et}function read_transposed(o,et,tt){let nt=Array(o).fill().map(()=>[]);for(let rt=0;rtnt[it].push(ot));return nt}function read_linear_table(o,et){let tt=1+et(),nt=et(),rt=read_array_while(et);return read_transposed(rt.length,1+o,et).flatMap((it,st)=>{let[at,...ct]=it;return Array(rt[st]).fill().map((lt,dt)=>{let ht=dt*nt;return[at+dt*tt,ct.map(pt=>pt+ht)]})})}function read_replacement_table(o,et){let tt=1+et();return read_transposed(tt,1+o,et).map(rt=>[rt[0],rt.slice(1)])}function read_trie(o){let et=[],tt=read_sorted(o);return rt(nt([]),[]),et;function nt(ot){let it=o(),st=read_array_while(()=>{let at=read_sorted(o).map(ct=>tt[ct]);if(at.length)return nt(at)});return{S:it,B:st,Q:ot}}function rt({S:ot,B:it},st,at){if(!(ot&4&&at===st[st.length-1])){ot&2&&(at=st[st.length-1]),ot&1&&et.push(st);for(let ct of it)for(let lt of ct.Q)rt(ct,[...st,lt],at)}}}function hex_cp(o){return o.toString(16).toUpperCase().padStart(2,"0")}function quote_cp(o){return`{${hex_cp(o)}}`}function explode_cp(o){let et=[];for(let tt=0,nt=o.length;tt>24&255}function unpack_cp(o){return o&16777215}let SHIFTED_RANK,EXCLUSIONS,DECOMP,RECOMP;function init$1(){let o=read_compressed_payload(COMPRESSED);SHIFTED_RANK=new Map(read_sorted_arrays(o).flatMap((et,tt)=>et.map(nt=>[nt,tt+1<<24]))),EXCLUSIONS=new Set(read_sorted(o)),DECOMP=new Map,RECOMP=new Map;for(let[et,tt]of read_mapped(o)){if(!EXCLUSIONS.has(et)&&tt.length==2){let[nt,rt]=tt,ot=RECOMP.get(nt);ot||(ot=new Map,RECOMP.set(nt,ot)),ot.set(rt,et)}DECOMP.set(et,tt.reverse())}}function is_hangul(o){return o>=S0&&o=L0&&o=V0&&etT0&&et0&&rt(T0+ct)}else{let it=DECOMP.get(ot);it?tt.push(...it):rt(ot)}if(!tt.length)break;ot=tt.pop()}if(nt&&et.length>1){let ot=unpack_cc(et[0]);for(let it=1;it0&&rt>=it)it==0?(et.push(nt,...tt),tt.length=0,nt=st):tt.push(st),rt=it;else{let at=compose_pair(nt,st);at>=0?nt=at:rt==0&&it==0?(et.push(nt),nt=st):(tt.push(st),rt=it)}}return nt>=0&&et.push(nt,...tt),et}function nfd(o){return decomposed(o).map(unpack_cp)}function nfc(o){return composed_from_decomposed(decomposed(o))}const HYPHEN=45,STOP_CH=".",FE0F=65039,UNIQUE_PH=1,Array_from=o=>Array.from(o);function group_has_cp(o,et){return o.P.has(et)||o.Q.has(et)}class Emoji extends Array{get is_emoji(){return!0}}let MAPPED,IGNORED,CM,NSM,ESCAPE,GROUPS,WHOLE_VALID,WHOLE_MAP,VALID,EMOJI_LIST,EMOJI_ROOT;function init(){if(MAPPED)return;let o=read_compressed_payload(COMPRESSED$1);const et=()=>read_sorted(o),tt=()=>new Set(et()),nt=(lt,dt)=>dt.forEach(ht=>lt.add(ht));MAPPED=new Map(read_mapped(o)),IGNORED=tt(),CM=et(),NSM=new Set(et().map(lt=>CM[lt])),CM=new Set(CM),ESCAPE=tt(),tt();let rt=read_sorted_arrays(o),ot=o();const it=()=>{let lt=new Set;return et().forEach(dt=>nt(lt,rt[dt])),nt(lt,et()),lt};GROUPS=read_array_while(lt=>{let dt=read_array_while(o).map(ht=>ht+96);if(dt.length){let ht=lt>=ot;dt[0]-=32,dt=str_from_cps(dt),ht&&(dt=`Restricted[${dt}]`);let pt=it(),mt=it(),ft=!o();return{N:dt,P:pt,Q:mt,M:ft,R:ht}}}),WHOLE_VALID=tt(),WHOLE_MAP=new Map;let st=et().concat(Array_from(WHOLE_VALID)).sort((lt,dt)=>lt-dt);st.forEach((lt,dt)=>{let ht=o(),pt=st[dt]=ht?st[dt-ht]:{V:[],M:new Map};pt.V.push(lt),WHOLE_VALID.has(lt)||WHOLE_MAP.set(lt,pt)});for(let{V:lt,M:dt}of new Set(WHOLE_MAP.values())){let ht=[];for(let mt of lt){let ft=GROUPS.filter(gt=>group_has_cp(gt,mt)),yt=ht.find(({G:gt})=>ft.some(xt=>gt.has(xt)));yt||(yt={G:new Set,V:[]},ht.push(yt)),yt.V.push(mt),nt(yt.G,ft)}let pt=ht.flatMap(mt=>Array_from(mt.G));for(let{G:mt,V:ft}of ht){let yt=new Set(pt.filter(gt=>!mt.has(gt)));for(let gt of ft)dt.set(gt,yt)}}VALID=new Set;let at=new Set;const ct=lt=>VALID.has(lt)?at.add(lt):VALID.add(lt);for(let lt of GROUPS){for(let dt of lt.P)ct(dt);for(let dt of lt.Q)ct(dt)}for(let lt of VALID)!WHOLE_MAP.has(lt)&&!at.has(lt)&&WHOLE_MAP.set(lt,UNIQUE_PH);nt(VALID,nfd(VALID)),EMOJI_LIST=read_trie(o).map(lt=>Emoji.from(lt)).sort(compare_arrays),EMOJI_ROOT=new Map;for(let lt of EMOJI_LIST){let dt=[EMOJI_ROOT];for(let ht of lt){let pt=dt.map(mt=>{let ft=mt.get(ht);return ft||(ft=new Map,mt.set(ht,ft)),ft});ht===FE0F?dt.push(...pt):dt=pt}for(let ht of dt)ht.V=lt}}function quoted_cp(o){return(should_escape(o)?"":`${bidi_qq(safe_str_from_cps([o]))} `)+quote_cp(o)}function bidi_qq(o){return`"${o}"‎`}function check_label_extension(o){if(o.length>=4&&o[2]==HYPHEN&&o[3]==HYPHEN)throw new Error(`invalid label extension: "${str_from_cps(o.slice(0,4))}"`)}function check_leading_underscore(o){for(let tt=o.lastIndexOf(95);tt>0;)if(o[--tt]!==95)throw new Error("underscore allowed only at start")}function check_fenced(o){let et=o[0],tt=FENCED.get(et);if(tt)throw error_placement(`leading ${tt}`);let nt=o.length,rt=-1;for(let ot=1;otet&&(et>>=1,o=[...o.slice(0,et),8230,...o.slice(-et)]);let rt=0,ot=o.length;for(let it=0;it{let ot=explode_cp(rt),it={input:ot,offset:nt};nt+=ot.length+1;try{let st=it.tokens=tokens_from_str(ot,et,tt),at=st.length,ct;if(!at)throw new Error("empty label");let lt=it.output=st.flat();if(check_leading_underscore(lt),!(it.emoji=at>1||st[0].is_emoji)&<.every(ht=>ht<128))check_label_extension(lt),ct="ASCII";else{let ht=st.flatMap(pt=>pt.is_emoji?[]:pt);if(!ht.length)ct="Emoji";else{if(CM.has(lt[0]))throw error_placement("leading combining mark");for(let ft=1;ftit.has(st)):Array_from(it),!tt.length)return}else nt.push(rt)}if(tt){for(let rt of tt)if(nt.every(ot=>group_has_cp(rt,ot)))throw new Error(`whole-script confusable: ${o.N}/${rt.N}`)}}function determine_group(o){let et=GROUPS;for(let tt of o){let nt=et.filter(rt=>group_has_cp(rt,tt));if(!nt.length)throw GROUPS.some(rt=>group_has_cp(rt,tt))?error_group_member(et[0],tt):error_disallowed(tt);if(et=nt,nt.length==1)break}return et}function flatten$1(o){return o.map(({input:et,error:tt,output:nt})=>{if(tt){let rt=tt.message;throw new Error(o.length==1?rt:`Invalid label ${bidi_qq(safe_str_from_cps(et,63))}: ${rt}`)}return str_from_cps(nt)}).join(STOP_CH)}function error_disallowed(o){return new Error(`disallowed character: ${quoted_cp(o)}`)}function error_group_member(o,et){let tt=quoted_cp(et),nt=GROUPS.find(rt=>rt.P.has(et));return nt&&(tt=`${nt.N} ${tt}`),new Error(`illegal mixture: ${o.N} + ${tt}`)}function error_placement(o){return new Error(`illegal placement: ${o}`)}function check_group(o,et){for(let tt of et)if(!group_has_cp(o,tt))throw error_group_member(o,tt);if(o.M){let tt=nfd(et);for(let nt=1,rt=tt.length;ntNSM_MAX)throw new Error(`excessive non-spacing marks: ${bidi_qq(safe_str_from_cps(tt.slice(nt-1,ot)))} (${ot-nt}/${NSM_MAX})`);nt=ot}}}function tokens_from_str(o,et,tt){let nt=[],rt=[];for(o=o.slice().reverse();o.length;){let ot=consume_emoji_reversed(o);if(ot)rt.length&&(nt.push(et(rt)),rt=[]),nt.push(tt(ot));else{let it=o.pop();if(VALID.has(it))rt.push(it);else{let st=MAPPED.get(it);if(st)rt.push(...st);else if(!IGNORED.has(it))throw error_disallowed(it)}}}return rt.length&&nt.push(et(rt)),nt}function filter_fe0f(o){return o.filter(et=>et!=FE0F)}function consume_emoji_reversed(o,et){let tt=EMOJI_ROOT,nt,rt=o.length;for(;rt&&(tt=tt.get(o[--rt]),!!tt);){let{V:ot}=tt;ot&&(nt=ot,o.length=rt)}return nt}const[SHA512_Kh,SHA512_Kl]=u64.split(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map(o=>BigInt(o))),SHA512_W_H=new Uint32Array(80),SHA512_W_L=new Uint32Array(80);class SHA512 extends HashMD{constructor(){super(128,64,16,!1),this.Ah=1779033703,this.Al=-205731576,this.Bh=-1150833019,this.Bl=-2067093701,this.Ch=1013904242,this.Cl=-23791573,this.Dh=-1521486534,this.Dl=1595750129,this.Eh=1359893119,this.El=-1377402159,this.Fh=-1694144372,this.Fl=725511199,this.Gh=528734635,this.Gl=-79577749,this.Hh=1541459225,this.Hl=327033209}get(){const{Ah:et,Al:tt,Bh:nt,Bl:rt,Ch:ot,Cl:it,Dh:st,Dl:at,Eh:ct,El:lt,Fh:dt,Fl:ht,Gh:pt,Gl:mt,Hh:ft,Hl:yt}=this;return[et,tt,nt,rt,ot,it,st,at,ct,lt,dt,ht,pt,mt,ft,yt]}set(et,tt,nt,rt,ot,it,st,at,ct,lt,dt,ht,pt,mt,ft,yt){this.Ah=et|0,this.Al=tt|0,this.Bh=nt|0,this.Bl=rt|0,this.Ch=ot|0,this.Cl=it|0,this.Dh=st|0,this.Dl=at|0,this.Eh=ct|0,this.El=lt|0,this.Fh=dt|0,this.Fl=ht|0,this.Gh=pt|0,this.Gl=mt|0,this.Hh=ft|0,this.Hl=yt|0}process(et,tt){for(let vt=0;vt<16;vt++,tt+=4)SHA512_W_H[vt]=et.getUint32(tt),SHA512_W_L[vt]=et.getUint32(tt+=4);for(let vt=16;vt<80;vt++){const bt=SHA512_W_H[vt-15]|0,Et=SHA512_W_L[vt-15]|0,wt=u64.rotrSH(bt,Et,1)^u64.rotrSH(bt,Et,8)^u64.shrSH(bt,Et,7),kt=u64.rotrSL(bt,Et,1)^u64.rotrSL(bt,Et,8)^u64.shrSL(bt,Et,7),It=SHA512_W_H[vt-2]|0,Rt=SHA512_W_L[vt-2]|0,Pt=u64.rotrSH(It,Rt,19)^u64.rotrBH(It,Rt,61)^u64.shrSH(It,Rt,6),jt=u64.rotrSL(It,Rt,19)^u64.rotrBL(It,Rt,61)^u64.shrSL(It,Rt,6),Ot=u64.add4L(kt,jt,SHA512_W_L[vt-7],SHA512_W_L[vt-16]),Bt=u64.add4H(Ot,wt,Pt,SHA512_W_H[vt-7],SHA512_W_H[vt-16]);SHA512_W_H[vt]=Bt|0,SHA512_W_L[vt]=Ot|0}let{Ah:nt,Al:rt,Bh:ot,Bl:it,Ch:st,Cl:at,Dh:ct,Dl:lt,Eh:dt,El:ht,Fh:pt,Fl:mt,Gh:ft,Gl:yt,Hh:gt,Hl:xt}=this;for(let vt=0;vt<80;vt++){const bt=u64.rotrSH(dt,ht,14)^u64.rotrSH(dt,ht,18)^u64.rotrBH(dt,ht,41),Et=u64.rotrSL(dt,ht,14)^u64.rotrSL(dt,ht,18)^u64.rotrBL(dt,ht,41),wt=dt&pt^~dt&ft,kt=ht&mt^~ht&yt,It=u64.add5L(xt,Et,kt,SHA512_Kl[vt],SHA512_W_L[vt]),Rt=u64.add5H(It,gt,bt,wt,SHA512_Kh[vt],SHA512_W_H[vt]),Pt=It|0,jt=u64.rotrSH(nt,rt,28)^u64.rotrBH(nt,rt,34)^u64.rotrBH(nt,rt,39),Ot=u64.rotrSL(nt,rt,28)^u64.rotrBL(nt,rt,34)^u64.rotrBL(nt,rt,39),Bt=nt&ot^nt&st^ot&st,zt=rt&it^rt&at^it&at;gt=ft|0,xt=yt|0,ft=pt|0,yt=mt|0,pt=dt|0,mt=ht|0,{h:dt,l:ht}=u64.add(ct|0,lt|0,Rt|0,Pt|0),ct=st|0,lt=at|0,st=ot|0,at=it|0,ot=nt|0,it=rt|0;const Ft=u64.add3L(Pt,Ot,zt);nt=u64.add3H(Ft,Rt,jt,Bt),rt=Ft|0}({h:nt,l:rt}=u64.add(this.Ah|0,this.Al|0,nt|0,rt|0)),{h:ot,l:it}=u64.add(this.Bh|0,this.Bl|0,ot|0,it|0),{h:st,l:at}=u64.add(this.Ch|0,this.Cl|0,st|0,at|0),{h:ct,l:lt}=u64.add(this.Dh|0,this.Dl|0,ct|0,lt|0),{h:dt,l:ht}=u64.add(this.Eh|0,this.El|0,dt|0,ht|0),{h:pt,l:mt}=u64.add(this.Fh|0,this.Fl|0,pt|0,mt|0),{h:ft,l:yt}=u64.add(this.Gh|0,this.Gl|0,ft|0,yt|0),{h:gt,l:xt}=u64.add(this.Hh|0,this.Hl|0,gt|0,xt|0),this.set(nt,rt,ot,it,st,at,ct,lt,dt,ht,pt,mt,ft,yt,gt,xt)}roundClean(){SHA512_W_H.fill(0),SHA512_W_L.fill(0)}destroy(){this.buffer.fill(0),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}const sha512=wrapConstructor(()=>new SHA512);function normalize$3(o){return ens_normalize(o)}normalize$3.parseError=o=>o;function normalize$2(o){return normalize$3(o)}function debounce$1(o,et,tt){var nt,rt,ot,it,st;et==null&&(et=100);function at(){var lt=Date.now()-it;lt=0?nt=setTimeout(at,et-lt):(nt=null,tt||(st=o.apply(ot,rt),ot=rt=null))}var ct=function(){ot=this,rt=arguments,it=Date.now();var lt=tt&&!nt;return nt||(nt=setTimeout(at,et)),lt&&(st=o.apply(ot,rt),ot=rt=null),st};return ct.clear=function(){nt&&(clearTimeout(nt),nt=null)},ct.flush=function(){nt&&(st=o.apply(ot,rt),ot=rt=null,clearTimeout(nt),nt=null)},ct}debounce$1.debounce=debounce$1;var debounce_1=debounce$1;const createDebounce=getDefaultExportFromCjs(debounce_1);function useMeasure(o){let{debounce:et,scroll:tt,polyfill:nt,offsetSize:rt}=o===void 0?{debounce:0,scroll:!1,offsetSize:!1}:o;const ot=nt||(typeof window>"u"?class{}:window.ResizeObserver);if(!ot)throw new Error("This browser does not support ResizeObserver out of the box. See: https://github.com/react-spring/react-use-measure/#resize-observer-polyfills");const[it,st]=reactExports.useState({left:0,top:0,width:0,height:0,bottom:0,right:0,x:0,y:0}),at=reactExports.useRef({element:null,scrollContainers:null,resizeObserver:null,lastBounds:it}),ct=et?typeof et=="number"?et:et.scroll:null,lt=et?typeof et=="number"?et:et.resize:null,dt=reactExports.useRef(!1);reactExports.useEffect(()=>(dt.current=!0,()=>void(dt.current=!1)));const[ht,pt,mt]=reactExports.useMemo(()=>{const xt=()=>{if(!at.current.element)return;const{left:vt,top:bt,width:Et,height:wt,bottom:kt,right:It,x:Rt,y:Pt}=at.current.element.getBoundingClientRect(),jt={left:vt,top:bt,width:Et,height:wt,bottom:kt,right:It,x:Rt,y:Pt};at.current.element instanceof HTMLElement&&rt&&(jt.height=at.current.element.offsetHeight,jt.width=at.current.element.offsetWidth),Object.freeze(jt),dt.current&&!areBoundsEqual(at.current.lastBounds,jt)&&st(at.current.lastBounds=jt)};return[xt,lt?createDebounce(xt,lt):xt,ct?createDebounce(xt,ct):xt]},[st,rt,ct,lt]);function ft(){at.current.scrollContainers&&(at.current.scrollContainers.forEach(xt=>xt.removeEventListener("scroll",mt,!0)),at.current.scrollContainers=null),at.current.resizeObserver&&(at.current.resizeObserver.disconnect(),at.current.resizeObserver=null)}function yt(){at.current.element&&(at.current.resizeObserver=new ot(mt),at.current.resizeObserver.observe(at.current.element),tt&&at.current.scrollContainers&&at.current.scrollContainers.forEach(xt=>xt.addEventListener("scroll",mt,{capture:!0,passive:!0})))}const gt=xt=>{!xt||xt===at.current.element||(ft(),at.current.element=xt,at.current.scrollContainers=findScrollContainers(xt),yt())};return useOnWindowScroll(mt,!!tt),useOnWindowResize(pt),reactExports.useEffect(()=>{ft(),yt()},[tt,mt,pt]),reactExports.useEffect(()=>ft,[]),[gt,it,ht]}function useOnWindowResize(o){reactExports.useEffect(()=>{const et=o;return window.addEventListener("resize",et),()=>void window.removeEventListener("resize",et)},[o])}function useOnWindowScroll(o,et){reactExports.useEffect(()=>{if(et){const tt=o;return window.addEventListener("scroll",tt,{capture:!0,passive:!0}),()=>void window.removeEventListener("scroll",tt,!0)}},[o,et])}function findScrollContainers(o){const et=[];if(!o||o===document.body)return et;const{overflow:tt,overflowX:nt,overflowY:rt}=window.getComputedStyle(o);return[tt,nt,rt].some(ot=>ot==="auto"||ot==="scroll")&&et.push(o),[...et,...findScrollContainers(o.parentElement)]}const keys$1=["x","y","top","bottom","left","right","width","height"],areBoundsEqual=(o,et)=>keys$1.every(tt=>o[tt]===et[tt]);var MapShim=function(){if(typeof Map<"u")return Map;function o(et,tt){var nt=-1;return et.some(function(rt,ot){return rt[0]===tt?(nt=ot,!0):!1}),nt}return function(){function et(){this.__entries__=[]}return Object.defineProperty(et.prototype,"size",{get:function(){return this.__entries__.length},enumerable:!0,configurable:!0}),et.prototype.get=function(tt){var nt=o(this.__entries__,tt),rt=this.__entries__[nt];return rt&&rt[1]},et.prototype.set=function(tt,nt){var rt=o(this.__entries__,tt);~rt?this.__entries__[rt][1]=nt:this.__entries__.push([tt,nt])},et.prototype.delete=function(tt){var nt=this.__entries__,rt=o(nt,tt);~rt&&nt.splice(rt,1)},et.prototype.has=function(tt){return!!~o(this.__entries__,tt)},et.prototype.clear=function(){this.__entries__.splice(0)},et.prototype.forEach=function(tt,nt){nt===void 0&&(nt=null);for(var rt=0,ot=this.__entries__;rt0},o.prototype.connect_=function(){!isBrowser$2||this.connected_||(document.addEventListener("transitionend",this.onTransitionEnd_),window.addEventListener("resize",this.refresh),mutationObserverSupported?(this.mutationsObserver_=new MutationObserver(this.refresh),this.mutationsObserver_.observe(document,{attributes:!0,childList:!0,characterData:!0,subtree:!0})):(document.addEventListener("DOMSubtreeModified",this.refresh),this.mutationEventsAdded_=!0),this.connected_=!0)},o.prototype.disconnect_=function(){!isBrowser$2||!this.connected_||(document.removeEventListener("transitionend",this.onTransitionEnd_),window.removeEventListener("resize",this.refresh),this.mutationsObserver_&&this.mutationsObserver_.disconnect(),this.mutationEventsAdded_&&document.removeEventListener("DOMSubtreeModified",this.refresh),this.mutationsObserver_=null,this.mutationEventsAdded_=!1,this.connected_=!1)},o.prototype.onTransitionEnd_=function(et){var tt=et.propertyName,nt=tt===void 0?"":tt,rt=transitionKeys.some(function(ot){return!!~nt.indexOf(ot)});rt&&this.refresh()},o.getInstance=function(){return this.instance_||(this.instance_=new o),this.instance_},o.instance_=null,o}(),defineConfigurable=function(o,et){for(var tt=0,nt=Object.keys(et);tt"u"||!(Element instanceof Object))){if(!(et instanceof getWindowOf(et).Element))throw new TypeError('parameter 1 is not of type "Element".');var tt=this.observations_;tt.has(et)||(tt.set(et,new ResizeObservation(et)),this.controller_.addObserver(this),this.controller_.refresh())}},o.prototype.unobserve=function(et){if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");if(!(typeof Element>"u"||!(Element instanceof Object))){if(!(et instanceof getWindowOf(et).Element))throw new TypeError('parameter 1 is not of type "Element".');var tt=this.observations_;tt.has(et)&&(tt.delete(et),tt.size||this.controller_.removeObserver(this))}},o.prototype.disconnect=function(){this.clearActive(),this.observations_.clear(),this.controller_.removeObserver(this)},o.prototype.gatherActive=function(){var et=this;this.clearActive(),this.observations_.forEach(function(tt){tt.isActive()&&et.activeObservations_.push(tt)})},o.prototype.broadcastActive=function(){if(this.hasActive()){var et=this.callbackCtx_,tt=this.activeObservations_.map(function(nt){return new ResizeObserverEntry(nt.target,nt.broadcastRect())});this.callback_.call(et,tt,et),this.clearActive()}},o.prototype.clearActive=function(){this.activeObservations_.splice(0)},o.prototype.hasActive=function(){return this.activeObservations_.length>0},o}(),observers=typeof WeakMap<"u"?new WeakMap:new MapShim,ResizeObserver$1=function(){function o(et){if(!(this instanceof o))throw new TypeError("Cannot call a class as a function.");if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");var tt=ResizeObserverController.getInstance(),nt=new ResizeObserverSPI(et,tt,this);observers.set(this,nt)}return o}();["observe","unobserve","disconnect"].forEach(function(o){ResizeObserver$1.prototype[o]=function(){var et;return(et=observers.get(this))[o].apply(et,arguments)}});var index$1=function(){return typeof global$1.ResizeObserver<"u"?global$1.ResizeObserver:ResizeObserver$1}(),browser$1={},canPromise$1=function(){return typeof Promise=="function"&&Promise.prototype&&Promise.prototype.then},qrcode={},utils$2={};let toSJISFunction;const CODEWORDS_COUNT=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];utils$2.getSymbolSize=function(et){if(!et)throw new Error('"version" cannot be null or undefined');if(et<1||et>40)throw new Error('"version" should be in range from 1 to 40');return et*4+17};utils$2.getSymbolTotalCodewords=function(et){return CODEWORDS_COUNT[et]};utils$2.getBCHDigit=function(o){let et=0;for(;o!==0;)et++,o>>>=1;return et};utils$2.setToSJISFunction=function(et){if(typeof et!="function")throw new Error('"toSJISFunc" is not a valid function.');toSJISFunction=et};utils$2.isKanjiModeEnabled=function(){return typeof toSJISFunction<"u"};utils$2.toSJIS=function(et){return toSJISFunction(et)};var errorCorrectionLevel={};(function(o){o.L={bit:1},o.M={bit:0},o.Q={bit:3},o.H={bit:2};function et(tt){if(typeof tt!="string")throw new Error("Param is not a string");switch(tt.toLowerCase()){case"l":case"low":return o.L;case"m":case"medium":return o.M;case"q":case"quartile":return o.Q;case"h":case"high":return o.H;default:throw new Error("Unknown EC Level: "+tt)}}o.isValid=function(nt){return nt&&typeof nt.bit<"u"&&nt.bit>=0&&nt.bit<4},o.from=function(nt,rt){if(o.isValid(nt))return nt;try{return et(nt)}catch{return rt}}})(errorCorrectionLevel);function BitBuffer$1(){this.buffer=[],this.length=0}BitBuffer$1.prototype={get:function(o){const et=Math.floor(o/8);return(this.buffer[et]>>>7-o%8&1)===1},put:function(o,et){for(let tt=0;tt>>et-tt-1&1)===1)},getLengthInBits:function(){return this.length},putBit:function(o){const et=Math.floor(this.length/8);this.buffer.length<=et&&this.buffer.push(0),o&&(this.buffer[et]|=128>>>this.length%8),this.length++}};var bitBuffer=BitBuffer$1;function BitMatrix$1(o){if(!o||o<1)throw new Error("BitMatrix size must be defined and greater than 0");this.size=o,this.data=new Uint8Array(o*o),this.reservedBit=new Uint8Array(o*o)}BitMatrix$1.prototype.set=function(o,et,tt,nt){const rt=o*this.size+et;this.data[rt]=tt,nt&&(this.reservedBit[rt]=!0)};BitMatrix$1.prototype.get=function(o,et){return this.data[o*this.size+et]};BitMatrix$1.prototype.xor=function(o,et,tt){this.data[o*this.size+et]^=tt};BitMatrix$1.prototype.isReserved=function(o,et){return this.reservedBit[o*this.size+et]};var bitMatrix=BitMatrix$1,alignmentPattern={};(function(o){const et=utils$2.getSymbolSize;o.getRowColCoords=function(nt){if(nt===1)return[];const rt=Math.floor(nt/7)+2,ot=et(nt),it=ot===145?26:Math.ceil((ot-13)/(2*rt-2))*2,st=[ot-7];for(let at=1;at=0&&rt<=7},o.from=function(rt){return o.isValid(rt)?parseInt(rt,10):void 0},o.getPenaltyN1=function(rt){const ot=rt.size;let it=0,st=0,at=0,ct=null,lt=null;for(let dt=0;dt=5&&(it+=et.N1+(st-5)),ct=pt,st=1),pt=rt.get(ht,dt),pt===lt?at++:(at>=5&&(it+=et.N1+(at-5)),lt=pt,at=1)}st>=5&&(it+=et.N1+(st-5)),at>=5&&(it+=et.N1+(at-5))}return it},o.getPenaltyN2=function(rt){const ot=rt.size;let it=0;for(let st=0;st=10&&(st===1488||st===93)&&it++,at=at<<1&2047|rt.get(lt,ct),lt>=10&&(at===1488||at===93)&&it++}return it*et.N3},o.getPenaltyN4=function(rt){let ot=0;const it=rt.data.length;for(let at=0;at=0;){const it=ot[0];for(let at=0;at0){const ot=new Uint8Array(this.degree);return ot.set(nt,rt),ot}return nt};var reedSolomonEncoder=ReedSolomonEncoder$1,version$4={},mode$1={},versionCheck={};versionCheck.isValid=function(et){return!isNaN(et)&&et>=1&&et<=40};var regex={};const numeric="[0-9]+",alphanumeric="[A-Z $%*+\\-./:]+";let kanji="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";kanji=kanji.replace(/u/g,"\\u");const byte="(?:(?![A-Z0-9 $%*+\\-./:]|"+kanji+`)(?:.|[\r ]))+`;regex.KANJI=new RegExp(kanji,"g");regex.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g");regex.BYTE=new RegExp(byte,"g");regex.NUMERIC=new RegExp(numeric,"g");regex.ALPHANUMERIC=new RegExp(alphanumeric,"g");const TEST_KANJI=new RegExp("^"+kanji+"$"),TEST_NUMERIC=new RegExp("^"+numeric+"$"),TEST_ALPHANUMERIC=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");regex.testKanji=function(et){return TEST_KANJI.test(et)};regex.testNumeric=function(et){return TEST_NUMERIC.test(et)};regex.testAlphanumeric=function(et){return TEST_ALPHANUMERIC.test(et)};(function(o){const et=versionCheck,tt=regex;o.NUMERIC={id:"Numeric",bit:1,ccBits:[10,12,14]},o.ALPHANUMERIC={id:"Alphanumeric",bit:2,ccBits:[9,11,13]},o.BYTE={id:"Byte",bit:4,ccBits:[8,16,16]},o.KANJI={id:"Kanji",bit:8,ccBits:[8,10,12]},o.MIXED={bit:-1},o.getCharCountIndicator=function(ot,it){if(!ot.ccBits)throw new Error("Invalid mode: "+ot);if(!et.isValid(it))throw new Error("Invalid version: "+it);return it>=1&&it<10?ot.ccBits[0]:it<27?ot.ccBits[1]:ot.ccBits[2]},o.getBestModeForData=function(ot){return tt.testNumeric(ot)?o.NUMERIC:tt.testAlphanumeric(ot)?o.ALPHANUMERIC:tt.testKanji(ot)?o.KANJI:o.BYTE},o.toString=function(ot){if(ot&&ot.id)return ot.id;throw new Error("Invalid mode")},o.isValid=function(ot){return ot&&ot.bit&&ot.ccBits};function nt(rt){if(typeof rt!="string")throw new Error("Param is not a string");switch(rt.toLowerCase()){case"numeric":return o.NUMERIC;case"alphanumeric":return o.ALPHANUMERIC;case"kanji":return o.KANJI;case"byte":return o.BYTE;default:throw new Error("Unknown mode: "+rt)}}o.from=function(ot,it){if(o.isValid(ot))return ot;try{return nt(ot)}catch{return it}}})(mode$1);(function(o){const et=utils$2,tt=errorCorrectionCode,nt=errorCorrectionLevel,rt=mode$1,ot=versionCheck,it=7973,st=et.getBCHDigit(it);function at(ht,pt,mt){for(let ft=1;ft<=40;ft++)if(pt<=o.getCapacity(ft,mt,ht))return ft}function ct(ht,pt){return rt.getCharCountIndicator(ht,pt)+4}function lt(ht,pt){let mt=0;return ht.forEach(function(ft){const yt=ct(ft.mode,pt);mt+=yt+ft.getBitsLength()}),mt}function dt(ht,pt){for(let mt=1;mt<=40;mt++)if(lt(ht,mt)<=o.getCapacity(mt,pt,rt.MIXED))return mt}o.from=function(pt,mt){return ot.isValid(pt)?parseInt(pt,10):mt},o.getCapacity=function(pt,mt,ft){if(!ot.isValid(pt))throw new Error("Invalid QR Code version");typeof ft>"u"&&(ft=rt.BYTE);const yt=et.getSymbolTotalCodewords(pt),gt=tt.getTotalCodewordsCount(pt,mt),xt=(yt-gt)*8;if(ft===rt.MIXED)return xt;const vt=xt-ct(ft,pt);switch(ft){case rt.NUMERIC:return Math.floor(vt/10*3);case rt.ALPHANUMERIC:return Math.floor(vt/11*2);case rt.KANJI:return Math.floor(vt/13);case rt.BYTE:default:return Math.floor(vt/8)}},o.getBestVersionForData=function(pt,mt){let ft;const yt=nt.from(mt,nt.M);if(Array.isArray(pt)){if(pt.length>1)return dt(pt,yt);if(pt.length===0)return 1;ft=pt[0]}else ft=pt;return at(ft.mode,ft.getLength(),yt)},o.getEncodedBits=function(pt){if(!ot.isValid(pt)||pt<7)throw new Error("Invalid QR Code version");let mt=pt<<12;for(;et.getBCHDigit(mt)-st>=0;)mt^=it<=0;)rt^=G15<0&&(nt=this.data.substr(tt),rt=parseInt(nt,10),et.put(rt,ot*3+1))};var numericData=NumericData;const Mode$3=mode$1,ALPHA_NUM_CHARS=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"," ","$","%","*","+","-",".","/",":"];function AlphanumericData(o){this.mode=Mode$3.ALPHANUMERIC,this.data=o}AlphanumericData.getBitsLength=function(et){return 11*Math.floor(et/2)+6*(et%2)};AlphanumericData.prototype.getLength=function(){return this.data.length};AlphanumericData.prototype.getBitsLength=function(){return AlphanumericData.getBitsLength(this.data.length)};AlphanumericData.prototype.write=function(et){let tt;for(tt=0;tt+2<=this.data.length;tt+=2){let nt=ALPHA_NUM_CHARS.indexOf(this.data[tt])*45;nt+=ALPHA_NUM_CHARS.indexOf(this.data[tt+1]),et.put(nt,11)}this.data.length%2&&et.put(ALPHA_NUM_CHARS.indexOf(this.data[tt]),6)};var alphanumericData=AlphanumericData;const Mode$2=mode$1;function ByteData(o){this.mode=Mode$2.BYTE,typeof o=="string"?this.data=new TextEncoder().encode(o):this.data=new Uint8Array(o)}ByteData.getBitsLength=function(et){return et*8};ByteData.prototype.getLength=function(){return this.data.length};ByteData.prototype.getBitsLength=function(){return ByteData.getBitsLength(this.data.length)};ByteData.prototype.write=function(o){for(let et=0,tt=this.data.length;et=33088&&tt<=40956)tt-=33088;else if(tt>=57408&&tt<=60351)tt-=49472;else throw new Error("Invalid SJIS character: "+this.data[et]+` -Make sure your charset is UTF-8`);tt=(tt>>>8&255)*192+(tt&255),o.put(tt,13)}};var kanjiData=KanjiData,dijkstra={exports:{}};(function(o){var et={single_source_shortest_paths:function(tt,nt,rt){var ot={},it={};it[nt]=0;var st=et.PriorityQueue.make();st.push(nt,0);for(var at,ct,lt,dt,ht,pt,mt,ft,yt;!st.empty();){at=st.pop(),ct=at.value,dt=at.cost,ht=tt[ct]||{};for(lt in ht)ht.hasOwnProperty(lt)&&(pt=ht[lt],mt=dt+pt,ft=it[lt],yt=typeof it[lt]>"u",(yt||ft>mt)&&(it[lt]=mt,st.push(lt,mt),ot[lt]=ct))}if(typeof rt<"u"&&typeof it[rt]>"u"){var gt=["Could not find a path from ",nt," to ",rt,"."].join("");throw new Error(gt)}return ot},extract_shortest_path_from_predecessor_list:function(tt,nt){for(var rt=[],ot=nt;ot;)rt.push(ot),tt[ot],ot=tt[ot];return rt.reverse(),rt},find_path:function(tt,nt,rt){var ot=et.single_source_shortest_paths(tt,nt,rt);return et.extract_shortest_path_from_predecessor_list(ot,rt)},PriorityQueue:{make:function(tt){var nt=et.PriorityQueue,rt={},ot;tt=tt||{};for(ot in nt)nt.hasOwnProperty(ot)&&(rt[ot]=nt[ot]);return rt.queue=[],rt.sorter=tt.sorter||nt.default_sorter,rt},default_sorter:function(tt,nt){return tt.cost-nt.cost},push:function(tt,nt){var rt={value:tt,cost:nt};this.queue.push(rt),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return this.queue.length===0}}};o.exports=et})(dijkstra);var dijkstraExports=dijkstra.exports;(function(o){const et=mode$1,tt=numericData,nt=alphanumericData,rt=byteData,ot=kanjiData,it=regex,st=utils$2,at=dijkstraExports;function ct(gt){return unescape(encodeURIComponent(gt)).length}function lt(gt,xt,vt){const bt=[];let Et;for(;(Et=gt.exec(vt))!==null;)bt.push({data:Et[0],index:Et.index,mode:xt,length:Et[0].length});return bt}function dt(gt){const xt=lt(it.NUMERIC,et.NUMERIC,gt),vt=lt(it.ALPHANUMERIC,et.ALPHANUMERIC,gt);let bt,Et;return st.isKanjiModeEnabled()?(bt=lt(it.BYTE,et.BYTE,gt),Et=lt(it.KANJI,et.KANJI,gt)):(bt=lt(it.BYTE_KANJI,et.BYTE,gt),Et=[]),xt.concat(vt,bt,Et).sort(function(kt,Tt){return kt.index-Tt.index}).map(function(kt){return{data:kt.data,mode:kt.mode,length:kt.length}})}function ht(gt,xt){switch(xt){case et.NUMERIC:return tt.getBitsLength(gt);case et.ALPHANUMERIC:return nt.getBitsLength(gt);case et.KANJI:return ot.getBitsLength(gt);case et.BYTE:return rt.getBitsLength(gt)}}function pt(gt){return gt.reduce(function(xt,vt){const bt=xt.length-1>=0?xt[xt.length-1]:null;return bt&&bt.mode===vt.mode?(xt[xt.length-1].data+=vt.data,xt):(xt.push(vt),xt)},[])}function mt(gt){const xt=[];for(let vt=0;vt=0&&st<=6&&(at===0||at===6)||at>=0&&at<=6&&(st===0||st===6)||st>=2&&st<=4&&at>=2&&at<=4?o.set(ot+st,it+at,!0,!0):o.set(ot+st,it+at,!1,!0))}}function setupTimingPattern(o){const et=o.size;for(let tt=8;tt>st&1)===1,o.set(rt,ot,it,!0),o.set(ot,rt,it,!0)}function setupFormatInfo(o,et,tt){const nt=o.size,rt=FormatInfo.getEncodedBits(et,tt);let ot,it;for(ot=0;ot<15;ot++)it=(rt>>ot&1)===1,ot<6?o.set(ot,8,it,!0):ot<8?o.set(ot+1,8,it,!0):o.set(nt-15+ot,8,it,!0),ot<8?o.set(8,nt-ot-1,it,!0):ot<9?o.set(8,15-ot-1+1,it,!0):o.set(8,15-ot-1,it,!0);o.set(nt-8,8,1,!0)}function setupData(o,et){const tt=o.size;let nt=-1,rt=tt-1,ot=7,it=0;for(let st=tt-1;st>0;st-=2)for(st===6&&st--;;){for(let at=0;at<2;at++)if(!o.isReserved(rt,st-at)){let ct=!1;it>>ot&1)===1),o.set(rt,st-at,ct),ot--,ot===-1&&(it++,ot=7)}if(rt+=nt,rt<0||tt<=rt){rt-=nt,nt=-nt;break}}}function createData(o,et,tt){const nt=new BitBuffer;tt.forEach(function(at){nt.put(at.mode.bit,4),nt.put(at.getLength(),Mode.getCharCountIndicator(at.mode,o)),at.write(nt)});const rt=Utils$1.getSymbolTotalCodewords(o),ot=ECCode.getTotalCodewordsCount(o,et),it=(rt-ot)*8;for(nt.getLengthInBits()+4<=it&&nt.put(0,4);nt.getLengthInBits()%8!==0;)nt.putBit(0);const st=(it-nt.getLengthInBits())/8;for(let at=0;at>>8&255)*192+(tt&255),o.put(tt,13)}};var kanjiData=KanjiData,dijkstra={exports:{}};(function(o){var et={single_source_shortest_paths:function(tt,nt,rt){var ot={},it={};it[nt]=0;var st=et.PriorityQueue.make();st.push(nt,0);for(var at,ct,lt,dt,ht,pt,mt,ft,yt;!st.empty();){at=st.pop(),ct=at.value,dt=at.cost,ht=tt[ct]||{};for(lt in ht)ht.hasOwnProperty(lt)&&(pt=ht[lt],mt=dt+pt,ft=it[lt],yt=typeof it[lt]>"u",(yt||ft>mt)&&(it[lt]=mt,st.push(lt,mt),ot[lt]=ct))}if(typeof rt<"u"&&typeof it[rt]>"u"){var gt=["Could not find a path from ",nt," to ",rt,"."].join("");throw new Error(gt)}return ot},extract_shortest_path_from_predecessor_list:function(tt,nt){for(var rt=[],ot=nt;ot;)rt.push(ot),tt[ot],ot=tt[ot];return rt.reverse(),rt},find_path:function(tt,nt,rt){var ot=et.single_source_shortest_paths(tt,nt,rt);return et.extract_shortest_path_from_predecessor_list(ot,rt)},PriorityQueue:{make:function(tt){var nt=et.PriorityQueue,rt={},ot;tt=tt||{};for(ot in nt)nt.hasOwnProperty(ot)&&(rt[ot]=nt[ot]);return rt.queue=[],rt.sorter=tt.sorter||nt.default_sorter,rt},default_sorter:function(tt,nt){return tt.cost-nt.cost},push:function(tt,nt){var rt={value:tt,cost:nt};this.queue.push(rt),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return this.queue.length===0}}};o.exports=et})(dijkstra);var dijkstraExports=dijkstra.exports;(function(o){const et=mode$1,tt=numericData,nt=alphanumericData,rt=byteData,ot=kanjiData,it=regex,st=utils$2,at=dijkstraExports;function ct(gt){return unescape(encodeURIComponent(gt)).length}function lt(gt,xt,vt){const bt=[];let Et;for(;(Et=gt.exec(vt))!==null;)bt.push({data:Et[0],index:Et.index,mode:xt,length:Et[0].length});return bt}function dt(gt){const xt=lt(it.NUMERIC,et.NUMERIC,gt),vt=lt(it.ALPHANUMERIC,et.ALPHANUMERIC,gt);let bt,Et;return st.isKanjiModeEnabled()?(bt=lt(it.BYTE,et.BYTE,gt),Et=lt(it.KANJI,et.KANJI,gt)):(bt=lt(it.BYTE_KANJI,et.BYTE,gt),Et=[]),xt.concat(vt,bt,Et).sort(function(kt,It){return kt.index-It.index}).map(function(kt){return{data:kt.data,mode:kt.mode,length:kt.length}})}function ht(gt,xt){switch(xt){case et.NUMERIC:return tt.getBitsLength(gt);case et.ALPHANUMERIC:return nt.getBitsLength(gt);case et.KANJI:return ot.getBitsLength(gt);case et.BYTE:return rt.getBitsLength(gt)}}function pt(gt){return gt.reduce(function(xt,vt){const bt=xt.length-1>=0?xt[xt.length-1]:null;return bt&&bt.mode===vt.mode?(xt[xt.length-1].data+=vt.data,xt):(xt.push(vt),xt)},[])}function mt(gt){const xt=[];for(let vt=0;vt=0&&st<=6&&(at===0||at===6)||at>=0&&at<=6&&(st===0||st===6)||st>=2&&st<=4&&at>=2&&at<=4?o.set(ot+st,it+at,!0,!0):o.set(ot+st,it+at,!1,!0))}}function setupTimingPattern(o){const et=o.size;for(let tt=8;tt>st&1)===1,o.set(rt,ot,it,!0),o.set(ot,rt,it,!0)}function setupFormatInfo(o,et,tt){const nt=o.size,rt=FormatInfo.getEncodedBits(et,tt);let ot,it;for(ot=0;ot<15;ot++)it=(rt>>ot&1)===1,ot<6?o.set(ot,8,it,!0):ot<8?o.set(ot+1,8,it,!0):o.set(nt-15+ot,8,it,!0),ot<8?o.set(8,nt-ot-1,it,!0):ot<9?o.set(8,15-ot-1+1,it,!0):o.set(8,15-ot-1,it,!0);o.set(nt-8,8,1,!0)}function setupData(o,et){const tt=o.size;let nt=-1,rt=tt-1,ot=7,it=0;for(let st=tt-1;st>0;st-=2)for(st===6&&st--;;){for(let at=0;at<2;at++)if(!o.isReserved(rt,st-at)){let ct=!1;it>>ot&1)===1),o.set(rt,st-at,ct),ot--,ot===-1&&(it++,ot=7)}if(rt+=nt,rt<0||tt<=rt){rt-=nt,nt=-nt;break}}}function createData(o,et,tt){const nt=new BitBuffer;tt.forEach(function(at){nt.put(at.mode.bit,4),nt.put(at.getLength(),Mode.getCharCountIndicator(at.mode,o)),at.write(nt)});const rt=Utils$1.getSymbolTotalCodewords(o),ot=ECCode.getTotalCodewordsCount(o,et),it=(rt-ot)*8;for(nt.getLengthInBits()+4<=it&&nt.put(0,4);nt.getLengthInBits()%8!==0;)nt.putBit(0);const st=(it-nt.getLengthInBits())/8;for(let at=0;at=7&&setupVersionInfo(at,et),setupData(at,it),isNaN(nt)&&(nt=MaskPattern.getBestMask(at,setupFormatInfo.bind(null,at,tt))),MaskPattern.applyMask(nt,at),setupFormatInfo(at,tt,nt),{modules:at,version:et,errorCorrectionLevel:tt,maskPattern:nt,segments:rt}}qrcode.create=function(et,tt){if(typeof et>"u"||et==="")throw new Error("No input text");let nt=ECLevel.M,rt,ot;return typeof tt<"u"&&(nt=ECLevel.from(tt.errorCorrectionLevel,ECLevel.M),rt=Version$1.from(tt.version),ot=MaskPattern.from(tt.maskPattern),tt.toSJISFunc&&Utils$1.setToSJISFunction(tt.toSJISFunc)),createSymbol(et,rt,nt,ot)};var canvas={},utils$1={};(function(o){function et(tt){if(typeof tt=="number"&&(tt=tt.toString()),typeof tt!="string")throw new Error("Color should be defined as hex string");let nt=tt.slice().replace("#","").split("");if(nt.length<3||nt.length===5||nt.length>8)throw new Error("Invalid hex color: "+tt);(nt.length===3||nt.length===4)&&(nt=Array.prototype.concat.apply([],nt.map(function(ot){return[ot,ot]}))),nt.length===6&&nt.push("F","F");const rt=parseInt(nt.join(""),16);return{r:rt>>24&255,g:rt>>16&255,b:rt>>8&255,a:rt&255,hex:"#"+nt.slice(0,6).join("")}}o.getOptions=function(nt){nt||(nt={}),nt.color||(nt.color={});const rt=typeof nt.margin>"u"||nt.margin===null||nt.margin<0?4:nt.margin,ot=nt.width&&nt.width>=21?nt.width:void 0,it=nt.scale||4;return{width:ot,scale:ot?4:it,margin:rt,color:{dark:et(nt.color.dark||"#000000ff"),light:et(nt.color.light||"#ffffffff")},type:nt.type,rendererOpts:nt.rendererOpts||{}}},o.getScale=function(nt,rt){return rt.width&&rt.width>=nt+rt.margin*2?rt.width/(nt+rt.margin*2):rt.scale},o.getImageWidth=function(nt,rt){const ot=o.getScale(nt,rt);return Math.floor((nt+rt.margin*2)*ot)},o.qrToImageData=function(nt,rt,ot){const it=rt.modules.size,st=rt.modules.data,at=o.getScale(it,ot),ct=Math.floor((it+ot.margin*2)*at),lt=ot.margin*at,dt=[ot.color.light,ot.color.dark];for(let ht=0;ht=lt&&pt>=lt&&ht"u"&&(!it||!it.getContext)&&(at=it,it=void 0),it||(ct=nt()),at=et.getOptions(at);const lt=et.getImageWidth(ot.modules.size,at),dt=ct.getContext("2d"),ht=dt.createImageData(lt,lt);return et.qrToImageData(ht.data,ot,at),tt(dt,ct,lt),dt.putImageData(ht,0,0),ct},o.renderToDataURL=function(ot,it,st){let at=st;typeof at>"u"&&(!it||!it.getContext)&&(at=it,it=void 0),at||(at={});const ct=o.render(ot,it,at),lt=at.type||"image/png",dt=at.rendererOpts||{};return ct.toDataURL(lt,dt.quality)}})(canvas);var svgTag={};const Utils=utils$1;function getColorAttrib(o,et){const tt=o.a/255,nt=et+'="'+o.hex+'"';return tt<1?nt+" "+et+'-opacity="'+tt.toFixed(2).slice(1)+'"':nt}function svgCmd(o,et,tt){let nt=o+et;return typeof tt<"u"&&(nt+=" "+tt),nt}function qrToPath(o,et,tt){let nt="",rt=0,ot=!1,it=0;for(let st=0;st0&&at>0&&o[st-1]||(nt+=ot?svgCmd("M",at+tt,.5+ct+tt):svgCmd("m",rt,0),rt=0,ot=!1),at+1':"",ct="',lt='viewBox="0 0 '+st+" "+st+'"',ht=''+at+ct+` -`;return typeof nt=="function"&&nt(null,ht),ht};const canPromise=canPromise$1,QRCode$2=qrcode,CanvasRenderer=canvas,SvgRenderer=svgTag;function renderCanvas(o,et,tt,nt,rt){const ot=[].slice.call(arguments,1),it=ot.length,st=typeof ot[it-1]=="function";if(!st&&!canPromise())throw new Error("Callback required as last argument");if(st){if(it<2)throw new Error("Too few arguments provided");it===2?(rt=tt,tt=et,et=nt=void 0):it===3&&(et.getContext&&typeof rt>"u"?(rt=nt,nt=void 0):(rt=nt,nt=tt,tt=et,et=void 0))}else{if(it<1)throw new Error("Too few arguments provided");return it===1?(tt=et,et=nt=void 0):it===2&&!et.getContext&&(nt=tt,tt=et,et=void 0),new Promise(function(at,ct){try{const lt=QRCode$2.create(tt,nt);at(o(lt,et,nt))}catch(lt){ct(lt)}})}try{const at=QRCode$2.create(tt,nt);rt(null,o(at,et,nt))}catch(at){rt(at)}}browser$1.create=QRCode$2.create;browser$1.toCanvas=renderCanvas.bind(null,CanvasRenderer.render);browser$1.toDataURL=renderCanvas.bind(null,CanvasRenderer.renderToDataURL);browser$1.toString=renderCanvas.bind(null,function(o,et,tt){return SvgRenderer.render(o,tt)});var PRE_ENTER=0,ENTERING=1,ENTERED=2,PRE_EXIT=3,EXITING=4,EXITED=5,UNMOUNTED=6,STATES=["preEnter","entering","entered","preExit","exiting","exited","unmounted"],startOrEnd=function(et){return et?UNMOUNTED:EXITED},updateState=function(et,tt,nt,rt,ot){clearTimeout(rt.current),tt(et),nt.current=et,ot&&ot({state:STATES[et]})},useTransition=function(et){var tt=et===void 0?{}:et,nt=tt.enter,rt=nt===void 0?!0:nt,ot=tt.exit,it=ot===void 0?!0:ot,st=tt.preEnter,at=tt.preExit,ct=tt.timeout,lt=tt.initialEntered,dt=tt.mountOnEnter,ht=tt.unmountOnExit,pt=tt.onChange,mt=reactExports.useState(lt?ENTERED:startOrEnd(dt)),ft=mt[0],yt=mt[1],gt=reactExports.useRef(ft),xt=reactExports.useRef(),vt,bt;typeof ct=="object"?(vt=ct.enter,bt=ct.exit):vt=bt=ct;var Et=reactExports.useCallback(function(){var kt;switch(gt.current){case ENTERING:case PRE_ENTER:kt=ENTERED;break;case EXITING:case PRE_EXIT:kt=startOrEnd(ht);break}kt!==void 0&&updateState(kt,yt,gt,xt,pt)},[pt,ht]),wt=reactExports.useCallback(function(kt){var Tt=function Pt($t){switch(updateState($t,yt,gt,xt,pt),$t){case ENTERING:vt>=0&&(xt.current=setTimeout(Et,vt));break;case EXITING:bt>=0&&(xt.current=setTimeout(Et,bt));break;case PRE_ENTER:case PRE_EXIT:xt.current=setTimeout(function(){return Pt($t+1)},0);break}},Rt=gt.current<=ENTERED;typeof kt!="boolean"&&(kt=!Rt),kt?Rt||Tt(rt?st?PRE_ENTER:ENTERING:ENTERED):Rt&&Tt(it?at?PRE_EXIT:EXITING:startOrEnd(ht))},[Et,pt,rt,it,st,at,vt,bt,ht]);return reactExports.useEffect(function(){return function(){return clearTimeout(xt.current)}},[]),[STATES[ft],wt,Et]};const defaultConnectors=({app:o,walletConnectProjectId:et,coinbaseWalletPreference:tt})=>{const nt=o.name&&o.icon&&o.description&&o.url,rt=!(typeof window>"u")&&(window==null?void 0:window.parent)!==window,ot=[];return rt&&ot.push(safe({allowedDomains:[/gnosis-safe.io$/,/app.safe.global$/]})),ot.push(injected({target:"metaMask"}),coinbaseWallet({appName:o.name,appLogoUrl:o.icon,overrideIsMetaMask:!1,preference:tt})),et&&ot.push(walletConnect({showQrModal:!1,projectId:et,metadata:nt?{name:o.name,description:o.description,url:o.url,icons:[o.icon]}:void 0})),ot};let globalAppName,globalAppIcon;const getAppName=()=>globalAppName,getAppIcon=()=>globalAppIcon,defaultConfig=({appName:o="ConnectKit",appIcon:et,appDescription:tt,appUrl:nt,walletConnectProjectId:rt,coinbaseWalletPreference:ot,chains:it=[mainnet,polygon,optimism,arbitrum],client:st,...at})=>{var ct,lt;globalAppName=o,et&&(globalAppIcon=et);const dt=(ct=at==null?void 0:at.transports)!==null&&ct!==void 0?ct:Object.fromEntries(it.map(mt=>[mt.id,http()])),ht=(lt=at==null?void 0:at.connectors)!==null&<!==void 0?lt:defaultConnectors({app:{name:o,icon:et,description:tt,url:nt},walletConnectProjectId:rt,coinbaseWalletPreference:ot});return{...at,chains:it,connectors:ht,transports:dt}},isWalletInstalled=o=>{if(typeof window>"u")return!1;const{ethereum:et}=window;return!!(et!=null&&et[`is${o}`]||et!=null&&et.providers&&(et!=null&&et.providers.find(tt=>tt==null?void 0:tt[`is${o}`])))},isFamily=()=>isWalletInstalled("Family"),isRainbow=()=>isWalletInstalled("Rainbow"),isZerion=()=>isWalletInstalled("Zerion"),Mock=({...o})=>jsxRuntimeExports.jsxs("svg",{...o,"aria-hidden":"true",width:"44",height:"44",viewBox:"0 0 44 44",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{background:"linear-gradient(180deg, #8995A9 0%, #424D5F 99.48%)"},children:[jsxRuntimeExports.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M20.5611 8.12948C21.0082 7.90729 21.5007 7.79167 22 7.79167C22.4993 7.79167 22.9919 7.90729 23.439 8.12948L23.4408 8.1304L33.0387 12.9293C33.577 13.197 34.031 13.61 34.3478 14.121C34.6649 14.6323 34.833 15.2218 34.8333 15.8234V27.2595C34.833 27.8611 34.6649 28.4511 34.3478 28.9624C34.031 29.4733 33.578 29.8858 33.0398 30.1535L23.4411 34.9528C22.9919 35.1775 22.4963 35.2947 21.994 35.2947C21.4918 35.2947 20.9964 35.1777 20.5472 34.9529L10.9475 30.1531L10.9452 30.1519C10.4071 29.8808 9.95535 29.4646 9.6411 28.9504C9.32739 28.437 9.16312 27.8464 9.16673 27.2448L9.16675 27.2417L10.0004 27.2475H9.16673V27.2448V15.8239C9.16705 15.2223 9.33518 14.6322 9.65222 14.121C9.96906 13.61 10.4221 13.1976 10.9604 12.9298L20.5592 8.1304L20.5611 8.12948ZM21.3031 9.62267L11.8706 14.3389L22 19.4036L32.1294 14.3389L22.697 9.62267C22.4806 9.51531 22.2416 9.45905 22 9.45905C21.7585 9.45905 21.5194 9.51534 21.3031 9.62267ZM10.8341 15.8241C10.8341 15.7785 10.8362 15.733 10.8401 15.6878L21.1663 20.8509V33.3983L11.6955 28.6629C11.4352 28.5315 11.2159 28.3297 11.0638 28.0809C10.9116 27.8318 10.8321 27.5452 10.8341 27.2533L10.8341 27.2475V15.8241ZM22.8337 33.3923L32.2967 28.6608C32.5576 28.5312 32.7772 28.3313 32.9308 28.0836C33.0844 27.836 33.1658 27.5504 33.166 27.259V15.8243C33.1659 15.7786 33.1639 15.7331 33.1599 15.6878L22.8337 20.8509V33.3923Z",fill:"url(#paint0_linear_3546_7073)"}),jsxRuntimeExports.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M10.8341 15.8241C10.8341 15.7785 10.8362 15.733 10.8401 15.6878L21.1663 20.8509V33.3983L11.6955 28.6629C11.4352 28.5315 11.2159 28.3297 11.0638 28.0809C10.9116 27.8318 10.8321 27.5452 10.8341 27.2533L10.8341 27.2475V15.8241Z",fill:"url(#paint1_linear_3546_7073)",fillOpacity:"0.3"}),jsxRuntimeExports.jsxs("defs",{children:[jsxRuntimeExports.jsxs("linearGradient",{id:"paint0_linear_3546_7073",x1:"22",y1:"7.79167",x2:"22",y2:"35.2947",gradientUnits:"userSpaceOnUse",children:[jsxRuntimeExports.jsx("stop",{stopColor:"white"}),jsxRuntimeExports.jsx("stop",{offset:"1",stopColor:"white",stopOpacity:"0.7"})]}),jsxRuntimeExports.jsxs("linearGradient",{id:"paint1_linear_3546_7073",x1:"22",y1:"7.79167",x2:"22",y2:"35.2947",gradientUnits:"userSpaceOnUse",children:[jsxRuntimeExports.jsx("stop",{stopColor:"white"}),jsxRuntimeExports.jsx("stop",{offset:"1",stopColor:"white",stopOpacity:"0.7"})]})]})]}),Injected=({...o})=>jsxRuntimeExports.jsx("svg",{...o,width:"32",height:"32",viewBox:"0 0 32 32",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntimeExports.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M15.6505 3.64041C15.6501 3.64062 15.6497 3.64083 15.6493 3.64103L6.05165 8.43985L16.2501 13.5391L26.4484 8.43987L16.8508 3.64103C16.8504 3.64083 16.85 3.64063 16.8496 3.64043C16.6632 3.54806 16.458 3.5 16.25 3.5C16.042 3.5 15.8369 3.54806 15.6505 3.64041ZM28 10.4592L17.5001 15.7091L17.5 28.5205L27.248 23.6465L27.2508 23.6452C27.4757 23.5334 27.665 23.3611 27.7973 23.1477C27.9297 22.9342 27.9999 22.6881 28 22.4369V10.4592ZM15 28.527L15.0001 15.7091L4.50006 10.4591V22.4333C4.49831 22.6849 4.56687 22.9319 4.69807 23.1466C4.82896 23.3608 5.01696 23.5342 5.24095 23.6475C5.24148 23.6477 5.242 23.648 5.24253 23.6483L15 28.527ZM14.5207 31.0824L4.12104 25.8826L4.11759 25.8809C3.47681 25.558 2.93902 25.0625 2.56486 24.4502C2.19154 23.8394 1.99597 23.1365 2.00006 22.4207V10.0486C2.00044 9.33234 2.20062 8.62972 2.5781 8.021C2.95529 7.41274 3.49457 6.92167 4.13537 6.60291C4.13585 6.60267 4.13633 6.60243 4.13681 6.60219L14.534 1.40359L14.5368 1.40221C15.0692 1.13767 15.6556 1 16.25 1C16.8445 1 17.4309 1.13767 17.9633 1.40221L17.966 1.40358L28.3633 6.60219C28.3638 6.60245 28.3643 6.6027 28.3648 6.60295C29.0055 6.92171 29.5448 7.41276 29.922 8.021C30.2994 8.62973 30.4996 9.33168 30.5 10.0479V22.4376C30.4996 23.1538 30.2994 23.8565 29.922 24.4652C29.5448 25.0734 29.0056 25.5644 28.365 25.8831C28.3644 25.8834 28.3638 25.8837 28.3633 25.884L17.9664 31.0824C17.9663 31.0825 17.9665 31.0824 17.9664 31.0824C17.4316 31.3499 16.8415 31.4894 16.2435 31.4894C15.6455 31.4894 15.0554 31.3499 14.5207 31.0824C14.5205 31.0824 14.5208 31.0825 14.5207 31.0824Z",fill:"#CCCCCC"})}),WalletConnect=({background:o=!1,...et})=>jsxRuntimeExports.jsx("svg",{...et,width:"32",height:"32",viewBox:"0 0 32 32",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:o?{background:"var(--ck-brand-walletConnect)"}:void 0,children:jsxRuntimeExports.jsx("path",{d:"M9.58818 11.8556C13.1293 8.31442 18.8706 8.31442 22.4117 11.8556L22.8379 12.2818C23.015 12.4588 23.015 12.7459 22.8379 12.9229L21.3801 14.3808C21.2915 14.4693 21.148 14.4693 21.0595 14.3808L20.473 13.7943C18.0026 11.3239 13.9973 11.3239 11.5269 13.7943L10.8989 14.4223C10.8104 14.5109 10.6668 14.5109 10.5783 14.4223L9.12041 12.9645C8.94336 12.7875 8.94336 12.5004 9.12041 12.3234L9.58818 11.8556ZM25.4268 14.8706L26.7243 16.1682C26.9013 16.3452 26.9013 16.6323 26.7243 16.8093L20.8737 22.6599C20.6966 22.8371 20.4096 22.8371 20.2325 22.6599L16.0802 18.5076C16.0359 18.4634 15.9641 18.4634 15.9199 18.5076L11.7675 22.6599C11.5905 22.8371 11.3034 22.8371 11.1264 22.66C11.1264 22.66 11.1264 22.6599 11.1264 22.6599L5.27561 16.8092C5.09856 16.6322 5.09856 16.3451 5.27561 16.168L6.57313 14.8706C6.75019 14.6934 7.03726 14.6934 7.21431 14.8706L11.3668 19.023C11.411 19.0672 11.4828 19.0672 11.5271 19.023L15.6793 14.8706C15.8563 14.6934 16.1434 14.6934 16.3205 14.8706L20.473 19.023C20.5172 19.0672 20.589 19.0672 20.6332 19.023L24.7856 14.8706C24.9627 14.6935 25.2498 14.6935 25.4268 14.8706Z",fill:o?"white":"var(--ck-brand-walletConnect)"})}),MetaMask=({background:o=!1,...et})=>jsxRuntimeExports.jsxs("svg",{...et,style:o?{background:"linear-gradient(0deg, var(--ck-brand-metamask-12), var(--ck-brand-metamask-11))",borderRadius:"27.5%"}:void 0,width:"32",height:"32",viewBox:"0 0 32 32",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntimeExports.jsx("path",{d:"M27.2684 4.03027L17.5018 11.2841L19.3079 7.00442L27.2684 4.03027Z",fill:"var(--ck-brand-metamask-02)",stroke:"var(--ck-brand-metamask-02)",strokeWidth:"0.269931",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntimeExports.jsx("path",{d:"M4.7218 4.03027L14.4099 11.3528L12.6921 7.00442L4.7218 4.03027Z",fill:"var(--ck-brand-metamask-08)",stroke:"var(--ck-brand-metamask-08)",strokeWidth:"0.269931",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntimeExports.jsx("path",{d:"M23.7544 20.8438L21.1532 24.8289L26.7187 26.3602L28.3187 20.9321L23.7544 20.8438Z",fill:"var(--ck-brand-metamask-08)",stroke:"var(--ck-brand-metamask-08)",strokeWidth:"0.269931",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntimeExports.jsx("path",{d:"M3.69104 20.9321L5.28117 26.3602L10.8467 24.8289L8.24551 20.8438L3.69104 20.9321Z",fill:"var(--ck-brand-metamask-08)",stroke:"var(--ck-brand-metamask-08)",strokeWidth:"0.269931",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntimeExports.jsx("path",{d:"M10.5327 14.1108L8.98181 16.4568L14.5081 16.7022L14.3117 10.7637L10.5327 14.1108Z",fill:"var(--ck-brand-metamask-08)",stroke:"var(--ck-brand-metamask-08)",strokeWidth:"0.269931",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntimeExports.jsx("path",{d:"M21.4576 14.1111L17.6295 10.6953L17.5018 16.7025L23.0182 16.4571L21.4576 14.1111Z",fill:"var(--ck-brand-metamask-08)",stroke:"var(--ck-brand-metamask-08)",strokeWidth:"0.269931",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntimeExports.jsx("path",{d:"M10.8469 24.8292L14.1647 23.2096L11.2984 20.9717L10.8469 24.8292Z",fill:"var(--ck-brand-metamask-08)",stroke:"var(--ck-brand-metamask-08)",strokeWidth:"0.269931",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntimeExports.jsx("path",{d:"M17.8257 23.2096L21.1531 24.8292L20.6918 20.9717L17.8257 23.2096Z",fill:"var(--ck-brand-metamask-08)",stroke:"var(--ck-brand-metamask-08)",strokeWidth:"0.269931",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntimeExports.jsx("path",{d:"M21.1531 24.8296L17.8257 23.21L18.0906 25.3793L18.0612 26.2921L21.1531 24.8296Z",fill:"var(--ck-brand-metamask-06)",stroke:"var(--ck-brand-metamask-06)",strokeWidth:"0.269931",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntimeExports.jsx("path",{d:"M10.8469 24.8296L13.9388 26.2921L13.9192 25.3793L14.1647 23.21L10.8469 24.8296Z",fill:"var(--ck-brand-metamask-06)",stroke:"var(--ck-brand-metamask-06)",strokeWidth:"0.269931",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntimeExports.jsx("path",{d:"M13.9877 19.5389L11.2196 18.7242L13.1729 17.8311L13.9877 19.5389Z",fill:"var(--ck-brand-metamask-09)",stroke:"var(--ck-brand-metamask-09)",strokeWidth:"0.269931",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntimeExports.jsx("path",{d:"M18.0023 19.5389L18.8171 17.8311L20.7802 18.7242L18.0023 19.5389Z",fill:"var(--ck-brand-metamask-09)",stroke:"var(--ck-brand-metamask-09)",strokeWidth:"0.269931",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntimeExports.jsx("path",{d:"M10.8468 24.8289L11.3179 20.8438L8.24561 20.9321L10.8468 24.8289Z",fill:"var(--ck-brand-metamask-03)",stroke:"var(--ck-brand-metamask-03)",strokeWidth:"0.269931",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntimeExports.jsx("path",{d:"M20.6821 20.8438L21.1532 24.8289L23.7544 20.9321L20.6821 20.8438Z",fill:"var(--ck-brand-metamask-03)",stroke:"var(--ck-brand-metamask-03)",strokeWidth:"0.269931",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntimeExports.jsx("path",{d:"M23.0182 16.4565L17.5018 16.7019L18.0122 19.5387L18.827 17.8308L20.7902 18.7239L23.0182 16.4565Z",fill:"var(--ck-brand-metamask-03)",stroke:"var(--ck-brand-metamask-03)",strokeWidth:"0.269931",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntimeExports.jsx("path",{d:"M11.2198 18.7239L13.1829 17.8308L13.9878 19.5387L14.5081 16.7019L8.98181 16.4565L11.2198 18.7239Z",fill:"var(--ck-brand-metamask-03)",stroke:"var(--ck-brand-metamask-03)",strokeWidth:"0.269931",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntimeExports.jsx("path",{d:"M8.98181 16.4565L11.2983 20.9718L11.2198 18.7239L8.98181 16.4565Z",fill:"var(--ck-brand-metamask-10)",stroke:"var(--ck-brand-metamask-10)",strokeWidth:"0.269931",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntimeExports.jsx("path",{d:"M20.7901 18.7239L20.6919 20.9718L23.0181 16.4565L20.7901 18.7239Z",fill:"var(--ck-brand-metamask-10)",stroke:"var(--ck-brand-metamask-10)",strokeWidth:"0.269931",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntimeExports.jsx("path",{d:"M14.508 16.7021L13.9878 19.5389L14.6356 22.886L14.7828 18.4788L14.508 16.7021Z",fill:"var(--ck-brand-metamask-10)",stroke:"var(--ck-brand-metamask-10)",strokeWidth:"0.269931",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntimeExports.jsx("path",{d:"M17.5017 16.7021L17.2367 18.4689L17.3545 22.886L18.0121 19.5389L17.5017 16.7021Z",fill:"var(--ck-brand-metamask-10)",stroke:"var(--ck-brand-metamask-10)",strokeWidth:"0.269931",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntimeExports.jsx("path",{d:"M18.0121 19.5388L17.3545 22.886L17.8257 23.2099L20.6918 20.972L20.79 18.7241L18.0121 19.5388Z",fill:"var(--ck-brand-metamask-01)",stroke:"var(--ck-brand-metamask-01)",strokeWidth:"0.269931",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntimeExports.jsx("path",{d:"M11.2196 18.7241L11.2981 20.972L14.1644 23.2099L14.6355 22.886L13.9877 19.5388L11.2196 18.7241Z",fill:"var(--ck-brand-metamask-01)",stroke:"var(--ck-brand-metamask-01)",strokeWidth:"0.269931",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntimeExports.jsx("path",{d:"M18.0615 26.2917L18.0908 25.3788L17.8455 25.1628H14.145L13.9192 25.3788L13.9388 26.2917L10.8469 24.8291L11.9267 25.7126L14.1155 27.234H17.875L20.0736 25.7126L21.1533 24.8291L18.0615 26.2917Z",fill:"var(--ck-brand-metamask-07)",stroke:"var(--ck-brand-metamask-07)",strokeWidth:"0.269931",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntimeExports.jsx("path",{d:"M17.8258 23.2096L17.3546 22.8857H14.6357L14.1646 23.2096L13.9191 25.379L14.1449 25.163H17.8454L18.0907 25.379L17.8258 23.2096Z",fill:"var(--ck-brand-metamask-04)",stroke:"var(--ck-brand-metamask-04)",strokeWidth:"0.269931",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntimeExports.jsx("path",{d:"M27.6806 11.7552L28.5149 7.75041L27.2683 4.03027L17.8257 11.0387L21.4575 14.1109L26.591 15.6128L27.7296 14.2876L27.2389 13.9342L28.0241 13.2178L27.4156 12.7465L28.2007 12.1478L27.6806 11.7552Z",fill:"var(--ck-brand-metamask-05)",stroke:"var(--ck-brand-metamask-05)",strokeWidth:"0.269931",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntimeExports.jsx("path",{d:"M3.48486 7.75041L4.3192 11.7552L3.78916 12.1478L4.57441 12.7465L3.97566 13.2178L4.7609 13.9342L4.27012 14.2876L5.39892 15.6128L10.5325 14.1109L14.1644 11.0387L4.72164 4.03027L3.48486 7.75041Z",fill:"var(--ck-brand-metamask-05)",stroke:"var(--ck-brand-metamask-05)",strokeWidth:"0.269931",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntimeExports.jsx("path",{d:"M26.591 15.6122L21.4575 14.1104L23.0181 16.4564L20.6919 20.9716L23.7544 20.9323H28.3186L26.591 15.6122Z",fill:"var(--ck-brand-metamask-01)",stroke:"var(--ck-brand-metamask-01)",strokeWidth:"0.269931",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntimeExports.jsx("path",{d:"M10.5326 14.1104L5.39897 15.6122L3.69104 20.9323H8.24551L11.2982 20.9716L8.98168 16.4564L10.5326 14.1104Z",fill:"var(--ck-brand-metamask-01)",stroke:"var(--ck-brand-metamask-01)",strokeWidth:"0.269931",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntimeExports.jsx("path",{d:"M17.5018 16.7018L17.8258 11.0381L19.3177 7.00391H12.6921L14.1645 11.0381L14.5081 16.7018L14.6258 18.4883L14.6356 22.8856H17.3546L17.3742 18.4883L17.5018 16.7018Z",fill:"var(--ck-brand-metamask-01)",stroke:"var(--ck-brand-metamask-01)",strokeWidth:"0.269931",strokeLinecap:"round",strokeLinejoin:"round"})]}),Coinbase=({background:o=!1,...et})=>jsxRuntimeExports.jsxs("svg",{...et,width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntimeExports.jsx("circle",{cx:"10",cy:"10",r:"10",fill:"var(--ck-brand-coinbaseWallet)"}),o&&jsxRuntimeExports.jsx("rect",{rx:"27%",width:"20",height:"20",fill:"var(--ck-brand-coinbaseWallet)"}),jsxRuntimeExports.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M10.0001 17C13.8661 17 17.0001 13.866 17.0001 10C17.0001 6.13401 13.8661 3 10.0001 3C6.13413 3 3.00012 6.13401 3.00012 10C3.00012 13.866 6.13413 17 10.0001 17ZM8.25012 7.71429C7.95427 7.71429 7.71441 7.95414 7.71441 8.25V11.75C7.71441 12.0459 7.95427 12.2857 8.25012 12.2857H11.7501C12.046 12.2857 12.2858 12.0459 12.2858 11.75V8.25C12.2858 7.95414 12.046 7.71429 11.7501 7.71429H8.25012Z",fill:"white"})]}),Family=({...o})=>jsxRuntimeExports.jsx("svg",{...o,width:"120",height:"120",viewBox:"0 0 120 120",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{backgroundSize:"100% 100%",backgroundImage:'url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAALQAAAC0CAYAAAA9zQYyAAABQGlDQ1BzUDNDAAB4nGNgYHyQk5xbzKLAwJCbV1IU5O6kEBEZpcD+iIGZQYSBk4GPQTYxubjAN9gthAEIihPLi5NLinIYUMC3awyMIPqybkZiXopc+xz3pvOzD4rlWyascy2VY8APuFJSi5OB9B8gVkkuKCphYGAEuoZBqbykAMR2AbJFkjMSU4DsCCBbpwjoQCC7BSSeDmHPALGTIOw1IHZRSJAzkH0AyFZIR2InIbFzc0qToW4AuZ4nNS80GEhzALEMQzFDAIMxgzMONWxgNc5AaMCgCAov9HAoTjM2gujicWJgYL33//9nVQYG9skMDH8n/P//e+H////8GBiYZzEwHBBB6G++z8Bgux/EQoh5AfkbzYHBtBUhpmHBwCDIxcBwoqIgsSgRLMQMxExpmQwMn5YzMPBGMjAIXwDqiQYAOQZcLsEClb4AAGmfSURBVHgB1b0J1G3HVR6497n3/98o6Q0anubBludJeAiTbYwd2gGC6UACBFZY7gVNB3CaJEB3VhbQhNW9OtDQkAYSIOkEGhJCGJrEBGzJkrEsT7Jky5JszXrSexqf3qw3/v891TXsvWvvferce/8nyabrvfPfc+rUqdq166u9d+06pwrP+/CHA3AI8RQRmqFxbyRliVdpcSQ9jj27IASwdAVHVxi7l65hcZAn6NlFdOOce4vCgB5Fc5iXdiN1abSFP1/2PrRoUtiYR/Oy9C9Tr7EwNVc4pwojTDFxC0CMI2nH8hwlhX4D5ZOvWwzy9cHlS8FlzhfwZNlyDN2pPlSXwT0VAtd7yTL8+SDuHOvCzzKdyOButIeuj6HfpTXtu8Ew3WD6NpjnALnFuI1IPB9GK0n5ZiCM9H4GyTJhLqAX1GHZMoJK70Etp0tK4nlhLqBfQF08CFnAgPrN8SHMz0N1YmjluYGwNKDnSeV5DEOnttHnpZ7fKBDyuWJWUHnKqWLUsgyaJ4WbjT2nDv56TCWL6gaw0vklrAv/vpD2mNcWrTpAI00+H9G0G5XWU/1gs8fBSCM1gMq/Y/d9BzD3WiqUpS4zQakyBkDQ6k7HQ5uZi4CgQepphJE66DiuC9PM57lcpsU1auA6Ul1Q1S399o6mF1qXFDq5NbyHqi7QoBmZ5wp8wdn+3G6o6qifRV0vQ3QtbxGwPUbT+RSXeEj/NiUyqQwP5BaIOw8Gl94HAwTKS0viXkk1fejeru02k2+jrNb1gE7d4GA7YwtEYYEtHyhN0HWh6/Q7AQV4bmidPwzDaF00rbpdGnHQqI+vh26LoPjNdQCi3XeAlL7zcaA6g5PYCDBqMup70xahvpK2DkMACmjVvc4904EFApL08dJgAAxVUX3OTEIlFcYYigooPi9fZ0nPtCj6fKPr+2MSD+fUARzNDBCJ0yBR9ZT6qjKC8jRImcxfvuf4b84pLXBdsG1bG94pLSL00i0taHpdP4rv6XnoOiut1aDSaCyYI3AV7aM29KAyc1QwNqSyZ5gHdEcM7kbyaAXfmOYg5vaF2MrQxCzFGFZ3Oj9dH98xPc263t0YQKAdPCA0CHxn1CDo+Z4ysSQvrovTPjkksHCdoLYDtOpCaY3AAZgvYBjABFShWdGfjs7VKcepugSiS3dK/6vt80HHUnVfalA4b2CHDROCG1uDmM87dd4Cgy5HiG1I2OB6uwEC9VhOhxosytZrSSAg2nU9dZ2wRT+MaB+mXwdtd7pD6qJA3ENtQCOxAYZ2d6M+Y3w2dQEL9rntQXXSAGOaO2f+zcACGZVwMRJZ5QtULxE+/OvKHAvTFhMs7bZx5XyOVNZg7kAxT0nkTkmNVNFunoRz6rZXKi4xxvR2YhoDm5ntJRxxroJhBMQtIHe+vj6e8muBTMwKJgFqg/eUV0/8aNWnWRfn/QBV/gDUrh2w0Un9PZMv063axEtfXxehn/JhgdNzHRoDQM2fWiU12Hb3OMyV0K3KeDAbadUA8AQsIDqVRqS1VndOOoCuWCBmIavgdE0MI/D2JCl61eAi7RSYWVWO1Rddp9QN7evQAnk5tJyRUgemknQ6rgMfyozyoNHqfTDo1PWAtkQWuhttxveB6lDqpWtQz7XG0HTqw8fNFF3mOWU+5eKcRNYSG6AN6qk2wNHZKWJPkgqQHstSFZxUpvOJZhTlNaHryQig828AwBFzoFQ0MQ8ziDOYMTGhJ6akhq+gnjGoYWjD8YBEQK0GFbrjAYyD2AAhd6KSFQNZQBCcOMDaTj1wfahjgjU5pB7U2B1UbcPqfCDJuC6qzYxWTPGR3xPTBqm9dD1R6gLAHdO2SSDaU6MJX/u+CA3XMWdES0edk6UzUr14nNDxs/QrfnPlANBSnmkKCsNTQ6gGk+r1A3uR47ykggrmibrWcRbQLOGGErEVqkRT6jjm2qtG5/MJAXwGwajApunhB0QODFrTtECd03VWwmk+1QqEobnBEjrTXkDOkjkBYUIgSHGmkyIaST/wCuCQnk4ETW2TBOSBSei1UkMDcJlFkBBPu0mhnwA6I3BO0nlMs574SrydoRt7Qe0A2VRRYDbjKIVRI6kpvpgcaJWjrkCnC8Wh50I3rkhhdT1RQJ5AZaIBNjZUdqOHDtSub2xEB+5YTpSQM2ApUk0PaA0wEF3Du/qBBcBE1Vnbn1wXAKtxuNzg6qCBrTtlp0FO5Zl0YMHMdeBfDUoteSe+ftxhVVov3TWPQNOv24bbIZ33SaOU81mU4h1pmBkdPEBE6rg6yLgIQAb1fvAbPF0UN5hY0b3GxI+AWYOXwTzRYCYglHN7TzPQgDoUM0QTUCUrSzEl4bCaGTOodhoDPEvr9Gwo5kp+tsOB71ZLpPpb6DYN7+qLyBpJaRwYDqiCrouugx8HxLqzNJ5BBbnutMYT4iUoCYNkBhWTCJrmoBU0heaJ/Or2BlUbMjWAgdww9aCAWOoQUnukMgjY8VgHEBM3g5qvCcAz6vxsZg0EkBIOmsfW5OCEKpGW2PMkM/fwdD51gJ4OAA71GfRmS2oAa9MOJxpIMkOpeJZiufGKqVFUNWSmiS2HKObKhJiuxw8AUMtnerDS5U2nOh6gdMD1YL5hFZYChfpbxwDa/scMBLYnRf1C6aCdgF55CAhMpmWx2vBm4Ad2LMNAnrTa1LW/RkVQvz0SqEmbzLDSOyOAI4E4CyqlTGYAYusz9tiG7uhX28/efQsNoFsJ7aTVIjNDwAkV2CsUxyCepgEIn9MzU8VII6mBTZxu0Mm4LxZgFk9HH9hOLoydEUNnGeCJjpAlQxo4zrB6C/TslkhodLYmWM1R60qgRjAdskq5CuiuYkB0pAZzoQVIqiHVAXPdZoE7axBg8AAraFDTL41ATVsyLRMPaAJz4k+HOJDURZr7+tiKsJZhM7AnwTIjzZN+14nvqdz19BsHjetprBH6iq0krWO8ES5OUouzAut7MQxs78qbagaAIV7hSR2+FwuDSBJPiTHTzsalgqY0us73FSgK07vCQG0OKsIDeQuyT0M1fC82clFjEwZ1aphQ8u9j3myKGFCr+gFJBRiRVtV0AiPhJtToDPTKJwvu5KGRupBUyx0T2EYO1VSCamumDjkDZUqxlA7VG1AHuEPtqr0YRiKHInSqhq0dtQ7WM+VO42DtlCylCdgzoT+QidFl4dLFmGw/0zQ3BvqNQM64i/HrDNqgXsrCOkcR9GA4uPc7FKiH73JQZtq3DNBQXQrMGsgGxJHQBOQVD/RScJVwWCUgWEEjhBYGBlHB1b5ij0Yqm+w1sTeBwIDk4bAN4AdTnZNqbFMycLWZNAUwEk1AQLDNT5PNL1PtSH+oSPbozUgDyYAqJliPfzU41sksYcnNklGm+509WQFNNjSoekDxykwRlLSm9KFAll18bIYBtbuRNsjjGDVucQIl//ZdHiCugRWWeZzUB4lc122OzMnqj0elVVEBHxRd1YbGxswSWneOPrRknjgJzQBeSQXEXlriC4jzgWAGi2xf8UBjU6zohaurcPnmzXDhpk2wfTrN6VJYiww4urYGz545HY8z8FQ8nl9fJ3VTGmad6ElgTnlP2FOAIICBUAEFaAFQzQ0w9r4e3IrXgyVYKEp4c6J902a4YssW2BXrcIGifT0mObJ2Fg6ePQvPpuP0aTg163MjBCqnF7o7GkwFMg0YLKTaMZCEZ5+8FUwMYgxBBniTGDPpap0Sz/PAkbr6aqR9T+T3ZYnvkfYdK6uwQoPztShNj6yvwcHI70OR/wfi71oocnKSNVDRmKklspuuLzRnV12H1L4I1P0K3mKesZoQLRAxwQCgvl0Itl49COKNIBLhBM5tJ+2Lbb+z9zUXScUgJRBHBqxgjVtByEcBeKxsVwBfGFmBsDsy7y07dsDrLjgfrti61fiijXoBG1Lc/pOn4LaDB+ELR4/CExHoE6h2bx6ksInCg8v0r3MAgDqZoDutsZs7HhBSJ8y9IsDO1RV4285d8MZI+1WRdmjQPhYeO3kSPnv4MNx97Dg8d/ZMAW/uOB3Z0oX2DBJkSVht7p5MFxYG0oaBtARWLcJ1wcD+4BA73Ap89a6d8NadO+G6bduk8y0KqaxHnj8Bdx45DPcePw6HI8iZ71nDTAqPOnLfFewEKLosZDv6LCIBtmfXjwCbQd0pHgplJJmDaT9Kt+MjHwk8KzaQ0NAYAPJvNicSgK1kLkeXpfCKiqu2NKu3ItleFpn4zgsvhOu3b4ctkwm8kHB6NovgOJLB/cCJE1k6BG50UDNxoQ5okMSz7rzae6HtzokAuaS7LoL37ZH2V5+3HbZON/w1mwlnorS668hR+EwE94PPP0/mRPWArIdgBl3F2xGMXz6HUA2PjqU0qAF3KGB/VaT5a3ftjkDeAdsi7QHOPSS+fz7Sfnuk/eHIdx6j5MkUoj0da3Tocx233vO9XsxGGUuE6n/n+vo3FLOpvDMCWrtl6mDASWMA671g4HYKzPE+S+gVksgrnQI0VKYmc+JvXroHXhGBPO06eDFDqmgCx588+SQ8dupUUUuIakDGDAABM1uKqEAsPmg2LWg0tCNKte+96kp4RQRFt6REWzakBrvv+PPwB/v3Z9Ok0A7i1eBJojqrCKJ1St1BNA2bUEDSOMTEF0VT4u9ccTm8MWrDTS8y35O34gtHj8EHn34q0r5WXHohmYAgIE6/ZxuA1qBOgF4nQK+HOljWM6UMaDZD+Bp33Xxz0CaHnhmc52NOYNbSeVWBd8VdywCQ7Ll3XXQRvOfii7JkaIWNSosxSCVb+2PPHYQ/fvIJksQo7wME9aAfQ0xATUJAsTETs1L811+4G755z55RbfJi0v6JSPtHDhwgW5VnRosZUj02QTSOJyKra3LzrcZn3x35/k2XXAI7VlfgpaT9yNnE9+ci7c/KmCWZSwLoBFqwYD4bO0MaNM76XtLMwIGaB8TpnREqS795mTvurltuCaJuQzBvvlW7y87wMWjT+aoyMzKQs6nRxQFGBfOUpNv2CIIkHb4q2msvBkOXZfDnjhyB33p0b2Za1j7Kfg5gvTnFi6EnWbJ+jwDu4G9dfjm8ddcu+HLSfmek/T/t2x8HjzOlaQqoxdMR9Dsiyk/bFzAngfM9V14B74yA/nLRnvL89KFD8B8j7Wtk+qUB4zowgIskzucB5HyNJHO6z+aKMT+CMrNC48MHA2iwgz8D6K4TG9hIZgEzCLg3sX0NNOqMBe6Oqu6HrrsWLo+j/40GPSgcY+BY4LTPxFH5P7/vfng+AmNKkpols6TDAuKJPFsAcX40MX7k5S+Di6IHwOcbXkKaOSTT41cfeih6SNbFF6xfudQ0VDdnAcN5UYj841dcD5cpvnvazoXmscGuj9sXTb5/8eBDcCJ1yA5zR0yS+GwC9qzPQD4DUCV1qCA+21vTQ3zxLVDT0XkwyygZ3bsWQC4eBOuLJjuT/bJTSsv2cpIS26YT+B8jIOaBOcw5ACzzwxLpfdqLIxj/yateCTsjLezDLrOWoUz6xCN1wNUcTxM+8cGdEcwfePnLDZiXpWEjNM9Lm9x/P3jttdF2n+aIRHv2HvFv5j/Vg/hfbP0p/Nj1L4dLI99btL0QmmHJuOS+/PFXviK6AKcZC0lIVCFZvDlm4goAzNt/+gDCKGITsymY2Vk5x6HbLoOYZv8Q0cyUsSuLz6eB3paKPWwaH/yxCIjdDhAA4yB8oWEsz+TT/tFIy7YotbJ/FoqfXA9icx1K14etUdP8wHXXRdpXR8v5ctCdQgLlD0RQbyVbMQsNHnhD0pQdTV4V03FTbKvUEa9wbkRd1osdxvJMwuSHIh+3RH5mUCczKJDQwzp/IJNYIRiBarCovEwcPE6rVG4k4BlCfmlHu4D8Sy/sh8xqi1Tf9111VXTUb5HWCvqAL++RQmrg74r2JKT3B/o+D/hEYkDxj2fAxOM7or1/6ZbN0lhfrqMfof2yrVvgu6++Kr8TAQQMkWpQ/L1pliIB5TuvuCLWdcuXnfYW3SlcRXzPcQqU5lVWsO/PdAp7nZPMgxluCnV4pG1JgIGETrf1K5R62rcQRUzNPE1+xB7ee8nF0c+5SzLVFQwNTmuwvxghjFy/OQ7s3hcHeOkLizRb1ZG0Tu8cYF80y7suvhjeSIPXVj4vEomjYYz2115wAXxDpC3RWKamifaYgGl/T/RkfG30j4/l81LS7vPX52+LfH9XpCthIwuTAFkay3Q8VN8/v5ZbDmhaDC1wdwMgq0FhzdD2EHnHFqDOygHbL2UgtXtlJYOCy9Ijz6B+5RysGmkBeyMNEUae4eu3RffbxXGKOvFWXm/MXoEeLki077lk8Py5gOFcaB4rj8+/Mfrvz4/2cT8rHbC8OlDAvCvOuL7z4osG+W2E9hdCcyten39LpP3S1U3lDUEynXhsVj+WAPNujFgIjEXKK3umDCaR3zdBaAE7hQ6UkR7Um1dQ3+LStk5ShcmX+LejykvA4AoxOMNYhdGCXqQ6Abtn6Q3LHbAgPvnA33fl5TCLo+9AhfDvt0Xa03sNPh9Ysuxl6Fg2bav8RNu3RA2TrvI3lUR3mtj45ssugy1q5u/FouNc+Qzu/LyIif82mnKJ1uyfCEraOiBrSZzGb4IxJZH1dQG2KlQjXq7pqvYO/Uph8QTwb5J2aaYnzf69Kc5E+RoGOg/+gJGggM00eft7meAZy9evjur7+jjb10dQJ2CvR4l37bbtMf78QVqfz5crjJX/hl074cpol84izcl0Sr9Xb9sGN+zeJWm/krTPK+/1ke/plYdEM7/fzC9KCZC1V0OeVBIZrEbnIINCbTvbN++GtrQBNhFUZqSi37CfwTuiAz+5YzJTcQnGkgTmY9DjvfSmZzY6uHRF5uPN0aY7G8GcfaKR9q+O6ppnE33ar/QB7vyrI5+TPbq2Pst1+Np43QLyV5pWH59ej/jr0aRLUrr40QO9C88vMhG20L71yVhMQeNUBzOZrxN7/Egvol+2oXMhGVTllcH0rsCbd9XB1DKAA1eWGRx6JKrE6MySdm+hNCPlJkm3ParB9HLQjmjbXRslNkC7cb5SoQWQFF5NLxYl2tNk1us03+ErS/uA38Eerzv/fNgZ+Z60S5bSYSg8BWuUZwuT4OI6j3C9iqjpHfyk8QNW8Zu+8k3S+YZoamzuJpaZDqCtwd4ouAFGvR+BEjMjFqVtSY80A/raHTvh9NpaNjW2OvtT/4LLw9/zYUEfW5i2Va4+ki39mgt2RNrX4U27d2fJt0g6Amyc5jAvrQYqzOlMzgmQbOmviTRnKd0HSay/jClvWllvhuDVu+1kzDdyQ//1lCGpB21upJ6WiHt7GmEzfaqiwgBo91h9T38q5cOoaYJDcoNKp6vg6bkhejwSU18f7U//OuY8UMwDzyIwLpMWRtLo+K+6KJlM6/CGSPsi8J4rzfk6WN7XT9nASqAlAueb3HjrNAaQdesIECZbusWYRBwvrJgcPBhEhwh1qW1oLUoLcPpsbqR3Oa7Zus2+orlMMOIYqKcOogwdfHPgs2ZzREVpid2i6Yrt2+DKaGpcFgcqPixdh69QuChO/FwaeZ7q4MMLpd0IHGXmedNg9Hn368PLIs83T8qSDcnlmIM1ksupLgRdMu2hQ2wsY8CJWnlnFcCfvDCxxXZOg5Mr4/RsNufnSEU5H6slMasPrmyowPb0ttKaHsGnrYehfLz7/a98BWyaTJqS8K9K8OSn8+Si++HXvUZo1/LmnGhXHb8lCJfOM7QvjQ0cC0gfdtx19BgNxIORXg0cm3P5rhBqvQfvcmAjgzCH2rKEVcgumEs2bR6kNwM2fQ5O/XFd+grQfA9hYBer7IRWbUMbApwo8WYIh0u3DT+d+qsEZg7ebEjh4q1bBvc3Srsx/RAA8RyedXlou9nPMbBQ27N5c563KFI6qDqotwiDbetyUgnUpE45A6uiw8iKlvy5ePksP3+wG4BeVezzSygepIqmltC00tql5xNDiQNry+LQeQ7UFXeKAYeGQUu8ZVTruaSFBenH6FgE2IV0NDr9WN4BRm4w/9Hauj5/LZUlPQmqHXFwuN6XGc8cJ5KvpA668jqP0OZANTmCRwC6HqJBXpbVKgPR4ktMZsfO6LIbY0aABpBhhOkuk7JiZTud1BXbWTSqpeq0iJBmXxsN55J2o+mXSQtz0hqgIcylKbQyGbFpwlhGMJBBtU2gzNjmla7y6wdxcIjsqXEfwQawcxojKqR+A4X606QqDyxYaPlXypzX880zVfHgT96NdG5wtRJllmVogkrw5/Ix74gEIddKEyXWQqg2dtBV9OmXCBtI+pKl3UhoDZxxUVqvQkbas4X3VnwrTQrJbzyjl9nSnbqVSC2B1zSEUZpraVO9ZpgRYnrWAvVqOQRqqMtQycIuDTUwhmvd+42QNBfjjGlpHNTPeomsymxJa/ldwgTxfWHs2WUat5UNwNDEOJfgeYwNXrQGS0IDQ2OJCmi54mmw5myNSD/5S3bCDkthvY43Y80WhgYAemZX1uXwRJjtD/ggiSrrytFUJS9Ntdb3g3zsicqfajSo7AgnWjakUV9OOiMo6Y3OjgtOKyiEaknuA7rGsDcd6apcHwZAddoE5jy7LMq9jdx8BNtpuYFawqiBfwFmq6eH8WLzvfTuD+Mnf4zc1wWBAjWG4C/Ubwh9EEB7kMivNkEALLAlU6xfIMfrQ2fOwrygwWKkMcVBsCCE0KDNSxmVN5Fd74V2A+j7Uvw825oBho1ygorXtGObJtN/VL76PuCweB1QlTsgtQHkwQCYCup7MJqMXzBbpKX0SQAYdGauc3BpMAyzPr6+Jt9FzqROdUGg1rs9GZshGHwyn6ZjBGu+lAWoSwHF7KjL2aaIQIXuP3lCAGEc8uAq54HrCmaws1aQ4FoX1X2fDUtIkZbqIS2dg6s8qvOA7lmwwJdrBa65aVs0jKQfpNW9YSRt0M+4zqo7aRPgUPntaWNBpNtM918tBExnVcW0tG+i8eDpM/myeMxC9p7NNNbQdSLXiX2Y2loHVwt+URTM7J9soQCgtkwL8PCxYzZ3lrrQICLYiqP8aUgc5rCTKMF3UXAA1M/qcnF4v2VqoEqLwdanNXtViXb5jkk8Fy9pcTytpFEAb3ouNPhCOy8BH47w3AHID/SDa191a3BtOmX9gX0nnidMlQ8VeACY41AJR6jxY9u7pTynLL7NGryZWDRiP73SVwqoawLnRbiB4xAeTUtYETe0lOW6hFYtVY8HJ0m1JNeSkxvJ8XyYt6LBgEpJHANULdl0owebdlAejv9ii8hGPSUtzEkHVnJL3Rp5SRZhPEsxl9x90xah/SxHDPgPDUHUCEWDB7jr0GGpOO/XUsZpYCS0frfHrO+dC6x77ph3OXSFmkcI5uWU+hJRaeWT6zP40tGjlWBVcZM5MyOoHti6Vs9YOmqcgF3HaSkL4xJSD/JETTcaEjXQwdWlBdRBy4/ELUqLjfLcuQGzT9voOIYVaNvItEGjOAN0V2xwYNHtxGj05Dx8/Hgcd52Bmiw4XLmX0EKbxRrYHYQxTquKgj3MwuEApJbLikS3PP1UW2L6YlABERxjW+USsz1t6PI22l9JNX101H99fOvFG7nm3wD23V2+9s/jgrRjecNIOWP0wkjeisd8H4iPqPjX7Bz+NrWFFgAtkOnnTMBKiw4f3L+/rBFNpq3BWAB5+V+RaPvpYGYo1Hc5Br0xhCaIZcX5YFe+LEtsdfCnjz1e1mv2EgOlzLoCaF/j+De4Hu4ldx+cNACwkhpUgxIgOK2Ol3vQAAo4oIzdw0baMPIcNs7DAqAvQ4dLq4OPF0VsUNEGS4ARgOs2ChbUrUOeDWDGYQkjH3v6aUCqgDYtZgrIjDcWnB6bPgxXS5TBoAO3KhChuurqCv8F1M+cOg23PPkUfOtVV7KWg3pSOaMlMmgm4zDeMFeBeHRgFm8eiAPUX/uvN8Itd98Ljzz9bHmJnAYdQHUCfW5Y0GKVC75OX4GAjgGI6pdGl3yetNLVl1wE3/yWr4L3//V3wJ6dO5qg5mphcKBs1FU/Y9pUxfPGR3oskU4/8sST0YlwHLZu2SQTI7LhKNTtLVodRM65/VT81NOq24l3nLITLOU9Dl54G4mxefPytIfKpIM/2/84vPuyS2HTpLG6KDa4xyBtiASHU0D9S8/pdk2ndzyyF3783/4ePPzMgbL1wuoq1YfBqlbsDB7AwXSa5cKLhWzceCqsMSztUF3n866k2H/4KPzGh2+Gm+66B37m7/4teMdrXmUpZyk6B+iDENrxnkYvqz74+OMZK2kfFiD8yC6yAAN7uXo6lM0DNk0Kxm3H6omEtAUwsi8aRUqXtdgrqvKn5t0EbjvwLHzi2WfhGy+9rPoudal8GhYzh/2ixdNimSRpCPgp7dNHjsBP/s5/gMfi6HnTls3QTTrgr9eFKUEDur3Y4cbDQMYtkR4b58uHgmVU1ygS0KwBR+Ixz8LF2ZS9Bw/Bz/z7P4Y/+MkPwIXnn2coCiOdOYTlu62ZA9BgJto+9tRTcMfBg9CtTq0NjTwwrGt56y9jqmljcaf5YTYNkiZBNhXQVLIAuSxAy4tts0rJ2wuThJ5EUP/SPXfDDbt25w9PTd6qsAANldaQ0uLvbIlrVaf08zt/eVtssCOwGsE8XZlGQE/iDVkCR9nwQWyxcnPcLvurGgyUFS9kKwoAMMsApO/30nINa2uwL0rrf/Whm+Gn/vb7hnVWPAdoyqMBDUGZE14ia1v+udOn4dfv/SL0Xfr6e5K1esDi/O1J89e9cJwLD6qQLQJMVZqk8HSebPAyJEAFcJbUNKuTpTP9TiKAJtMJPB5nDX/v4YfgR1/zWjOy1p0GWtKAJQHdN+mGnXLA2Q994V6YblqBlc2bIh0rmR7eT4VHzWIfkqQmWQ3a1Pr/Q/DbaeQ4GvnJFhRpu7wcn+od22wWB+y5k5+FW+970OQnPGAB4u61QmgkYsmsaWP6/t9H98IXo2t38+bV3DbscgoaxIRP3oexVtjZlp4W0CaH2BlhUEGZfqSK9iSlda8pNkiXiVxJ77hGSfDvHnwQrty2Hb7tqqsNogNn7mgzQlqBGHUicNJApU/k7z9yDFY2rWa7eZpWbsoSgF5L5IKdk1zAremDNsMcKXNDeInSChFOl5PlXPmFtF5cR1I7DeLTNlhpQ6J4/vjhozUrJYb1Ng/6RGNA32e6/edP3u34l3Eg+Cv33AMrqyswjeOrpM2hKwLH+J8DezawmhoIRuhUPljMmlFbq8FEMoeqzvI0JZQtEpAkXsZzUh1RVCdCp2m9iPUz8M/uvANu2L0brti2XTJHpdKQKiGMUi1rOr+Xzq4XiPaJHapLpkZaS3lazA1WU9zri7M+iATQqkyX5XnDHaf1vgNAm4e1OkPI6mLQp9WFjKBd6hwqoHl5NqzGdH5c9u7uijadRFCtr88smMGaFyw4vAbVNDNtehZVDgXmJ54/AT/56U+RwEuAnkRaJlmjyN7lAOKA6D0tMAR0K24KDZ7lc2r0uksnmvqwlObBGm+VkBmWiY5Xqz2cOXMWvufmm+DfvvNdcP35F9AmkZYo6fTEiWDfQm2/3O2AzDSD9Ppim+XdmEKdgSrbKBd7LZUle3SEYkblvLyNpKSSLns0YCsNbjytL9NlgQElNQOnjHOwbBQPdQHxkjDfibwJNOZB40vWRQlQwljZNVp2/3XWAS/X9cSJk/C9N90EZ2K61diRVnhsk9sIaG9G/R50FTS8G5h8Fui0g6Y5hc7c1IMk0lu5PtTVOHPvpzbraEQik6E/nRbTI1XgWLTb/v7Hb4UHjx6pPVcfjpONCaAB4b5Ckm9Z4zcDOm+yQwxjpuV9s9PCuVi2HS4b8WBNg/W8z3sFduZ+jW/FdYP82mnxHNI6OmIdNK25LnIfch3T/bQ7a+nENW1S8XkgNumsKefaQeJY7atGD475DH7pXJTggcOH4e/d9JG8WedqBHI6knTuJp3gSBcZNB3KzNCf/8EgroYpqFGwF0b1RR0U/SNTkYhkhvB+00XChdz5yzYDsBIonwDPnj0N33fLzfBPb/gq+JtXX2PVujNDRFqHBoCVamtpZt2oxT/Oe/uhbFzJEkBLAlMO+g7TkK7YkKI6rWHkBtKCq5BPjzpLvbBmbT9eLVb+kOTgvbtzW3WlA4ArqmVe6JccXbOZKqA7v3HfPvi5z34Wjsfx1OYo2FbjuCZJ5zJQ74rggerVYJdw0fb1qyiRcoxB3wkVhqfMS6cxABrXtQdVYHPv7aUiJbfiwpvStG5B5um1s/Czd3wWnj55Er7r5dfDedGW0iZIAMs548NWNKBOr86RmUEHsIQOxcyozvsuL2ySpTiZF1rFNqXPWMAN3NtI2kacviQuS4fmMb0AHRU/gDs6zR1QR2cV7sHMJsigo3s6sJobYi/H4+jZM/DnceLkf7/jzuzx2kxATho7gVkPTGWvcuqsUi7jF2AgtT1PNG3NhWYM0whY+VyjP5SlDMoItPai6oHA7P7tphORGskaOLO2Dr9y793wx48+Aj/+hhvgXXmd48qcAahYuIVKQ3A0GymtGhDZrMh7pPO0Kt3vOqG9NCC9P0CACE1mgJK6MB40gWGDaeflrdIiEYNQec03i2sVqRN38tyMUicu9L6OVDc2LTy4USdDa1boLD7zzDPwC5+7Ex46djSCeKVI5vg7mRavBsrYpjzBZoN0Iqz1GJC3iJfQeJdDp8fGRVCMqB8nltlEFv/lHY+ySHXeeWVSV2fn7eGeOnUK/sFtH4M3X3gRfHeU1u+4LC0yPjHdrSWB5VqBWDc0qywg27MyivbHBm1ysJkSiO7CgaDz9CDrGvdAXaOLgzlpfZqxMJJ3BXX1bBThwa634oPONjPUmThklU6SmkVgUHQEHQfz+1paV+NjTz4Bf/rww3BrnAVcjUJsS5TKCcjpSJIZp8WrUex3EiAde6CoDEQZ2LIlUDRkQ8DAkK0pND/B4i/BRb2PqMNSKGWJaGbeOJ8M7OzIR7OBZ1p+ay322LsOH4Q7Pvks7Nq0Cb7lqmuixL4Krt+xE7bweyCKaiEFhxI7aNpp8ANYJDX7oYsqq1+r16lV8lMj2spR+lbdze+8+EVpF8VBlYrlHBWJhSPsnWHPQpXQJR3PFmY3a+Jbj9U+cNXrnYT2gQVJAvEjcYLkxsf2ws37H4f90S2XgLs1zgGsxl82MVaS63SiwUzg7IY7+labWZXnGTF2j8LiHde70rih2TDV7uGepCdoGHCFoR1lR5t2pj3Bk786VnatW4Nj62vwOw98CX73/i/Ba3buhn90w1vgDbsvqiNrxUwPbFR08UieX/EKaNcRoW+L6QWroDoGCkAss+iLHlAdRvcwGArPSh89q0yKuWkBqixqgUp5BWyfIdrJHu0oF9GgCNVTRav29B2aF314QoNp4l8Wavprnk8+9QT89r33wL0HD8GZfj0DN5sWUwZx8WQkTxeqyZMwUDGoOiWohgzDSoYhL8zkBJ2bdzncyGIYjLejlCIOfCWpAar3gPPN7xbQQjRp0iNJ6TWoWy3vXtkEb9+zB959xVVw+bbzYOvU7ketgc2VNUKVkYEgHpcisrC6nGQQRINazZScB6qBUjD15iv28zINoOJ1lNYYAezNABbYtmrtvJstQhJX92jdgUHbp2xeUHygjh+g0q5DaERw3F+79DJ444UXw31Ru378ySfh9gPPwoEzp2ETSeTslovnub3JfVqkcjUltMYx5xCknaB5rhpd45TOp55BzaCYY0ZlWlwEqC48oJdlggKNPE47amUvCMCrdu2CvxHt57dGBq120/rJTbDMNLadizNMR6RBBw9AFHjp+WK/seYJkl0gaVwYr9A3KKZVeDv5RtLOS18lGLi6IzC1JZq0ZrruCuDZwigdPNW9LLnVXGc5VPzojqabPGmArdE2fsvFe+Ctl+yBY2tn4IuHDsGH9u+HLx47UvaLx/IFk3QiZRoZ/57vwFxRb+uKhaBxOORgc1CIMGSp//5uUJBIarAtpVpCppbjvws3b4YfuO56+Gu7L8r3+c0q8I/6iwaILT1l4oBGSQPnuwGG0Kt8mxnwCAohoKU1UqfR/dkIEh8C2nuhLRPqPTRpAXU60g3iuAikPVhSS2yFeadJwWreZN50ltRgAayBDfqaeMUvqp2/ugm+bs+l8DUR3HceOgD/5oEH4bkIcp223XnRMQGbKVuxHmqcxvih7RMoX4KjtAC9DxCKqYE4LE5G3iqa7dfEsbQo33dffS18xxVX5+18jUTW57XWVkUH27HBVaA0ElKjkfM+qA7lXtDGvN1mLSuHLpjy0XGnIdeqUBkJvt04Lc5J65WgScPI5tC18iquVQSe8QVaSCYR0NkJCmJN0/8cwChvXo+QvSkyEI0Rb4ua9g07d8EfRz/0H+57nFZUqsANHQg2mnWngpDOMVRXKig8tviSzo0fuiWZwT3APbxcl0LQi3+XSa5U/HNe9Fz85KtfBW+Jg76UfBbA+D39wSG430ERWrqWjRXJBYRgjewuI0kkMNh69I1M2xgdioA5WG4+Pf+uLdvWm7UcKhMABCXycr1ko1qVToPSXgbAI4JEYYmAVuLLuiwwCJtjO3/ftdfB1du3wa8/9CAcm/W84WWdETb2L/+xqo5BDXpQDvP5JyYHKoNbZ8T3cCQbrBlAVYzCk/IhQBxa74l+yZ97zevg2q3bq2sogJHQ5hdqJtzJW0HUpLRbJ35osaeNnletzVIJQEkr1zkVHca8Gr0HTg8uEN1G1CxoLq4o6t+guF7Kqnv1odDGg+L8YlJP2qthjgXNE1ASWl3Ly0hhKGR6dfH2iy6BK7Zug5+OHpEDZ8/mWWQ2c7Rg5NP0spVwQN8DaJsc4kWisQ+03HZa2rLNxSYGQEOKq/cJlE0UmNXx2Uuib/J/ffUb4OqtWwXM/QiY5V3cMGS0x1MLQ0H21sU8wma3ox4to3JXFcb1ogvZzRbAlaFB6wE8L8zrjc30uDBv3dSIxUmHZD4hMUrkS1fbMGutbC90xQ5HrPxXgsT4oYPjf2WjlMPP8cJDoO6njUx//g1vhH941+fhUHTN5o29lamErYqhh7Adh4jJYdxc5bmpj5BfY0JY6YagdpNlVQcsjOoL88npeX5k3v/5ujfl7SqCA7Ps5qWYKcwYntbrUM+Hn2WhSCdWbahsONMiHM8vOoogx0Wy8q9EQP4rAGBxE2rHEMFdUvNsXK5zN7/niI8elHRW9yQdHR1Ld/plMi7dvAV+IYL6A5//HDyfHOFsCmqLAEBwlalDmnFW5UubaPeyEr4pzH2XgxM2l8BqPUeABQJzGgD+WJzW3hPB3Dsga6kMYNWbzm8ecaH1y7NRWkJDxbKWLEkqB6xAyA6+vkqA+XyBNuJH9eNI/EbyCPayaht1M3tVwlDFSGU64g00KyhtElyxaCV15k8Q2ZGD2NRKg/KA8cotW+GHr3sZ/MJDD2QTlN/HblW9OFpxXvVH443JYfdVrg/o32GoAxEkRCbpnDYRev+VV8G74qh3RvyVjx6DVW0M5EWgboGMn5FBEBKQlaRm+rVG4YmXOmaszn+v4kYDLhGvicZzzMPFockbQcxBJYmLAGqMfZBMDuyabjvdETS4fZPoTkpkiCFhNn2C2jbfFN16Xzp+DP746afyhBroBQO5h5hCQMZvdWIsGHb4ybHpUjzGsXviECKi6POmWRkEfssll8rdwYaNAYy7bOA6WzJ47PCAkO3o8oEsyzOa9JFrkPNiawcY2GV/BUMFNO+HbU3A6glRTwhgqKPzx6lKW0q2MJwTGITgzBBqQ7HulPmhxeh/d821cMtzB+Bw3xfes7YIunbBncHgeuzeYFs3YRS0TArbOwYVTPZzP4vM6OEfvex62B0d7t7UGAAbykyWH1mbQzEPYHhuAzUUSSFtS/M1H2VNiI4kujs6d+jnx9K37p1zWlycdkA/A6Q8i4Zm7uz10zTWUF4ocOgd7+e1j1l2IKhz/RuP7ZMV+J+vfxX0eQfZWRlrkVoWM4qaUVNWh3fYanH5nXrjXJ4USVWnseug0Kk9ILdJktDRvnjz+RfAW3fstBUMbXNDshgisxmkh/ruyT/80g37rrCtU8oFWXjKLBHN5gtONh+oPj3kay2LPAtBO283nFY3Zn15B3X7gDSRekYzQ8kxPRWKlS8esADtpgijF8N0rOwkwvHzzXHi5TXbt8M9J54v73uI6w0sr5qmQgAzsYI4tKFReTcqb9BkI7OFRtgr1RbKyjzrsxm8N/ofJzQL6D9Pp6SGgWBya7d/UCUX26kt1QXELK2okYMbrVRgFy8I22KoO3cj4AbMkRczLbbSq9E+irnU0W8gs4C4xun5fWQ2O8AKFD43g/URAHuQ61WuUnHyNT/3XSjaOEpR+PZLL4e77v9iERSqg5VHEDS6ZfYwODMDcWCC1IkVIcy95Ic1XoM5AMggsDCgz+bGZdF2/oY4EBQprA5tZoxJZ31vDNj6XkuSAgNUg5pEmbz8wxKM/LPS4AttaNUxXtKgy7Fl6rZiQAfVGUVrsqKiNmKbuZoxEzCZqnWcA6g5AU0WtinlW/4LfcEB1inzBOqv3r0bLlxZhYNRAOYPQeT9GX7jztY7SAGqrEZbdbBsUGq5UkvgTqYGSee377oQtqaPIIP+LB2Mm24emD0zlr2WjpDaU+xFqIMOusZO2dHs1tMLRstX41jvdapzmOdHDnTn89Jj49rRhnw+llbFo7qHavwQlLEs0hnB2MEBqubTkhX8NcC4hg1Drcn5azxcsLIC3xy9HrM05upDNbnE1aILC0uLkMUv+EOVxmikcwDRDInYtHliNPT/mz17bCXCEMQtZkAjDnWcEqymyugliGtoMTPUr5zSm2qctndpPTGtc4ChzD7XtO5ap0V3L5/yC0n0joShHVUm5rrUtX7eVJONfZQMYSg8WjS2Qu8S6OWY33HRRfBvHtsLOOlLpx18V1d/gzIFw5zy7KZBriba3PDACvKbattnQG+NRL32vAvs5Ik2ORxj5klnVRTRB1Vz+oQaBB3NGKRGS+9Dd0oJyeCKPkmCMnUcnA0HG7B9XfHzQ9hY1rggr/rKXnnpCrlRsIKgY3OEHhETjNfm8HlqQamiF5LiyAoj0lyPn14dsXJB1ObHI3Y6Ze4FJbwG5bNpOBKmJoE/x0Ym6CrN3o1I1FVxNihIPAzUmSbOMyHYrEcFjA4BGpJf1KlSxYoZuQzj1cAqybsRCb1IDPm0sGR6nXaZMlxDy/MdGmbkAS91Ho378kxXPUHs6XBFDMqcd3+cTPMrOLCkwuuiR+y2o4dpJ1l6E3IseHzqXwplYqUlnRq1rMCriM5xaZnWKH6v2LRlkFayCENmhJFffW56Png6hs9l6sh2lKqoypeGxkGvL14P+hpPNXTpAG06TJpavPyMpZVztGXk5yhikNbRUYuiiSKPA9brA8mgvt6RASSozgADb9QYqNHdGhM62toRgUeRaUq8P3woC0R24dVdrtCqaHFV4qBcvh68D+0TDRpGIbMuHl4k9OVbNksluIB+RDpr4C8bWkJs8LwaELHZUdIRc9jNhUoasBpOL3KEKqnH+AKN61Zj4pxrXPD8vLRyHqrJkZtYOX+T1yC9KoryDVa5F7ind50BO7fJAMwAoxLcn7faJwV245mBJ52nwWGfPWRBFv0Z9GgYCscxwSFbUjCDEGqeY8xmKc1M6DMxPVyc3qijAoNmDljmhEa+LWAjjEvqUQZifTFJv/OLyn6uJgY/UtaHkI/vEIcEtK49sQDj4mtR5TaSFlx6+hAY5X4BhJga7JqmRkWZfOqaoIQl4lokzrsXGkcK50+nWRim9+YnQZfB4MGBK9CU5ezp5tt23r2XgRPql9wazGn5liyho4djhQcZyPdcviPXY20ZYAhkfz54hiUzYm04ig+6p2p9T/H5o1pwlQdoistip4Zx0Zry7lRaiVwi30Vp+TrU2V3UqMlx/N5KAQfS8g252syjFhe57VqdGRptRTxsC5eaxC+DwaRO0xp7PUvoOEwPk6pNQGEPsfqdEcwYQYfhV9+ukUKw0XI7aNWhP3+d36vDkBeD66YEp5tjQK51ACijfiA7ml1UoZohQNKqq2BnCnLDIwgUhm6JWgM0XgJHNbq0tefAIh1l0/K9IR0y1ymDXPvqKPtyzFOsobImAwGjBnGohGgrpkFpO4L6mrkGbW6ox4omD7Q8c5AbgiHU7WMLEY0bKgF2j5VQGhCDpdB/5lIWlOmFKHaMn+2HKzxocI+B2l+3znXP9irMlJdmvzITOkA9oWDcc7TgjEiNrvCFyK+DDt0qWHsVYKPkF5LW10yn82AucXnhHiGYOhaPAVDlxy8pM3o6GnSxJ4iYyLf1uzatxWf8uadUSg42Xg8INajX88tsALw9CHIOiA47wfGMsBhq2hRGJlawimNNpDpnYiszAhw4c8YkEGKCajMVWsxyVLTvIaiJhMqknBetDT1w2ynJVDJQkhTppKP3GNEDiIjttN5EW1EESxB1pJKKJXkD2NyKUmZXy0NVvhaX4r7p1HVQC3CoorraYbIZxhMrPDBcFEYb4dyCl7VHzq4De8sEzgFk3ZQCZWw8PcRoCnZQOC8IKIPKS1aLzoBK65uNVUKDG7AthwZFamwFlxiH9Jm2V9PdbC+iXo6KXXUpiQyqUibO5FDpLSEAyki2BIrbTzcTQlMkqLSoOWI6VWjGiVyiupTlFwIYkwP7KsgJ1IHfhR5r9OB+/fmisKDNdLGHzpxWu1yR10xWuwrVtSht28hEheZOsnriodanfjdYrtU9Sv+lo0dMVnodZzHtGrgQ6a3vIQw6pCETxqQ3DwRbElmBAt15Dp27bnFtDAXYiBnrdSNpTc92PdSnTzT2TmLnx6r6KnzH+h2UpMX6bjQzUh1sGnAeVZiBUVgGqBqwpDElmvujA3U69j7/PN1U5QGBG5mkOsAFw6Kg+Ffip/OaDsTBbXnt6CfN2MGjJ07YfCihMRPVvSwV6X6v2xOHNAVdOLTpzUlY+nTki+bGk7fu6Gl97Xs9joEWYOAC8gTMedTcHEsrrYbDDu4DWwyo0BBoYRleST4zF0zd9Bp3TSqDJUeK16BDm2asKuZAe53CHYcO5gUdDVhHtLjGoKePabSbBhGAsfGQDhrg+suHE7N1uOfIEXj1BTtECxtCAYxTnEEN/p76Ne6eMKTDS+rgpHIYvHlGQ/tOZcrJ6btCSUu3tAsLtaoOtaEZ52bGT2hScWj7hC5Hp9Vli6Zr8AD1M4VAZegkBvblDbwAMksK4qeHJhINPz24AgxNFVS0oQK/l3ooJObzew4fhsNnz8KmrZuBNWt5rBpgGi8BxgMX01x9NP/wZwdYkwfu/RDcrCpmoKRnbnrqCXgNAZrHKkiNItovDCnBFsGacfNqY55RElmtcWdEBADZ01Dqgwi23+iPZw0LJI3vqeKCd5qESGqmnZt3GD47SKsBBLXs/NupXsCjcn43lDulAnrvf0EJiwDW5Ajgx2IVzKF2QvMsBzXs+C/7HiNw86KanJXqlNJulqGhD4M4lX2lqV7YIU2NDiY9q3mkrZH/095H4ejaWT0e81ga/Dqa7L0W4+YF5eEQWxoa3+Pxd/z6+73WN4PdyDH2zaD/1m/ed4MbyXtuWqx1oLoGXy64Dx8kfn4QLUhAbbE/KNCKpFYdUoSbki0n19fhpiefzPtKopiHXusODYzABSr6NHC6eRXRBXCGrDL11g98JFto/+mTcOszT1WhCCPA5huuUF7rwRhG0Eg7Qi9wBVlKo3rfOfub6yc/SGDgOJQ0uLGjewFxG8nTHVy3vGKS1EXFq06Kgii0nX6kzduMBSudhwJSNLKAVwnS3K2IhA8/sR/2nnietmmuryWIpA6s+RXQCUDBla1De0sKHYEAowYl1M+XMO9PWDYj/92HH4L3XnZlZig6LonPODgGhhEilJrT9yWJZm4AA+QUiV1tSLZ/6/d7WnzoOo/3ngF/5oSXKq0OIhz0tWJa8YagVHXoARqRumCBGwKMaktUJWozE8DKFv54KE1x/+lje8uGUoQdmfhqcMJYCsr90vrca6nN6wcdklWPTCWhmB2JyNsPHoBPH3g2rxfM9rNIaEUTzFFVnhCDaWyrQjZ/RGNojsoBYNUE1MkHwTlaOhSfscUwn5ZPfdpRhqq0rV+X1uSlz/vWbWI+zRnJjc4C2vCzYqZkyd8aNuqi95fMbFM0yJyWO2575hm47dmnodu8iSQ0vaNNhRQPFZg6t+RaK4jJYfg1gvD6fmopzXx7lmzo1OOmUwiTKfzE7Z+EE2trw3EZDPHVbDgP7jGafLwTCbwCaVZVtF5FGIC8cZAnwHzLR6bAeNpuGN+65vRj9xalbeVtxGCNs68AKPOLhJBrYBh0QNUuGGyctB3/hNq+HbTJOnDqJPzs7Z/JGOmmK1kAajpaUleEk2nnNiQkK1NhegI9UMBKSRRgM4PSlrfRcbIyhSdOn4JfufcusZs6B2JU+TAjhIeoDo4Plr/eQtGVr7OBZD8SEbxoIxoQdEbtobI/669dtEXHDY+WPe7Tdy9aWvYu1WsHXKyTKKCAzfaoB4n8jhyadYM4Hr9ilQUTdaTrP3r0Edh76gR0ar9v+QwuI0pnVvFl5R2aejJm01/jtsMBeOuLSkGii+7S343l4vKHmph73GQ2hX5lFX4v2tJvu/ASeM/lVxq1xhNXKBnTj1J180JL60s+Ipn1OtGd6kUMZLAMFB2KhgeguFPobaQdBGKw7f0ATZni00JFy2ASpzZcHXgQHUGLTRDzA5VNwO7VIDbrkNdGcKibTQsoVHKR6sCSmf1I+vjQY4/Br3/x3gjm1bKpUPZwdCJsRKhKmSisq6apIxrrgBLAezkaDVSXX2UGQ2OmiRidXXeTDOrUA0/F6J/49Cfg8RPHW9pwKLFR52aZGRo3jJRGVQctIsTe6ZR/uhPpXJct6KoYaal4oz+7kYq8GGlV2XPpoLQTdHXRYpK0ledHp+IavOSIlsWH/ly1H4N5oorg86dPPg8/dfunIyYCdKvTMiCcVI9T0BkCmEkfng6pn9LBaOhcHUYuGDRob6OKZ/EfiUxmx2Ql2kfxOBxm8Hdu/At4MlZIqx7+1W0EXB+0jJMylQQPY3Tq4XSngQE0cKV7WHdq4nhxebmGx5EDGgduIP2yaXFeeqRBlJEWYNLXDtM4Wk3ueBoabOZ26kCKGxxT+n306BH4rg9/CA716xkXk2Q7J9OUJbRkCCQwa+sHVRY06Bs0v7s2NrLEMZPSuZ9w6RQSsdiiidBJlNCT1Uh8VC9PnTkD33PTX8ADRw4bKe3bwHTAxZ1R6OXReaGHpVpn3/vN0SVeJJh0xG5wjs5nbQ1F1YFR27rdaFpYKm3XTAsL6bA0DydcbBsBS22aWGHzQgRGsKaHP/ghxpluvwmBin8fPHwI3v+RG+GJU6cyFiarqxkbWUJrDcT0UaMHwhpAo0NhbXsfOhgBSTNoCY1Qu49Bo5bSkfhNqzDdvAqPxQr93QjqG/ftNSqJe3h+NNjyvStJ3Ejuvr7WYBYA53g1KGJpTGqbvR9GbWu1bI5W3Fj6jabFJdP6vMlkEoaWZwIOTZb6+ijV3fFRL//FfGfvRnDto9stS2k6WBN//Mn98L0f/gvYf+Y0TDYXLGTNnSSz0Aa1XRAHps4A7GBp8KEbfbCRUQUMqQP5pY8tOyWBaDfRrGJSr9y0CZ6brcP/8LFb4Ne+8Hk4G8/FAwJOUsOQeSKFg13ERjO6dLBOJFzQnc1LbLpn1sDDZQ5YMl1JixtIu3y+7WPgmlMdeCipARaqPxeUAJUsuO20kEpt+y9jG//AzTfCkX4WBdommCYMrK5kTGAyNzplP3tBKQV6c8QR3cCo9XIggneBYagP1BdPyug7u8LVtkeBE2WTFYtbhhFHjF6P5sc/v+sO+I8P3g8/+7avha+77AroqGdWVUOg1nWDOZpDh86ty6HB5cAMUD69yq3gRs7NkSnfaxHCBBpCUf1dIm2rks20dN2P01FeUIK6vFlHz6e6zpQrb0HAxq/xXiggJwR8dN9j8HOf+VR+BWKyGoG8aSUem/J4aiKejfoWpOSM5aW4YsLWOQ5U9ytGHJCVN8h89R0aFZFzLDM5qKa+q1slqNnxOmLNg5KQPB6g7K0C7Mejn/oHPvpheMeey+F7rn813HDRHtgeGSBVRD26tcQNANJqhdzhnBRj0KBqZE5jnsd2nq3zVhos3JlLqUeKxDeeW3qTG2jYA1TvvHmMykd3Wq0Ng9WGuh8PqkTnZ9bX4RNPPA6/f/+X4PY4A7geTc4E4mxukmROE27JA8ZChds56GxVG/G7JxnHlD40qleJK2G6kEdoMxGzQ14thboXAYRqKrD663jbsSlotdrHnjo7uwY3P/0k3BR79cvPuwDefeXV8O6rXgYv27ELNiW1BNbkgAXnOSgpHJRak0EQn2dSOjvBYEAwYMNyGkLS15dsFvVAk3fAdiO00vYqQlqcwMvCINU12WhZCyW7OQBPJmVtZmy6eqp/TTXo5MTZs7Dv2BH4yGOPwI3xeOLkiTj7F8dOEbwrEcRddgqsFqkcvRri0UD13jNrfmTgwiivREjC/GA3DZITBPvmfbkZ2Mxwb3MHrqn+4lg5+vOCgdk/XRo6/eu7AvY+MmEWzx+Obr2H4szib3/xbrjhwovh+197A3zd5VfDhgMDtkPTgXiWMDhJXc0SVVVss83HLsIqAixuAZ1WnczLW+LJYrB9oHzRXn4Lv+sH4gG8vc0dQX+VrUNo0Hd3lML/4vbb4AsHnoX1DsskSQTylFy1xWU7zWDOQJ6wZGZzIYCxjzletw2otmkxZKSNllpOV2cU5BoHta9fW2C1a/QX0HmwqOhR7qjLz9sE33jJ5fDeK6+BV+68EFYi+oMzM4x6GqW1SmLjV9amBzOqQ/uc/CyHQhyLDHMeWFLM40bSpj9iR6ajr5n02ZAmEzTxJdS6Iw68HABK0IfBcCCH1128B371ve+D+w8diJ6MffDnUcMenK1VIOf3NJyfGSwPeE2QodStLbwRjcjB7LEy/AwBbLycC3KJokBblWC9nVxCZdM/Mt0C8FfX2CO9btrD11xyKXzbZVfCe/ZcASsR7bNQN5rx1VwUcppOgVkDubMvJaEGt3CW69nBUDb5EUZonNM1wsj91j0Yzwtxflpt6HLaPCDsgPe8yRvk9sSLvD8gVp88DYbFdlb28wDkQVEY/yST8IaLL4W3xPb7wJveDB9/5in4w8cfgTuPxrmGSXm/pJPBH4A2NcoMZeE5GlSXOkg6biO91MPgdQAbP1w5qRVK9zbnvKwWybXKb/TdOkjanjiVlOE1286Dn3j5q+DtaR/DvgBY9jNUDB0DdvAHdyQjkbvqjyXah+48MqMKp3NupYrooIgiO4LUDdTdSldJg4oDnq817xeWlmhGereG+V2NDRnz8DYPdrJo6OUII7+ozBJjosRjJZqT74neqvdefgV8/MAz8MsP3RfnHU4W5QCVd0QARTZ+0X16pXgglPjnJEm5njZvclwYkYvcTSEM5IecZYEXKpMTE/JK6D384wjkb4/ejQumq4PdZf1Os5l/oTYoV00kCJEpzB645kDZyQTgfG1n30QikEEq/VMGEIqXUtdQCcAKtIIdFzfCRsKZZtsG0iJotMueNyqS6ShNljpzqLzocCAg+BwaUhpIe7KXk/dM4SPt9Z02rH/Lrt3wh08+Dr+59xE4lRJNwCjCIZi5HIc3w3AcxjfCYLHGEQib3o6NpQ3Mjp6uQxWA9rAj2lX/5JWvgW+95LKs/WYklc0Os6HSMSotGnGmsomU5kQJVIYydjWDU2C7us6lU77BcUP9emnirwchuLS+Zv63kRYdkynfMGhN3TtJCqIaFFKy4A+wgqRXxfAneEyxFNMVUG+N5sj7r7oO9mzaAv9blNbHs9dlonSLpxABYBykLBs8R1ph2krQAngrs0DgZmmuP60qpwhld6weLp6swK+//k3w6u3nZxNDwByUuaHALYAOlo4x2iSQe66+OwwCYuOX5tyQGQq2dTqcwxVY4t5G0uPwXFwX6l4mrZEWgpIlLKor+upileX5Ym3UOrbmZ3QI6sSbHTOlHWbBPvM3on39qvPPgx+9+/PwRHTzsWjX4GTpjKrTDYVUW6gN6IM6tWAOL4sQYKBua9paQ/SFJWamrSo2bYbfueGtAzDro2+B2REcWoeW6MGWbSkFhxtqhczNAGbRlnlYNJxZNpxD2mX6COLwRnNixj9cz/0rBgOtDwp8dF/zno8kmVvteu2W7fCrr78BLkoLmye1TFPLlhrukFWGLzo8jXw05z4HvJxjsyDX0quSUNb73Rzjf/N1b4IrN2+pYO7L0fcwvmWyVn3QALWTBmJzEyDlKwZsdEiSyhKvegO6f8OY8TsvVdp5sRr/ui9WBw4qa0vlxgNk02YDPMt173ivN1RddyBed8e1W7fBb0dPyBagtaB94wEqqylsrP+DqjDwywz+0IlEPyB4VW2lYFCMKVtUhNkMfj7azFdu3poBvM5gdpI5gxvqN7cayPPUod9mOf121FA4QLEmHWGABu6aGMwnYKDOFx0vVdrR9GDrxSc8bezrzQffTrzywqS5lTUdJr6haVP7roXazuuUJv1etmkr/PT1r8wCToN6gF0vPNER3sKnGmS2306ZI5HtbIdlWrlVtkhOYP5AHBi8e/fFUjEBtTv0xucMYgE4wGAHWi+5tdS4dss2KHYYGrFleRHUOJElFplMga6VoMCRAxZc4waePae8pV+GKoFd29kxMXVaSp037HG8Np2l0YFyeyAd6lltcmTJDOVYU3HfEv3W358+x5uVcVXGClHklbwZ3Noq1Yo1wuLXrRoZFdwSBUEbBMVESlskvyqqme+Mg4Je+ZhbPV8kQG+vPWKD+pUSdT5E0jt27C43mvyocAiidSiepjnrErX+2QYrFlzDBp49p7xFyhH9pUe6p+jJUCU9R31TFDYiSPQBVUiYNoDKd/DtF6yEZxD3wQqx74mAvnrTpgzoIJMMWDMUTJ1baAPaZ4g1PkiN1G8oPSrQILCLhP5InMK+cLqpAlnZzTPFjL53IFUMazKTy1MdQXeOH7z0Srgu2ut17epGPQjwQYMXB4leYNhoo5xLIypa1Xsdhluo40udE2+u2bwZvvviy9rjGA9saJsecg8aZkivzA5lelwQvV3/8NqXw2w2K4PEXm0wDgCGD9KrYNgsI6BfOChEWCClGOBU2z5K59dt2w7v2nWRVJQrpE0LPb3N6o7pbOBZ953BoRti12QVfvaKl0cpsBlkyznJQzMrEB898AMMnbLncsBLnD6AbnypR4BBXYJOE5l01epm+PHLrxWBMwsLvEtt7EBotQmDnto15w9qvBSPr9mxC752x84ipUN1OdbC69ziMkFjdKojszkRQrNSOgbliTrNyv7mZDt/Z5w4SSKhNdhoTW97Bo2FIKWWIPtGh+oDTRL7TVvPh//76lfBfzj8LNx04hjsWz9b3u7Ls2MBZEbFuQXqYBEWE8IsWCaElzAtAAE5WAQy4Gn/m0k8rooA/przt8P7d10KO+Lkx3oYd5kOMDZGQgDxG3DQryuke6mMVKX8Bkc8X8UJfOtFe+AThw/n5eOwo0y4QxIOB+MBqPc8G6QZr/zc54Khbiwl9yRmlJIU6R2NZOj3a+tw9XQFfv+Nb4Wt3VTUTFY7oLwZWiipopbqlGgHRfqrCfP5fGfvySCqYRsvwo+wgXnOeVTz1CUcVsV3xrFyWhdhIWGNfILVYPyrJSW3j0jSoDxNUCXuouB5qj+p4+8Lk+Rc6cpMXvo906/D++74FDwXZuo7w5RJZ8c22mMl5gcOC6fQ3tZtNDiZGhTz8vbIM3jHzj2wXfX+BGRjZsBiMGsKsEWCAk2vHkg/HVeqr9O1MgseKrCNlFV5oqNBbrtxCzSJs7QMgmOvATnXqdETmnkpAseEQQvQRlsqU3AWbHuMgVnzReKUlEZVJn9bkLUoS+oE8FCmx7/9kj3wm0/ui2OuXjZ6KjPPAIOGyVEIi4Te+PvQwVLcYnQVA8U266O58b7o2WBm8K+RyP1iMAdXDEtkRY6pL4M6v/mbpA5JZ1ZzvDa2dHpfgKOhiXdsly8NqYGH86VqcHUz5PT1HsC8hGCcA2G8OBEi+lcG51B/Nfh9xwOY3y6jpgfWNpAxFYH6XdHL8hv79kKYTgkYtOmm+WKBrkE34niY/4I/jkVaSBbDvoft0R56RRwQ9r2VBMbPOXi6hnmN0orLL3sqUAeSCtnzgUpCsHRmvsASQQM2OECrziQrbbFBD3Pq1ei4SBfVC1HycvJETK1BXvPAHCyvjaTW5wADIeTzHGsDqQO0EwTVBjKvEEr7vHr7edGWn8Dx7MIjW7qR2+CrtDmFjgO6qU6D+Q2kQ9ldl97ZSB/RejDLyDfUAYNm9Fw1PacOjCEtLVhjZQYqUwOUyTFWPak6g1gBTfZHYWIoE2PChXHpls/RpjP14/yDep46CpepAb3MABpcegYT09gSMqZdXB4Lg2okLXD0hlB6MmYSmfem83bAx44fIQnd1Rfecl4NaQIwt/GW+wSLM/FiRzhTAH11nOI2zApgZv9aDGMA9rA4GFCH2nNR1T+Fju7rdanB9fJWXKtAb37kaIMspWoV6JlWkbzBdQamP9g00ik4bbD1NnnoOLD5mijX0Xr1nO+AXGed91weUcCRa22embKo8Ku3xDmDo4cgKCeDBTAuTwRoQOveYIxUzlSLEBCq2NzI/s0tWw2TmPktuwwABlJkmdACtcRRRjMGOsWZX9daZsDM0b5RqQDhSHDEBKspWCoNaO+H4OOj19KbeaeaQOc94JeOYI0UhvwN7tx3njAn26WDaiCNIoMLrFJ618pqeVUiqK2RWw1l7A4vnapEGF1ON5DI45f5pXrefqSMEqgvXl09J6ZslHEe1PnHixWwDNUiTpsdxmsBMBRPrV/uREoG1AxV52U54B7XhLEnRkwxnT6UTmBkSytoHjQawJM/qFIYz/6cQO2e58O/sZeO5BHLApEJocDv2QudWN8S1PSa5or3pjhCxXyzxc7uBPJyrKrF/7Q0mFvbcwweh9yJmdZBIwZlZzfuWZ0+LKw18NZb1Q1wpKTUoDyv6MCaXKIRejVJ0UKj7jDObhupxvBeWKqvzA1Olw9IDa5T9aqtpjxRQgdrU+ZvS4OKFmpgdLENHdwTvSabDupd2HhUKhLmM/lcwqCXslSkc98pQ+MZnJPvWJwHRl+LFm1g0rPkZomu81BSHdTzHNcaW7SUSIvoMHLOEWO832ibeDDjgnTmmhHu7o7lsSi0AY3zSQmtk/j/bD9rpB420jyh84IDc3TOWKIFiEWNEFS+Bgyq4wiY6ab3agwGfT5/cB1jhLCxDjdicQyfUXTASF6Lgi5Paz7vixYJje2815K5YXo4M9S3nrseabDFEpoNdG1jtDgXw4H03Rice+861zAA7ghKrb1VG0LuKZu49y0W6jNmyarQaDDNrgatetCk+ajBF8bqBjC0+VWn4nGBLr8fo2MD8YvShpEbWpjla1eZo2trdqKLnsqbHcHGQ3sZA+/t0Ht1NVqLXxx//OTz0AxBnhyZcXzhodnwPl4B0WNiEHDeTRATysgSVRizbzApADAwL4LuFOpmcOmXeXndegpgYOJwXPNZeHFDZrcXKmhZe/DMaStZ+I5vUNSN5+6rVza6QYlS1EhmY8THNPcdP9rOQUmkpY6wgbTqWDRRwA0pC3QjyAtLT508XgYbxPBOV1uZMNLowXaUfM+lL8sKQ/2MyjEGNV0ufw8uDVIGCh97jx2SF7DkRSx+bn6zgarOSxsUb5nuFPaePAGAOK6FdMVb9+W6ZLrxL1YG+aLs9bH35EkzA6zbFlzcgkzPOXhADDp+UGCAAoDT62vwU7feCCfXzgy3yZhTzkCdAhg/awZyB+Ir77GCmz9h8p2Ega3rwLQbIEPpdGcj7b92+62wlhaQx9oRDajn0B/ghYPZ8ELFGbrdM3x95+GDwMtL4AtoeH6y8xH+nK+1NMJB4gLq07MZ3HX4kH3DDU2yHIQBYdigoxKW1TLMl8IAI+q1IcH4uP/wAbj38LPw2LGjAzBji3bXQoYOBOvShBYT7XOeZgQHCFQNRuf8WuYjRw7C3QefhYcjMMxWH1jrr/mnJ7n80W/wCHMOUOVKBR1f7z16GI6tr6sNmywP2sbDfNB3vicbZvq8JK1ycgt6u7wA40effdqCYQTUfC70BYB5HVR7DFoEekmsJzs8OBnY6Z3pvBfIU/vyB50373vEbJFhwI2OfvrtB4UrglogpjgvffVvUHXQr7wybXonsdueeAzOhBnc/PhDeaOeCdo3DXGMPGyTvGzABfn5cvnddW0q/dmTT+S94dHZIsVERpMPjuXr7rU/wZL80c6CNbzcslsTrff8n5/cF3vd2YpzsKAGaDBzpCcNJK0CA0uZQXq0z0rHAQUKtRfPegTDBx9/OK9r/JEnH8/7gzDQtQoXm9rTzWVjI16VG3D00VJ1tI0tDYm1ofSmPGlG7EQ0kW6NnTEtKP6XTz2e66K3zht83ADDjq95tdEwT8Nwh2Sa0V2fipL5o88+WRbEz4viE44oB6HTjyLVKTZoqoPCUVGO4FBd+w6DGQuY01cHaW+NTx08INKtpeI1R7TP1khhPtVpggWtJtnYs3T4vqhpYgmdAHHo7Jm8nvEzZ07BbU/vL4DohuobdB1QsUafa3taHbpqZnbP5cv30cWL1ugK3QnQ9xx6FvadeD7TfuDMGfjoE3ulM2pQG23uCYPaDmGePeeO0MjDXxvtAlbz3fLMk/BYHBAWCd3ROtKVIShMrlxo2tjGBOBBoQY16tZxD+pfUzhmwhKg03Zuv/3og1Fa9Haf584x2BXjpzmFIegOxSgNfKQ8AG0dfZnc0FNq+D945AHaT3ElRk7gDx59ANIaHQO6u6G0KwXU8oNli6mLodPfV52iU3XWHUoDuWweG+BPEu0rtNNYPP7r44/k+1NVP94vUH8W5VsQG829TPDmpD40r/QncumYRWz80eN7C16mE6h7lcMAoCBqDsCqe0c0nXeLKWZydbzKHMBK6UjgZw8fhk8ceNbaoyo76bnpYTWAMJILQQZY5gA7AOMgj9JJLrdTQAb1fRv9fjRK589GKVf2AynA+Pyh5+DmaHrkNJ0FtedfRx0MGuuj67FBa5UjbwJ4a85rEk37Sjw+9fST8JkDz5TOmGmfwO3x+rZYp6kCvv7WUuMBHQIzL5VdE9y9sCCNViWylU2ngKzOb33mqYiRg2WV/7RVCdvRhhEOc9Bo7EYYWTlp/AEDcAXsBOZJ2rh+WnYJ/cUv3Q1HkirvhpIGPXMBmpLLd0gtfX16VCdMYl6DEWGw/Vhi7snZGvzS3Z+j7cZou960oGC8+fN33Zk/4vS2aBMcmpOuIoM06K7pOW0nC5hBgRpq2Qmsa5G2n7/r9kxrJ7SXHVp/8Qt3wrGzpwX8GtiirbpGh/L8bPEch+0DFgbVvFC8zr9Q6DgUafs/vvSFrA0TXspq/938Rm0V7KJ0M7haUHBq0qJQIqXGbAfljesjqO8/cQx+66H7TQ9t2XVjzNJBC785nXNIIsLAK8DH7z98P+w9cTyrvdQJ80HnT0Vb+l/fd4+R5gLmDoZmEMAArEYC6mvFtk5dexOpc+VqcP72/V+CJ6LPP29sSkJkQttR74t26Z/sfUjS+kN3Ri/0/CBca00+b74Oy3UAMB4Wz7e0PevvP/IQ7Dt1qmw0lPZi6SZ1E07B05BAnNfoKtTldEe7HxLDVeaoDHSyfdjLUTeuX4V/F23pv4heD89QM2iBBjhgSAo6svw9n0fnmUkdKn1C/2f7HoV/dd+9tO902egmdcQJb0UWj9+4/4vRJNkvdqsxQbBhRvE5qVyhFRtp6DrofEKVnppfbGLw70eeeBx+6767YbJphWznKe3YOy3aJpog/9e9d8EHH3ukLBvAtndXXXrieXD0MG+D8x0HjXZ0fAcwGiXzvquSeaqOD0Us/OsoSDK/eb/vSfFwaKnG66Ogxp2AvB2Ylo6XVA30LqrYwwDGrgl8nW3CCnIGNw8MJxMyPSLBSSX+7BfugPuPHxEpzcAYmCKKud0yAFdpWGoaNY1qMIWlQdPx8LEj8M8+91k4neIJEJM8mJ3IICXFpy+R/6fPfBIeOHJ4KOXAaprW3uVeeosUVucizdSzvizmVwLzQ0ePwM/dcXve4zGbSStTorsjTVNAjvH3FyLfvxTt1Ck9K/ynQ0tQGTAC2MEjtoFrTCN18GCUtcNKVzvjo8ePwk9/7jMZE4nG6YRox44GhYwnICHJjKo49HjTeGWCO/CR0kVrJtJrOK3qRbr1qvuu7vF9pO/h73/qY/DUqeeNlOPKD4DtQO1tuGYcOHBpqaSkUwLzf3/bR+F4nA6ZrGySBU462ksvg2JSpF3aATVtpfBDH/8oPBif0w017WwjzgOzsSvBSmNtVmg7mQ8GQzqePPk8/Eik/XC0n7u8sWWL9kmW0NN4HItt+IGYfv/zxwywWl4Q7QnhJs3XwQK8C/Y+P5eWJBC6QbUvnT8daX//rTfDmSTwWCtOaTBoGlrkp+BPRFhLOjfi8Jq777ZmqTeSsMTJJzLKuDIfNvI6ZbQc2PraOqyfPQuzeKydOg07I/H/z9e/G1523gV1ERq1ao9fxXKMFEt9Za6W7hpszOj90V7+7ls+BIfixEnatndKG0VOaC89pDLSAoJ9JGx97Wykfy3vTb5ndTP8+298D1y6bbssnCOL6GClmd/h0DSHEdqZnZn+INURAE2hStEnjh+Dv3fLTXAg0lRoX420k4RTtCfez/pZoZtov2LTFvj1r3sXXHXe+WZpW1lkJkBzNasgRDqWV9w1B9zaPEudKAmDf/DJKNDiZFvexD7SzzvNdnkTe16irQ5OMsidLc2Se8BMB+rJjh/+4f8F5gXUDzHruDx1DaxeiSiAahvFcDLODP3Row/BVdu2wSsuuADqrBAMTQgYSl4ttb1fU2zkzrrlsrqNx3+JNvMPfvwWeD7Fpf2naQ/qTjZT76qGEW3TSWHHYqf8k0cehiu2b4NX7txR6Waed65DUaWEXufZYfWuTZiJphlrPT6yfx/8yMf/Eg5HbZGBvKlIuMmAdiKEAA4EiuRp+qM4lnlZBPT1519glKqx7xVfEYbnk86acVrbshZc0b8x/qZo7//EZ2+DgyxEEqBXqqmU7WfXuIXvAjBiXrUUKtBUI8wF9NiDgzgEh2eTRNs6DP61KEFujJWcxd/E3G3J3tNMhSG4NXM7BQ593emBlDIzjsXG/K0Hvgi/GAdJZ7ATIBdATCoglC9LQN0RE2mvw1NR69y0b1/+oPOa886D80Zo9+aQNkUMQBqAnlJ8+j0ZJdov3fU5+OV774aTKT7SvbKpRXsnTKu0E7CJiLUofv/8sUdz21x7/vmwPdEOli5PoxEg6toM7qE9eH0+8v1f3veFyPfPw6mYMG9kT6ZQcZFW2mUDUGIceheYs6PngTlHDUyOFEbeAA+ik/oq+vvyxXf169BC1oEWcEzmx/paND3Ws/nBZsjVm7fAT7z+q+Cdey6PDOkG664xGU1KcAh+bYOeiRLhtmefjgOjO2FvtN+K5yKZGKt5AiK7ubqJME73fl7ZMn9aH9X3bD3RT+bTWqrHGlweaf+ZN78Fvv7Sy/KAzK8IZNQ22DpgY9aQ9yzqch49fPqZZ+CffvqTcSr+tKO9uOk6nioeoT0RMiPaZ5n2tczzRPsroqT+4de8Hr7h0itz6WZrEGi76wy9CmsT/qXzNAP4mQNPwy/f8zl44Pnj0RNDAmS1emTy/t9KIxpTg8EdQIHcSWeDg3mA1jf79rIvZhlT/rDR2NIAvKQBr4Bd1rxbz4ydra1npiZw9BEcIca9bfdF8J3XvBzefdmVsGU6ta84wpCxqOpiJEk8PxE7zs3RNfSf47Tqrc8+lScdpnkWjcAgdudEADEaAtAq831enDuDOY0Loh3bn020z+CrL74Y3nfttfBNV12Vpd5gSVq0tOuLTL+yoY9Ge/fWOPv3+w8+CHcefC6q47Qh/JRUdOmIxW/bKdpHVKTQXkGd6M/AjnXoYn1eu2MnfMe1L4f3XH41bIt80qtc8a8Onu9a2xyPPLk9Avl3H7ov0n6gDFizRF6VafmJTHNP8kNDMAOYUT8BGnXB8r1hI9B9vPaeeyrt/EAIlVXaCB8MDivajJSmDhFohfZAA60C7JlIugRqZvY1ccD1jXuugG+/5jp4ZWR2KrQlJTSDS90C3HP4UDZl/mTvI/DM6VNlKpt8s8zQjtR0deRzvii4EJ4BrUUSaBFKBsdaAkcBxSw2YqpLH+m/aus2eOell8L7XnYdvCl2UNmPRPjW6JBQAH3Xc8/Bjfsehz999FF4+vQpmiyZin9cBq5Tol1UNEiDq2ar3CJQ8+ZNBdhr0jHT0sepPa7del7eb/19174MXnXBTuClxlvaUWMuCbG7Dz0Ht0Zf/QejAHni9IncCQvPiwDp2MRIbsWueGOA5ityfmn/9XTSVds5l58L6gSnAuKgpAEUya35mqHKgJYIboMgzW1upLWg7ar9UJpfJHZGcr6OrAQkSd0rEySBOAFhRkdibmJ4ktipEc6PDfrmCy+Ga7afBxdG9X5+sh+JgLWYz/FoXx6MnpO9cTbyzgiIw2tnyjsBNEvJEw1ZKrB7iyRbp2xOgkRFXf6rUVjq03OnTEeiN0vsdalHn4AdwZHqd0Es780XXQTXRFt195bNcEGincpKtuzRqJ0OnY60R8/F5yPtB8+cNTOs2Q+eNEukP7vjplUqi5mhGzV3HKwLs7DJpMxD9twk/s4GtJf6JNp3Rtpft+vC7InavXlzHCes5vXnUogp8uD4udjpHovmxF1RixyJnRrFB86TJVM5Ty5QZD851lFlBm1nB4DJdg7GxKjnDDcWQlxngKGSzYCGVhizo/meA3WGtTJDyAdW05NbLzO2nxWJvb4uUruAYpalSU8bsvRkk4vIMHqvU7OTXQX0ZCqDJlZx7O+UKVbdc1HLzGDrzp0V2Kb2wE6dcVb2CyHaWRsF3gXJ85JUbWrUTDcN7jKQJ9OqSQztRL+g2dPebjutZRI9zPvAZghpzcT7zHfZnaov30XrsZIMygotQhdpDn6Hp+NOyG0y6Spw2dRA6/bRAG4OBFth5N507gMNR7CVZ6yuS/dJdMoH4lyBQFvzpsqnDYUmHc009qUh+8QIZuiMVCRtbxF6JWmG6gZI4qK8utoViUHqLcejArLoTPVrEUKVq4BG6qBZgmA5WFp2swn00zhJQ2BIC75nLUQ7pga/vpfy+Ajtk05evUUBwRzaofFrQgC2eVghs/RLwOr7JB2TCRP5nrXKtPB9VjsrjPGdaJeX8h3txa9M8ZjukX0iLjkE4xoCBWapTwPMWgCN1ruEja0+ajLkxkKoi9xpUEvXjrf7AuJU2QQOJID0XWZiVqWRKazaZTMZ9qAAGCM0k9LV/bxRqWQUkNMLUwbAlXFo6qUrF4oECUGtA106dx7ERTDk1wQS7dRJQ+pM3AFZktPoVvY/UdKg0K20hjmQ7HwE80qlp320UQvRTdonpNozj0t5YdIX2jXfaYJM+J6Obg7tJIUHmlAdAzCjm53WUrpVJTkfB3MK87ek8NcmKS/oSAAQBhCoZRVwECAH0AwuwM62VPo0ui9xxUwJ4vrLwHKjKv0yS/W9FjUIZI8NmCXPcSbYZpjaQAXVaMvQnssk2vtUZho4VrNKz6AuTTv7wVu0E78r7Ypo075YtaVI6hbtSUqHzHfueL3srxdqHTiPIu6HtJP/3ggWJzw8sOvzmnjbHrgAtPPCdID4RZlpTwjSICr34I7AX6RRYQOafJH91KoiWVqTfZx/J50CBVTGUnrJ34AUrY2pQbsIzD54aZCL6/NC7kHVveTYZ6lXBiwh84D3Aay0g6IfLO2IDiScxA1ccQHtWvAgOl5pkms65HwTnV2QjhkE1OD4DoYW4bumXUtZHSevH+pnoKaFeo4D3jfqOicsb3IMCiJQA3diRQ1J7jwY6INdEQgnWU2D8BZFMiCbLZSH2WAueJsDrOo1IKZ8jIRGWwd5RpUpZCqpyvqWO1w2RZj4yQjtQeUFA1ygq8eARlyedqx2jOOXTT+gXQ1YBdx0rbvfwFyaR7t0QAAZ+Ml9UJ1X5aE6wQsFcwpTjbVmUBWVtHwyCupQJFpKlE0KxewQSJqTVOPGR8pUhFooDGBJgR1UicP54RDQAIBO5QV9XzO2PmJPVQ+sp1ReNjPSNfnaNY8g1A1FSL1L5waiGX2h2KAdXN0U0M11bYpyqfilaWfNwlqS8hCNw3wXcwWE/wGHgsTSrujmarBEVmlqvQCqr/nFBXMKZuNNqxhrvj5/c88wiWznTHxhEtLgShqXMFyaVzFZSYKgGbsMHU6CMYil8QXElZm2fjpXMqW4oQgkgW1+BmgyL6h+tSOivDq3iOZKru2QfM31CqoDapkRTI4cF1Q+NTGbbTJ2z0IGlKSu6ZaiGSzfmc+8KLmhnUAr5ikDGXGw4ZW0G8LAyGydt/hsTI5Bp9C/oma5cCApCwLKoOINgVoqAJJkhjpBg1WKo86EH2MbW2qAhglYiTRSgJlHlqq6Jyn0IxIbGBcQNANMvVnDBKKd0RKU1gJdd8VHLY1atNdzpElBHKWdfwLUzgdEOypeMFSlGZE1iGpXqhwaLWlpr+RZMGvaUfO9EV/4AnYFWBU/aBPEAZDBXfPvtJVoNKAd+fsGQGJCYG5nSwHNLKKuYHBbSxUQ8iruOOyGo3S5E7TMMw/XnmB/VTkCwlDjURAkibI2MqzO/3WdYJB3m3aFTAI5eoDDCO0WiyBodPtTiMQOoaLJPSwQDUMyxWxxJGnazMcgDhtSjsqjVNcxhdvNlbcURmN66+XwROtrf48yKPdUkRrY8uYUWN3AmBB7SW9xQYl0e4wCQV0oqSESQz/fArDPSC/sAa7uwRPD0ockMxfm9iscFINQeRkqregb3nQAtHVo0WzOcQjaUhFgyVnpINoNwGEIalO+ohNgfudjfqqOizAHS63rFib9L92bbjhTbLSWAU8thIWCrHOlgco2HD2jwQ1BD+Ra4qIWjIY2dUuBxdI9TKvlgDEQdJ1QgxqgaigCJPuv2YaeR7uyK5envUkwKAMGzFggKBAx7SLRg8qXaCeAByZg0Mw4LLFFO0e0OiBWSBth2IBUE2emTBymyxL6XAMDV65BEVh7jICaEykholV6uV0NKA2yprRoE1V/Rhg693F/Txfd6pRMuxoUV6nlM2gV0Cj9y017TqsEi87pXPhO+bQ6oBE+nP9GwLxEOHdAc8HB1boBbNR+WZYaGvgi/eYxcsT+QEePv4HtpMsyzXhwwNPuAMIheDJeGO3nQrce0M2lXZMHG6AdWvSPgNikASvUBnmeO5hTeGGA1gRsANg5WtMtEgSy0h/uOei7MsK4SoTlgTAmIXS80zZMrpSQcNGhnVkz9L8ItGs6WjT6eJ++QTt7c2paR7sZM+j7uDHacUFHWJTWPRZgfpiWdzKU/5Ey1e9D13rj0FdJUjo4aT2UDjZvW+nyE9QFC4eQB5RolEGllU3DlqhRNOtn1L3RJW7RyyVUQABomloZpx1REXj8pX0HjmbK19RaiAaemBnQ7Mod3ENFM+eNdWyQ2cltizUH7o+opLmlGW2nMGmpDYxbF4c0W9IVzTgfdy6PeWmnzDh9Ax0T6qyXTQtgO4GvVKD0qK8BqQJg03K5YGuueA4amrVMUPR48FJa3Umw0iVxaqTcphkkt1J2nbVUpKoGwDbNFG/GMTDkfYnoVL1KJ9kQzahyD5UHmndgylQ059lcrM/pduBidVr0g/OC9ADu+RbNiJYOVQ+NBXR8ZozKfcp78HJSMxNNqAuDwrWKtuLINYh6CtXzXnqbwlpVtfc4b1XVQXLfKXW95tLMZ452uRPCKF0wXqsB7fYe/yyg2WQ3ntaoJcUaQ3urvceq0alpbj3YxAU0y8ts87NvhWYayvuF29Cjpere2mroxjPB3RiIrbFnwOqnpbiyGGBNurmMFg2A42lg7Bl4cWmXPM+R9nk81+rPP78M7Yjzr1+E8P8B0szv+tLrxRwAAAAASUVORK5CYII=")'}}),Trust=({theme:o="light",...et})=>jsxRuntimeExports.jsxs("svg",{...et,width:"44",height:"44",viewBox:"0 0 44 44",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntimeExports.jsx("rect",{width:"44",height:"44",fill:o==="light"?"var(--ck-brand-trust-02)":"var(--ck-brand-trust-02b)"}),jsxRuntimeExports.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M33.0246 11.8662C33.4096 11.8662 33.774 12.0243 34.0421 12.2925C34.3102 12.5675 34.4615 12.9387 34.4546 13.3168C34.3859 17.4143 34.2277 20.5493 33.9321 23.0312C33.6433 25.5131 33.2102 27.3556 32.5571 28.8475C32.1171 29.8443 31.574 30.6693 30.9346 31.3706C30.0752 32.2987 29.0921 32.9725 28.0196 33.6119C27.561 33.8861 27.0843 34.1568 26.5842 34.4408C25.5172 35.0468 24.3441 35.713 23.0146 36.6025C22.5333 36.9256 21.9077 36.9256 21.4265 36.6025C20.0766 35.7026 18.8879 35.0281 17.8112 34.4173C17.5718 34.2815 17.3379 34.1488 17.109 34.0175C15.8509 33.2887 14.7165 32.5943 13.7265 31.5906C13.0665 30.9306 12.4959 30.1262 12.0421 29.1706C11.4234 27.8918 11.004 26.345 10.6946 24.3443C10.2821 21.67 10.0759 18.1706 10.0002 13.3168C9.99336 12.9387 10.1377 12.5675 10.4059 12.2925C10.674 12.0243 11.0452 11.8662 11.4302 11.8662H12.0215C13.8433 11.8731 17.8652 11.6943 21.344 8.98559C21.8596 8.58683 22.5815 8.58683 23.0971 8.98559C26.5759 11.6943 30.5977 11.8731 32.4265 11.8662H33.0246ZM29.8277 27.9331C30.2746 27.0118 30.6459 25.74 30.9277 23.9112C31.2646 21.725 31.4709 18.755 31.5671 14.7125C29.4221 14.6506 25.7371 14.2381 22.224 11.8731C18.7109 14.2312 15.0259 14.6437 12.8877 14.7125C12.9633 18.0537 13.1146 20.6525 13.3552 22.6943C13.6302 25.0181 14.0221 26.5925 14.5102 27.6993C14.8333 28.435 15.1909 28.9643 15.6171 29.4318C16.1877 30.0575 16.9096 30.5731 17.8927 31.1643C18.3005 31.409 18.7502 31.6635 19.2396 31.9406C20.1116 32.4341 21.1099 32.9991 22.224 33.7081C23.3175 33.0107 24.3014 32.4515 25.1633 31.9616C25.4231 31.8139 25.6717 31.6725 25.909 31.5356C27.119 30.8412 28.0127 30.2637 28.6796 29.59C29.1265 29.1293 29.4909 28.6275 29.8277 27.9331Z",fill:o==="light"?"var(--ck-brand-trust-01)":"var(--ck-brand-trust-01b)"})]}),Argent=({...o})=>jsxRuntimeExports.jsxs("svg",{...o,width:"32",height:"32",viewBox:"0 0 32 32",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntimeExports.jsx("rect",{width:"32",height:"32",fill:"white"}),jsxRuntimeExports.jsx("path",{d:"M18.3242 7.63647H13.6516C13.4955 7.63647 13.3704 7.76611 13.367 7.92726C13.2726 12.4568 10.9768 16.7559 7.02532 19.8009C6.89986 19.8976 6.87128 20.0792 6.963 20.21L9.69685 24.112C9.78986 24.2448 9.97107 24.2747 10.0986 24.1772C12.5694 22.2856 14.5567 20.0038 15.9879 17.4746C17.4191 20.0038 19.4065 22.2856 21.8773 24.1772C22.0047 24.2747 22.186 24.2448 22.2791 24.112L25.013 20.21C25.1045 20.0792 25.0759 19.8976 24.9506 19.8009C20.999 16.7559 18.7033 12.4568 18.609 7.92726C18.6056 7.76611 18.4803 7.63647 18.3242 7.63647Z",fill:"var(--ck-brand-argent)"})]}),ImToken=({...o})=>jsxRuntimeExports.jsx("svg",{...o,width:"32",height:"32",viewBox:"0 0 32 32",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{background:`linear-gradient( +`;return typeof nt=="function"&&nt(null,ht),ht};const canPromise=canPromise$1,QRCode$2=qrcode,CanvasRenderer=canvas,SvgRenderer=svgTag;function renderCanvas(o,et,tt,nt,rt){const ot=[].slice.call(arguments,1),it=ot.length,st=typeof ot[it-1]=="function";if(!st&&!canPromise())throw new Error("Callback required as last argument");if(st){if(it<2)throw new Error("Too few arguments provided");it===2?(rt=tt,tt=et,et=nt=void 0):it===3&&(et.getContext&&typeof rt>"u"?(rt=nt,nt=void 0):(rt=nt,nt=tt,tt=et,et=void 0))}else{if(it<1)throw new Error("Too few arguments provided");return it===1?(tt=et,et=nt=void 0):it===2&&!et.getContext&&(nt=tt,tt=et,et=void 0),new Promise(function(at,ct){try{const lt=QRCode$2.create(tt,nt);at(o(lt,et,nt))}catch(lt){ct(lt)}})}try{const at=QRCode$2.create(tt,nt);rt(null,o(at,et,nt))}catch(at){rt(at)}}browser$1.create=QRCode$2.create;browser$1.toCanvas=renderCanvas.bind(null,CanvasRenderer.render);browser$1.toDataURL=renderCanvas.bind(null,CanvasRenderer.renderToDataURL);browser$1.toString=renderCanvas.bind(null,function(o,et,tt){return SvgRenderer.render(o,tt)});var PRE_ENTER=0,ENTERING=1,ENTERED=2,PRE_EXIT=3,EXITING=4,EXITED=5,UNMOUNTED=6,STATES=["preEnter","entering","entered","preExit","exiting","exited","unmounted"],startOrEnd=function(et){return et?UNMOUNTED:EXITED},updateState=function(et,tt,nt,rt,ot){clearTimeout(rt.current),tt(et),nt.current=et,ot&&ot({state:STATES[et]})},useTransition=function(et){var tt=et===void 0?{}:et,nt=tt.enter,rt=nt===void 0?!0:nt,ot=tt.exit,it=ot===void 0?!0:ot,st=tt.preEnter,at=tt.preExit,ct=tt.timeout,lt=tt.initialEntered,dt=tt.mountOnEnter,ht=tt.unmountOnExit,pt=tt.onChange,mt=reactExports.useState(lt?ENTERED:startOrEnd(dt)),ft=mt[0],yt=mt[1],gt=reactExports.useRef(ft),xt=reactExports.useRef(),vt,bt;typeof ct=="object"?(vt=ct.enter,bt=ct.exit):vt=bt=ct;var Et=reactExports.useCallback(function(){var kt;switch(gt.current){case ENTERING:case PRE_ENTER:kt=ENTERED;break;case EXITING:case PRE_EXIT:kt=startOrEnd(ht);break}kt!==void 0&&updateState(kt,yt,gt,xt,pt)},[pt,ht]),wt=reactExports.useCallback(function(kt){var It=function Pt(jt){switch(updateState(jt,yt,gt,xt,pt),jt){case ENTERING:vt>=0&&(xt.current=setTimeout(Et,vt));break;case EXITING:bt>=0&&(xt.current=setTimeout(Et,bt));break;case PRE_ENTER:case PRE_EXIT:xt.current=setTimeout(function(){return Pt(jt+1)},0);break}},Rt=gt.current<=ENTERED;typeof kt!="boolean"&&(kt=!Rt),kt?Rt||It(rt?st?PRE_ENTER:ENTERING:ENTERED):Rt&&It(it?at?PRE_EXIT:EXITING:startOrEnd(ht))},[Et,pt,rt,it,st,at,vt,bt,ht]);return reactExports.useEffect(function(){return function(){return clearTimeout(xt.current)}},[]),[STATES[ft],wt,Et]};const defaultConnectors=({app:o,walletConnectProjectId:et,coinbaseWalletPreference:tt})=>{const nt=o.name&&o.icon&&o.description&&o.url,rt=!(typeof window>"u")&&(window==null?void 0:window.parent)!==window,ot=[];return rt&&ot.push(safe({allowedDomains:[/gnosis-safe.io$/,/app.safe.global$/]})),ot.push(injected({target:"metaMask"}),coinbaseWallet({appName:o.name,appLogoUrl:o.icon,overrideIsMetaMask:!1,preference:tt})),et&&ot.push(walletConnect({showQrModal:!1,projectId:et,metadata:nt?{name:o.name,description:o.description,url:o.url,icons:[o.icon]}:void 0})),ot};let globalAppName,globalAppIcon;const getAppName=()=>globalAppName,getAppIcon=()=>globalAppIcon,defaultConfig=({appName:o="ConnectKit",appIcon:et,appDescription:tt,appUrl:nt,walletConnectProjectId:rt,coinbaseWalletPreference:ot,chains:it=[mainnet,polygon,optimism,arbitrum],client:st,...at})=>{var ct,lt;globalAppName=o,et&&(globalAppIcon=et);const dt=(ct=at==null?void 0:at.transports)!==null&&ct!==void 0?ct:Object.fromEntries(it.map(mt=>[mt.id,http()])),ht=(lt=at==null?void 0:at.connectors)!==null&<!==void 0?lt:defaultConnectors({app:{name:o,icon:et,description:tt,url:nt},walletConnectProjectId:rt,coinbaseWalletPreference:ot});return{...at,chains:it,connectors:ht,transports:dt}},isWalletInstalled=o=>{if(typeof window>"u")return!1;const{ethereum:et}=window;return!!(et!=null&&et[`is${o}`]||et!=null&&et.providers&&(et!=null&&et.providers.find(tt=>tt==null?void 0:tt[`is${o}`])))},isFamily=()=>isWalletInstalled("Family"),isRainbow=()=>isWalletInstalled("Rainbow"),isZerion=()=>isWalletInstalled("Zerion"),Mock=({...o})=>jsxRuntimeExports.jsxs("svg",{...o,"aria-hidden":"true",width:"44",height:"44",viewBox:"0 0 44 44",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{background:"linear-gradient(180deg, #8995A9 0%, #424D5F 99.48%)"},children:[jsxRuntimeExports.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M20.5611 8.12948C21.0082 7.90729 21.5007 7.79167 22 7.79167C22.4993 7.79167 22.9919 7.90729 23.439 8.12948L23.4408 8.1304L33.0387 12.9293C33.577 13.197 34.031 13.61 34.3478 14.121C34.6649 14.6323 34.833 15.2218 34.8333 15.8234V27.2595C34.833 27.8611 34.6649 28.4511 34.3478 28.9624C34.031 29.4733 33.578 29.8858 33.0398 30.1535L23.4411 34.9528C22.9919 35.1775 22.4963 35.2947 21.994 35.2947C21.4918 35.2947 20.9964 35.1777 20.5472 34.9529L10.9475 30.1531L10.9452 30.1519C10.4071 29.8808 9.95535 29.4646 9.6411 28.9504C9.32739 28.437 9.16312 27.8464 9.16673 27.2448L9.16675 27.2417L10.0004 27.2475H9.16673V27.2448V15.8239C9.16705 15.2223 9.33518 14.6322 9.65222 14.121C9.96906 13.61 10.4221 13.1976 10.9604 12.9298L20.5592 8.1304L20.5611 8.12948ZM21.3031 9.62267L11.8706 14.3389L22 19.4036L32.1294 14.3389L22.697 9.62267C22.4806 9.51531 22.2416 9.45905 22 9.45905C21.7585 9.45905 21.5194 9.51534 21.3031 9.62267ZM10.8341 15.8241C10.8341 15.7785 10.8362 15.733 10.8401 15.6878L21.1663 20.8509V33.3983L11.6955 28.6629C11.4352 28.5315 11.2159 28.3297 11.0638 28.0809C10.9116 27.8318 10.8321 27.5452 10.8341 27.2533L10.8341 27.2475V15.8241ZM22.8337 33.3923L32.2967 28.6608C32.5576 28.5312 32.7772 28.3313 32.9308 28.0836C33.0844 27.836 33.1658 27.5504 33.166 27.259V15.8243C33.1659 15.7786 33.1639 15.7331 33.1599 15.6878L22.8337 20.8509V33.3923Z",fill:"url(#paint0_linear_3546_7073)"}),jsxRuntimeExports.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M10.8341 15.8241C10.8341 15.7785 10.8362 15.733 10.8401 15.6878L21.1663 20.8509V33.3983L11.6955 28.6629C11.4352 28.5315 11.2159 28.3297 11.0638 28.0809C10.9116 27.8318 10.8321 27.5452 10.8341 27.2533L10.8341 27.2475V15.8241Z",fill:"url(#paint1_linear_3546_7073)",fillOpacity:"0.3"}),jsxRuntimeExports.jsxs("defs",{children:[jsxRuntimeExports.jsxs("linearGradient",{id:"paint0_linear_3546_7073",x1:"22",y1:"7.79167",x2:"22",y2:"35.2947",gradientUnits:"userSpaceOnUse",children:[jsxRuntimeExports.jsx("stop",{stopColor:"white"}),jsxRuntimeExports.jsx("stop",{offset:"1",stopColor:"white",stopOpacity:"0.7"})]}),jsxRuntimeExports.jsxs("linearGradient",{id:"paint1_linear_3546_7073",x1:"22",y1:"7.79167",x2:"22",y2:"35.2947",gradientUnits:"userSpaceOnUse",children:[jsxRuntimeExports.jsx("stop",{stopColor:"white"}),jsxRuntimeExports.jsx("stop",{offset:"1",stopColor:"white",stopOpacity:"0.7"})]})]})]}),Injected=({...o})=>jsxRuntimeExports.jsx("svg",{...o,width:"32",height:"32",viewBox:"0 0 32 32",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntimeExports.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M15.6505 3.64041C15.6501 3.64062 15.6497 3.64083 15.6493 3.64103L6.05165 8.43985L16.2501 13.5391L26.4484 8.43987L16.8508 3.64103C16.8504 3.64083 16.85 3.64063 16.8496 3.64043C16.6632 3.54806 16.458 3.5 16.25 3.5C16.042 3.5 15.8369 3.54806 15.6505 3.64041ZM28 10.4592L17.5001 15.7091L17.5 28.5205L27.248 23.6465L27.2508 23.6452C27.4757 23.5334 27.665 23.3611 27.7973 23.1477C27.9297 22.9342 27.9999 22.6881 28 22.4369V10.4592ZM15 28.527L15.0001 15.7091L4.50006 10.4591V22.4333C4.49831 22.6849 4.56687 22.9319 4.69807 23.1466C4.82896 23.3608 5.01696 23.5342 5.24095 23.6475C5.24148 23.6477 5.242 23.648 5.24253 23.6483L15 28.527ZM14.5207 31.0824L4.12104 25.8826L4.11759 25.8809C3.47681 25.558 2.93902 25.0625 2.56486 24.4502C2.19154 23.8394 1.99597 23.1365 2.00006 22.4207V10.0486C2.00044 9.33234 2.20062 8.62972 2.5781 8.021C2.95529 7.41274 3.49457 6.92167 4.13537 6.60291C4.13585 6.60267 4.13633 6.60243 4.13681 6.60219L14.534 1.40359L14.5368 1.40221C15.0692 1.13767 15.6556 1 16.25 1C16.8445 1 17.4309 1.13767 17.9633 1.40221L17.966 1.40358L28.3633 6.60219C28.3638 6.60245 28.3643 6.6027 28.3648 6.60295C29.0055 6.92171 29.5448 7.41276 29.922 8.021C30.2994 8.62973 30.4996 9.33168 30.5 10.0479V22.4376C30.4996 23.1538 30.2994 23.8565 29.922 24.4652C29.5448 25.0734 29.0056 25.5644 28.365 25.8831C28.3644 25.8834 28.3638 25.8837 28.3633 25.884L17.9664 31.0824C17.9663 31.0825 17.9665 31.0824 17.9664 31.0824C17.4316 31.3499 16.8415 31.4894 16.2435 31.4894C15.6455 31.4894 15.0554 31.3499 14.5207 31.0824C14.5205 31.0824 14.5208 31.0825 14.5207 31.0824Z",fill:"#CCCCCC"})}),WalletConnect=({background:o=!1,...et})=>jsxRuntimeExports.jsx("svg",{...et,width:"32",height:"32",viewBox:"0 0 32 32",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:o?{background:"var(--ck-brand-walletConnect)"}:void 0,children:jsxRuntimeExports.jsx("path",{d:"M9.58818 11.8556C13.1293 8.31442 18.8706 8.31442 22.4117 11.8556L22.8379 12.2818C23.015 12.4588 23.015 12.7459 22.8379 12.9229L21.3801 14.3808C21.2915 14.4693 21.148 14.4693 21.0595 14.3808L20.473 13.7943C18.0026 11.3239 13.9973 11.3239 11.5269 13.7943L10.8989 14.4223C10.8104 14.5109 10.6668 14.5109 10.5783 14.4223L9.12041 12.9645C8.94336 12.7875 8.94336 12.5004 9.12041 12.3234L9.58818 11.8556ZM25.4268 14.8706L26.7243 16.1682C26.9013 16.3452 26.9013 16.6323 26.7243 16.8093L20.8737 22.6599C20.6966 22.8371 20.4096 22.8371 20.2325 22.6599L16.0802 18.5076C16.0359 18.4634 15.9641 18.4634 15.9199 18.5076L11.7675 22.6599C11.5905 22.8371 11.3034 22.8371 11.1264 22.66C11.1264 22.66 11.1264 22.6599 11.1264 22.6599L5.27561 16.8092C5.09856 16.6322 5.09856 16.3451 5.27561 16.168L6.57313 14.8706C6.75019 14.6934 7.03726 14.6934 7.21431 14.8706L11.3668 19.023C11.411 19.0672 11.4828 19.0672 11.5271 19.023L15.6793 14.8706C15.8563 14.6934 16.1434 14.6934 16.3205 14.8706L20.473 19.023C20.5172 19.0672 20.589 19.0672 20.6332 19.023L24.7856 14.8706C24.9627 14.6935 25.2498 14.6935 25.4268 14.8706Z",fill:o?"white":"var(--ck-brand-walletConnect)"})}),MetaMask=({background:o=!1,...et})=>jsxRuntimeExports.jsxs("svg",{...et,style:o?{background:"linear-gradient(0deg, var(--ck-brand-metamask-12), var(--ck-brand-metamask-11))",borderRadius:"27.5%"}:void 0,width:"32",height:"32",viewBox:"0 0 32 32",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntimeExports.jsx("path",{d:"M27.2684 4.03027L17.5018 11.2841L19.3079 7.00442L27.2684 4.03027Z",fill:"var(--ck-brand-metamask-02)",stroke:"var(--ck-brand-metamask-02)",strokeWidth:"0.269931",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntimeExports.jsx("path",{d:"M4.7218 4.03027L14.4099 11.3528L12.6921 7.00442L4.7218 4.03027Z",fill:"var(--ck-brand-metamask-08)",stroke:"var(--ck-brand-metamask-08)",strokeWidth:"0.269931",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntimeExports.jsx("path",{d:"M23.7544 20.8438L21.1532 24.8289L26.7187 26.3602L28.3187 20.9321L23.7544 20.8438Z",fill:"var(--ck-brand-metamask-08)",stroke:"var(--ck-brand-metamask-08)",strokeWidth:"0.269931",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntimeExports.jsx("path",{d:"M3.69104 20.9321L5.28117 26.3602L10.8467 24.8289L8.24551 20.8438L3.69104 20.9321Z",fill:"var(--ck-brand-metamask-08)",stroke:"var(--ck-brand-metamask-08)",strokeWidth:"0.269931",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntimeExports.jsx("path",{d:"M10.5327 14.1108L8.98181 16.4568L14.5081 16.7022L14.3117 10.7637L10.5327 14.1108Z",fill:"var(--ck-brand-metamask-08)",stroke:"var(--ck-brand-metamask-08)",strokeWidth:"0.269931",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntimeExports.jsx("path",{d:"M21.4576 14.1111L17.6295 10.6953L17.5018 16.7025L23.0182 16.4571L21.4576 14.1111Z",fill:"var(--ck-brand-metamask-08)",stroke:"var(--ck-brand-metamask-08)",strokeWidth:"0.269931",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntimeExports.jsx("path",{d:"M10.8469 24.8292L14.1647 23.2096L11.2984 20.9717L10.8469 24.8292Z",fill:"var(--ck-brand-metamask-08)",stroke:"var(--ck-brand-metamask-08)",strokeWidth:"0.269931",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntimeExports.jsx("path",{d:"M17.8257 23.2096L21.1531 24.8292L20.6918 20.9717L17.8257 23.2096Z",fill:"var(--ck-brand-metamask-08)",stroke:"var(--ck-brand-metamask-08)",strokeWidth:"0.269931",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntimeExports.jsx("path",{d:"M21.1531 24.8296L17.8257 23.21L18.0906 25.3793L18.0612 26.2921L21.1531 24.8296Z",fill:"var(--ck-brand-metamask-06)",stroke:"var(--ck-brand-metamask-06)",strokeWidth:"0.269931",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntimeExports.jsx("path",{d:"M10.8469 24.8296L13.9388 26.2921L13.9192 25.3793L14.1647 23.21L10.8469 24.8296Z",fill:"var(--ck-brand-metamask-06)",stroke:"var(--ck-brand-metamask-06)",strokeWidth:"0.269931",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntimeExports.jsx("path",{d:"M13.9877 19.5389L11.2196 18.7242L13.1729 17.8311L13.9877 19.5389Z",fill:"var(--ck-brand-metamask-09)",stroke:"var(--ck-brand-metamask-09)",strokeWidth:"0.269931",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntimeExports.jsx("path",{d:"M18.0023 19.5389L18.8171 17.8311L20.7802 18.7242L18.0023 19.5389Z",fill:"var(--ck-brand-metamask-09)",stroke:"var(--ck-brand-metamask-09)",strokeWidth:"0.269931",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntimeExports.jsx("path",{d:"M10.8468 24.8289L11.3179 20.8438L8.24561 20.9321L10.8468 24.8289Z",fill:"var(--ck-brand-metamask-03)",stroke:"var(--ck-brand-metamask-03)",strokeWidth:"0.269931",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntimeExports.jsx("path",{d:"M20.6821 20.8438L21.1532 24.8289L23.7544 20.9321L20.6821 20.8438Z",fill:"var(--ck-brand-metamask-03)",stroke:"var(--ck-brand-metamask-03)",strokeWidth:"0.269931",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntimeExports.jsx("path",{d:"M23.0182 16.4565L17.5018 16.7019L18.0122 19.5387L18.827 17.8308L20.7902 18.7239L23.0182 16.4565Z",fill:"var(--ck-brand-metamask-03)",stroke:"var(--ck-brand-metamask-03)",strokeWidth:"0.269931",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntimeExports.jsx("path",{d:"M11.2198 18.7239L13.1829 17.8308L13.9878 19.5387L14.5081 16.7019L8.98181 16.4565L11.2198 18.7239Z",fill:"var(--ck-brand-metamask-03)",stroke:"var(--ck-brand-metamask-03)",strokeWidth:"0.269931",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntimeExports.jsx("path",{d:"M8.98181 16.4565L11.2983 20.9718L11.2198 18.7239L8.98181 16.4565Z",fill:"var(--ck-brand-metamask-10)",stroke:"var(--ck-brand-metamask-10)",strokeWidth:"0.269931",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntimeExports.jsx("path",{d:"M20.7901 18.7239L20.6919 20.9718L23.0181 16.4565L20.7901 18.7239Z",fill:"var(--ck-brand-metamask-10)",stroke:"var(--ck-brand-metamask-10)",strokeWidth:"0.269931",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntimeExports.jsx("path",{d:"M14.508 16.7021L13.9878 19.5389L14.6356 22.886L14.7828 18.4788L14.508 16.7021Z",fill:"var(--ck-brand-metamask-10)",stroke:"var(--ck-brand-metamask-10)",strokeWidth:"0.269931",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntimeExports.jsx("path",{d:"M17.5017 16.7021L17.2367 18.4689L17.3545 22.886L18.0121 19.5389L17.5017 16.7021Z",fill:"var(--ck-brand-metamask-10)",stroke:"var(--ck-brand-metamask-10)",strokeWidth:"0.269931",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntimeExports.jsx("path",{d:"M18.0121 19.5388L17.3545 22.886L17.8257 23.2099L20.6918 20.972L20.79 18.7241L18.0121 19.5388Z",fill:"var(--ck-brand-metamask-01)",stroke:"var(--ck-brand-metamask-01)",strokeWidth:"0.269931",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntimeExports.jsx("path",{d:"M11.2196 18.7241L11.2981 20.972L14.1644 23.2099L14.6355 22.886L13.9877 19.5388L11.2196 18.7241Z",fill:"var(--ck-brand-metamask-01)",stroke:"var(--ck-brand-metamask-01)",strokeWidth:"0.269931",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntimeExports.jsx("path",{d:"M18.0615 26.2917L18.0908 25.3788L17.8455 25.1628H14.145L13.9192 25.3788L13.9388 26.2917L10.8469 24.8291L11.9267 25.7126L14.1155 27.234H17.875L20.0736 25.7126L21.1533 24.8291L18.0615 26.2917Z",fill:"var(--ck-brand-metamask-07)",stroke:"var(--ck-brand-metamask-07)",strokeWidth:"0.269931",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntimeExports.jsx("path",{d:"M17.8258 23.2096L17.3546 22.8857H14.6357L14.1646 23.2096L13.9191 25.379L14.1449 25.163H17.8454L18.0907 25.379L17.8258 23.2096Z",fill:"var(--ck-brand-metamask-04)",stroke:"var(--ck-brand-metamask-04)",strokeWidth:"0.269931",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntimeExports.jsx("path",{d:"M27.6806 11.7552L28.5149 7.75041L27.2683 4.03027L17.8257 11.0387L21.4575 14.1109L26.591 15.6128L27.7296 14.2876L27.2389 13.9342L28.0241 13.2178L27.4156 12.7465L28.2007 12.1478L27.6806 11.7552Z",fill:"var(--ck-brand-metamask-05)",stroke:"var(--ck-brand-metamask-05)",strokeWidth:"0.269931",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntimeExports.jsx("path",{d:"M3.48486 7.75041L4.3192 11.7552L3.78916 12.1478L4.57441 12.7465L3.97566 13.2178L4.7609 13.9342L4.27012 14.2876L5.39892 15.6128L10.5325 14.1109L14.1644 11.0387L4.72164 4.03027L3.48486 7.75041Z",fill:"var(--ck-brand-metamask-05)",stroke:"var(--ck-brand-metamask-05)",strokeWidth:"0.269931",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntimeExports.jsx("path",{d:"M26.591 15.6122L21.4575 14.1104L23.0181 16.4564L20.6919 20.9716L23.7544 20.9323H28.3186L26.591 15.6122Z",fill:"var(--ck-brand-metamask-01)",stroke:"var(--ck-brand-metamask-01)",strokeWidth:"0.269931",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntimeExports.jsx("path",{d:"M10.5326 14.1104L5.39897 15.6122L3.69104 20.9323H8.24551L11.2982 20.9716L8.98168 16.4564L10.5326 14.1104Z",fill:"var(--ck-brand-metamask-01)",stroke:"var(--ck-brand-metamask-01)",strokeWidth:"0.269931",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntimeExports.jsx("path",{d:"M17.5018 16.7018L17.8258 11.0381L19.3177 7.00391H12.6921L14.1645 11.0381L14.5081 16.7018L14.6258 18.4883L14.6356 22.8856H17.3546L17.3742 18.4883L17.5018 16.7018Z",fill:"var(--ck-brand-metamask-01)",stroke:"var(--ck-brand-metamask-01)",strokeWidth:"0.269931",strokeLinecap:"round",strokeLinejoin:"round"})]}),Coinbase=({background:o=!1,...et})=>jsxRuntimeExports.jsxs("svg",{...et,width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntimeExports.jsx("circle",{cx:"10",cy:"10",r:"10",fill:"var(--ck-brand-coinbaseWallet)"}),o&&jsxRuntimeExports.jsx("rect",{rx:"27%",width:"20",height:"20",fill:"var(--ck-brand-coinbaseWallet)"}),jsxRuntimeExports.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M10.0001 17C13.8661 17 17.0001 13.866 17.0001 10C17.0001 6.13401 13.8661 3 10.0001 3C6.13413 3 3.00012 6.13401 3.00012 10C3.00012 13.866 6.13413 17 10.0001 17ZM8.25012 7.71429C7.95427 7.71429 7.71441 7.95414 7.71441 8.25V11.75C7.71441 12.0459 7.95427 12.2857 8.25012 12.2857H11.7501C12.046 12.2857 12.2858 12.0459 12.2858 11.75V8.25C12.2858 7.95414 12.046 7.71429 11.7501 7.71429H8.25012Z",fill:"white"})]}),Family=({...o})=>jsxRuntimeExports.jsx("svg",{...o,width:"120",height:"120",viewBox:"0 0 120 120",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{backgroundSize:"100% 100%",backgroundImage:'url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAALQAAAC0CAYAAAA9zQYyAAABQGlDQ1BzUDNDAAB4nGNgYHyQk5xbzKLAwJCbV1IU5O6kEBEZpcD+iIGZQYSBk4GPQTYxubjAN9gthAEIihPLi5NLinIYUMC3awyMIPqybkZiXopc+xz3pvOzD4rlWyascy2VY8APuFJSi5OB9B8gVkkuKCphYGAEuoZBqbykAMR2AbJFkjMSU4DsCCBbpwjoQCC7BSSeDmHPALGTIOw1IHZRSJAzkH0AyFZIR2InIbFzc0qToW4AuZ4nNS80GEhzALEMQzFDAIMxgzMONWxgNc5AaMCgCAov9HAoTjM2gujicWJgYL33//9nVQYG9skMDH8n/P//e+H////8GBiYZzEwHBBB6G++z8Bgux/EQoh5AfkbzYHBtBUhpmHBwCDIxcBwoqIgsSgRLMQMxExpmQwMn5YzMPBGMjAIXwDqiQYAOQZcLsEClb4AAGmfSURBVHgB1b0J1G3HVR6497n3/98o6Q0anubBludJeAiTbYwd2gGC6UACBFZY7gVNB3CaJEB3VhbQhNW9OtDQkAYSIOkEGhJCGJrEBGzJkrEsT7Jky5JszXrSexqf3qw3/v891TXsvWvvferce/8nyabrvfPfc+rUqdq166u9d+06pwrP+/CHA3AI8RQRmqFxbyRliVdpcSQ9jj27IASwdAVHVxi7l65hcZAn6NlFdOOce4vCgB5Fc5iXdiN1abSFP1/2PrRoUtiYR/Oy9C9Tr7EwNVc4pwojTDFxC0CMI2nH8hwlhX4D5ZOvWwzy9cHlS8FlzhfwZNlyDN2pPlSXwT0VAtd7yTL8+SDuHOvCzzKdyOButIeuj6HfpTXtu8Ew3WD6NpjnALnFuI1IPB9GK0n5ZiCM9H4GyTJhLqAX1GHZMoJK70Etp0tK4nlhLqBfQF08CFnAgPrN8SHMz0N1YmjluYGwNKDnSeV5DEOnttHnpZ7fKBDyuWJWUHnKqWLUsgyaJ4WbjT2nDv56TCWL6gaw0vklrAv/vpD2mNcWrTpAI00+H9G0G5XWU/1gs8fBSCM1gMq/Y/d9BzD3WiqUpS4zQakyBkDQ6k7HQ5uZi4CgQepphJE66DiuC9PM57lcpsU1auA6Ul1Q1S399o6mF1qXFDq5NbyHqi7QoBmZ5wp8wdn+3G6o6qifRV0vQ3QtbxGwPUbT+RSXeEj/NiUyqQwP5BaIOw8Gl94HAwTKS0viXkk1fejeru02k2+jrNb1gE7d4GA7YwtEYYEtHyhN0HWh6/Q7AQV4bmidPwzDaF00rbpdGnHQqI+vh26LoPjNdQCi3XeAlL7zcaA6g5PYCDBqMup70xahvpK2DkMACmjVvc4904EFApL08dJgAAxVUX3OTEIlFcYYigooPi9fZ0nPtCj6fKPr+2MSD+fUARzNDBCJ0yBR9ZT6qjKC8jRImcxfvuf4b84pLXBdsG1bG94pLSL00i0taHpdP4rv6XnoOiut1aDSaCyYI3AV7aM29KAyc1QwNqSyZ5gHdEcM7kbyaAXfmOYg5vaF2MrQxCzFGFZ3Oj9dH98xPc263t0YQKAdPCA0CHxn1CDo+Z4ysSQvrovTPjkksHCdoLYDtOpCaY3AAZgvYBjABFShWdGfjs7VKcepugSiS3dK/6vt80HHUnVfalA4b2CHDROCG1uDmM87dd4Cgy5HiG1I2OB6uwEC9VhOhxosytZrSSAg2nU9dZ2wRT+MaB+mXwdtd7pD6qJA3ENtQCOxAYZ2d6M+Y3w2dQEL9rntQXXSAGOaO2f+zcACGZVwMRJZ5QtULxE+/OvKHAvTFhMs7bZx5XyOVNZg7kAxT0nkTkmNVNFunoRz6rZXKi4xxvR2YhoDm5ntJRxxroJhBMQtIHe+vj6e8muBTMwKJgFqg/eUV0/8aNWnWRfn/QBV/gDUrh2w0Un9PZMv063axEtfXxehn/JhgdNzHRoDQM2fWiU12Hb3OMyV0K3KeDAbadUA8AQsIDqVRqS1VndOOoCuWCBmIavgdE0MI/D2JCl61eAi7RSYWVWO1Rddp9QN7evQAnk5tJyRUgemknQ6rgMfyozyoNHqfTDo1PWAtkQWuhttxveB6lDqpWtQz7XG0HTqw8fNFF3mOWU+5eKcRNYSG6AN6qk2wNHZKWJPkgqQHstSFZxUpvOJZhTlNaHryQig828AwBFzoFQ0MQ8ziDOYMTGhJ6akhq+gnjGoYWjD8YBEQK0GFbrjAYyD2AAhd6KSFQNZQBCcOMDaTj1wfahjgjU5pB7U2B1UbcPqfCDJuC6qzYxWTPGR3xPTBqm9dD1R6gLAHdO2SSDaU6MJX/u+CA3XMWdES0edk6UzUr14nNDxs/QrfnPlANBSnmkKCsNTQ6gGk+r1A3uR47ykggrmibrWcRbQLOGGErEVqkRT6jjm2qtG5/MJAXwGwajApunhB0QODFrTtECd03VWwmk+1QqEobnBEjrTXkDOkjkBYUIgSHGmkyIaST/wCuCQnk4ETW2TBOSBSei1UkMDcJlFkBBPu0mhnwA6I3BO0nlMs574SrydoRt7Qe0A2VRRYDbjKIVRI6kpvpgcaJWjrkCnC8Wh50I3rkhhdT1RQJ5AZaIBNjZUdqOHDtSub2xEB+5YTpSQM2ApUk0PaA0wEF3Du/qBBcBE1Vnbn1wXAKtxuNzg6qCBrTtlp0FO5Zl0YMHMdeBfDUoteSe+ftxhVVov3TWPQNOv24bbIZ33SaOU81mU4h1pmBkdPEBE6rg6yLgIQAb1fvAbPF0UN5hY0b3GxI+AWYOXwTzRYCYglHN7TzPQgDoUM0QTUCUrSzEl4bCaGTOodhoDPEvr9Gwo5kp+tsOB71ZLpPpb6DYN7+qLyBpJaRwYDqiCrouugx8HxLqzNJ5BBbnutMYT4iUoCYNkBhWTCJrmoBU0heaJ/Or2BlUbMjWAgdww9aCAWOoQUnukMgjY8VgHEBM3g5qvCcAz6vxsZg0EkBIOmsfW5OCEKpGW2PMkM/fwdD51gJ4OAA71GfRmS2oAa9MOJxpIMkOpeJZiufGKqVFUNWSmiS2HKObKhJiuxw8AUMtnerDS5U2nOh6gdMD1YL5hFZYChfpbxwDa/scMBLYnRf1C6aCdgF55CAhMpmWx2vBm4Ad2LMNAnrTa1LW/RkVQvz0SqEmbzLDSOyOAI4E4CyqlTGYAYusz9tiG7uhX28/efQsNoFsJ7aTVIjNDwAkV2CsUxyCepgEIn9MzU8VII6mBTZxu0Mm4LxZgFk9HH9hOLoydEUNnGeCJjpAlQxo4zrB6C/TslkhodLYmWM1R60qgRjAdskq5CuiuYkB0pAZzoQVIqiHVAXPdZoE7axBg8AAraFDTL41ATVsyLRMPaAJz4k+HOJDURZr7+tiKsJZhM7AnwTIjzZN+14nvqdz19BsHjetprBH6iq0krWO8ES5OUouzAut7MQxs78qbagaAIV7hSR2+FwuDSBJPiTHTzsalgqY0us73FSgK07vCQG0OKsIDeQuyT0M1fC82clFjEwZ1aphQ8u9j3myKGFCr+gFJBRiRVtV0AiPhJtToDPTKJwvu5KGRupBUyx0T2EYO1VSCamumDjkDZUqxlA7VG1AHuEPtqr0YRiKHInSqhq0dtQ7WM+VO42DtlCylCdgzoT+QidFl4dLFmGw/0zQ3BvqNQM64i/HrDNqgXsrCOkcR9GA4uPc7FKiH73JQZtq3DNBQXQrMGsgGxJHQBOQVD/RScJVwWCUgWEEjhBYGBlHB1b5ij0Yqm+w1sTeBwIDk4bAN4AdTnZNqbFMycLWZNAUwEk1AQLDNT5PNL1PtSH+oSPbozUgDyYAqJliPfzU41sksYcnNklGm+509WQFNNjSoekDxykwRlLSm9KFAll18bIYBtbuRNsjjGDVucQIl//ZdHiCugRWWeZzUB4lc122OzMnqj0elVVEBHxRd1YbGxswSWneOPrRknjgJzQBeSQXEXlriC4jzgWAGi2xf8UBjU6zohaurcPnmzXDhpk2wfTrN6VJYiww4urYGz545HY8z8FQ8nl9fJ3VTGmad6ElgTnlP2FOAIICBUAEFaAFQzQ0w9r4e3IrXgyVYKEp4c6J902a4YssW2BXrcIGifT0mObJ2Fg6ePQvPpuP0aTg163MjBCqnF7o7GkwFMg0YLKTaMZCEZ5+8FUwMYgxBBniTGDPpap0Sz/PAkbr6aqR9T+T3ZYnvkfYdK6uwQoPztShNj6yvwcHI70OR/wfi71oocnKSNVDRmKklspuuLzRnV12H1L4I1P0K3mKesZoQLRAxwQCgvl0Itl49COKNIBLhBM5tJ+2Lbb+z9zUXScUgJRBHBqxgjVtByEcBeKxsVwBfGFmBsDsy7y07dsDrLjgfrti61fiijXoBG1Lc/pOn4LaDB+ELR4/CExHoE6h2bx6ksInCg8v0r3MAgDqZoDutsZs7HhBSJ8y9IsDO1RV4285d8MZI+1WRdmjQPhYeO3kSPnv4MNx97Dg8d/ZMAW/uOB3Z0oX2DBJkSVht7p5MFxYG0oaBtARWLcJ1wcD+4BA73Ap89a6d8NadO+G6bduk8y0KqaxHnj8Bdx45DPcePw6HI8iZ71nDTAqPOnLfFewEKLosZDv6LCIBtmfXjwCbQd0pHgplJJmDaT9Kt+MjHwk8KzaQ0NAYAPJvNicSgK1kLkeXpfCKiqu2NKu3ItleFpn4zgsvhOu3b4ctkwm8kHB6NovgOJLB/cCJE1k6BG50UDNxoQ5okMSz7rzae6HtzokAuaS7LoL37ZH2V5+3HbZON/w1mwlnorS668hR+EwE94PPP0/mRPWArIdgBl3F2xGMXz6HUA2PjqU0qAF3KGB/VaT5a3ftjkDeAdsi7QHOPSS+fz7Sfnuk/eHIdx6j5MkUoj0da3Tocx233vO9XsxGGUuE6n/n+vo3FLOpvDMCWrtl6mDASWMA671g4HYKzPE+S+gVksgrnQI0VKYmc+JvXroHXhGBPO06eDFDqmgCx588+SQ8dupUUUuIakDGDAABM1uKqEAsPmg2LWg0tCNKte+96kp4RQRFt6REWzakBrvv+PPwB/v3Z9Ok0A7i1eBJojqrCKJ1St1BNA2bUEDSOMTEF0VT4u9ccTm8MWrDTS8y35O34gtHj8EHn34q0r5WXHohmYAgIE6/ZxuA1qBOgF4nQK+HOljWM6UMaDZD+Bp33Xxz0CaHnhmc52NOYNbSeVWBd8VdywCQ7Ll3XXQRvOfii7JkaIWNSosxSCVb+2PPHYQ/fvIJksQo7wME9aAfQ0xATUJAsTETs1L811+4G755z55RbfJi0v6JSPtHDhwgW5VnRosZUj02QTSOJyKra3LzrcZn3x35/k2XXAI7VlfgpaT9yNnE9+ci7c/KmCWZSwLoBFqwYD4bO0MaNM76XtLMwIGaB8TpnREqS795mTvurltuCaJuQzBvvlW7y87wMWjT+aoyMzKQs6nRxQFGBfOUpNv2CIIkHb4q2msvBkOXZfDnjhyB33p0b2Za1j7Kfg5gvTnFi6EnWbJ+jwDu4G9dfjm8ddcu+HLSfmek/T/t2x8HjzOlaQqoxdMR9Dsiyk/bFzAngfM9V14B74yA/nLRnvL89KFD8B8j7Wtk+qUB4zowgIskzucB5HyNJHO6z+aKMT+CMrNC48MHA2iwgz8D6K4TG9hIZgEzCLg3sX0NNOqMBe6Oqu6HrrsWLo+j/40GPSgcY+BY4LTPxFH5P7/vfng+AmNKkpols6TDAuKJPFsAcX40MX7k5S+Di6IHwOcbXkKaOSTT41cfeih6SNbFF6xfudQ0VDdnAcN5UYj841dcD5cpvnvazoXmscGuj9sXTb5/8eBDcCJ1yA5zR0yS+GwC9qzPQD4DUCV1qCA+21vTQ3zxLVDT0XkwyygZ3bsWQC4eBOuLJjuT/bJTSsv2cpIS26YT+B8jIOaBOcw5ACzzwxLpfdqLIxj/yateCTsjLezDLrOWoUz6xCN1wNUcTxM+8cGdEcwfePnLDZiXpWEjNM9Lm9x/P3jttdF2n+aIRHv2HvFv5j/Vg/hfbP0p/Nj1L4dLI99btL0QmmHJuOS+/PFXviK6AKcZC0lIVCFZvDlm4goAzNt/+gDCKGITsymY2Vk5x6HbLoOYZv8Q0cyUsSuLz6eB3paKPWwaH/yxCIjdDhAA4yB8oWEsz+TT/tFIy7YotbJ/FoqfXA9icx1K14etUdP8wHXXRdpXR8v5ctCdQgLlD0RQbyVbMQsNHnhD0pQdTV4V03FTbKvUEa9wbkRd1osdxvJMwuSHIh+3RH5mUCczKJDQwzp/IJNYIRiBarCovEwcPE6rVG4k4BlCfmlHu4D8Sy/sh8xqi1Tf9111VXTUb5HWCvqAL++RQmrg74r2JKT3B/o+D/hEYkDxj2fAxOM7or1/6ZbN0lhfrqMfof2yrVvgu6++Kr8TAQQMkWpQ/L1pliIB5TuvuCLWdcuXnfYW3SlcRXzPcQqU5lVWsO/PdAp7nZPMgxluCnV4pG1JgIGETrf1K5R62rcQRUzNPE1+xB7ee8nF0c+5SzLVFQwNTmuwvxghjFy/OQ7s3hcHeOkLizRb1ZG0Tu8cYF80y7suvhjeSIPXVj4vEomjYYz2115wAXxDpC3RWKamifaYgGl/T/RkfG30j4/l81LS7vPX52+LfH9XpCthIwuTAFkay3Q8VN8/v5ZbDmhaDC1wdwMgq0FhzdD2EHnHFqDOygHbL2UgtXtlJYOCy9Ijz6B+5RysGmkBeyMNEUae4eu3RffbxXGKOvFWXm/MXoEeLki077lk8Py5gOFcaB4rj8+/Mfrvz4/2cT8rHbC8OlDAvCvOuL7z4osG+W2E9hdCcyten39LpP3S1U3lDUEynXhsVj+WAPNujFgIjEXKK3umDCaR3zdBaAE7hQ6UkR7Um1dQ3+LStk5ShcmX+LejykvA4AoxOMNYhdGCXqQ6Abtn6Q3LHbAgPvnA33fl5TCLo+9AhfDvt0Xa03sNPh9Ysuxl6Fg2bav8RNu3RA2TrvI3lUR3mtj45ssugy1q5u/FouNc+Qzu/LyIif82mnKJ1uyfCEraOiBrSZzGb4IxJZH1dQG2KlQjXq7pqvYO/Uph8QTwb5J2aaYnzf69Kc5E+RoGOg/+gJGggM00eft7meAZy9evjur7+jjb10dQJ2CvR4l37bbtMf78QVqfz5crjJX/hl074cpol84izcl0Sr9Xb9sGN+zeJWm/krTPK+/1ke/plYdEM7/fzC9KCZC1V0OeVBIZrEbnIINCbTvbN++GtrQBNhFUZqSi37CfwTuiAz+5YzJTcQnGkgTmY9DjvfSmZzY6uHRF5uPN0aY7G8GcfaKR9q+O6ppnE33ar/QB7vyrI5+TPbq2Pst1+Np43QLyV5pWH59ej/jr0aRLUrr40QO9C88vMhG20L71yVhMQeNUBzOZrxN7/Egvol+2oXMhGVTllcH0rsCbd9XB1DKAA1eWGRx6JKrE6MySdm+hNCPlJkm3ParB9HLQjmjbXRslNkC7cb5SoQWQFF5NLxYl2tNk1us03+ErS/uA38Eerzv/fNgZ+Z60S5bSYSg8BWuUZwuT4OI6j3C9iqjpHfyk8QNW8Zu+8k3S+YZoamzuJpaZDqCtwd4ouAFGvR+BEjMjFqVtSY80A/raHTvh9NpaNjW2OvtT/4LLw9/zYUEfW5i2Va4+ki39mgt2RNrX4U27d2fJt0g6Amyc5jAvrQYqzOlMzgmQbOmviTRnKd0HSay/jClvWllvhuDVu+1kzDdyQ//1lCGpB21upJ6WiHt7GmEzfaqiwgBo91h9T38q5cOoaYJDcoNKp6vg6bkhejwSU18f7U//OuY8UMwDzyIwLpMWRtLo+K+6KJlM6/CGSPsi8J4rzfk6WN7XT9nASqAlAueb3HjrNAaQdesIECZbusWYRBwvrJgcPBhEhwh1qW1oLUoLcPpsbqR3Oa7Zus2+orlMMOIYqKcOogwdfHPgs2ZzREVpid2i6Yrt2+DKaGpcFgcqPixdh69QuChO/FwaeZ7q4MMLpd0IHGXmedNg9Hn368PLIs83T8qSDcnlmIM1ksupLgRdMu2hQ2wsY8CJWnlnFcCfvDCxxXZOg5Mr4/RsNufnSEU5H6slMasPrmyowPb0ttKaHsGnrYehfLz7/a98BWyaTJqS8K9K8OSn8+Si++HXvUZo1/LmnGhXHb8lCJfOM7QvjQ0cC0gfdtx19BgNxIORXg0cm3P5rhBqvQfvcmAjgzCH2rKEVcgumEs2bR6kNwM2fQ5O/XFd+grQfA9hYBer7IRWbUMbApwo8WYIh0u3DT+d+qsEZg7ebEjh4q1bBvc3Srsx/RAA8RyedXlou9nPMbBQ27N5c563KFI6qDqotwiDbetyUgnUpE45A6uiw8iKlvy5ePksP3+wG4BeVezzSygepIqmltC00tql5xNDiQNry+LQeQ7UFXeKAYeGQUu8ZVTruaSFBenH6FgE2IV0NDr9WN4BRm4w/9Hauj5/LZUlPQmqHXFwuN6XGc8cJ5KvpA668jqP0OZANTmCRwC6HqJBXpbVKgPR4ktMZsfO6LIbY0aABpBhhOkuk7JiZTud1BXbWTSqpeq0iJBmXxsN55J2o+mXSQtz0hqgIcylKbQyGbFpwlhGMJBBtU2gzNjmla7y6wdxcIjsqXEfwQawcxojKqR+A4X606QqDyxYaPlXypzX880zVfHgT96NdG5wtRJllmVogkrw5/Ix74gEIddKEyXWQqg2dtBV9OmXCBtI+pKl3UhoDZxxUVqvQkbas4X3VnwrTQrJbzyjl9nSnbqVSC2B1zSEUZpraVO9ZpgRYnrWAvVqOQRqqMtQycIuDTUwhmvd+42QNBfjjGlpHNTPeomsymxJa/ldwgTxfWHs2WUat5UNwNDEOJfgeYwNXrQGS0IDQ2OJCmi54mmw5myNSD/5S3bCDkthvY43Y80WhgYAemZX1uXwRJjtD/ggiSrrytFUJS9Ntdb3g3zsicqfajSo7AgnWjakUV9OOiMo6Y3OjgtOKyiEaknuA7rGsDcd6apcHwZAddoE5jy7LMq9jdx8BNtpuYFawqiBfwFmq6eH8WLzvfTuD+Mnf4zc1wWBAjWG4C/Ubwh9EEB7kMivNkEALLAlU6xfIMfrQ2fOwrygwWKkMcVBsCCE0KDNSxmVN5Fd74V2A+j7Uvw825oBho1ygorXtGObJtN/VL76PuCweB1QlTsgtQHkwQCYCup7MJqMXzBbpKX0SQAYdGauc3BpMAyzPr6+Jt9FzqROdUGg1rs9GZshGHwyn6ZjBGu+lAWoSwHF7KjL2aaIQIXuP3lCAGEc8uAq54HrCmaws1aQ4FoX1X2fDUtIkZbqIS2dg6s8qvOA7lmwwJdrBa65aVs0jKQfpNW9YSRt0M+4zqo7aRPgUPntaWNBpNtM918tBExnVcW0tG+i8eDpM/myeMxC9p7NNNbQdSLXiX2Y2loHVwt+URTM7J9soQCgtkwL8PCxYzZ3lrrQICLYiqP8aUgc5rCTKMF3UXAA1M/qcnF4v2VqoEqLwdanNXtViXb5jkk8Fy9pcTytpFEAb3ouNPhCOy8BH47w3AHID/SDa191a3BtOmX9gX0nnidMlQ8VeACY41AJR6jxY9u7pTynLL7NGryZWDRiP73SVwqoawLnRbiB4xAeTUtYETe0lOW6hFYtVY8HJ0m1JNeSkxvJ8XyYt6LBgEpJHANULdl0owebdlAejv9ii8hGPSUtzEkHVnJL3Rp5SRZhPEsxl9x90xah/SxHDPgPDUHUCEWDB7jr0GGpOO/XUsZpYCS0frfHrO+dC6x77ph3OXSFmkcI5uWU+hJRaeWT6zP40tGjlWBVcZM5MyOoHti6Vs9YOmqcgF3HaSkL4xJSD/JETTcaEjXQwdWlBdRBy4/ELUqLjfLcuQGzT9voOIYVaNvItEGjOAN0V2xwYNHtxGj05Dx8/Hgcd52Bmiw4XLmX0EKbxRrYHYQxTquKgj3MwuEApJbLikS3PP1UW2L6YlABERxjW+USsz1t6PI22l9JNX101H99fOvFG7nm3wD23V2+9s/jgrRjecNIOWP0wkjeisd8H4iPqPjX7Bz+NrWFFgAtkOnnTMBKiw4f3L+/rBFNpq3BWAB5+V+RaPvpYGYo1Hc5Br0xhCaIZcX5YFe+LEtsdfCnjz1e1mv2EgOlzLoCaF/j+De4Hu4ldx+cNACwkhpUgxIgOK2Ol3vQAAo4oIzdw0baMPIcNs7DAqAvQ4dLq4OPF0VsUNEGS4ARgOs2ChbUrUOeDWDGYQkjH3v6aUCqgDYtZgrIjDcWnB6bPgxXS5TBoAO3KhChuurqCv8F1M+cOg23PPkUfOtVV7KWg3pSOaMlMmgm4zDeMFeBeHRgFm8eiAPUX/uvN8Itd98Ljzz9bHmJnAYdQHUCfW5Y0GKVC75OX4GAjgGI6pdGl3yetNLVl1wE3/yWr4L3//V3wJ6dO5qg5mphcKBs1FU/Y9pUxfPGR3oskU4/8sST0YlwHLZu2SQTI7LhKNTtLVodRM65/VT81NOq24l3nLITLOU9Dl54G4mxefPytIfKpIM/2/84vPuyS2HTpLG6KDa4xyBtiASHU0D9S8/pdk2ndzyyF3783/4ePPzMgbL1wuoq1YfBqlbsDB7AwXSa5cKLhWzceCqsMSztUF3n866k2H/4KPzGh2+Gm+66B37m7/4teMdrXmUpZyk6B+iDENrxnkYvqz74+OMZK2kfFiD8yC6yAAN7uXo6lM0DNk0Kxm3H6omEtAUwsi8aRUqXtdgrqvKn5t0EbjvwLHzi2WfhGy+9rPoudal8GhYzh/2ixdNimSRpCPgp7dNHjsBP/s5/gMfi6HnTls3QTTrgr9eFKUEDur3Y4cbDQMYtkR4b58uHgmVU1ygS0KwBR+Ixz8LF2ZS9Bw/Bz/z7P4Y/+MkPwIXnn2coCiOdOYTlu62ZA9BgJto+9tRTcMfBg9CtTq0NjTwwrGt56y9jqmljcaf5YTYNkiZBNhXQVLIAuSxAy4tts0rJ2wuThJ5EUP/SPXfDDbt25w9PTd6qsAANldaQ0uLvbIlrVaf08zt/eVtssCOwGsE8XZlGQE/iDVkCR9nwQWyxcnPcLvurGgyUFS9kKwoAMMsApO/30nINa2uwL0rrf/Whm+Gn/vb7hnVWPAdoyqMBDUGZE14ia1v+udOn4dfv/SL0Xfr6e5K1esDi/O1J89e9cJwLD6qQLQJMVZqk8HSebPAyJEAFcJbUNKuTpTP9TiKAJtMJPB5nDX/v4YfgR1/zWjOy1p0GWtKAJQHdN+mGnXLA2Q994V6YblqBlc2bIh0rmR7eT4VHzWIfkqQmWQ3a1Pr/Q/DbaeQ4GvnJFhRpu7wcn+od22wWB+y5k5+FW+970OQnPGAB4u61QmgkYsmsaWP6/t9H98IXo2t38+bV3DbscgoaxIRP3oexVtjZlp4W0CaH2BlhUEGZfqSK9iSlda8pNkiXiVxJ77hGSfDvHnwQrty2Hb7tqqsNogNn7mgzQlqBGHUicNJApU/k7z9yDFY2rWa7eZpWbsoSgF5L5IKdk1zAremDNsMcKXNDeInSChFOl5PlXPmFtF5cR1I7DeLTNlhpQ6J4/vjhozUrJYb1Ng/6RGNA32e6/edP3u34l3Eg+Cv33AMrqyswjeOrpM2hKwLH+J8DezawmhoIRuhUPljMmlFbq8FEMoeqzvI0JZQtEpAkXsZzUh1RVCdCp2m9iPUz8M/uvANu2L0brti2XTJHpdKQKiGMUi1rOr+Xzq4XiPaJHapLpkZaS3lazA1WU9zri7M+iATQqkyX5XnDHaf1vgNAm4e1OkPI6mLQp9WFjKBd6hwqoHl5NqzGdH5c9u7uijadRFCtr88smMGaFyw4vAbVNDNtehZVDgXmJ54/AT/56U+RwEuAnkRaJlmjyN7lAOKA6D0tMAR0K24KDZ7lc2r0uksnmvqwlObBGm+VkBmWiY5Xqz2cOXMWvufmm+DfvvNdcP35F9AmkZYo6fTEiWDfQm2/3O2AzDSD9Ppim+XdmEKdgSrbKBd7LZUle3SEYkblvLyNpKSSLns0YCsNbjytL9NlgQElNQOnjHOwbBQPdQHxkjDfibwJNOZB40vWRQlQwljZNVp2/3XWAS/X9cSJk/C9N90EZ2K61diRVnhsk9sIaG9G/R50FTS8G5h8Fui0g6Y5hc7c1IMk0lu5PtTVOHPvpzbraEQik6E/nRbTI1XgWLTb/v7Hb4UHjx6pPVcfjpONCaAB4b5Ckm9Z4zcDOm+yQwxjpuV9s9PCuVi2HS4b8WBNg/W8z3sFduZ+jW/FdYP82mnxHNI6OmIdNK25LnIfch3T/bQ7a+nENW1S8XkgNumsKefaQeJY7atGD475DH7pXJTggcOH4e/d9JG8WedqBHI6knTuJp3gSBcZNB3KzNCf/8EgroYpqFGwF0b1RR0U/SNTkYhkhvB+00XChdz5yzYDsBIonwDPnj0N33fLzfBPb/gq+JtXX2PVujNDRFqHBoCVamtpZt2oxT/Oe/uhbFzJEkBLAlMO+g7TkK7YkKI6rWHkBtKCq5BPjzpLvbBmbT9eLVb+kOTgvbtzW3WlA4ArqmVe6JccXbOZKqA7v3HfPvi5z34Wjsfx1OYo2FbjuCZJ5zJQ74rggerVYJdw0fb1qyiRcoxB3wkVhqfMS6cxABrXtQdVYHPv7aUiJbfiwpvStG5B5um1s/Czd3wWnj55Er7r5dfDedGW0iZIAMs548NWNKBOr86RmUEHsIQOxcyozvsuL2ySpTiZF1rFNqXPWMAN3NtI2kacviQuS4fmMb0AHRU/gDs6zR1QR2cV7sHMJsigo3s6sJobYi/H4+jZM/DnceLkf7/jzuzx2kxATho7gVkPTGWvcuqsUi7jF2AgtT1PNG3NhWYM0whY+VyjP5SlDMoItPai6oHA7P7tphORGskaOLO2Dr9y793wx48+Aj/+hhvgXXmd48qcAahYuIVKQ3A0GymtGhDZrMh7pPO0Kt3vOqG9NCC9P0CACE1mgJK6MB40gWGDaeflrdIiEYNQec03i2sVqRN38tyMUicu9L6OVDc2LTy4USdDa1boLD7zzDPwC5+7Ex46djSCeKVI5vg7mRavBsrYpjzBZoN0Iqz1GJC3iJfQeJdDp8fGRVCMqB8nltlEFv/lHY+ySHXeeWVSV2fn7eGeOnUK/sFtH4M3X3gRfHeU1u+4LC0yPjHdrSWB5VqBWDc0qywg27MyivbHBm1ysJkSiO7CgaDz9CDrGvdAXaOLgzlpfZqxMJJ3BXX1bBThwa634oPONjPUmThklU6SmkVgUHQEHQfz+1paV+NjTz4Bf/rww3BrnAVcjUJsS5TKCcjpSJIZp8WrUex3EiAde6CoDEQZ2LIlUDRkQ8DAkK0pND/B4i/BRb2PqMNSKGWJaGbeOJ8M7OzIR7OBZ1p+ay322LsOH4Q7Pvks7Nq0Cb7lqmuixL4Krt+xE7bweyCKaiEFhxI7aNpp8ANYJDX7oYsqq1+r16lV8lMj2spR+lbdze+8+EVpF8VBlYrlHBWJhSPsnWHPQpXQJR3PFmY3a+Jbj9U+cNXrnYT2gQVJAvEjcYLkxsf2ws37H4f90S2XgLs1zgGsxl82MVaS63SiwUzg7IY7+labWZXnGTF2j8LiHde70rih2TDV7uGepCdoGHCFoR1lR5t2pj3Bk786VnatW4Nj62vwOw98CX73/i/Ba3buhn90w1vgDbsvqiNrxUwPbFR08UieX/EKaNcRoW+L6QWroDoGCkAss+iLHlAdRvcwGArPSh89q0yKuWkBqixqgUp5BWyfIdrJHu0oF9GgCNVTRav29B2aF314QoNp4l8Wavprnk8+9QT89r33wL0HD8GZfj0DN5sWUwZx8WQkTxeqyZMwUDGoOiWohgzDSoYhL8zkBJ2bdzncyGIYjLejlCIOfCWpAar3gPPN7xbQQjRp0iNJ6TWoWy3vXtkEb9+zB959xVVw+bbzYOvU7ketgc2VNUKVkYEgHpcisrC6nGQQRINazZScB6qBUjD15iv28zINoOJ1lNYYAezNABbYtmrtvJstQhJX92jdgUHbp2xeUHygjh+g0q5DaERw3F+79DJ444UXw31Ru378ySfh9gPPwoEzp2ETSeTslovnub3JfVqkcjUltMYx5xCknaB5rhpd45TOp55BzaCYY0ZlWlwEqC48oJdlggKNPE47amUvCMCrdu2CvxHt57dGBq120/rJTbDMNLadizNMR6RBBw9AFHjp+WK/seYJkl0gaVwYr9A3KKZVeDv5RtLOS18lGLi6IzC1JZq0ZrruCuDZwigdPNW9LLnVXGc5VPzojqabPGmArdE2fsvFe+Ctl+yBY2tn4IuHDsGH9u+HLx47UvaLx/IFk3QiZRoZ/57vwFxRb+uKhaBxOORgc1CIMGSp//5uUJBIarAtpVpCppbjvws3b4YfuO56+Gu7L8r3+c0q8I/6iwaILT1l4oBGSQPnuwGG0Kt8mxnwCAohoKU1UqfR/dkIEh8C2nuhLRPqPTRpAXU60g3iuAikPVhSS2yFeadJwWreZN50ltRgAayBDfqaeMUvqp2/ugm+bs+l8DUR3HceOgD/5oEH4bkIcp223XnRMQGbKVuxHmqcxvih7RMoX4KjtAC9DxCKqYE4LE5G3iqa7dfEsbQo33dffS18xxVX5+18jUTW57XWVkUH27HBVaA0ElKjkfM+qA7lXtDGvN1mLSuHLpjy0XGnIdeqUBkJvt04Lc5J65WgScPI5tC18iquVQSe8QVaSCYR0NkJCmJN0/8cwChvXo+QvSkyEI0Rb4ua9g07d8EfRz/0H+57nFZUqsANHQg2mnWngpDOMVRXKig8tviSzo0fuiWZwT3APbxcl0LQi3+XSa5U/HNe9Fz85KtfBW+Jg76UfBbA+D39wSG430ERWrqWjRXJBYRgjewuI0kkMNh69I1M2xgdioA5WG4+Pf+uLdvWm7UcKhMABCXycr1ko1qVToPSXgbAI4JEYYmAVuLLuiwwCJtjO3/ftdfB1du3wa8/9CAcm/W84WWdETb2L/+xqo5BDXpQDvP5JyYHKoNbZ8T3cCQbrBlAVYzCk/IhQBxa74l+yZ97zevg2q3bq2sogJHQ5hdqJtzJW0HUpLRbJ35osaeNnletzVIJQEkr1zkVHca8Gr0HTg8uEN1G1CxoLq4o6t+guF7Kqnv1odDGg+L8YlJP2qthjgXNE1ASWl3Ly0hhKGR6dfH2iy6BK7Zug5+OHpEDZ8/mWWQ2c7Rg5NP0spVwQN8DaJsc4kWisQ+03HZa2rLNxSYGQEOKq/cJlE0UmNXx2Uuib/J/ffUb4OqtWwXM/QiY5V3cMGS0x1MLQ0H21sU8wma3ox4to3JXFcb1ogvZzRbAlaFB6wE8L8zrjc30uDBv3dSIxUmHZD4hMUrkS1fbMGutbC90xQ5HrPxXgsT4oYPjf2WjlMPP8cJDoO6njUx//g1vhH941+fhUHTN5o29lamErYqhh7Adh4jJYdxc5bmpj5BfY0JY6YagdpNlVQcsjOoL88npeX5k3v/5ujfl7SqCA7Ps5qWYKcwYntbrUM+Hn2WhSCdWbahsONMiHM8vOoogx0Wy8q9EQP4rAGBxE2rHEMFdUvNsXK5zN7/niI8elHRW9yQdHR1Ld/plMi7dvAV+IYL6A5//HDyfHOFsCmqLAEBwlalDmnFW5UubaPeyEr4pzH2XgxM2l8BqPUeABQJzGgD+WJzW3hPB3Dsga6kMYNWbzm8ecaH1y7NRWkJDxbKWLEkqB6xAyA6+vkqA+XyBNuJH9eNI/EbyCPayaht1M3tVwlDFSGU64g00KyhtElyxaCV15k8Q2ZGD2NRKg/KA8cotW+GHr3sZ/MJDD2QTlN/HblW9OFpxXvVH443JYfdVrg/o32GoAxEkRCbpnDYRev+VV8G74qh3RvyVjx6DVW0M5EWgboGMn5FBEBKQlaRm+rVG4YmXOmaszn+v4kYDLhGvicZzzMPFockbQcxBJYmLAGqMfZBMDuyabjvdETS4fZPoTkpkiCFhNn2C2jbfFN16Xzp+DP746afyhBroBQO5h5hCQMZvdWIsGHb4ybHpUjzGsXviECKi6POmWRkEfssll8rdwYaNAYy7bOA6WzJ47PCAkO3o8oEsyzOa9JFrkPNiawcY2GV/BUMFNO+HbU3A6glRTwhgqKPzx6lKW0q2MJwTGITgzBBqQ7HulPmhxeh/d821cMtzB+Bw3xfes7YIunbBncHgeuzeYFs3YRS0TArbOwYVTPZzP4vM6OEfvex62B0d7t7UGAAbykyWH1mbQzEPYHhuAzUUSSFtS/M1H2VNiI4kujs6d+jnx9K37p1zWlycdkA/A6Q8i4Zm7uz10zTWUF4ocOgd7+e1j1l2IKhz/RuP7ZMV+J+vfxX0eQfZWRlrkVoWM4qaUVNWh3fYanH5nXrjXJ4USVWnseug0Kk9ILdJktDRvnjz+RfAW3fstBUMbXNDshgisxmkh/ruyT/80g37rrCtU8oFWXjKLBHN5gtONh+oPj3kay2LPAtBO283nFY3Zn15B3X7gDSRekYzQ8kxPRWKlS8esADtpgijF8N0rOwkwvHzzXHi5TXbt8M9J54v73uI6w0sr5qmQgAzsYI4tKFReTcqb9BkI7OFRtgr1RbKyjzrsxm8N/ofJzQL6D9Pp6SGgWBya7d/UCUX26kt1QXELK2okYMbrVRgFy8I22KoO3cj4AbMkRczLbbSq9E+irnU0W8gs4C4xun5fWQ2O8AKFD43g/URAHuQ61WuUnHyNT/3XSjaOEpR+PZLL4e77v9iERSqg5VHEDS6ZfYwODMDcWCC1IkVIcy95Ic1XoM5AMggsDCgz+bGZdF2/oY4EBQprA5tZoxJZ31vDNj6XkuSAgNUg5pEmbz8wxKM/LPS4AttaNUxXtKgy7Fl6rZiQAfVGUVrsqKiNmKbuZoxEzCZqnWcA6g5AU0WtinlW/4LfcEB1inzBOqv3r0bLlxZhYNRAOYPQeT9GX7jztY7SAGqrEZbdbBsUGq5UkvgTqYGSee377oQtqaPIIP+LB2Mm24emD0zlr2WjpDaU+xFqIMOusZO2dHs1tMLRstX41jvdapzmOdHDnTn89Jj49rRhnw+llbFo7qHavwQlLEs0hnB2MEBqubTkhX8NcC4hg1Drcn5azxcsLIC3xy9HrM05upDNbnE1aILC0uLkMUv+EOVxmikcwDRDInYtHliNPT/mz17bCXCEMQtZkAjDnWcEqymyugliGtoMTPUr5zSm2qctndpPTGtc4ChzD7XtO5ap0V3L5/yC0n0joShHVUm5rrUtX7eVJONfZQMYSg8WjS2Qu8S6OWY33HRRfBvHtsLOOlLpx18V1d/gzIFw5zy7KZBriba3PDACvKbattnQG+NRL32vAvs5Ik2ORxj5klnVRTRB1Vz+oQaBB3NGKRGS+9Dd0oJyeCKPkmCMnUcnA0HG7B9XfHzQ9hY1rggr/rKXnnpCrlRsIKgY3OEHhETjNfm8HlqQamiF5LiyAoj0lyPn14dsXJB1ObHI3Y6Ze4FJbwG5bNpOBKmJoE/x0Ym6CrN3o1I1FVxNihIPAzUmSbOMyHYrEcFjA4BGpJf1KlSxYoZuQzj1cAqybsRCb1IDPm0sGR6nXaZMlxDy/MdGmbkAS91Ho378kxXPUHs6XBFDMqcd3+cTPMrOLCkwuuiR+y2o4dpJ1l6E3IseHzqXwplYqUlnRq1rMCriM5xaZnWKH6v2LRlkFayCENmhJFffW56Png6hs9l6sh2lKqoypeGxkGvL14P+hpPNXTpAG06TJpavPyMpZVztGXk5yhikNbRUYuiiSKPA9brA8mgvt6RASSozgADb9QYqNHdGhM62toRgUeRaUq8P3woC0R24dVdrtCqaHFV4qBcvh68D+0TDRpGIbMuHl4k9OVbNksluIB+RDpr4C8bWkJs8LwaELHZUdIRc9jNhUoasBpOL3KEKqnH+AKN61Zj4pxrXPD8vLRyHqrJkZtYOX+T1yC9KoryDVa5F7ind50BO7fJAMwAoxLcn7faJwV245mBJ52nwWGfPWRBFv0Z9GgYCscxwSFbUjCDEGqeY8xmKc1M6DMxPVyc3qijAoNmDljmhEa+LWAjjEvqUQZifTFJv/OLyn6uJgY/UtaHkI/vEIcEtK49sQDj4mtR5TaSFlx6+hAY5X4BhJga7JqmRkWZfOqaoIQl4lokzrsXGkcK50+nWRim9+YnQZfB4MGBK9CU5ezp5tt23r2XgRPql9wazGn5liyho4djhQcZyPdcviPXY20ZYAhkfz54hiUzYm04ig+6p2p9T/H5o1pwlQdoistip4Zx0Zry7lRaiVwi30Vp+TrU2V3UqMlx/N5KAQfS8g252syjFhe57VqdGRptRTxsC5eaxC+DwaRO0xp7PUvoOEwPk6pNQGEPsfqdEcwYQYfhV9+ukUKw0XI7aNWhP3+d36vDkBeD66YEp5tjQK51ACijfiA7ml1UoZohQNKqq2BnCnLDIwgUhm6JWgM0XgJHNbq0tefAIh1l0/K9IR0y1ymDXPvqKPtyzFOsobImAwGjBnGohGgrpkFpO4L6mrkGbW6ox4omD7Q8c5AbgiHU7WMLEY0bKgF2j5VQGhCDpdB/5lIWlOmFKHaMn+2HKzxocI+B2l+3znXP9irMlJdmvzITOkA9oWDcc7TgjEiNrvCFyK+DDt0qWHsVYKPkF5LW10yn82AucXnhHiGYOhaPAVDlxy8pM3o6GnSxJ4iYyLf1uzatxWf8uadUSg42Xg8INajX88tsALw9CHIOiA47wfGMsBhq2hRGJlawimNNpDpnYiszAhw4c8YkEGKCajMVWsxyVLTvIaiJhMqknBetDT1w2ynJVDJQkhTppKP3GNEDiIjttN5EW1EESxB1pJKKJXkD2NyKUmZXy0NVvhaX4r7p1HVQC3CoorraYbIZxhMrPDBcFEYb4dyCl7VHzq4De8sEzgFk3ZQCZWw8PcRoCnZQOC8IKIPKS1aLzoBK65uNVUKDG7AthwZFamwFlxiH9Jm2V9PdbC+iXo6KXXUpiQyqUibO5FDpLSEAyki2BIrbTzcTQlMkqLSoOWI6VWjGiVyiupTlFwIYkwP7KsgJ1IHfhR5r9OB+/fmisKDNdLGHzpxWu1yR10xWuwrVtSht28hEheZOsnriodanfjdYrtU9Sv+lo0dMVnodZzHtGrgQ6a3vIQw6pCETxqQ3DwRbElmBAt15Dp27bnFtDAXYiBnrdSNpTc92PdSnTzT2TmLnx6r6KnzH+h2UpMX6bjQzUh1sGnAeVZiBUVgGqBqwpDElmvujA3U69j7/PN1U5QGBG5mkOsAFw6Kg+Ffip/OaDsTBbXnt6CfN2MGjJ07YfCihMRPVvSwV6X6v2xOHNAVdOLTpzUlY+nTki+bGk7fu6Gl97Xs9joEWYOAC8gTMedTcHEsrrYbDDu4DWwyo0BBoYRleST4zF0zd9Bp3TSqDJUeK16BDm2asKuZAe53CHYcO5gUdDVhHtLjGoKePabSbBhGAsfGQDhrg+suHE7N1uOfIEXj1BTtECxtCAYxTnEEN/p76Ne6eMKTDS+rgpHIYvHlGQ/tOZcrJ6btCSUu3tAsLtaoOtaEZ52bGT2hScWj7hC5Hp9Vli6Zr8AD1M4VAZegkBvblDbwAMksK4qeHJhINPz24AgxNFVS0oQK/l3ooJObzew4fhsNnz8KmrZuBNWt5rBpgGi8BxgMX01x9NP/wZwdYkwfu/RDcrCpmoKRnbnrqCXgNAZrHKkiNItovDCnBFsGacfNqY55RElmtcWdEBADZ01Dqgwi23+iPZw0LJI3vqeKCd5qESGqmnZt3GD47SKsBBLXs/NupXsCjcn43lDulAnrvf0EJiwDW5Ajgx2IVzKF2QvMsBzXs+C/7HiNw86KanJXqlNJulqGhD4M4lX2lqV7YIU2NDiY9q3mkrZH/095H4ejaWT0e81ga/Dqa7L0W4+YF5eEQWxoa3+Pxd/z6+73WN4PdyDH2zaD/1m/ed4MbyXtuWqx1oLoGXy64Dx8kfn4QLUhAbbE/KNCKpFYdUoSbki0n19fhpiefzPtKopiHXusODYzABSr6NHC6eRXRBXCGrDL11g98JFto/+mTcOszT1WhCCPA5huuUF7rwRhG0Eg7Qi9wBVlKo3rfOfub6yc/SGDgOJQ0uLGjewFxG8nTHVy3vGKS1EXFq06Kgii0nX6kzduMBSudhwJSNLKAVwnS3K2IhA8/sR/2nnietmmuryWIpA6s+RXQCUDBla1De0sKHYEAowYl1M+XMO9PWDYj/92HH4L3XnZlZig6LonPODgGhhEilJrT9yWJZm4AA+QUiV1tSLZ/6/d7WnzoOo/3ngF/5oSXKq0OIhz0tWJa8YagVHXoARqRumCBGwKMaktUJWozE8DKFv54KE1x/+lje8uGUoQdmfhqcMJYCsr90vrca6nN6wcdklWPTCWhmB2JyNsPHoBPH3g2rxfM9rNIaEUTzFFVnhCDaWyrQjZ/RGNojsoBYNUE1MkHwTlaOhSfscUwn5ZPfdpRhqq0rV+X1uSlz/vWbWI+zRnJjc4C2vCzYqZkyd8aNuqi95fMbFM0yJyWO2575hm47dmnodu8iSQ0vaNNhRQPFZg6t+RaK4jJYfg1gvD6fmopzXx7lmzo1OOmUwiTKfzE7Z+EE2trw3EZDPHVbDgP7jGafLwTCbwCaVZVtF5FGIC8cZAnwHzLR6bAeNpuGN+65vRj9xalbeVtxGCNs68AKPOLhJBrYBh0QNUuGGyctB3/hNq+HbTJOnDqJPzs7Z/JGOmmK1kAajpaUleEk2nnNiQkK1NhegI9UMBKSRRgM4PSlrfRcbIyhSdOn4JfufcusZs6B2JU+TAjhIeoDo4Plr/eQtGVr7OBZD8SEbxoIxoQdEbtobI/669dtEXHDY+WPe7Tdy9aWvYu1WsHXKyTKKCAzfaoB4n8jhyadYM4Hr9ilQUTdaTrP3r0Edh76gR0ar9v+QwuI0pnVvFl5R2aejJm01/jtsMBeOuLSkGii+7S343l4vKHmph73GQ2hX5lFX4v2tJvu/ASeM/lVxq1xhNXKBnTj1J180JL60s+Ipn1OtGd6kUMZLAMFB2KhgeguFPobaQdBGKw7f0ATZni00JFy2ASpzZcHXgQHUGLTRDzA5VNwO7VIDbrkNdGcKibTQsoVHKR6sCSmf1I+vjQY4/Br3/x3gjm1bKpUPZwdCJsRKhKmSisq6apIxrrgBLAezkaDVSXX2UGQ2OmiRidXXeTDOrUA0/F6J/49Cfg8RPHW9pwKLFR52aZGRo3jJRGVQctIsTe6ZR/uhPpXJct6KoYaal4oz+7kYq8GGlV2XPpoLQTdHXRYpK0ledHp+IavOSIlsWH/ly1H4N5oorg86dPPg8/dfunIyYCdKvTMiCcVI9T0BkCmEkfng6pn9LBaOhcHUYuGDRob6OKZ/EfiUxmx2Ql2kfxOBxm8Hdu/At4MlZIqx7+1W0EXB+0jJMylQQPY3Tq4XSngQE0cKV7WHdq4nhxebmGx5EDGgduIP2yaXFeeqRBlJEWYNLXDtM4Wk3ueBoabOZ26kCKGxxT+n306BH4rg9/CA716xkXk2Q7J9OUJbRkCCQwa+sHVRY06Bs0v7s2NrLEMZPSuZ9w6RQSsdiiidBJlNCT1Uh8VC9PnTkD33PTX8ADRw4bKe3bwHTAxZ1R6OXReaGHpVpn3/vN0SVeJJh0xG5wjs5nbQ1F1YFR27rdaFpYKm3XTAsL6bA0DydcbBsBS22aWGHzQgRGsKaHP/ghxpluvwmBin8fPHwI3v+RG+GJU6cyFiarqxkbWUJrDcT0UaMHwhpAo0NhbXsfOhgBSTNoCY1Qu49Bo5bSkfhNqzDdvAqPxQr93QjqG/ftNSqJe3h+NNjyvStJ3Ejuvr7WYBYA53g1KGJpTGqbvR9GbWu1bI5W3Fj6jabFJdP6vMlkEoaWZwIOTZb6+ijV3fFRL//FfGfvRnDto9stS2k6WBN//Mn98L0f/gvYf+Y0TDYXLGTNnSSz0Aa1XRAHps4A7GBp8KEbfbCRUQUMqQP5pY8tOyWBaDfRrGJSr9y0CZ6brcP/8LFb4Ne+8Hk4G8/FAwJOUsOQeSKFg13ERjO6dLBOJFzQnc1LbLpn1sDDZQ5YMl1JixtIu3y+7WPgmlMdeCipARaqPxeUAJUsuO20kEpt+y9jG//AzTfCkX4WBdommCYMrK5kTGAyNzplP3tBKQV6c8QR3cCo9XIggneBYagP1BdPyug7u8LVtkeBE2WTFYtbhhFHjF6P5sc/v+sO+I8P3g8/+7avha+77AroqGdWVUOg1nWDOZpDh86ty6HB5cAMUD69yq3gRs7NkSnfaxHCBBpCUf1dIm2rks20dN2P01FeUIK6vFlHz6e6zpQrb0HAxq/xXiggJwR8dN9j8HOf+VR+BWKyGoG8aSUem/J4aiKejfoWpOSM5aW4YsLWOQ5U9ytGHJCVN8h89R0aFZFzLDM5qKa+q1slqNnxOmLNg5KQPB6g7K0C7Mejn/oHPvpheMeey+F7rn813HDRHtgeGSBVRD26tcQNANJqhdzhnBRj0KBqZE5jnsd2nq3zVhos3JlLqUeKxDeeW3qTG2jYA1TvvHmMykd3Wq0Ng9WGuh8PqkTnZ9bX4RNPPA6/f/+X4PY4A7geTc4E4mxukmROE27JA8ZChds56GxVG/G7JxnHlD40qleJK2G6kEdoMxGzQ14thboXAYRqKrD663jbsSlotdrHnjo7uwY3P/0k3BR79cvPuwDefeXV8O6rXgYv27ELNiW1BNbkgAXnOSgpHJRak0EQn2dSOjvBYEAwYMNyGkLS15dsFvVAk3fAdiO00vYqQlqcwMvCINU12WhZCyW7OQBPJmVtZmy6eqp/TTXo5MTZs7Dv2BH4yGOPwI3xeOLkiTj7F8dOEbwrEcRddgqsFqkcvRri0UD13jNrfmTgwiivREjC/GA3DZITBPvmfbkZ2Mxwb3MHrqn+4lg5+vOCgdk/XRo6/eu7AvY+MmEWzx+Obr2H4szib3/xbrjhwovh+197A3zd5VfDhgMDtkPTgXiWMDhJXc0SVVVss83HLsIqAixuAZ1WnczLW+LJYrB9oHzRXn4Lv+sH4gG8vc0dQX+VrUNo0Hd3lML/4vbb4AsHnoX1DsskSQTylFy1xWU7zWDOQJ6wZGZzIYCxjzletw2otmkxZKSNllpOV2cU5BoHta9fW2C1a/QX0HmwqOhR7qjLz9sE33jJ5fDeK6+BV+68EFYi+oMzM4x6GqW1SmLjV9amBzOqQ/uc/CyHQhyLDHMeWFLM40bSpj9iR6ajr5n02ZAmEzTxJdS6Iw68HABK0IfBcCCH1128B371ve+D+w8diJ6MffDnUcMenK1VIOf3NJyfGSwPeE2QodStLbwRjcjB7LEy/AwBbLycC3KJokBblWC9nVxCZdM/Mt0C8FfX2CO9btrD11xyKXzbZVfCe/ZcASsR7bNQN5rx1VwUcppOgVkDubMvJaEGt3CW69nBUDb5EUZonNM1wsj91j0Yzwtxflpt6HLaPCDsgPe8yRvk9sSLvD8gVp88DYbFdlb28wDkQVEY/yST8IaLL4W3xPb7wJveDB9/5in4w8cfgTuPxrmGSXm/pJPBH4A2NcoMZeE5GlSXOkg6biO91MPgdQAbP1w5qRVK9zbnvKwWybXKb/TdOkjanjiVlOE1286Dn3j5q+DtaR/DvgBY9jNUDB0DdvAHdyQjkbvqjyXah+48MqMKp3NupYrooIgiO4LUDdTdSldJg4oDnq817xeWlmhGereG+V2NDRnz8DYPdrJo6OUII7+ozBJjosRjJZqT74neqvdefgV8/MAz8MsP3RfnHU4W5QCVd0QARTZ+0X16pXgglPjnJEm5njZvclwYkYvcTSEM5IecZYEXKpMTE/JK6D384wjkb4/ejQumq4PdZf1Os5l/oTYoV00kCJEpzB645kDZyQTgfG1n30QikEEq/VMGEIqXUtdQCcAKtIIdFzfCRsKZZtsG0iJotMueNyqS6ShNljpzqLzocCAg+BwaUhpIe7KXk/dM4SPt9Z02rH/Lrt3wh08+Dr+59xE4lRJNwCjCIZi5HIc3w3AcxjfCYLHGEQib3o6NpQ3Mjp6uQxWA9rAj2lX/5JWvgW+95LKs/WYklc0Os6HSMSotGnGmsomU5kQJVIYydjWDU2C7us6lU77BcUP9emnirwchuLS+Zv63kRYdkynfMGhN3TtJCqIaFFKy4A+wgqRXxfAneEyxFNMVUG+N5sj7r7oO9mzaAv9blNbHs9dlonSLpxABYBykLBs8R1ph2krQAngrs0DgZmmuP60qpwhld6weLp6swK+//k3w6u3nZxNDwByUuaHALYAOlo4x2iSQe66+OwwCYuOX5tyQGQq2dTqcwxVY4t5G0uPwXFwX6l4mrZEWgpIlLKor+upileX5Ym3UOrbmZ3QI6sSbHTOlHWbBPvM3on39qvPPgx+9+/PwRHTzsWjX4GTpjKrTDYVUW6gN6IM6tWAOL4sQYKBua9paQ/SFJWamrSo2bYbfueGtAzDro2+B2REcWoeW6MGWbSkFhxtqhczNAGbRlnlYNJxZNpxD2mX6COLwRnNixj9cz/0rBgOtDwp8dF/zno8kmVvteu2W7fCrr78BLkoLmye1TFPLlhrukFWGLzo8jXw05z4HvJxjsyDX0quSUNb73Rzjf/N1b4IrN2+pYO7L0fcwvmWyVn3QALWTBmJzEyDlKwZsdEiSyhKvegO6f8OY8TsvVdp5sRr/ui9WBw4qa0vlxgNk02YDPMt173ivN1RddyBed8e1W7fBb0dPyBagtaB94wEqqylsrP+DqjDwywz+0IlEPyB4VW2lYFCMKVtUhNkMfj7azFdu3poBvM5gdpI5gxvqN7cayPPUod9mOf121FA4QLEmHWGABu6aGMwnYKDOFx0vVdrR9GDrxSc8bezrzQffTrzywqS5lTUdJr6haVP7roXazuuUJv1etmkr/PT1r8wCToN6gF0vPNER3sKnGmS2306ZI5HtbIdlWrlVtkhOYP5AHBi8e/fFUjEBtTv0xucMYgE4wGAHWi+5tdS4dss2KHYYGrFleRHUOJElFplMga6VoMCRAxZc4waePae8pV+GKoFd29kxMXVaSp037HG8Np2l0YFyeyAd6lltcmTJDOVYU3HfEv3W358+x5uVcVXGClHklbwZ3Noq1Yo1wuLXrRoZFdwSBUEbBMVESlskvyqqme+Mg4Je+ZhbPV8kQG+vPWKD+pUSdT5E0jt27C43mvyocAiidSiepjnrErX+2QYrFlzDBp49p7xFyhH9pUe6p+jJUCU9R31TFDYiSPQBVUiYNoDKd/DtF6yEZxD3wQqx74mAvnrTpgzoIJMMWDMUTJ1baAPaZ4g1PkiN1G8oPSrQILCLhP5InMK+cLqpAlnZzTPFjL53IFUMazKTy1MdQXeOH7z0Srgu2ut17epGPQjwQYMXB4leYNhoo5xLIypa1Xsdhluo40udE2+u2bwZvvviy9rjGA9saJsecg8aZkivzA5lelwQvV3/8NqXw2w2K4PEXm0wDgCGD9KrYNgsI6BfOChEWCClGOBU2z5K59dt2w7v2nWRVJQrpE0LPb3N6o7pbOBZ953BoRti12QVfvaKl0cpsBlkyznJQzMrEB898AMMnbLncsBLnD6AbnypR4BBXYJOE5l01epm+PHLrxWBMwsLvEtt7EBotQmDnto15w9qvBSPr9mxC752x84ipUN1OdbC69ziMkFjdKojszkRQrNSOgbliTrNyv7mZDt/Z5w4SSKhNdhoTW97Bo2FIKWWIPtGh+oDTRL7TVvPh//76lfBfzj8LNx04hjsWz9b3u7Ls2MBZEbFuQXqYBEWE8IsWCaElzAtAAE5WAQy4Gn/m0k8rooA/przt8P7d10KO+Lkx3oYd5kOMDZGQgDxG3DQryuke6mMVKX8Bkc8X8UJfOtFe+AThw/n5eOwo0y4QxIOB+MBqPc8G6QZr/zc54Khbiwl9yRmlJIU6R2NZOj3a+tw9XQFfv+Nb4Wt3VTUTFY7oLwZWiipopbqlGgHRfqrCfP5fGfvySCqYRsvwo+wgXnOeVTz1CUcVsV3xrFyWhdhIWGNfILVYPyrJSW3j0jSoDxNUCXuouB5qj+p4+8Lk+Rc6cpMXvo906/D++74FDwXZuo7w5RJZ8c22mMl5gcOC6fQ3tZtNDiZGhTz8vbIM3jHzj2wXfX+BGRjZsBiMGsKsEWCAk2vHkg/HVeqr9O1MgseKrCNlFV5oqNBbrtxCzSJs7QMgmOvATnXqdETmnkpAseEQQvQRlsqU3AWbHuMgVnzReKUlEZVJn9bkLUoS+oE8FCmx7/9kj3wm0/ui2OuXjZ6KjPPAIOGyVEIi4Te+PvQwVLcYnQVA8U266O58b7o2WBm8K+RyP1iMAdXDEtkRY6pL4M6v/mbpA5JZ1ZzvDa2dHpfgKOhiXdsly8NqYGH86VqcHUz5PT1HsC8hGCcA2G8OBEi+lcG51B/Nfh9xwOY3y6jpgfWNpAxFYH6XdHL8hv79kKYTgkYtOmm+WKBrkE34niY/4I/jkVaSBbDvoft0R56RRwQ9r2VBMbPOXi6hnmN0orLL3sqUAeSCtnzgUpCsHRmvsASQQM2OECrziQrbbFBD3Pq1ei4SBfVC1HycvJETK1BXvPAHCyvjaTW5wADIeTzHGsDqQO0EwTVBjKvEEr7vHr7edGWn8Dx7MIjW7qR2+CrtDmFjgO6qU6D+Q2kQ9ldl97ZSB/RejDLyDfUAYNm9Fw1PacOjCEtLVhjZQYqUwOUyTFWPak6g1gBTfZHYWIoE2PChXHpls/RpjP14/yDep46CpepAb3MABpcegYT09gSMqZdXB4Lg2okLXD0hlB6MmYSmfem83bAx44fIQnd1Rfecl4NaQIwt/GW+wSLM/FiRzhTAH11nOI2zApgZv9aDGMA9rA4GFCH2nNR1T+Fju7rdanB9fJWXKtAb37kaIMspWoV6JlWkbzBdQamP9g00ik4bbD1NnnoOLD5mijX0Xr1nO+AXGed91weUcCRa22embKo8Ku3xDmDo4cgKCeDBTAuTwRoQOveYIxUzlSLEBCq2NzI/s0tWw2TmPktuwwABlJkmdACtcRRRjMGOsWZX9daZsDM0b5RqQDhSHDEBKspWCoNaO+H4OOj19KbeaeaQOc94JeOYI0UhvwN7tx3njAn26WDaiCNIoMLrFJ618pqeVUiqK2RWw1l7A4vnapEGF1ON5DI45f5pXrefqSMEqgvXl09J6ZslHEe1PnHixWwDNUiTpsdxmsBMBRPrV/uREoG1AxV52U54B7XhLEnRkwxnT6UTmBkSytoHjQawJM/qFIYz/6cQO2e58O/sZeO5BHLApEJocDv2QudWN8S1PSa5or3pjhCxXyzxc7uBPJyrKrF/7Q0mFvbcwweh9yJmdZBIwZlZzfuWZ0+LKw18NZb1Q1wpKTUoDyv6MCaXKIRejVJ0UKj7jDObhupxvBeWKqvzA1Olw9IDa5T9aqtpjxRQgdrU+ZvS4OKFmpgdLENHdwTvSabDupd2HhUKhLmM/lcwqCXslSkc98pQ+MZnJPvWJwHRl+LFm1g0rPkZomu81BSHdTzHNcaW7SUSIvoMHLOEWO832ibeDDjgnTmmhHu7o7lsSi0AY3zSQmtk/j/bD9rpB420jyh84IDc3TOWKIFiEWNEFS+Bgyq4wiY6ab3agwGfT5/cB1jhLCxDjdicQyfUXTASF6Lgi5Paz7vixYJje2815K5YXo4M9S3nrseabDFEpoNdG1jtDgXw4H03Rice+861zAA7ghKrb1VG0LuKZu49y0W6jNmyarQaDDNrgatetCk+ajBF8bqBjC0+VWn4nGBLr8fo2MD8YvShpEbWpjla1eZo2trdqKLnsqbHcHGQ3sZA+/t0Ht1NVqLXxx//OTz0AxBnhyZcXzhodnwPl4B0WNiEHDeTRATysgSVRizbzApADAwL4LuFOpmcOmXeXndegpgYOJwXPNZeHFDZrcXKmhZe/DMaStZ+I5vUNSN5+6rVza6QYlS1EhmY8THNPcdP9rOQUmkpY6wgbTqWDRRwA0pC3QjyAtLT508XgYbxPBOV1uZMNLowXaUfM+lL8sKQ/2MyjEGNV0ufw8uDVIGCh97jx2SF7DkRSx+bn6zgarOSxsUb5nuFPaePAGAOK6FdMVb9+W6ZLrxL1YG+aLs9bH35EkzA6zbFlzcgkzPOXhADDp+UGCAAoDT62vwU7feCCfXzgy3yZhTzkCdAhg/awZyB+Ir77GCmz9h8p2Ega3rwLQbIEPpdGcj7b92+62wlhaQx9oRDajn0B/ghYPZ8ELFGbrdM3x95+GDwMtL4AtoeH6y8xH+nK+1NMJB4gLq07MZ3HX4kH3DDU2yHIQBYdigoxKW1TLMl8IAI+q1IcH4uP/wAbj38LPw2LGjAzBji3bXQoYOBOvShBYT7XOeZgQHCFQNRuf8WuYjRw7C3QefhYcjMMxWH1jrr/mnJ7n80W/wCHMOUOVKBR1f7z16GI6tr6sNmywP2sbDfNB3vicbZvq8JK1ycgt6u7wA40effdqCYQTUfC70BYB5HVR7DFoEekmsJzs8OBnY6Z3pvBfIU/vyB50373vEbJFhwI2OfvrtB4UrglogpjgvffVvUHXQr7wybXonsdueeAzOhBnc/PhDeaOeCdo3DXGMPGyTvGzABfn5cvnddW0q/dmTT+S94dHZIsVERpMPjuXr7rU/wZL80c6CNbzcslsTrff8n5/cF3vd2YpzsKAGaDBzpCcNJK0CA0uZQXq0z0rHAQUKtRfPegTDBx9/OK9r/JEnH8/7gzDQtQoXm9rTzWVjI16VG3D00VJ1tI0tDYm1ofSmPGlG7EQ0kW6NnTEtKP6XTz2e66K3zht83ADDjq95tdEwT8Nwh2Sa0V2fipL5o88+WRbEz4viE44oB6HTjyLVKTZoqoPCUVGO4FBd+w6DGQuY01cHaW+NTx08INKtpeI1R7TP1khhPtVpggWtJtnYs3T4vqhpYgmdAHHo7Jm8nvEzZ07BbU/vL4DohuobdB1QsUafa3taHbpqZnbP5cv30cWL1ugK3QnQ9xx6FvadeD7TfuDMGfjoE3ulM2pQG23uCYPaDmGePeeO0MjDXxvtAlbz3fLMk/BYHBAWCd3ROtKVIShMrlxo2tjGBOBBoQY16tZxD+pfUzhmwhKg03Zuv/3og1Fa9Haf584x2BXjpzmFIegOxSgNfKQ8AG0dfZnc0FNq+D945AHaT3ElRk7gDx59ANIaHQO6u6G0KwXU8oNli6mLodPfV52iU3XWHUoDuWweG+BPEu0rtNNYPP7r44/k+1NVP94vUH8W5VsQG829TPDmpD40r/QncumYRWz80eN7C16mE6h7lcMAoCBqDsCqe0c0nXeLKWZydbzKHMBK6UjgZw8fhk8ceNbaoyo76bnpYTWAMJILQQZY5gA7AOMgj9JJLrdTQAb1fRv9fjRK589GKVf2AynA+Pyh5+DmaHrkNJ0FtedfRx0MGuuj67FBa5UjbwJ4a85rEk37Sjw+9fST8JkDz5TOmGmfwO3x+rZYp6kCvv7WUuMBHQIzL5VdE9y9sCCNViWylU2ngKzOb33mqYiRg2WV/7RVCdvRhhEOc9Bo7EYYWTlp/AEDcAXsBOZJ2rh+WnYJ/cUv3Q1HkirvhpIGPXMBmpLLd0gtfX16VCdMYl6DEWGw/Vhi7snZGvzS3Z+j7cZou960oGC8+fN33Zk/4vS2aBMcmpOuIoM06K7pOW0nC5hBgRpq2Qmsa5G2n7/r9kxrJ7SXHVp/8Qt3wrGzpwX8GtiirbpGh/L8bPEch+0DFgbVvFC8zr9Q6DgUafs/vvSFrA0TXspq/938Rm0V7KJ0M7haUHBq0qJQIqXGbAfljesjqO8/cQx+66H7TQ9t2XVjzNJBC785nXNIIsLAK8DH7z98P+w9cTyrvdQJ80HnT0Vb+l/fd4+R5gLmDoZmEMAArEYC6mvFtk5dexOpc+VqcP72/V+CJ6LPP29sSkJkQttR74t26Z/sfUjS+kN3Ri/0/CBca00+b74Oy3UAMB4Wz7e0PevvP/IQ7Dt1qmw0lPZi6SZ1E07B05BAnNfoKtTldEe7HxLDVeaoDHSyfdjLUTeuX4V/F23pv4heD89QM2iBBjhgSAo6svw9n0fnmUkdKn1C/2f7HoV/dd+9tO902egmdcQJb0UWj9+4/4vRJNkvdqsxQbBhRvE5qVyhFRtp6DrofEKVnppfbGLw70eeeBx+6767YbJphWznKe3YOy3aJpog/9e9d8EHH3ukLBvAtndXXXrieXD0MG+D8x0HjXZ0fAcwGiXzvquSeaqOD0Us/OsoSDK/eb/vSfFwaKnG66Ogxp2AvB2Ylo6XVA30LqrYwwDGrgl8nW3CCnIGNw8MJxMyPSLBSSX+7BfugPuPHxEpzcAYmCKKud0yAFdpWGoaNY1qMIWlQdPx8LEj8M8+91k4neIJEJM8mJ3IICXFpy+R/6fPfBIeOHJ4KOXAaprW3uVeeosUVucizdSzvizmVwLzQ0ePwM/dcXve4zGbSStTorsjTVNAjvH3FyLfvxTt1Ck9K/ynQ0tQGTAC2MEjtoFrTCN18GCUtcNKVzvjo8ePwk9/7jMZE4nG6YRox44GhYwnICHJjKo49HjTeGWCO/CR0kVrJtJrOK3qRbr1qvuu7vF9pO/h73/qY/DUqeeNlOPKD4DtQO1tuGYcOHBpqaSkUwLzf3/bR+F4nA6ZrGySBU462ksvg2JSpF3aATVtpfBDH/8oPBif0w017WwjzgOzsSvBSmNtVmg7mQ8GQzqePPk8/Eik/XC0n7u8sWWL9kmW0NN4HItt+IGYfv/zxwywWl4Q7QnhJs3XwQK8C/Y+P5eWJBC6QbUvnT8daX//rTfDmSTwWCtOaTBoGlrkp+BPRFhLOjfi8Jq777ZmqTeSsMTJJzLKuDIfNvI6ZbQc2PraOqyfPQuzeKydOg07I/H/z9e/G1523gV1ERq1ao9fxXKMFEt9Za6W7hpszOj90V7+7ls+BIfixEnatndKG0VOaC89pDLSAoJ9JGx97Wykfy3vTb5ndTP8+298D1y6bbssnCOL6GClmd/h0DSHEdqZnZn+INURAE2hStEnjh+Dv3fLTXAg0lRoX420k4RTtCfez/pZoZtov2LTFvj1r3sXXHXe+WZpW1lkJkBzNasgRDqWV9w1B9zaPEudKAmDf/DJKNDiZFvexD7SzzvNdnkTe16irQ5OMsidLc2Se8BMB+rJjh/+4f8F5gXUDzHruDx1DaxeiSiAahvFcDLODP3Row/BVdu2wSsuuADqrBAMTQgYSl4ttb1fU2zkzrrlsrqNx3+JNvMPfvwWeD7Fpf2naQ/qTjZT76qGEW3TSWHHYqf8k0cehiu2b4NX7txR6Waed65DUaWEXufZYfWuTZiJphlrPT6yfx/8yMf/Eg5HbZGBvKlIuMmAdiKEAA4EiuRp+qM4lnlZBPT1519glKqx7xVfEYbnk86acVrbshZc0b8x/qZo7//EZ2+DgyxEEqBXqqmU7WfXuIXvAjBiXrUUKtBUI8wF9NiDgzgEh2eTRNs6DP61KEFujJWcxd/E3G3J3tNMhSG4NXM7BQ593emBlDIzjsXG/K0Hvgi/GAdJZ7ATIBdATCoglC9LQN0RE2mvw1NR69y0b1/+oPOa886D80Zo9+aQNkUMQBqAnlJ8+j0ZJdov3fU5+OV774aTKT7SvbKpRXsnTKu0E7CJiLUofv/8sUdz21x7/vmwPdEOli5PoxEg6toM7qE9eH0+8v1f3veFyPfPw6mYMG9kT6ZQcZFW2mUDUGIceheYs6PngTlHDUyOFEbeAA+ik/oq+vvyxXf169BC1oEWcEzmx/paND3Ws/nBZsjVm7fAT7z+q+Cdey6PDOkG664xGU1KcAh+bYOeiRLhtmefjgOjO2FvtN+K5yKZGKt5AiK7ubqJME73fl7ZMn9aH9X3bD3RT+bTWqrHGlweaf+ZN78Fvv7Sy/KAzK8IZNQ22DpgY9aQ9yzqch49fPqZZ+CffvqTcSr+tKO9uOk6nioeoT0RMiPaZ5n2tczzRPsroqT+4de8Hr7h0itz6WZrEGi76wy9CmsT/qXzNAP4mQNPwy/f8zl44Pnj0RNDAmS1emTy/t9KIxpTg8EdQIHcSWeDg3mA1jf79rIvZhlT/rDR2NIAvKQBr4Bd1rxbz4ydra1npiZw9BEcIca9bfdF8J3XvBzefdmVsGU6ta84wpCxqOpiJEk8PxE7zs3RNfSf47Tqrc8+lScdpnkWjcAgdudEADEaAtAq831enDuDOY0Loh3bn020z+CrL74Y3nfttfBNV12Vpd5gSVq0tOuLTL+yoY9Ge/fWOPv3+w8+CHcefC6q47Qh/JRUdOmIxW/bKdpHVKTQXkGd6M/AjnXoYn1eu2MnfMe1L4f3XH41bIt80qtc8a8Onu9a2xyPPLk9Avl3H7ov0n6gDFizRF6VafmJTHNP8kNDMAOYUT8BGnXB8r1hI9B9vPaeeyrt/EAIlVXaCB8MDivajJSmDhFohfZAA60C7JlIugRqZvY1ccD1jXuugG+/5jp4ZWR2KrQlJTSDS90C3HP4UDZl/mTvI/DM6VNlKpt8s8zQjtR0deRzvii4EJ4BrUUSaBFKBsdaAkcBxSw2YqpLH+m/aus2eOell8L7XnYdvCl2UNmPRPjW6JBQAH3Xc8/Bjfsehz999FF4+vQpmiyZin9cBq5Tol1UNEiDq2ar3CJQ8+ZNBdhr0jHT0sepPa7del7eb/19174MXnXBTuClxlvaUWMuCbG7Dz0Ht0Zf/QejAHni9IncCQvPiwDp2MRIbsWueGOA5ityfmn/9XTSVds5l58L6gSnAuKgpAEUya35mqHKgJYIboMgzW1upLWg7ar9UJpfJHZGcr6OrAQkSd0rEySBOAFhRkdibmJ4ktipEc6PDfrmCy+Ga7afBxdG9X5+sh+JgLWYz/FoXx6MnpO9cTbyzgiIw2tnyjsBNEvJEw1ZKrB7iyRbp2xOgkRFXf6rUVjq03OnTEeiN0vsdalHn4AdwZHqd0Es780XXQTXRFt195bNcEGincpKtuzRqJ0OnY60R8/F5yPtB8+cNTOs2Q+eNEukP7vjplUqi5mhGzV3HKwLs7DJpMxD9twk/s4GtJf6JNp3Rtpft+vC7InavXlzHCes5vXnUogp8uD4udjpHovmxF1RixyJnRrFB86TJVM5Ty5QZD851lFlBm1nB4DJdg7GxKjnDDcWQlxngKGSzYCGVhizo/meA3WGtTJDyAdW05NbLzO2nxWJvb4uUruAYpalSU8bsvRkk4vIMHqvU7OTXQX0ZCqDJlZx7O+UKVbdc1HLzGDrzp0V2Kb2wE6dcVb2CyHaWRsF3gXJ85JUbWrUTDcN7jKQJ9OqSQztRL+g2dPebjutZRI9zPvAZghpzcT7zHfZnaov30XrsZIMygotQhdpDn6Hp+NOyG0y6Spw2dRA6/bRAG4OBFth5N507gMNR7CVZ6yuS/dJdMoH4lyBQFvzpsqnDYUmHc009qUh+8QIZuiMVCRtbxF6JWmG6gZI4qK8utoViUHqLcejArLoTPVrEUKVq4BG6qBZgmA5WFp2swn00zhJQ2BIC75nLUQ7pga/vpfy+Ajtk05evUUBwRzaofFrQgC2eVghs/RLwOr7JB2TCRP5nrXKtPB9VjsrjPGdaJeX8h3txa9M8ZjukX0iLjkE4xoCBWapTwPMWgCN1ruEja0+ajLkxkKoi9xpUEvXjrf7AuJU2QQOJID0XWZiVqWRKazaZTMZ9qAAGCM0k9LV/bxRqWQUkNMLUwbAlXFo6qUrF4oECUGtA106dx7ERTDk1wQS7dRJQ+pM3AFZktPoVvY/UdKg0K20hjmQ7HwE80qlp320UQvRTdonpNozj0t5YdIX2jXfaYJM+J6Obg7tJIUHmlAdAzCjm53WUrpVJTkfB3MK87ek8NcmKS/oSAAQBhCoZRVwECAH0AwuwM62VPo0ui9xxUwJ4vrLwHKjKv0yS/W9FjUIZI8NmCXPcSbYZpjaQAXVaMvQnssk2vtUZho4VrNKz6AuTTv7wVu0E78r7Ypo075YtaVI6hbtSUqHzHfueL3srxdqHTiPIu6HtJP/3ggWJzw8sOvzmnjbHrgAtPPCdID4RZlpTwjSICr34I7AX6RRYQOafJH91KoiWVqTfZx/J50CBVTGUnrJ34AUrY2pQbsIzD54aZCL6/NC7kHVveTYZ6lXBiwh84D3Aay0g6IfLO2IDiScxA1ccQHtWvAgOl5pkms65HwTnV2QjhkE1OD4DoYW4bumXUtZHSevH+pnoKaFeo4D3jfqOicsb3IMCiJQA3diRQ1J7jwY6INdEQgnWU2D8BZFMiCbLZSH2WAueJsDrOo1IKZ8jIRGWwd5RpUpZCqpyvqWO1w2RZj4yQjtQeUFA1ygq8eARlyedqx2jOOXTT+gXQ1YBdx0rbvfwFyaR7t0QAAZ+Ml9UJ1X5aE6wQsFcwpTjbVmUBWVtHwyCupQJFpKlE0KxewQSJqTVOPGR8pUhFooDGBJgR1UicP54RDQAIBO5QV9XzO2PmJPVQ+sp1ReNjPSNfnaNY8g1A1FSL1L5waiGX2h2KAdXN0U0M11bYpyqfilaWfNwlqS8hCNw3wXcwWE/wGHgsTSrujmarBEVmlqvQCqr/nFBXMKZuNNqxhrvj5/c88wiWznTHxhEtLgShqXMFyaVzFZSYKgGbsMHU6CMYil8QXElZm2fjpXMqW4oQgkgW1+BmgyL6h+tSOivDq3iOZKru2QfM31CqoDapkRTI4cF1Q+NTGbbTJ2z0IGlKSu6ZaiGSzfmc+8KLmhnUAr5ikDGXGw4ZW0G8LAyGydt/hsTI5Bp9C/oma5cCApCwLKoOINgVoqAJJkhjpBg1WKo86EH2MbW2qAhglYiTRSgJlHlqq6Jyn0IxIbGBcQNANMvVnDBKKd0RKU1gJdd8VHLY1atNdzpElBHKWdfwLUzgdEOypeMFSlGZE1iGpXqhwaLWlpr+RZMGvaUfO9EV/4AnYFWBU/aBPEAZDBXfPvtJVoNKAd+fsGQGJCYG5nSwHNLKKuYHBbSxUQ8iruOOyGo3S5E7TMMw/XnmB/VTkCwlDjURAkibI2MqzO/3WdYJB3m3aFTAI5eoDDCO0WiyBodPtTiMQOoaLJPSwQDUMyxWxxJGnazMcgDhtSjsqjVNcxhdvNlbcURmN66+XwROtrf48yKPdUkRrY8uYUWN3AmBB7SW9xQYl0e4wCQV0oqSESQz/fArDPSC/sAa7uwRPD0ockMxfm9iscFINQeRkqregb3nQAtHVo0WzOcQjaUhFgyVnpINoNwGEIalO+ohNgfudjfqqOizAHS63rFib9L92bbjhTbLSWAU8thIWCrHOlgco2HD2jwQ1BD+Ra4qIWjIY2dUuBxdI9TKvlgDEQdJ1QgxqgaigCJPuv2YaeR7uyK5envUkwKAMGzFggKBAx7SLRg8qXaCeAByZg0Mw4LLFFO0e0OiBWSBth2IBUE2emTBymyxL6XAMDV65BEVh7jICaEykholV6uV0NKA2yprRoE1V/Rhg693F/Txfd6pRMuxoUV6nlM2gV0Cj9y017TqsEi87pXPhO+bQ6oBE+nP9GwLxEOHdAc8HB1boBbNR+WZYaGvgi/eYxcsT+QEePv4HtpMsyzXhwwNPuAMIheDJeGO3nQrce0M2lXZMHG6AdWvSPgNikASvUBnmeO5hTeGGA1gRsANg5WtMtEgSy0h/uOei7MsK4SoTlgTAmIXS80zZMrpSQcNGhnVkz9L8ItGs6WjT6eJ++QTt7c2paR7sZM+j7uDHacUFHWJTWPRZgfpiWdzKU/5Ey1e9D13rj0FdJUjo4aT2UDjZvW+nyE9QFC4eQB5RolEGllU3DlqhRNOtn1L3RJW7RyyVUQABomloZpx1REXj8pX0HjmbK19RaiAaemBnQ7Mod3ENFM+eNdWyQ2cltizUH7o+opLmlGW2nMGmpDYxbF4c0W9IVzTgfdy6PeWmnzDh9Ax0T6qyXTQtgO4GvVKD0qK8BqQJg03K5YGuueA4amrVMUPR48FJa3Umw0iVxaqTcphkkt1J2nbVUpKoGwDbNFG/GMTDkfYnoVL1KJ9kQzahyD5UHmndgylQ059lcrM/pduBidVr0g/OC9ADu+RbNiJYOVQ+NBXR8ZozKfcp78HJSMxNNqAuDwrWKtuLINYh6CtXzXnqbwlpVtfc4b1XVQXLfKXW95tLMZ452uRPCKF0wXqsB7fYe/yyg2WQ3ntaoJcUaQ3urvceq0alpbj3YxAU0y8ts87NvhWYayvuF29Cjpere2mroxjPB3RiIrbFnwOqnpbiyGGBNurmMFg2A42lg7Bl4cWmXPM+R9nk81+rPP78M7Yjzr1+E8P8B0szv+tLrxRwAAAAASUVORK5CYII=")'}}),Trust=({theme:o="light",...et})=>jsxRuntimeExports.jsxs("svg",{...et,width:"44",height:"44",viewBox:"0 0 44 44",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntimeExports.jsx("rect",{width:"44",height:"44",fill:o==="light"?"var(--ck-brand-trust-02)":"var(--ck-brand-trust-02b)"}),jsxRuntimeExports.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M33.0246 11.8662C33.4096 11.8662 33.774 12.0243 34.0421 12.2925C34.3102 12.5675 34.4615 12.9387 34.4546 13.3168C34.3859 17.4143 34.2277 20.5493 33.9321 23.0312C33.6433 25.5131 33.2102 27.3556 32.5571 28.8475C32.1171 29.8443 31.574 30.6693 30.9346 31.3706C30.0752 32.2987 29.0921 32.9725 28.0196 33.6119C27.561 33.8861 27.0843 34.1568 26.5842 34.4408C25.5172 35.0468 24.3441 35.713 23.0146 36.6025C22.5333 36.9256 21.9077 36.9256 21.4265 36.6025C20.0766 35.7026 18.8879 35.0281 17.8112 34.4173C17.5718 34.2815 17.3379 34.1488 17.109 34.0175C15.8509 33.2887 14.7165 32.5943 13.7265 31.5906C13.0665 30.9306 12.4959 30.1262 12.0421 29.1706C11.4234 27.8918 11.004 26.345 10.6946 24.3443C10.2821 21.67 10.0759 18.1706 10.0002 13.3168C9.99336 12.9387 10.1377 12.5675 10.4059 12.2925C10.674 12.0243 11.0452 11.8662 11.4302 11.8662H12.0215C13.8433 11.8731 17.8652 11.6943 21.344 8.98559C21.8596 8.58683 22.5815 8.58683 23.0971 8.98559C26.5759 11.6943 30.5977 11.8731 32.4265 11.8662H33.0246ZM29.8277 27.9331C30.2746 27.0118 30.6459 25.74 30.9277 23.9112C31.2646 21.725 31.4709 18.755 31.5671 14.7125C29.4221 14.6506 25.7371 14.2381 22.224 11.8731C18.7109 14.2312 15.0259 14.6437 12.8877 14.7125C12.9633 18.0537 13.1146 20.6525 13.3552 22.6943C13.6302 25.0181 14.0221 26.5925 14.5102 27.6993C14.8333 28.435 15.1909 28.9643 15.6171 29.4318C16.1877 30.0575 16.9096 30.5731 17.8927 31.1643C18.3005 31.409 18.7502 31.6635 19.2396 31.9406C20.1116 32.4341 21.1099 32.9991 22.224 33.7081C23.3175 33.0107 24.3014 32.4515 25.1633 31.9616C25.4231 31.8139 25.6717 31.6725 25.909 31.5356C27.119 30.8412 28.0127 30.2637 28.6796 29.59C29.1265 29.1293 29.4909 28.6275 29.8277 27.9331Z",fill:o==="light"?"var(--ck-brand-trust-01)":"var(--ck-brand-trust-01b)"})]}),Argent=({...o})=>jsxRuntimeExports.jsxs("svg",{...o,width:"32",height:"32",viewBox:"0 0 32 32",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntimeExports.jsx("rect",{width:"32",height:"32",fill:"white"}),jsxRuntimeExports.jsx("path",{d:"M18.3242 7.63647H13.6516C13.4955 7.63647 13.3704 7.76611 13.367 7.92726C13.2726 12.4568 10.9768 16.7559 7.02532 19.8009C6.89986 19.8976 6.87128 20.0792 6.963 20.21L9.69685 24.112C9.78986 24.2448 9.97107 24.2747 10.0986 24.1772C12.5694 22.2856 14.5567 20.0038 15.9879 17.4746C17.4191 20.0038 19.4065 22.2856 21.8773 24.1772C22.0047 24.2747 22.186 24.2448 22.2791 24.112L25.013 20.21C25.1045 20.0792 25.0759 19.8976 24.9506 19.8009C20.999 16.7559 18.7033 12.4568 18.609 7.92726C18.6056 7.76611 18.4803 7.63647 18.3242 7.63647Z",fill:"var(--ck-brand-argent)"})]}),ImToken=({...o})=>jsxRuntimeExports.jsx("svg",{...o,width:"32",height:"32",viewBox:"0 0 32 32",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{background:`linear-gradient( 180deg, var(--ck-brand-imtoken-01) 0%, var(--ck-brand-imtoken-02) 100% @@ -933,7 +933,7 @@ Vui lòng thử lại.`,injectionScreen_notconnected_h1:"Đăng nhập vào {{ C là chủ sở hữu của ví.`,signInWithEthereumScreen_signedOut_p:`Vui lòng ký tin nhắn yêu cầu trên ví của bạn để tiếp tục.`,signInWithEthereumScreen_signedOut_button:"Đăng nhập",signInWithEthereumScreen_signedIn_heading:"Đăng nhập qua Ethereum",signInWithEthereumScreen_signedIn_h1:"Bạn đã xác nhận thành công.",signInWithEthereumScreen_signedIn_p:`Sau khi Đăng xuất bạn sẽ cần xác nhận lại trong làn tiếp theo.`,signInWithEthereumScreen_signedIn_button:"Đăng xuất"},getLocale=o=>{switch(o){case"ee-EE":return eeEE;case"ar-AE":return arAE;case"es-ES":return esES;case"fa-IR":return faIR;case"fr-FR":return frFR;case"ja-JP":return jaJP;case"pt-BR":return ptBR;case"ru-RU":return ruRU;case"zh-CN":return zhCN;case"ca-AD":return caAD;case"tr-TR":return trTR;case"vi-VN":return viVN;default:return enUS}};function useLocales(o){var et,tt;const rt=(tt=(et=useContext().options)===null||et===void 0?void 0:et.language)!==null&&tt!==void 0?tt:"en-US",ot=reactExports.useMemo(()=>getLocale(rt),[rt]);if(!ot)return console.error(`Missing translations for: ${rt}`),`Missing translations for: ${rt}`;const it={};return Object.keys(ot).map(st=>{const at=ot[st];return it[st]=localize(at,o)}),it}const localize=(o,et)=>{let tt=o;return et&&Object.keys(et).forEach(nt=>{tt=tt.replace(new RegExp(`({{ ${nt} }})`,"g"),et[nt])}),replaceMarkdown(tt)},replaceMarkdown=o=>{let et=o;return et=et.split(` -`),et=et.map((tt,nt)=>jsxRuntimeExports.jsxs(React.Fragment,{children:[wrapTags(tt),nto.split(/(\*\*[^\*]*\*\*)/g).map((nt,rt)=>/(\*\*.*\*\*)/g.test(nt)?jsxRuntimeExports.jsx("strong",{children:nt.replace(/\*\*/g,"")},rt):`${nt}`).map(nt=>typeof nt=="string"?nt.split(/(\[WALLETCONNECTLOGO\])/g).map(rt=>rt==="[WALLETCONNECTLOGO]"?jsxRuntimeExports.jsx("span",{className:"ck-tt-logo",children:jsxRuntimeExports.jsx(Logos.WalletConnect,{})},rt):rt):nt),LOG_LEVEL={debug:10,info:20,warn:30,error:40,none:100},useIsoLayoutEffect=typeof window<"u"&&window.document&&window.document.createElement!==void 0?reactExports.useLayoutEffect:reactExports.useEffect,useFitText=({logLevel:o="info",maxFontSize:et=100,minFontSize:tt=20,onFinish:nt,onStart:rt,resolution:ot=5}={})=>{const it=LOG_LEVEL[o],st=reactExports.useCallback(()=>({calcKey:0,fontSize:et,fontSizePrev:tt,fontSizeMax:et,fontSizeMin:tt}),[et,tt]),at=reactExports.useRef(null),ct=reactExports.useRef(),lt=reactExports.useRef(!1),[dt,ht]=reactExports.useState(st),{calcKey:pt,fontSize:mt,fontSizeMax:ft,fontSizeMin:yt,fontSizePrev:gt}=dt;let xt=null;const[vt]=reactExports.useState(()=>new index$1(()=>{xt=window.requestAnimationFrame(()=>{lt.current||(rt&&rt(),lt.current=!0,ht({...st(),calcKey:pt+1}))})}));reactExports.useEffect(()=>(at.current&&vt.observe(at.current),()=>{xt&&window.cancelAnimationFrame(xt),vt.disconnect()}),[xt,vt]);const bt=at.current&&at.current.innerHTML;return reactExports.useEffect(()=>{pt===0||lt.current||(bt!==ct.current&&(rt&&rt(),ht({...st(),calcKey:pt+1})),ct.current=bt)},[pt,st,bt,rt]),useIsoLayoutEffect(()=>{if(pt===0)return;const Et=Math.abs(mt-gt)<=ot,wt=!!at.current&&(at.current.scrollHeight>at.current.offsetHeight||at.current.scrollWidth>at.current.offsetWidth),kt=wt&&mt===gt,Tt=mt>gt;if(Et){kt?(lt.current=!1,it<=LOG_LEVEL.info&&console.info(`[use-fit-text] reached \`minFontSize = ${tt}\` without fitting text`)):wt?ht({fontSize:Tt?gt:yt,fontSizeMax:ft,fontSizeMin:yt,fontSizePrev:gt,calcKey:pt}):(lt.current=!1,nt&&nt(mt));return}let Rt,Pt=ft,$t=yt;wt?(Rt=Tt?gt-mt:yt-mt,Pt=Math.min(ft,mt)):(Rt=Tt?ft-mt:gt-mt,$t=Math.max(yt,mt)),ht({calcKey:pt,fontSize:mt+Rt/2,fontSizeMax:Pt,fontSizeMin:$t,fontSizePrev:mt})},[pt,mt,ft,yt,gt,nt,at,ot]),{fontSize:mt,ref:at}},FitText=({children:o})=>{const[et,tt]=React.useState(!1),{fontSize:nt,ref:rt}=useFitText({logLevel:"none",maxFontSize:100,minFontSize:70,onStart:()=>tt(!0),onFinish:()=>tt(!0)});return jsxRuntimeExports.jsx("div",{ref:rt,style:{visibility:et?"visible":"hidden",fontSize:`${nt}%`,maxHeight:"100%",maxWidth:"100%",display:"flex",justifyContent:"center",alignItems:"center"},children:o})};FitText.displayName="FitText";function useConnectors(){const o=useConnectors$1();return o??[]}function useConnector(o,et){const tt=useConnectors();return o==="injected"&&et?tt.find(nt=>nt.id===o&&nt.name===et):o==="injected"?tt.find(nt=>nt.id===o&&nt.name.includes("Injected")):tt.find(nt=>nt.id===o)}function useWalletConnectConnector(){return useConnector("walletConnect")}const useWallet=o=>{const tt=useWallets().find(nt=>nt.id===o);return tt||null},useWallets=()=>{const o=useConnectors(),et=useContext();return o.map(nt=>{var rt,ot;const it=Object.keys(walletConfigs).find(at=>at.split(",").map(ct=>ct.trim()).indexOf(nt.id)!==-1),st={id:nt.id,name:(ot=(rt=nt.name)!==null&&rt!==void 0?rt:nt.id)!==null&&ot!==void 0?ot:nt.type,icon:jsxRuntimeExports.jsx("img",{src:nt.icon,alt:nt.name,width:"100%",height:"100%"}),connector:nt,iconShape:"squircle",isInstalled:nt.type==="mock"||nt.type==="injected"&&nt.id!=="metaMask"||isCoinbaseWalletConnector(nt.id)};if(it){const at=walletConfigs[it];return{...st,iconConnector:nt.icon?jsxRuntimeExports.jsx("img",{src:nt.icon,alt:nt.name,width:"100%",height:"100%"}):void 0,...at}}return st}).filter((nt,rt,ot)=>ot.findIndex(it=>it.id===nt.id)===rt).map(nt=>{var rt,ot;return nt.id==="walletConnect"?{...nt,name:((rt=et.options)===null||rt===void 0?void 0:rt.walletConnectName)||nt.name,shortName:((ot=et.options)===null||ot===void 0?void 0:ot.walletConnectName)||nt.shortName}:nt}).filter((nt,rt,ot)=>!(nt.id==="coinbaseWalletSDK"&&ot.find(it=>it.id==="com.coinbase.wallet"))).filter((nt,rt,ot)=>!((nt.id==="metaMaskSDK"||nt.id==="metaMask")&&ot.find(it=>it.id==="io.metamask"||it.id==="io.metamask.mobile"))).sort((nt,rt)=>{const ot=nt.isInstalled&&isInjectedConnector(nt.connector.type),it=rt.isInstalled&&isInjectedConnector(rt.connector.type);return ot&&!it?-1:!ot&&it?1:0}).sort((nt,rt)=>nt.id==="walletConnect"?1:rt.id==="walletConnect"?-1:0)},ProfileIcon=({isSignedIn:o})=>jsxRuntimeExports.jsxs("div",{style:{position:"relative"},children:[o?jsxRuntimeExports.jsx(AuthIcon,{style:{bottom:-1,right:-1}}):jsxRuntimeExports.jsx("div",{style:{zIndex:2,position:"absolute",top:-2,right:-2,background:"#1A88F8",borderRadius:8,boxShadow:"0 0 0 2px var(--ck-body-background)",width:8,height:8}}),jsxRuntimeExports.jsxs("svg",{"aria-hidden":"true",width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{overflow:"visible"},children:[jsxRuntimeExports.jsx("circle",{cx:"10",cy:"10",r:"9",stroke:"currentColor",strokeWidth:"2"}),jsxRuntimeExports.jsx("path",{d:"M16.5 16.775C14.8618 15.0649 12.5552 14 10 14C7.44477 14 5.13825 15.0649 3.5 16.775",stroke:"currentColor",strokeWidth:"2"}),jsxRuntimeExports.jsx("circle",{cx:"10",cy:"8",r:"3",stroke:"currentColor",strokeWidth:"2"})]})]}),InfoIcon=({...o})=>jsxRuntimeExports.jsx("svg",{"aria-hidden":"true",width:"22",height:"22",viewBox:"0 0 22 22",fill:"none",xmlns:"http://www.w3.org/2000/svg",...o,children:jsxRuntimeExports.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M20 11C20 15.9706 15.9706 20 11 20C6.02944 20 2 15.9706 2 11C2 6.02944 6.02944 2 11 2C15.9706 2 20 6.02944 20 11ZM22 11C22 17.0751 17.0751 22 11 22C4.92487 22 0 17.0751 0 11C0 4.92487 4.92487 0 11 0C17.0751 0 22 4.92487 22 11ZM11.6445 12.7051C11.6445 13.1348 11.3223 13.4678 10.7744 13.4678C10.2266 13.4678 9.92578 13.1885 9.92578 12.6191V12.4795C9.92578 11.4268 10.4951 10.8574 11.2686 10.3203C12.2031 9.67578 12.665 9.32129 12.665 8.59082C12.665 7.76367 12.0205 7.21582 11.043 7.21582C10.3232 7.21582 9.80762 7.57031 9.45312 8.16113C9.38282 8.24242 9.32286 8.32101 9.2667 8.39461C9.04826 8.68087 8.88747 8.8916 8.40039 8.8916C8.0459 8.8916 7.66992 8.62305 7.66992 8.15039C7.66992 7.96777 7.70215 7.7959 7.75586 7.61328C8.05664 6.625 9.27051 5.75488 11.1182 5.75488C12.9336 5.75488 14.5234 6.71094 14.5234 8.50488C14.5234 9.7832 13.7822 10.417 12.7402 11.1045C11.999 11.5986 11.6445 11.9746 11.6445 12.5762V12.7051ZM11.9131 15.5625C11.9131 16.1855 11.376 16.6797 10.7529 16.6797C10.1299 16.6797 9.59277 16.1748 9.59277 15.5625C9.59277 14.9395 10.1191 14.4453 10.7529 14.4453C11.3867 14.4453 11.9131 14.9287 11.9131 15.5625Z",fill:"currentColor"})}),CloseIcon=({...o})=>jsxRuntimeExports.jsx(motion.svg,{width:14,height:14,viewBox:"0 0 14 14",fill:"none",xmlns:"http://www.w3.org/2000/svg",...o,children:jsxRuntimeExports.jsx("path",{d:"M1 13L13 1M1 1L13 13",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})}),BackIcon=({...o})=>jsxRuntimeExports.jsx(motion.svg,{width:9,height:16,viewBox:"0 0 9 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...o,children:jsxRuntimeExports.jsx("path",{d:"M8 1L1 8L8 15",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),contentTransitionDuration=.22,contentVariants$2={initial:{zIndex:2,opacity:0},animate:{opacity:1,scale:1,transition:{duration:contentTransitionDuration*.75,delay:contentTransitionDuration*.25,ease:[.26,.08,.25,1]}},exit:{zIndex:1,opacity:0,pointerEvents:"none",position:"absolute",left:["50%","50%"],x:["-50%","-50%"],transition:{duration:contentTransitionDuration,ease:[.26,.08,.25,1]}}},Modal=({open:o,pages:et,pageId:tt,positionInside:nt,inline:rt,demo:ot,onClose:it,onBack:st,onInfo:at})=>{var ct,lt,dt,ht,pt,mt,ft,yt,gt,xt,vt,bt;const Et=useContext(),wt=useThemeContext(),kt=isMobile(),{isSignedIn:Tt,reset:Rt}=useSIWE(),Pt=useWallet((ct=Et.connector)===null||ct===void 0?void 0:ct.id),$t={name:Pt==null?void 0:Pt.name,shortName:(lt=Pt==null?void 0:Pt.shortName)!==null&<!==void 0?lt:Pt==null?void 0:Pt.name,icon:(dt=Pt==null?void 0:Pt.iconConnector)!==null&&dt!==void 0?dt:Pt==null?void 0:Pt.icon,iconShape:(ht=Pt==null?void 0:Pt.iconShape)!==null&&ht!==void 0?ht:"circle",iconShouldShrink:Pt==null?void 0:Pt.iconShouldShrink},Ot=useLocales({CONNECTORNAME:$t==null?void 0:$t.name}),[Bt,zt]=useTransition({timeout:160,preEnter:!0,mountOnEnter:!0,unmountOnExit:!0}),Ft=!(Bt==="exited"||Bt==="unmounted"),Yt=Bt==="preEnter"||Bt!=="exiting",Ht=Et.route===routes.CONNECTORS?0:Et.route===routes.DOWNLOAD?2:1,Ut=usePrevious(Ht,Ht);nt||useLockBodyScroll(Ft),usePrevious(tt,tt),reactExports.useEffect(()=>{zt(o),o&&Qt(void 0)},[o]);const[qt,Lt]=reactExports.useState({width:void 0,height:void 0}),[Zt,Qt]=reactExports.useState(void 0),Nt=Vt=>{const en={width:Vt==null?void 0:Vt.offsetWidth,height:Vt==null?void 0:Vt.offsetHeight};Lt({width:`${en==null?void 0:en.width}px`,height:`${en==null?void 0:en.height}px`})};let Gt;const nn=reactExports.useCallback(Vt=>{Vt&&(Xt.current=Vt,Qt(Zt!==void 0),clearTimeout(Gt),Gt=setTimeout(()=>Qt(!1),360),Nt(Vt))},[o,Zt]),{chain:Wt}=useAccount(),{switchChain:hn}=useSwitchChain(),Xt=reactExports.useRef(null);reactExports.useEffect(()=>{Xt.current&&Nt(Xt.current)},[Wt,hn,kt,Tt,Et.options,Et.resize]),reactExports.useEffect(()=>{if(!Ft){Lt({width:void 0,height:void 0});return}const Vt=en=>{en.key==="Escape"&&it&&it()};return document.addEventListener("keydown",Vt),()=>{document.removeEventListener("keydown",Vt)}},[Ft,it]);const Jt={"--height":qt.height,"--width":qt.width};function tn(){return Pt?!(!Pt.getWalletConnectDeeplink||Pt.isInstalled):!1}function _t(){var Vt;switch(Et.route){case routes.ABOUT:return Ot.aboutScreen_heading;case routes.CONNECT:return tn()?isWalletConnectConnector((Vt=Pt==null?void 0:Pt.connector)===null||Vt===void 0?void 0:Vt.id)?Ot.scanScreen_heading:Ot.scanScreen_heading_withConnector:$t==null?void 0:$t.name;case routes.CONNECTORS:return Ot.connectorsScreen_heading;case routes.MOBILECONNECTORS:return Ot.mobileConnectorsScreen_heading;case routes.DOWNLOAD:return Ot.downloadAppScreen_heading;case routes.ONBOARDING:return Ot.onboardingScreen_heading;case routes.PROFILE:return Ot.profileScreen_heading;case routes.SWITCHNETWORKS:return Ot.switchNetworkScreen_heading;case routes.SIGNINWITHETHEREUM:return Tt?Ot.signInWithEthereumScreen_signedIn_heading:Ot.signInWithEthereumScreen_signedOut_heading;default:return""}}const Dt=jsxRuntimeExports.jsx(ResetContainer,{$useTheme:(pt=ot==null?void 0:ot.theme)!==null&&pt!==void 0?pt:wt.theme,$useMode:(mt=ot==null?void 0:ot.mode)!==null&&mt!==void 0?mt:wt.mode,$customTheme:(ft=ot==null?void 0:ot.customTheme)!==null&&ft!==void 0?ft:wt.customTheme,children:jsxRuntimeExports.jsxs(ModalContainer,{role:"dialog",style:{pointerEvents:Yt?"auto":"none",position:nt?"absolute":void 0},children:[!rt&&jsxRuntimeExports.jsx(BackgroundOverlay,{$active:Yt,onClick:it,$blur:(yt=Et.options)===null||yt===void 0?void 0:yt.overlayBlur}),jsxRuntimeExports.jsxs(Container$7,{style:Jt,initial:!1,children:[jsxRuntimeExports.jsx("div",{style:{pointerEvents:Zt?"all":"none",position:"absolute",top:0,bottom:0,left:"50%",transform:"translateX(-50%)",width:"var(--width)",zIndex:9,transition:"width 200ms ease"}}),jsxRuntimeExports.jsxs(BoxContainer,{className:`${Yt&&"active"}`,children:[jsxRuntimeExports.jsx(AnimatePresence,{initial:!1,children:((gt=Et.options)===null||gt===void 0?void 0:gt.disclaimer)&&Et.route===routes.CONNECTORS&&jsxRuntimeExports.jsx(DisclaimerBackground,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{delay:0,duration:.2,ease:[.25,.1,.25,1]},children:jsxRuntimeExports.jsx(Disclaimer,{children:jsxRuntimeExports.jsx("div",{children:(xt=Et.options)===null||xt===void 0?void 0:xt.disclaimer})})})}),jsxRuntimeExports.jsx(AnimatePresence,{initial:!1,children:Et.errorMessage&&jsxRuntimeExports.jsxs(ErrorMessage,{initial:{y:"10%",x:"-50%"},animate:{y:"-100%"},exit:{y:"100%"},transition:{duration:.2,ease:"easeInOut"},children:[jsxRuntimeExports.jsx("span",{children:Et.errorMessage}),jsxRuntimeExports.jsx("div",{onClick:()=>Et.displayError(null),style:{position:"absolute",right:24,top:24,cursor:"pointer"},children:jsxRuntimeExports.jsx(CloseIcon,{})})]})}),jsxRuntimeExports.jsxs(ControllerContainer,{children:[it&&jsxRuntimeExports.jsx(CloseButton,{"aria-label":flattenChildren(Ot.close).toString(),onClick:it,children:jsxRuntimeExports.jsx(CloseIcon,{})}),jsxRuntimeExports.jsx("div",{style:{position:"absolute",top:23,left:20,width:32,height:32},children:jsxRuntimeExports.jsx(AnimatePresence,{children:st?jsxRuntimeExports.jsx(BackButton,{disabled:Zt,"aria-label":flattenChildren(Ot.back).toString(),onClick:st,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:kt?0:.1,delay:kt?.01:0},children:jsxRuntimeExports.jsx(BackIcon,{})},"backButton"):Et.route===routes.PROFILE&&Et.signInWithEthereum?jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[!Tt&&!(!((vt=Et.options)===null||vt===void 0)&&vt.hideTooltips)&&jsxRuntimeExports.jsx(motion.div,{style:{position:"absolute",inset:0,pointerEvents:"none"},initial:{opacity:0,scale:.8},animate:{opacity:1,scale:1,transition:{delay:.5,duration:.2}},exit:{opacity:0,scale:.6,transition:{delay:0,duration:kt?0:.1}},children:jsxRuntimeExports.jsx(SignInTooltip,{children:Ot.signInWithEthereumScreen_tooltip})}),jsxRuntimeExports.jsx(SiweButton,{disabled:Zt,"aria-label":Ot.signInWithEthereumScreen_signedOut_heading,onClick:()=>{Rt(),Et.setRoute(routes.SIGNINWITHETHEREUM)},initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:kt?0:.1,delay:kt?.01:0},children:jsxRuntimeExports.jsx(ProfileIcon,{isSignedIn:Tt})},"siweButton")]}):at&&!(!((bt=Et.options)===null||bt===void 0)&&bt.hideQuestionMarkCTA)&&jsxRuntimeExports.jsx(InfoButton,{disabled:Zt,"aria-label":flattenChildren(Ot.moreInformation).toString(),onClick:at,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:kt?0:.1,delay:kt?.01:0},children:jsxRuntimeExports.jsx(InfoIcon,{})},"infoButton")})})]}),jsxRuntimeExports.jsx(ModalHeading,{children:jsxRuntimeExports.jsx(AnimatePresence,{children:jsxRuntimeExports.jsx(motion.div,{style:{position:"absolute",top:0,bottom:0,left:52,right:52,display:"flex",justifyContent:"center"},initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:kt?0:.17,delay:kt?.01:0},children:jsxRuntimeExports.jsx(FitText,{children:_t()})},`${Et.route}-${Tt?"signedIn":""}`)})}),jsxRuntimeExports.jsx(InnerContainer$1,{children:Object.keys(et).map(Vt=>{const en=et[Vt];return jsxRuntimeExports.jsx(Page,{open:Vt===tt,initial:!nt&&Bt!=="entered",enterAnim:Vt===tt?Ht>Ut?"active-scale-up":"active":"",exitAnim:Vt!==tt?Ht{const[st,at]=useTransition({timeout:400,preEnter:!0,initialEntered:et,mountOnEnter:!0,unmountOnExit:!0}),ct=!(st==="exited"||st==="unmounted"),lt=st==="preEnter"||st!=="exiting";return reactExports.useEffect(()=>{at(et)},[et]),ct?jsxRuntimeExports.jsx(PageContainer,{className:`${lt?ot:it}`,style:{animationDuration:tt?"0ms":void 0,animationDelay:tt?"0ms":void 0},children:o}):null},OrDivider=({children:o})=>{const et=useLocales();return jsxRuntimeExports.jsx(TextWithHr,{children:jsxRuntimeExports.jsx("span",{children:o??et.or})})},Graphic=styled(motion.div)` +`),et=et.map((tt,nt)=>jsxRuntimeExports.jsxs(React.Fragment,{children:[wrapTags(tt),nto.split(/(\*\*[^\*]*\*\*)/g).map((nt,rt)=>/(\*\*.*\*\*)/g.test(nt)?jsxRuntimeExports.jsx("strong",{children:nt.replace(/\*\*/g,"")},rt):`${nt}`).map(nt=>typeof nt=="string"?nt.split(/(\[WALLETCONNECTLOGO\])/g).map(rt=>rt==="[WALLETCONNECTLOGO]"?jsxRuntimeExports.jsx("span",{className:"ck-tt-logo",children:jsxRuntimeExports.jsx(Logos.WalletConnect,{})},rt):rt):nt),LOG_LEVEL={debug:10,info:20,warn:30,error:40,none:100},useIsoLayoutEffect=typeof window<"u"&&window.document&&window.document.createElement!==void 0?reactExports.useLayoutEffect:reactExports.useEffect,useFitText=({logLevel:o="info",maxFontSize:et=100,minFontSize:tt=20,onFinish:nt,onStart:rt,resolution:ot=5}={})=>{const it=LOG_LEVEL[o],st=reactExports.useCallback(()=>({calcKey:0,fontSize:et,fontSizePrev:tt,fontSizeMax:et,fontSizeMin:tt}),[et,tt]),at=reactExports.useRef(null),ct=reactExports.useRef(),lt=reactExports.useRef(!1),[dt,ht]=reactExports.useState(st),{calcKey:pt,fontSize:mt,fontSizeMax:ft,fontSizeMin:yt,fontSizePrev:gt}=dt;let xt=null;const[vt]=reactExports.useState(()=>new index$1(()=>{xt=window.requestAnimationFrame(()=>{lt.current||(rt&&rt(),lt.current=!0,ht({...st(),calcKey:pt+1}))})}));reactExports.useEffect(()=>(at.current&&vt.observe(at.current),()=>{xt&&window.cancelAnimationFrame(xt),vt.disconnect()}),[xt,vt]);const bt=at.current&&at.current.innerHTML;return reactExports.useEffect(()=>{pt===0||lt.current||(bt!==ct.current&&(rt&&rt(),ht({...st(),calcKey:pt+1})),ct.current=bt)},[pt,st,bt,rt]),useIsoLayoutEffect(()=>{if(pt===0)return;const Et=Math.abs(mt-gt)<=ot,wt=!!at.current&&(at.current.scrollHeight>at.current.offsetHeight||at.current.scrollWidth>at.current.offsetWidth),kt=wt&&mt===gt,It=mt>gt;if(Et){kt?(lt.current=!1,it<=LOG_LEVEL.info&&console.info(`[use-fit-text] reached \`minFontSize = ${tt}\` without fitting text`)):wt?ht({fontSize:It?gt:yt,fontSizeMax:ft,fontSizeMin:yt,fontSizePrev:gt,calcKey:pt}):(lt.current=!1,nt&&nt(mt));return}let Rt,Pt=ft,jt=yt;wt?(Rt=It?gt-mt:yt-mt,Pt=Math.min(ft,mt)):(Rt=It?ft-mt:gt-mt,jt=Math.max(yt,mt)),ht({calcKey:pt,fontSize:mt+Rt/2,fontSizeMax:Pt,fontSizeMin:jt,fontSizePrev:mt})},[pt,mt,ft,yt,gt,nt,at,ot]),{fontSize:mt,ref:at}},FitText=({children:o})=>{const[et,tt]=React.useState(!1),{fontSize:nt,ref:rt}=useFitText({logLevel:"none",maxFontSize:100,minFontSize:70,onStart:()=>tt(!0),onFinish:()=>tt(!0)});return jsxRuntimeExports.jsx("div",{ref:rt,style:{visibility:et?"visible":"hidden",fontSize:`${nt}%`,maxHeight:"100%",maxWidth:"100%",display:"flex",justifyContent:"center",alignItems:"center"},children:o})};FitText.displayName="FitText";function useConnectors(){const o=useConnectors$1();return o??[]}function useConnector(o,et){const tt=useConnectors();return o==="injected"&&et?tt.find(nt=>nt.id===o&&nt.name===et):o==="injected"?tt.find(nt=>nt.id===o&&nt.name.includes("Injected")):tt.find(nt=>nt.id===o)}function useWalletConnectConnector(){return useConnector("walletConnect")}const useWallet=o=>{const tt=useWallets().find(nt=>nt.id===o);return tt||null},useWallets=()=>{const o=useConnectors(),et=useContext();return o.map(nt=>{var rt,ot;const it=Object.keys(walletConfigs).find(at=>at.split(",").map(ct=>ct.trim()).indexOf(nt.id)!==-1),st={id:nt.id,name:(ot=(rt=nt.name)!==null&&rt!==void 0?rt:nt.id)!==null&&ot!==void 0?ot:nt.type,icon:jsxRuntimeExports.jsx("img",{src:nt.icon,alt:nt.name,width:"100%",height:"100%"}),connector:nt,iconShape:"squircle",isInstalled:nt.type==="mock"||nt.type==="injected"&&nt.id!=="metaMask"||isCoinbaseWalletConnector(nt.id)};if(it){const at=walletConfigs[it];return{...st,iconConnector:nt.icon?jsxRuntimeExports.jsx("img",{src:nt.icon,alt:nt.name,width:"100%",height:"100%"}):void 0,...at}}return st}).filter((nt,rt,ot)=>ot.findIndex(it=>it.id===nt.id)===rt).map(nt=>{var rt,ot;return nt.id==="walletConnect"?{...nt,name:((rt=et.options)===null||rt===void 0?void 0:rt.walletConnectName)||nt.name,shortName:((ot=et.options)===null||ot===void 0?void 0:ot.walletConnectName)||nt.shortName}:nt}).filter((nt,rt,ot)=>!(nt.id==="coinbaseWalletSDK"&&ot.find(it=>it.id==="com.coinbase.wallet"))).filter((nt,rt,ot)=>!((nt.id==="metaMaskSDK"||nt.id==="metaMask")&&ot.find(it=>it.id==="io.metamask"||it.id==="io.metamask.mobile"))).sort((nt,rt)=>{const ot=nt.isInstalled&&isInjectedConnector(nt.connector.type),it=rt.isInstalled&&isInjectedConnector(rt.connector.type);return ot&&!it?-1:!ot&&it?1:0}).sort((nt,rt)=>nt.id==="walletConnect"?1:rt.id==="walletConnect"?-1:0)},ProfileIcon=({isSignedIn:o})=>jsxRuntimeExports.jsxs("div",{style:{position:"relative"},children:[o?jsxRuntimeExports.jsx(AuthIcon,{style:{bottom:-1,right:-1}}):jsxRuntimeExports.jsx("div",{style:{zIndex:2,position:"absolute",top:-2,right:-2,background:"#1A88F8",borderRadius:8,boxShadow:"0 0 0 2px var(--ck-body-background)",width:8,height:8}}),jsxRuntimeExports.jsxs("svg",{"aria-hidden":"true",width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{overflow:"visible"},children:[jsxRuntimeExports.jsx("circle",{cx:"10",cy:"10",r:"9",stroke:"currentColor",strokeWidth:"2"}),jsxRuntimeExports.jsx("path",{d:"M16.5 16.775C14.8618 15.0649 12.5552 14 10 14C7.44477 14 5.13825 15.0649 3.5 16.775",stroke:"currentColor",strokeWidth:"2"}),jsxRuntimeExports.jsx("circle",{cx:"10",cy:"8",r:"3",stroke:"currentColor",strokeWidth:"2"})]})]}),InfoIcon=({...o})=>jsxRuntimeExports.jsx("svg",{"aria-hidden":"true",width:"22",height:"22",viewBox:"0 0 22 22",fill:"none",xmlns:"http://www.w3.org/2000/svg",...o,children:jsxRuntimeExports.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M20 11C20 15.9706 15.9706 20 11 20C6.02944 20 2 15.9706 2 11C2 6.02944 6.02944 2 11 2C15.9706 2 20 6.02944 20 11ZM22 11C22 17.0751 17.0751 22 11 22C4.92487 22 0 17.0751 0 11C0 4.92487 4.92487 0 11 0C17.0751 0 22 4.92487 22 11ZM11.6445 12.7051C11.6445 13.1348 11.3223 13.4678 10.7744 13.4678C10.2266 13.4678 9.92578 13.1885 9.92578 12.6191V12.4795C9.92578 11.4268 10.4951 10.8574 11.2686 10.3203C12.2031 9.67578 12.665 9.32129 12.665 8.59082C12.665 7.76367 12.0205 7.21582 11.043 7.21582C10.3232 7.21582 9.80762 7.57031 9.45312 8.16113C9.38282 8.24242 9.32286 8.32101 9.2667 8.39461C9.04826 8.68087 8.88747 8.8916 8.40039 8.8916C8.0459 8.8916 7.66992 8.62305 7.66992 8.15039C7.66992 7.96777 7.70215 7.7959 7.75586 7.61328C8.05664 6.625 9.27051 5.75488 11.1182 5.75488C12.9336 5.75488 14.5234 6.71094 14.5234 8.50488C14.5234 9.7832 13.7822 10.417 12.7402 11.1045C11.999 11.5986 11.6445 11.9746 11.6445 12.5762V12.7051ZM11.9131 15.5625C11.9131 16.1855 11.376 16.6797 10.7529 16.6797C10.1299 16.6797 9.59277 16.1748 9.59277 15.5625C9.59277 14.9395 10.1191 14.4453 10.7529 14.4453C11.3867 14.4453 11.9131 14.9287 11.9131 15.5625Z",fill:"currentColor"})}),CloseIcon=({...o})=>jsxRuntimeExports.jsx(motion.svg,{width:14,height:14,viewBox:"0 0 14 14",fill:"none",xmlns:"http://www.w3.org/2000/svg",...o,children:jsxRuntimeExports.jsx("path",{d:"M1 13L13 1M1 1L13 13",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})}),BackIcon=({...o})=>jsxRuntimeExports.jsx(motion.svg,{width:9,height:16,viewBox:"0 0 9 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...o,children:jsxRuntimeExports.jsx("path",{d:"M8 1L1 8L8 15",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),contentTransitionDuration=.22,contentVariants$2={initial:{zIndex:2,opacity:0},animate:{opacity:1,scale:1,transition:{duration:contentTransitionDuration*.75,delay:contentTransitionDuration*.25,ease:[.26,.08,.25,1]}},exit:{zIndex:1,opacity:0,pointerEvents:"none",position:"absolute",left:["50%","50%"],x:["-50%","-50%"],transition:{duration:contentTransitionDuration,ease:[.26,.08,.25,1]}}},Modal=({open:o,pages:et,pageId:tt,positionInside:nt,inline:rt,demo:ot,onClose:it,onBack:st,onInfo:at})=>{var ct,lt,dt,ht,pt,mt,ft,yt,gt,xt,vt,bt;const Et=useContext(),wt=useThemeContext(),kt=isMobile(),{isSignedIn:It,reset:Rt}=useSIWE(),Pt=useWallet((ct=Et.connector)===null||ct===void 0?void 0:ct.id),jt={name:Pt==null?void 0:Pt.name,shortName:(lt=Pt==null?void 0:Pt.shortName)!==null&<!==void 0?lt:Pt==null?void 0:Pt.name,icon:(dt=Pt==null?void 0:Pt.iconConnector)!==null&&dt!==void 0?dt:Pt==null?void 0:Pt.icon,iconShape:(ht=Pt==null?void 0:Pt.iconShape)!==null&&ht!==void 0?ht:"circle",iconShouldShrink:Pt==null?void 0:Pt.iconShouldShrink},Ot=useLocales({CONNECTORNAME:jt==null?void 0:jt.name}),[Bt,zt]=useTransition({timeout:160,preEnter:!0,mountOnEnter:!0,unmountOnExit:!0}),Ft=!(Bt==="exited"||Bt==="unmounted"),Yt=Bt==="preEnter"||Bt!=="exiting",Ht=Et.route===routes.CONNECTORS?0:Et.route===routes.DOWNLOAD?2:1,Ut=usePrevious(Ht,Ht);nt||useLockBodyScroll(Ft),usePrevious(tt,tt),reactExports.useEffect(()=>{zt(o),o&&Qt(void 0)},[o]);const[qt,Lt]=reactExports.useState({width:void 0,height:void 0}),[Zt,Qt]=reactExports.useState(void 0),Nt=Vt=>{const en={width:Vt==null?void 0:Vt.offsetWidth,height:Vt==null?void 0:Vt.offsetHeight};Lt({width:`${en==null?void 0:en.width}px`,height:`${en==null?void 0:en.height}px`})};let Gt;const nn=reactExports.useCallback(Vt=>{Vt&&(Xt.current=Vt,Qt(Zt!==void 0),clearTimeout(Gt),Gt=setTimeout(()=>Qt(!1),360),Nt(Vt))},[o,Zt]),{chain:Wt}=useAccount(),{switchChain:hn}=useSwitchChain(),Xt=reactExports.useRef(null);reactExports.useEffect(()=>{Xt.current&&Nt(Xt.current)},[Wt,hn,kt,It,Et.options,Et.resize]),reactExports.useEffect(()=>{if(!Ft){Lt({width:void 0,height:void 0});return}const Vt=en=>{en.key==="Escape"&&it&&it()};return document.addEventListener("keydown",Vt),()=>{document.removeEventListener("keydown",Vt)}},[Ft,it]);const Jt={"--height":qt.height,"--width":qt.width};function tn(){return Pt?!(!Pt.getWalletConnectDeeplink||Pt.isInstalled):!1}function _t(){var Vt;switch(Et.route){case routes.ABOUT:return Ot.aboutScreen_heading;case routes.CONNECT:return tn()?isWalletConnectConnector((Vt=Pt==null?void 0:Pt.connector)===null||Vt===void 0?void 0:Vt.id)?Ot.scanScreen_heading:Ot.scanScreen_heading_withConnector:jt==null?void 0:jt.name;case routes.CONNECTORS:return Ot.connectorsScreen_heading;case routes.MOBILECONNECTORS:return Ot.mobileConnectorsScreen_heading;case routes.DOWNLOAD:return Ot.downloadAppScreen_heading;case routes.ONBOARDING:return Ot.onboardingScreen_heading;case routes.PROFILE:return Ot.profileScreen_heading;case routes.SWITCHNETWORKS:return Ot.switchNetworkScreen_heading;case routes.SIGNINWITHETHEREUM:return It?Ot.signInWithEthereumScreen_signedIn_heading:Ot.signInWithEthereumScreen_signedOut_heading;default:return""}}const Dt=jsxRuntimeExports.jsx(ResetContainer,{$useTheme:(pt=ot==null?void 0:ot.theme)!==null&&pt!==void 0?pt:wt.theme,$useMode:(mt=ot==null?void 0:ot.mode)!==null&&mt!==void 0?mt:wt.mode,$customTheme:(ft=ot==null?void 0:ot.customTheme)!==null&&ft!==void 0?ft:wt.customTheme,children:jsxRuntimeExports.jsxs(ModalContainer,{role:"dialog",style:{pointerEvents:Yt?"auto":"none",position:nt?"absolute":void 0},children:[!rt&&jsxRuntimeExports.jsx(BackgroundOverlay,{$active:Yt,onClick:it,$blur:(yt=Et.options)===null||yt===void 0?void 0:yt.overlayBlur}),jsxRuntimeExports.jsxs(Container$7,{style:Jt,initial:!1,children:[jsxRuntimeExports.jsx("div",{style:{pointerEvents:Zt?"all":"none",position:"absolute",top:0,bottom:0,left:"50%",transform:"translateX(-50%)",width:"var(--width)",zIndex:9,transition:"width 200ms ease"}}),jsxRuntimeExports.jsxs(BoxContainer,{className:`${Yt&&"active"}`,children:[jsxRuntimeExports.jsx(AnimatePresence,{initial:!1,children:((gt=Et.options)===null||gt===void 0?void 0:gt.disclaimer)&&Et.route===routes.CONNECTORS&&jsxRuntimeExports.jsx(DisclaimerBackground,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{delay:0,duration:.2,ease:[.25,.1,.25,1]},children:jsxRuntimeExports.jsx(Disclaimer,{children:jsxRuntimeExports.jsx("div",{children:(xt=Et.options)===null||xt===void 0?void 0:xt.disclaimer})})})}),jsxRuntimeExports.jsx(AnimatePresence,{initial:!1,children:Et.errorMessage&&jsxRuntimeExports.jsxs(ErrorMessage,{initial:{y:"10%",x:"-50%"},animate:{y:"-100%"},exit:{y:"100%"},transition:{duration:.2,ease:"easeInOut"},children:[jsxRuntimeExports.jsx("span",{children:Et.errorMessage}),jsxRuntimeExports.jsx("div",{onClick:()=>Et.displayError(null),style:{position:"absolute",right:24,top:24,cursor:"pointer"},children:jsxRuntimeExports.jsx(CloseIcon,{})})]})}),jsxRuntimeExports.jsxs(ControllerContainer,{children:[it&&jsxRuntimeExports.jsx(CloseButton,{"aria-label":flattenChildren(Ot.close).toString(),onClick:it,children:jsxRuntimeExports.jsx(CloseIcon,{})}),jsxRuntimeExports.jsx("div",{style:{position:"absolute",top:23,left:20,width:32,height:32},children:jsxRuntimeExports.jsx(AnimatePresence,{children:st?jsxRuntimeExports.jsx(BackButton,{disabled:Zt,"aria-label":flattenChildren(Ot.back).toString(),onClick:st,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:kt?0:.1,delay:kt?.01:0},children:jsxRuntimeExports.jsx(BackIcon,{})},"backButton"):Et.route===routes.PROFILE&&Et.signInWithEthereum?jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[!It&&!(!((vt=Et.options)===null||vt===void 0)&&vt.hideTooltips)&&jsxRuntimeExports.jsx(motion.div,{style:{position:"absolute",inset:0,pointerEvents:"none"},initial:{opacity:0,scale:.8},animate:{opacity:1,scale:1,transition:{delay:.5,duration:.2}},exit:{opacity:0,scale:.6,transition:{delay:0,duration:kt?0:.1}},children:jsxRuntimeExports.jsx(SignInTooltip,{children:Ot.signInWithEthereumScreen_tooltip})}),jsxRuntimeExports.jsx(SiweButton,{disabled:Zt,"aria-label":Ot.signInWithEthereumScreen_signedOut_heading,onClick:()=>{Rt(),Et.setRoute(routes.SIGNINWITHETHEREUM)},initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:kt?0:.1,delay:kt?.01:0},children:jsxRuntimeExports.jsx(ProfileIcon,{isSignedIn:It})},"siweButton")]}):at&&!(!((bt=Et.options)===null||bt===void 0)&&bt.hideQuestionMarkCTA)&&jsxRuntimeExports.jsx(InfoButton,{disabled:Zt,"aria-label":flattenChildren(Ot.moreInformation).toString(),onClick:at,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:kt?0:.1,delay:kt?.01:0},children:jsxRuntimeExports.jsx(InfoIcon,{})},"infoButton")})})]}),jsxRuntimeExports.jsx(ModalHeading,{children:jsxRuntimeExports.jsx(AnimatePresence,{children:jsxRuntimeExports.jsx(motion.div,{style:{position:"absolute",top:0,bottom:0,left:52,right:52,display:"flex",justifyContent:"center"},initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:kt?0:.17,delay:kt?.01:0},children:jsxRuntimeExports.jsx(FitText,{children:_t()})},`${Et.route}-${It?"signedIn":""}`)})}),jsxRuntimeExports.jsx(InnerContainer$1,{children:Object.keys(et).map(Vt=>{const en=et[Vt];return jsxRuntimeExports.jsx(Page,{open:Vt===tt,initial:!nt&&Bt!=="entered",enterAnim:Vt===tt?Ht>Ut?"active-scale-up":"active":"",exitAnim:Vt!==tt?Ht{const[st,at]=useTransition({timeout:400,preEnter:!0,initialEntered:et,mountOnEnter:!0,unmountOnExit:!0}),ct=!(st==="exited"||st==="unmounted"),lt=st==="preEnter"||st!=="exiting";return reactExports.useEffect(()=>{at(et)},[et]),ct?jsxRuntimeExports.jsx(PageContainer,{className:`${lt?ot:it}`,style:{animationDuration:tt?"0ms":void 0,animationDelay:tt?"0ms":void 0},children:o}):null},OrDivider=({children:o})=>{const et=useLocales();return jsxRuntimeExports.jsx(TextWithHr,{children:jsxRuntimeExports.jsx("span",{children:o??et.or})})},Graphic=styled(motion.div)` position: relative; margin: 16px auto 20px; height: 190px; @@ -1516,7 +1516,7 @@ Vui lòng thử lại.`,injectionScreen_notconnected_h1:"Đăng nhập vào {{ C rgba(255, 255, 255, 0.2) 0%, rgba(0, 0, 0, 0) 100% ), - linear-gradient(180deg, #3897FB 0%, #5004F1 100%))`,boxShadow:"var(--ck-graphic-globe-box-shadow, 0px -6px 20px rgba(56, 151, 251, 0.23))"},children:jsxRuntimeExports.jsx(SpinContainer,{style:o?void 0:{animationPlayState:"paused"},children:jsxRuntimeExports.jsxs("svg",{width:"128",height:"128",viewBox:"0 0 128 128",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntimeExports.jsxs("g",{children:[jsxRuntimeExports.jsx("circle",{cx:"30",cy:"141",r:"64",stroke:`url(#networkRadialA-${et})`,strokeWidth:"3"}),jsxRuntimeExports.jsx("circle",{cx:"78.8515",cy:"131.123",r:"54.1005",transform:"rotate(-37.4016 78.8515 131.123)",stroke:`url(#networkRadialB-${et})`,strokeWidth:"3"}),jsxRuntimeExports.jsx("circle",{cx:"63.6053",cy:"2.12794",r:"50.8338",transform:"rotate(134.702 63.6053 2.12794)",stroke:`url(#networkRadialC-${et})`,strokeWidth:"3"}),jsxRuntimeExports.jsx("circle",{cx:"126.658",cy:"56.6577",r:"50.3433",transform:"rotate(-105 126.658 56.6577)",stroke:`url(#networkRadialD-${et})`,strokeWidth:"3"}),jsxRuntimeExports.jsx("circle",{cx:"13.6619",cy:"18.9603",r:"46.0247",transform:"rotate(107.362 13.6619 18.9603)",stroke:`url(#networkRadialE-${et})`,strokeWidth:"3"})]}),jsxRuntimeExports.jsxs("defs",{children:[jsxRuntimeExports.jsxs("radialGradient",{id:`networkRadialA-${et}`,cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(60.5 84) rotate(104.668) scale(77.0097)",children:[jsxRuntimeExports.jsx("stop",{stopColor:"var(--ck-graphic-globe-lines, white)"}),jsxRuntimeExports.jsx("stop",{offset:"1",stopColor:"var(--ck-graphic-globe-lines, white)",stopOpacity:"0"})]}),jsxRuntimeExports.jsxs("radialGradient",{id:`networkRadialB-${et}`,cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(96.1805 81.6717) rotate(97.125) scale(64.7443)",children:[jsxRuntimeExports.jsx("stop",{stopColor:"var(--ck-graphic-globe-lines, white)"}),jsxRuntimeExports.jsx("stop",{offset:"1",stopColor:"var(--ck-graphic-globe-lines, white)",stopOpacity:"0"})]}),jsxRuntimeExports.jsxs("radialGradient",{id:`networkRadialC-${et}`,cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(96.3816 -36.4455) rotate(114.614) scale(57.7177)",children:[jsxRuntimeExports.jsx("stop",{stopColor:"var(--ck-graphic-globe-lines, white)"}),jsxRuntimeExports.jsx("stop",{offset:"1",stopColor:"var(--ck-graphic-globe-lines, white)",stopOpacity:"0"})]}),jsxRuntimeExports.jsxs("radialGradient",{id:`networkRadialD-${et}`,cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(137.86 7.73234) rotate(92.3288) scale(62.743)",children:[jsxRuntimeExports.jsx("stop",{stopColor:"var(--ck-graphic-globe-lines, white)"}),jsxRuntimeExports.jsx("stop",{offset:"1",stopColor:"var(--ck-graphic-globe-lines, white)",stopOpacity:"0"})]}),jsxRuntimeExports.jsxs("radialGradient",{id:`networkRadialE-${et}`,cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(35.3203 -21.566) rotate(104.513) scale(54.8617)",children:[jsxRuntimeExports.jsx("stop",{stopColor:"var(--ck-graphic-globe-lines, white)"}),jsxRuntimeExports.jsx("stop",{offset:"1",stopColor:"var(--ck-graphic-globe-lines, white)",stopOpacity:"0"})]})]})]})})},"SlideThreeInner"),jsxRuntimeExports.jsxs(motion.div,{exit:{opacity:0},children:[jsxRuntimeExports.jsx(motion.div,{initial:o?void 0:{scale:1.1},animate:o?pulseAnim:void 0,transition:{...pulseTransition},style:{position:"absolute",inset:0,borderRadius:"50%",boxShadow:"0 0 0 2px var(--ck-graphic-globe-lines, rgba(126, 112, 243, 1))"}},"pulseA"),jsxRuntimeExports.jsx(motion.div,{initial:o?void 0:{scale:1.2,opacity:.25},animate:o?pulseAnim:void 0,transition:{...pulseTransition,delay:.5},style:{position:"absolute",inset:0,borderRadius:"50%",boxShadow:"0 0 0 2px var(--ck-graphic-globe-lines, rgba(126, 112, 243, 1))"}},"pulseB")]})]},o),jsxRuntimeExports.jsxs(motion.div,{initial:{rotate:-20,scale:.1,y:-10,x:-10},animate:{rotate:0,scale:1,y:0,x:0},exit:{zIndex:3,scale:.2,y:-25,x:15},style:{zIndex:12,borderRadius:"50%",position:"absolute",bottom:-4,right:-4,width:54,height:54,display:"flex",alignItems:"center",justifyContent:"center",padding:13,background:"var(--ck-graphic-compass-background, var(--ck-body-background))",boxShadow:"var(--ck-graphic-compass-box-shadow, 0px 2px 9px rgba(0, 0, 0, 0.15))"},children:[jsxRuntimeExports.jsx(BgLighten,{}),jsxRuntimeExports.jsx(motion.div,{style:{zIndex:2,position:"absolute"},initial:{rotate:-170},animate:{rotate:0},exit:{rotate:-180,transition:{duration:0}},transition:{type:"spring",stiffness:6,damping:.9,mass:.2},children:Compass})]})]},"SlideThree")})},About=()=>{var o,et;const tt=useLocales({}),nt=useContext(),rt=(et=(o=nt.options)===null||o===void 0?void 0:o.ethereumOnboardingUrl)!==null&&et!==void 0?et:tt.aboutScreen_ctaUrl,[ot,it]=reactExports.useState(!0),[st,at]=reactExports.useState(0),ct=reactExports.useRef(!1),lt=reactExports.useRef(0),dt=[.16,1,.3,1],ht=600;let pt;reactExports.useEffect(()=>()=>clearInterval(pt),[]);const mt=()=>{if(Et.current){const{overflow:Pt}=getComputedStyle(Et.current);return Pt!=="visible"}return!1},ft=Pt=>{it(!1),mt()?yt(Pt):at(Pt)},yt=Pt=>{if(Et.current){const{offsetWidth:$t}=Et.current;Et.current.scrollLeft=$t*Pt,setTimeout(()=>at(Pt),100)}},gt=()=>{if(!Et.current)return;const{offsetWidth:Pt,scrollLeft:$t}=Et.current,Ot=lt.current;lt.current=$t;const Bt=4;if(Ot-$t>-Bt&&Ot-$t{bt()},vt=()=>{const{offsetWidth:Pt,scrollLeft:$t}=Et.current,Ot=Math.round($t/Pt);at(Ot)},bt=()=>{ct.current=!0,clearTimeout(pt)},Et=reactExports.useRef(null);reactExports.useEffect(()=>{if(Et.current)return Et.current.addEventListener("scroll",gt),Et.current.addEventListener("touchmove",xt),Et.current.addEventListener("touchend",vt),()=>{Et.current&&(Et.current.removeEventListener("scroll",gt),Et.current.removeEventListener("touchmove",xt),Et.current.removeEventListener("touchend",vt))}},[Et]);const wt=[jsxRuntimeExports.jsx(SlideOne,{layoutId:"graphicCircle",duration:ht,ease:dt}),jsxRuntimeExports.jsx(SlideTwo,{layoutId:"graphicCircle",duration:ht,ease:dt}),jsxRuntimeExports.jsx(SlideThree,{layoutId:"graphicCircle",duration:ht,ease:dt})],kt=[jsxRuntimeExports.jsx(SlideOne,{duration:ht,ease:dt}),jsxRuntimeExports.jsx(SlideTwo,{duration:ht,ease:dt}),jsxRuntimeExports.jsx(SlideThree,{duration:ht,ease:dt})],Tt=(()=>{var Pt;switch((Pt=nt.options)===null||Pt===void 0?void 0:Pt.language){case"en-US":case"zh-CN":return 64;default:return 84}})(),Rt=[jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(ModalH1,{style:{height:24},$small:!0,children:jsxRuntimeExports.jsx(FitText,{children:tt.aboutScreen_a_h1})}),jsxRuntimeExports.jsx(ModalBody,{style:{height:Tt},children:jsxRuntimeExports.jsx(FitText,{children:tt.aboutScreen_a_p})})]}),jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(ModalH1,{style:{height:24},$small:!0,children:jsxRuntimeExports.jsx(FitText,{children:tt.aboutScreen_b_h1})}),jsxRuntimeExports.jsx(ModalBody,{style:{height:Tt},children:jsxRuntimeExports.jsx(FitText,{children:tt.aboutScreen_b_p})})]}),jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(ModalH1,{style:{height:24},$small:!0,children:jsxRuntimeExports.jsx(FitText,{children:tt.aboutScreen_c_h1})}),jsxRuntimeExports.jsx(ModalBody,{style:{height:Tt},children:jsxRuntimeExports.jsx(FitText,{children:tt.aboutScreen_c_p})})]})];return jsxRuntimeExports.jsxs(PageContent,{children:[jsxRuntimeExports.jsxs(Slider,{children:[jsxRuntimeExports.jsx(ImageContainer$1,{children:jsxRuntimeExports.jsx(MotionConfig,{transition:{duration:ht/1e3,ease:dt},children:jsxRuntimeExports.jsx(AnimatePresence,{initial:!1,onExitComplete:()=>it(!0),children:wt.map((Pt,$t)=>st===$t&&jsxRuntimeExports.jsx(ImageContainerInner,{style:{position:"absolute"},children:Pt},$t))})})}),jsxRuntimeExports.jsx(Slides,{ref:Et,children:jsxRuntimeExports.jsx(AnimatePresence,{children:Rt.map((Pt,$t)=>jsxRuntimeExports.jsxs(Slide,{$active:st===$t,children:[jsxRuntimeExports.jsx(MobileImageContainer,{children:jsxRuntimeExports.jsx(MotionConfig,{transition:{duration:0},children:jsxRuntimeExports.jsx(ImageContainerInner,{children:kt[$t]})})}),jsxRuntimeExports.jsx(ModalContent,{style:{gap:8,paddingBottom:0},children:Pt})]},$t))})})]}),jsxRuntimeExports.jsx(OrDivider,{children:jsxRuntimeExports.jsx(Dots,{children:Rt.map((Pt,$t)=>jsxRuntimeExports.jsx(Dot,{$active:st===$t,onClick:()=>{bt(),ft($t)}},$t))})}),jsxRuntimeExports.jsx(Button$1,{href:rt,arrow:!0,children:tt.aboutScreen_ctaText})]})},Shimmer$1=We` + linear-gradient(180deg, #3897FB 0%, #5004F1 100%))`,boxShadow:"var(--ck-graphic-globe-box-shadow, 0px -6px 20px rgba(56, 151, 251, 0.23))"},children:jsxRuntimeExports.jsx(SpinContainer,{style:o?void 0:{animationPlayState:"paused"},children:jsxRuntimeExports.jsxs("svg",{width:"128",height:"128",viewBox:"0 0 128 128",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntimeExports.jsxs("g",{children:[jsxRuntimeExports.jsx("circle",{cx:"30",cy:"141",r:"64",stroke:`url(#networkRadialA-${et})`,strokeWidth:"3"}),jsxRuntimeExports.jsx("circle",{cx:"78.8515",cy:"131.123",r:"54.1005",transform:"rotate(-37.4016 78.8515 131.123)",stroke:`url(#networkRadialB-${et})`,strokeWidth:"3"}),jsxRuntimeExports.jsx("circle",{cx:"63.6053",cy:"2.12794",r:"50.8338",transform:"rotate(134.702 63.6053 2.12794)",stroke:`url(#networkRadialC-${et})`,strokeWidth:"3"}),jsxRuntimeExports.jsx("circle",{cx:"126.658",cy:"56.6577",r:"50.3433",transform:"rotate(-105 126.658 56.6577)",stroke:`url(#networkRadialD-${et})`,strokeWidth:"3"}),jsxRuntimeExports.jsx("circle",{cx:"13.6619",cy:"18.9603",r:"46.0247",transform:"rotate(107.362 13.6619 18.9603)",stroke:`url(#networkRadialE-${et})`,strokeWidth:"3"})]}),jsxRuntimeExports.jsxs("defs",{children:[jsxRuntimeExports.jsxs("radialGradient",{id:`networkRadialA-${et}`,cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(60.5 84) rotate(104.668) scale(77.0097)",children:[jsxRuntimeExports.jsx("stop",{stopColor:"var(--ck-graphic-globe-lines, white)"}),jsxRuntimeExports.jsx("stop",{offset:"1",stopColor:"var(--ck-graphic-globe-lines, white)",stopOpacity:"0"})]}),jsxRuntimeExports.jsxs("radialGradient",{id:`networkRadialB-${et}`,cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(96.1805 81.6717) rotate(97.125) scale(64.7443)",children:[jsxRuntimeExports.jsx("stop",{stopColor:"var(--ck-graphic-globe-lines, white)"}),jsxRuntimeExports.jsx("stop",{offset:"1",stopColor:"var(--ck-graphic-globe-lines, white)",stopOpacity:"0"})]}),jsxRuntimeExports.jsxs("radialGradient",{id:`networkRadialC-${et}`,cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(96.3816 -36.4455) rotate(114.614) scale(57.7177)",children:[jsxRuntimeExports.jsx("stop",{stopColor:"var(--ck-graphic-globe-lines, white)"}),jsxRuntimeExports.jsx("stop",{offset:"1",stopColor:"var(--ck-graphic-globe-lines, white)",stopOpacity:"0"})]}),jsxRuntimeExports.jsxs("radialGradient",{id:`networkRadialD-${et}`,cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(137.86 7.73234) rotate(92.3288) scale(62.743)",children:[jsxRuntimeExports.jsx("stop",{stopColor:"var(--ck-graphic-globe-lines, white)"}),jsxRuntimeExports.jsx("stop",{offset:"1",stopColor:"var(--ck-graphic-globe-lines, white)",stopOpacity:"0"})]}),jsxRuntimeExports.jsxs("radialGradient",{id:`networkRadialE-${et}`,cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"translate(35.3203 -21.566) rotate(104.513) scale(54.8617)",children:[jsxRuntimeExports.jsx("stop",{stopColor:"var(--ck-graphic-globe-lines, white)"}),jsxRuntimeExports.jsx("stop",{offset:"1",stopColor:"var(--ck-graphic-globe-lines, white)",stopOpacity:"0"})]})]})]})})},"SlideThreeInner"),jsxRuntimeExports.jsxs(motion.div,{exit:{opacity:0},children:[jsxRuntimeExports.jsx(motion.div,{initial:o?void 0:{scale:1.1},animate:o?pulseAnim:void 0,transition:{...pulseTransition},style:{position:"absolute",inset:0,borderRadius:"50%",boxShadow:"0 0 0 2px var(--ck-graphic-globe-lines, rgba(126, 112, 243, 1))"}},"pulseA"),jsxRuntimeExports.jsx(motion.div,{initial:o?void 0:{scale:1.2,opacity:.25},animate:o?pulseAnim:void 0,transition:{...pulseTransition,delay:.5},style:{position:"absolute",inset:0,borderRadius:"50%",boxShadow:"0 0 0 2px var(--ck-graphic-globe-lines, rgba(126, 112, 243, 1))"}},"pulseB")]})]},o),jsxRuntimeExports.jsxs(motion.div,{initial:{rotate:-20,scale:.1,y:-10,x:-10},animate:{rotate:0,scale:1,y:0,x:0},exit:{zIndex:3,scale:.2,y:-25,x:15},style:{zIndex:12,borderRadius:"50%",position:"absolute",bottom:-4,right:-4,width:54,height:54,display:"flex",alignItems:"center",justifyContent:"center",padding:13,background:"var(--ck-graphic-compass-background, var(--ck-body-background))",boxShadow:"var(--ck-graphic-compass-box-shadow, 0px 2px 9px rgba(0, 0, 0, 0.15))"},children:[jsxRuntimeExports.jsx(BgLighten,{}),jsxRuntimeExports.jsx(motion.div,{style:{zIndex:2,position:"absolute"},initial:{rotate:-170},animate:{rotate:0},exit:{rotate:-180,transition:{duration:0}},transition:{type:"spring",stiffness:6,damping:.9,mass:.2},children:Compass})]})]},"SlideThree")})},About=()=>{var o,et;const tt=useLocales({}),nt=useContext(),rt=(et=(o=nt.options)===null||o===void 0?void 0:o.ethereumOnboardingUrl)!==null&&et!==void 0?et:tt.aboutScreen_ctaUrl,[ot,it]=reactExports.useState(!0),[st,at]=reactExports.useState(0),ct=reactExports.useRef(!1),lt=reactExports.useRef(0),dt=[.16,1,.3,1],ht=600;let pt;reactExports.useEffect(()=>()=>clearInterval(pt),[]);const mt=()=>{if(Et.current){const{overflow:Pt}=getComputedStyle(Et.current);return Pt!=="visible"}return!1},ft=Pt=>{it(!1),mt()?yt(Pt):at(Pt)},yt=Pt=>{if(Et.current){const{offsetWidth:jt}=Et.current;Et.current.scrollLeft=jt*Pt,setTimeout(()=>at(Pt),100)}},gt=()=>{if(!Et.current)return;const{offsetWidth:Pt,scrollLeft:jt}=Et.current,Ot=lt.current;lt.current=jt;const Bt=4;if(Ot-jt>-Bt&&Ot-jt{bt()},vt=()=>{const{offsetWidth:Pt,scrollLeft:jt}=Et.current,Ot=Math.round(jt/Pt);at(Ot)},bt=()=>{ct.current=!0,clearTimeout(pt)},Et=reactExports.useRef(null);reactExports.useEffect(()=>{if(Et.current)return Et.current.addEventListener("scroll",gt),Et.current.addEventListener("touchmove",xt),Et.current.addEventListener("touchend",vt),()=>{Et.current&&(Et.current.removeEventListener("scroll",gt),Et.current.removeEventListener("touchmove",xt),Et.current.removeEventListener("touchend",vt))}},[Et]);const wt=[jsxRuntimeExports.jsx(SlideOne,{layoutId:"graphicCircle",duration:ht,ease:dt}),jsxRuntimeExports.jsx(SlideTwo,{layoutId:"graphicCircle",duration:ht,ease:dt}),jsxRuntimeExports.jsx(SlideThree,{layoutId:"graphicCircle",duration:ht,ease:dt})],kt=[jsxRuntimeExports.jsx(SlideOne,{duration:ht,ease:dt}),jsxRuntimeExports.jsx(SlideTwo,{duration:ht,ease:dt}),jsxRuntimeExports.jsx(SlideThree,{duration:ht,ease:dt})],It=(()=>{var Pt;switch((Pt=nt.options)===null||Pt===void 0?void 0:Pt.language){case"en-US":case"zh-CN":return 64;default:return 84}})(),Rt=[jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(ModalH1,{style:{height:24},$small:!0,children:jsxRuntimeExports.jsx(FitText,{children:tt.aboutScreen_a_h1})}),jsxRuntimeExports.jsx(ModalBody,{style:{height:It},children:jsxRuntimeExports.jsx(FitText,{children:tt.aboutScreen_a_p})})]}),jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(ModalH1,{style:{height:24},$small:!0,children:jsxRuntimeExports.jsx(FitText,{children:tt.aboutScreen_b_h1})}),jsxRuntimeExports.jsx(ModalBody,{style:{height:It},children:jsxRuntimeExports.jsx(FitText,{children:tt.aboutScreen_b_p})})]}),jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(ModalH1,{style:{height:24},$small:!0,children:jsxRuntimeExports.jsx(FitText,{children:tt.aboutScreen_c_h1})}),jsxRuntimeExports.jsx(ModalBody,{style:{height:It},children:jsxRuntimeExports.jsx(FitText,{children:tt.aboutScreen_c_p})})]})];return jsxRuntimeExports.jsxs(PageContent,{children:[jsxRuntimeExports.jsxs(Slider,{children:[jsxRuntimeExports.jsx(ImageContainer$1,{children:jsxRuntimeExports.jsx(MotionConfig,{transition:{duration:ht/1e3,ease:dt},children:jsxRuntimeExports.jsx(AnimatePresence,{initial:!1,onExitComplete:()=>it(!0),children:wt.map((Pt,jt)=>st===jt&&jsxRuntimeExports.jsx(ImageContainerInner,{style:{position:"absolute"},children:Pt},jt))})})}),jsxRuntimeExports.jsx(Slides,{ref:Et,children:jsxRuntimeExports.jsx(AnimatePresence,{children:Rt.map((Pt,jt)=>jsxRuntimeExports.jsxs(Slide,{$active:st===jt,children:[jsxRuntimeExports.jsx(MobileImageContainer,{children:jsxRuntimeExports.jsx(MotionConfig,{transition:{duration:0},children:jsxRuntimeExports.jsx(ImageContainerInner,{children:kt[jt]})})}),jsxRuntimeExports.jsx(ModalContent,{style:{gap:8,paddingBottom:0},children:Pt})]},jt))})})]}),jsxRuntimeExports.jsx(OrDivider,{children:jsxRuntimeExports.jsx(Dots,{children:Rt.map((Pt,jt)=>jsxRuntimeExports.jsx(Dot,{$active:st===jt,onClick:()=>{bt(),ft(jt)}},jt))})}),jsxRuntimeExports.jsx(Button$1,{href:rt,arrow:!0,children:tt.aboutScreen_ctaText})]})},Shimmer$1=We` 0%{ transform: translate(-100%) rotate(-45deg); } 100%{ transform: translate(100%) rotate(-80deg); } `,InfoBox=styled.div` @@ -2568,7 +2568,7 @@ Vui lòng thử lại.`,injectionScreen_notconnected_h1:"Đăng nhập vào {{ C background: var(--ck-tooltip-background); border-radius: ${o=>o.$size==="small"?2:3}px 0 0 0; } -`,Tooltip=({children:o,message:et,open:tt,xOffset:nt=0,yOffset:rt=0,delay:ot})=>{var it;const st=useContext(),at=useThemeContext();if(!((it=st.options)===null||it===void 0)&&it.hideTooltips)return jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:o});const[ct,lt]=reactExports.useState(!1),[dt,ht]=reactExports.useState(!1),[pt,mt]=reactExports.useState("small"),[ft,yt]=reactExports.useState(!1),[gt]=reactExports.useState(st.route),xt=reactExports.useRef(null),[vt,bt]=useMeasure({debounce:ft?0:220,offsetSize:!0,scroll:!0}),Et=()=>{let Tt=!1;const Rt=nt+bt.left+bt.width,Pt=rt+bt.top+bt.height*.5;return(Rt>window.innerWidth||Rt<0||Pt>window.innerHeight||Pt<0)&&(Tt=!0),Tt};return(typeof window<"u"?reactExports.useLayoutEffect:reactExports.useEffect)(()=>{if(!xt.current||bt.top+bt.bottom+bt.left+bt.right+bt.height+bt.width===0)return;const Tt=nt+bt.left+bt.width,Rt=rt+bt.top+bt.height*.5;!ft&&Tt!==0&&Rt!==0&&yt(!0),xt.current.style.left=`${Tt}px`,xt.current.style.top=`${Rt}px`,mt(xt.current.offsetHeight<=40?"small":"large"),ht(Et())},[bt,tt,ct]),reactExports.useEffect(()=>{st.open||lt(!1)},[st.open]),reactExports.useEffect(()=>{lt(!!tt)},[tt]),jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(motion.div,{ref:vt,style:tt===void 0?{cursor:"help"}:{},onHoverStart:()=>lt(!0),onHoverEnd:()=>lt(!1),onClick:()=>lt(!1),children:o}),jsxRuntimeExports.jsx(Portal$2,{children:jsxRuntimeExports.jsx(AnimatePresence,{children:gt===st.route&&!dt&&ct&&jsxRuntimeExports.jsx(ResetContainer,{$useTheme:at.theme,$useMode:at.mode,$customTheme:at.customTheme,children:jsxRuntimeExports.jsx(TooltipWindow,{children:jsxRuntimeExports.jsxs(TooltipContainer,{role:"tooltip",$size:pt,ref:xt,initial:"collapsed",animate:ft?"open":{},exit:"collapsed",variants:{collapsed:{transformOrigin:"20px 50%",opacity:0,scale:.9,z:.01,y:"-50%",x:20,transition:{duration:.1}},open:{willChange:"opacity,transform",opacity:1,scale:1,z:.01,y:"-50%",x:20,transition:{ease:[.76,0,.24,1],duration:.15,delay:ot||.5}}},children:[et,jsxRuntimeExports.jsx(TooltipTail,{$size:pt})]})})})})})]})},LogoContainer$4=styled(motion.div)` +`,Tooltip=({children:o,message:et,open:tt,xOffset:nt=0,yOffset:rt=0,delay:ot})=>{var it;const st=useContext(),at=useThemeContext();if(!((it=st.options)===null||it===void 0)&&it.hideTooltips)return jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:o});const[ct,lt]=reactExports.useState(!1),[dt,ht]=reactExports.useState(!1),[pt,mt]=reactExports.useState("small"),[ft,yt]=reactExports.useState(!1),[gt]=reactExports.useState(st.route),xt=reactExports.useRef(null),[vt,bt]=useMeasure({debounce:ft?0:220,offsetSize:!0,scroll:!0}),Et=()=>{let It=!1;const Rt=nt+bt.left+bt.width,Pt=rt+bt.top+bt.height*.5;return(Rt>window.innerWidth||Rt<0||Pt>window.innerHeight||Pt<0)&&(It=!0),It};return(typeof window<"u"?reactExports.useLayoutEffect:reactExports.useEffect)(()=>{if(!xt.current||bt.top+bt.bottom+bt.left+bt.right+bt.height+bt.width===0)return;const It=nt+bt.left+bt.width,Rt=rt+bt.top+bt.height*.5;!ft&&It!==0&&Rt!==0&&yt(!0),xt.current.style.left=`${It}px`,xt.current.style.top=`${Rt}px`,mt(xt.current.offsetHeight<=40?"small":"large"),ht(Et())},[bt,tt,ct]),reactExports.useEffect(()=>{st.open||lt(!1)},[st.open]),reactExports.useEffect(()=>{lt(!!tt)},[tt]),jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(motion.div,{ref:vt,style:tt===void 0?{cursor:"help"}:{},onHoverStart:()=>lt(!0),onHoverEnd:()=>lt(!1),onClick:()=>lt(!1),children:o}),jsxRuntimeExports.jsx(Portal$2,{children:jsxRuntimeExports.jsx(AnimatePresence,{children:gt===st.route&&!dt&&ct&&jsxRuntimeExports.jsx(ResetContainer,{$useTheme:at.theme,$useMode:at.mode,$customTheme:at.customTheme,children:jsxRuntimeExports.jsx(TooltipWindow,{children:jsxRuntimeExports.jsxs(TooltipContainer,{role:"tooltip",$size:pt,ref:xt,initial:"collapsed",animate:ft?"open":{},exit:"collapsed",variants:{collapsed:{transformOrigin:"20px 50%",opacity:0,scale:.9,z:.01,y:"-50%",x:20,transition:{duration:.1}},open:{willChange:"opacity,transform",opacity:1,scale:1,z:.01,y:"-50%",x:20,transition:{ease:[.76,0,.24,1],duration:.15,delay:ot||.5}}},children:[et,jsxRuntimeExports.jsx(TooltipTail,{$size:pt})]})})})})})]})},LogoContainer$4=styled(motion.div)` z-index: 4; position: relative; overflow: hidden; @@ -2742,7 +2742,7 @@ Vui lòng thử lại.`,injectionScreen_notconnected_h1:"Đăng nhập vào {{ C transform: rotate(360deg); } } -`,CircleSpinner=({logo:o,smallLogo:et,connecting:tt=!0,unavailable:nt=!1,countdown:rt=!1})=>jsxRuntimeExports.jsxs(LogoContainer$3,{transition:{duration:.5,ease:[.175,.885,.32,.98]},children:[jsxRuntimeExports.jsx(Logo,{$small:!nt&&et,style:nt?{borderRadius:0}:void 0,children:o}),jsxRuntimeExports.jsx(SpinnerContainer,{children:jsxRuntimeExports.jsxs(AnimatePresence,{children:[tt&&jsxRuntimeExports.jsx(Spinner$2,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0,transition:{duration:rt?1:0}},children:jsxRuntimeExports.jsxs("svg",{"aria-hidden":"true",width:"102",height:"102",viewBox:"0 0 102 102",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntimeExports.jsx("path",{d:"M52 100C24.3858 100 2 77.6142 2 50",stroke:"url(#paint0_linear_1943_4139)",strokeWidth:"3.5",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntimeExports.jsx("defs",{children:jsxRuntimeExports.jsxs("linearGradient",{id:"paint0_linear_1943_4139",x1:"2",y1:"48.5",x2:"53",y2:"100",gradientUnits:"userSpaceOnUse",children:[jsxRuntimeExports.jsx("stop",{stopColor:"var(--ck-spinner-color)"}),jsxRuntimeExports.jsx("stop",{offset:"1",stopColor:"var(--ck-spinner-color)",stopOpacity:"0"})]})})]})},"Spinner"),rt&&jsxRuntimeExports.jsxs(ExpiringSpinner,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.25},children:[jsxRuntimeExports.jsx("div",{}),jsxRuntimeExports.jsx("div",{})]},"ExpiringSpinner")]})})]}),states$1={CONNECTED:"connected",CONNECTING:"connecting",EXPIRING:"expiring",FAILED:"failed",REJECTED:"rejected",NOTCONNECTED:"notconnected",UNAVAILABLE:"unavailable"},contentVariants$1={initial:{willChange:"transform,opacity",position:"relative",opacity:0,scale:.95},animate:{position:"relative",opacity:1,scale:1,transition:{ease:[.16,1,.3,1],duration:.4,delay:.05,position:{delay:0}}},exit:{position:"absolute",opacity:0,scale:.95,transition:{ease:[.16,1,.3,1],duration:.3}}},ConnectWithInjector=({switchConnectMethod:o,forceState:et})=>{var tt,nt,rt,ot,it,st,at,ct;const{connect:lt}=useConnect({mutation:{onMutate:$t=>{$t.connector?kt(states$1.CONNECTING):kt(states$1.UNAVAILABLE)},onError($t){console.error($t)},onSettled($t,Ot){if(Ot){if(gt(!0),setTimeout(()=>gt(!1),3500),Ot.code)switch(Ot.code){case-32002:kt(states$1.NOTCONNECTED);break;case 4001:kt(states$1.REJECTED);break;default:kt(states$1.FAILED);break}else if(Ot.message)switch(Ot.message){case"User rejected request":kt(states$1.REJECTED);break;default:kt(states$1.FAILED);break}}setTimeout(dt,100)}}}),{triggerResize:dt,connector:ht}=useContext(),pt=ht.id,mt=useWallet(pt),ft={name:mt==null?void 0:mt.name,shortName:(tt=mt==null?void 0:mt.shortName)!==null&&tt!==void 0?tt:mt==null?void 0:mt.name,icon:(nt=mt==null?void 0:mt.iconConnector)!==null&&nt!==void 0?nt:mt==null?void 0:mt.icon,iconShape:(rt=mt==null?void 0:mt.iconShape)!==null&&rt!==void 0?rt:"circle",iconShouldShrink:mt==null?void 0:mt.iconShouldShrink},[yt,gt]=reactExports.useState(!1);reactExports.useState(9);const vt=detectBrowser(),bt=(ot=mt==null?void 0:mt.downloadUrls)===null||ot===void 0?void 0:ot[vt],Et=mt!=null&&mt.downloadUrls?{name:Object.keys(mt==null?void 0:mt.downloadUrls)[0],label:((it=Object.keys(mt==null?void 0:mt.downloadUrls)[0])===null||it===void 0?void 0:it.charAt(0).toUpperCase())+((st=Object.keys(mt==null?void 0:mt.downloadUrls)[0])===null||st===void 0?void 0:st.slice(1)),url:mt==null?void 0:mt.downloadUrls[Object.keys(mt==null?void 0:mt.downloadUrls)[0]]}:void 0,[wt,kt]=reactExports.useState(et||(mt!=null&&mt.isInstalled?states$1.CONNECTING:states$1.UNAVAILABLE)),Tt=useLocales({CONNECTORNAME:ft.name,CONNECTORSHORTNAME:(at=ft.shortName)!==null&&at!==void 0?at:ft.name,SUGGESTEDEXTENSIONBROWSER:(ct=Et==null?void 0:Et.label)!==null&&ct!==void 0?ct:"your browser"}),Rt=async()=>{mt!=null&&mt.isInstalled&&(mt!=null&&mt.connector)?lt({connector:mt==null?void 0:mt.connector}):kt(states$1.UNAVAILABLE)};let Pt;return reactExports.useEffect(()=>{if(wt!==states$1.UNAVAILABLE)return Pt=setTimeout(Rt,600),()=>{clearTimeout(Pt)}},[]),mt?isWalletConnectConnector(mt==null?void 0:mt.connector.id)?jsxRuntimeExports.jsx(PageContent,{children:jsxRuntimeExports.jsxs(Container$4,{children:[jsxRuntimeExports.jsx(ModalHeading,{children:"Invalid State"}),jsxRuntimeExports.jsx(ModalContent,{children:jsxRuntimeExports.jsx(Alert,{children:"WalletConnect does not have an injection flow. This state should never happen."})})]})}):jsxRuntimeExports.jsx(PageContent,{children:jsxRuntimeExports.jsxs(Container$4,{children:[jsxRuntimeExports.jsx(ConnectingContainer,{children:jsxRuntimeExports.jsxs(ConnectingAnimation,{$shake:wt===states$1.FAILED||wt===states$1.REJECTED,$circle:ft.iconShape==="circle",children:[jsxRuntimeExports.jsx(AnimatePresence,{children:(wt===states$1.FAILED||wt===states$1.REJECTED)&&jsxRuntimeExports.jsx(RetryButton,{"aria-label":"Retry",initial:{opacity:0,scale:.8},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.8},whileTap:{scale:.9},transition:{duration:.1},onClick:Rt,children:jsxRuntimeExports.jsx(RetryIconContainer,{children:jsxRuntimeExports.jsx(Tooltip,{open:yt&&(wt===states$1.FAILED||wt===states$1.REJECTED),message:Tt.tryAgainQuestion,xOffset:-6,children:jsxRuntimeExports.jsx(RetryIconCircle,{})})})})}),ft.iconShape==="circle"?jsxRuntimeExports.jsx(CircleSpinner,{logo:wt===states$1.UNAVAILABLE?jsxRuntimeExports.jsx("div",{style:{transform:"scale(1.14)",position:"relative",width:"100%"},children:ft.icon}):jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:ft.icon}),smallLogo:ft.iconShouldShrink,connecting:wt===states$1.CONNECTING,unavailable:wt===states$1.UNAVAILABLE}):jsxRuntimeExports.jsx(SquircleSpinner,{logo:wt===states$1.UNAVAILABLE?jsxRuntimeExports.jsx("div",{style:{transform:"scale(1.14)",position:"relative",width:"100%"},children:ft.icon}):jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:ft.icon}),connecting:wt===states$1.CONNECTING})]})}),jsxRuntimeExports.jsx(ModalContentContainer,{children:jsxRuntimeExports.jsxs(AnimatePresence,{initial:!1,children:[wt===states$1.FAILED&&jsxRuntimeExports.jsx(Content$1,{initial:"initial",animate:"animate",exit:"exit",variants:contentVariants$1,children:jsxRuntimeExports.jsxs(ModalContent,{children:[jsxRuntimeExports.jsxs(ModalH1,{$error:!0,children:[jsxRuntimeExports.jsx(AlertIcon,{}),Tt.injectionScreen_failed_h1]}),jsxRuntimeExports.jsx(ModalBody,{children:Tt.injectionScreen_failed_p})]})},states$1.FAILED),wt===states$1.REJECTED&&jsxRuntimeExports.jsx(Content$1,{initial:"initial",animate:"animate",exit:"exit",variants:contentVariants$1,children:jsxRuntimeExports.jsxs(ModalContent,{style:{paddingBottom:28},children:[jsxRuntimeExports.jsx(ModalH1,{children:Tt.injectionScreen_rejected_h1}),jsxRuntimeExports.jsx(ModalBody,{children:Tt.injectionScreen_rejected_p})]})},states$1.REJECTED),(wt===states$1.CONNECTING||wt===states$1.EXPIRING)&&jsxRuntimeExports.jsx(Content$1,{initial:"initial",animate:"animate",exit:"exit",variants:contentVariants$1,children:jsxRuntimeExports.jsxs(ModalContent,{style:{paddingBottom:28},children:[jsxRuntimeExports.jsx(ModalH1,{children:mt.connector.id==="injected"?Tt.injectionScreen_connecting_injected_h1:Tt.injectionScreen_connecting_h1}),jsxRuntimeExports.jsx(ModalBody,{children:mt.connector.id==="injected"?Tt.injectionScreen_connecting_injected_p:Tt.injectionScreen_connecting_p})]})},states$1.CONNECTING),wt===states$1.CONNECTED&&jsxRuntimeExports.jsx(Content$1,{initial:"initial",animate:"animate",exit:"exit",variants:contentVariants$1,children:jsxRuntimeExports.jsxs(ModalContent,{children:[jsxRuntimeExports.jsxs(ModalH1,{$valid:!0,children:[jsxRuntimeExports.jsx(TickIcon,{})," ",Tt.injectionScreen_connected_h1]}),jsxRuntimeExports.jsx(ModalBody,{children:Tt.injectionScreen_connected_p})]})},states$1.CONNECTED),wt===states$1.NOTCONNECTED&&jsxRuntimeExports.jsx(Content$1,{initial:"initial",animate:"animate",exit:"exit",variants:contentVariants$1,children:jsxRuntimeExports.jsxs(ModalContent,{children:[jsxRuntimeExports.jsx(ModalH1,{children:Tt.injectionScreen_notconnected_h1}),jsxRuntimeExports.jsx(ModalBody,{children:Tt.injectionScreen_notconnected_p})]})},states$1.NOTCONNECTED),wt===states$1.UNAVAILABLE&&jsxRuntimeExports.jsx(Content$1,{initial:"initial",animate:"animate",exit:"exit",variants:contentVariants$1,children:bt?jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsxs(ModalContent,{style:{paddingBottom:18},children:[jsxRuntimeExports.jsx(ModalH1,{children:Tt.injectionScreen_install_h1}),jsxRuntimeExports.jsx(ModalBody,{children:Tt.injectionScreen_install_p})]}),!mt.isInstalled&&bt&&jsxRuntimeExports.jsx(Button$1,{href:bt,icon:jsxRuntimeExports.jsx(BrowserIcon,{}),children:Tt.installTheExtension})]}):jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsxs(ModalContent,{style:{paddingBottom:12},children:[jsxRuntimeExports.jsx(ModalH1,{children:Tt.injectionScreen_unavailable_h1}),jsxRuntimeExports.jsx(ModalBody,{children:Tt.injectionScreen_unavailable_p})]}),!mt.isInstalled&&Et&&jsxRuntimeExports.jsxs(Button$1,{href:Et==null?void 0:Et.url,icon:jsxRuntimeExports.jsx(BrowserIcon,{browser:Et==null?void 0:Et.name}),children:["Install on ",Et==null?void 0:Et.label]})]})},states$1.UNAVAILABLE)]})})]})}):jsxRuntimeExports.jsx(PageContent,{children:jsxRuntimeExports.jsxs(Container$4,{children:[jsxRuntimeExports.jsx(ModalHeading,{children:"Invalid State"}),jsxRuntimeExports.jsx(ModalContent,{children:jsxRuntimeExports.jsx(Alert,{children:"No connectors match the id given. This state should never happen."})})]})})},QRCodeContainer=styled(motion.div)` +`,CircleSpinner=({logo:o,smallLogo:et,connecting:tt=!0,unavailable:nt=!1,countdown:rt=!1})=>jsxRuntimeExports.jsxs(LogoContainer$3,{transition:{duration:.5,ease:[.175,.885,.32,.98]},children:[jsxRuntimeExports.jsx(Logo,{$small:!nt&&et,style:nt?{borderRadius:0}:void 0,children:o}),jsxRuntimeExports.jsx(SpinnerContainer,{children:jsxRuntimeExports.jsxs(AnimatePresence,{children:[tt&&jsxRuntimeExports.jsx(Spinner$2,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0,transition:{duration:rt?1:0}},children:jsxRuntimeExports.jsxs("svg",{"aria-hidden":"true",width:"102",height:"102",viewBox:"0 0 102 102",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntimeExports.jsx("path",{d:"M52 100C24.3858 100 2 77.6142 2 50",stroke:"url(#paint0_linear_1943_4139)",strokeWidth:"3.5",strokeLinecap:"round",strokeLinejoin:"round"}),jsxRuntimeExports.jsx("defs",{children:jsxRuntimeExports.jsxs("linearGradient",{id:"paint0_linear_1943_4139",x1:"2",y1:"48.5",x2:"53",y2:"100",gradientUnits:"userSpaceOnUse",children:[jsxRuntimeExports.jsx("stop",{stopColor:"var(--ck-spinner-color)"}),jsxRuntimeExports.jsx("stop",{offset:"1",stopColor:"var(--ck-spinner-color)",stopOpacity:"0"})]})})]})},"Spinner"),rt&&jsxRuntimeExports.jsxs(ExpiringSpinner,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.25},children:[jsxRuntimeExports.jsx("div",{}),jsxRuntimeExports.jsx("div",{})]},"ExpiringSpinner")]})})]}),states$1={CONNECTED:"connected",CONNECTING:"connecting",EXPIRING:"expiring",FAILED:"failed",REJECTED:"rejected",NOTCONNECTED:"notconnected",UNAVAILABLE:"unavailable"},contentVariants$1={initial:{willChange:"transform,opacity",position:"relative",opacity:0,scale:.95},animate:{position:"relative",opacity:1,scale:1,transition:{ease:[.16,1,.3,1],duration:.4,delay:.05,position:{delay:0}}},exit:{position:"absolute",opacity:0,scale:.95,transition:{ease:[.16,1,.3,1],duration:.3}}},ConnectWithInjector=({switchConnectMethod:o,forceState:et})=>{var tt,nt,rt,ot,it,st,at,ct;const{connect:lt}=useConnect({mutation:{onMutate:jt=>{jt.connector?kt(states$1.CONNECTING):kt(states$1.UNAVAILABLE)},onError(jt){console.error(jt)},onSettled(jt,Ot){if(Ot){if(gt(!0),setTimeout(()=>gt(!1),3500),Ot.code)switch(Ot.code){case-32002:kt(states$1.NOTCONNECTED);break;case 4001:kt(states$1.REJECTED);break;default:kt(states$1.FAILED);break}else if(Ot.message)switch(Ot.message){case"User rejected request":kt(states$1.REJECTED);break;default:kt(states$1.FAILED);break}}setTimeout(dt,100)}}}),{triggerResize:dt,connector:ht}=useContext(),pt=ht.id,mt=useWallet(pt),ft={name:mt==null?void 0:mt.name,shortName:(tt=mt==null?void 0:mt.shortName)!==null&&tt!==void 0?tt:mt==null?void 0:mt.name,icon:(nt=mt==null?void 0:mt.iconConnector)!==null&&nt!==void 0?nt:mt==null?void 0:mt.icon,iconShape:(rt=mt==null?void 0:mt.iconShape)!==null&&rt!==void 0?rt:"circle",iconShouldShrink:mt==null?void 0:mt.iconShouldShrink},[yt,gt]=reactExports.useState(!1);reactExports.useState(9);const vt=detectBrowser(),bt=(ot=mt==null?void 0:mt.downloadUrls)===null||ot===void 0?void 0:ot[vt],Et=mt!=null&&mt.downloadUrls?{name:Object.keys(mt==null?void 0:mt.downloadUrls)[0],label:((it=Object.keys(mt==null?void 0:mt.downloadUrls)[0])===null||it===void 0?void 0:it.charAt(0).toUpperCase())+((st=Object.keys(mt==null?void 0:mt.downloadUrls)[0])===null||st===void 0?void 0:st.slice(1)),url:mt==null?void 0:mt.downloadUrls[Object.keys(mt==null?void 0:mt.downloadUrls)[0]]}:void 0,[wt,kt]=reactExports.useState(et||(mt!=null&&mt.isInstalled?states$1.CONNECTING:states$1.UNAVAILABLE)),It=useLocales({CONNECTORNAME:ft.name,CONNECTORSHORTNAME:(at=ft.shortName)!==null&&at!==void 0?at:ft.name,SUGGESTEDEXTENSIONBROWSER:(ct=Et==null?void 0:Et.label)!==null&&ct!==void 0?ct:"your browser"}),Rt=async()=>{mt!=null&&mt.isInstalled&&(mt!=null&&mt.connector)?lt({connector:mt==null?void 0:mt.connector}):kt(states$1.UNAVAILABLE)};let Pt;return reactExports.useEffect(()=>{if(wt!==states$1.UNAVAILABLE)return Pt=setTimeout(Rt,600),()=>{clearTimeout(Pt)}},[]),mt?isWalletConnectConnector(mt==null?void 0:mt.connector.id)?jsxRuntimeExports.jsx(PageContent,{children:jsxRuntimeExports.jsxs(Container$4,{children:[jsxRuntimeExports.jsx(ModalHeading,{children:"Invalid State"}),jsxRuntimeExports.jsx(ModalContent,{children:jsxRuntimeExports.jsx(Alert,{children:"WalletConnect does not have an injection flow. This state should never happen."})})]})}):jsxRuntimeExports.jsx(PageContent,{children:jsxRuntimeExports.jsxs(Container$4,{children:[jsxRuntimeExports.jsx(ConnectingContainer,{children:jsxRuntimeExports.jsxs(ConnectingAnimation,{$shake:wt===states$1.FAILED||wt===states$1.REJECTED,$circle:ft.iconShape==="circle",children:[jsxRuntimeExports.jsx(AnimatePresence,{children:(wt===states$1.FAILED||wt===states$1.REJECTED)&&jsxRuntimeExports.jsx(RetryButton,{"aria-label":"Retry",initial:{opacity:0,scale:.8},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.8},whileTap:{scale:.9},transition:{duration:.1},onClick:Rt,children:jsxRuntimeExports.jsx(RetryIconContainer,{children:jsxRuntimeExports.jsx(Tooltip,{open:yt&&(wt===states$1.FAILED||wt===states$1.REJECTED),message:It.tryAgainQuestion,xOffset:-6,children:jsxRuntimeExports.jsx(RetryIconCircle,{})})})})}),ft.iconShape==="circle"?jsxRuntimeExports.jsx(CircleSpinner,{logo:wt===states$1.UNAVAILABLE?jsxRuntimeExports.jsx("div",{style:{transform:"scale(1.14)",position:"relative",width:"100%"},children:ft.icon}):jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:ft.icon}),smallLogo:ft.iconShouldShrink,connecting:wt===states$1.CONNECTING,unavailable:wt===states$1.UNAVAILABLE}):jsxRuntimeExports.jsx(SquircleSpinner,{logo:wt===states$1.UNAVAILABLE?jsxRuntimeExports.jsx("div",{style:{transform:"scale(1.14)",position:"relative",width:"100%"},children:ft.icon}):jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:ft.icon}),connecting:wt===states$1.CONNECTING})]})}),jsxRuntimeExports.jsx(ModalContentContainer,{children:jsxRuntimeExports.jsxs(AnimatePresence,{initial:!1,children:[wt===states$1.FAILED&&jsxRuntimeExports.jsx(Content$1,{initial:"initial",animate:"animate",exit:"exit",variants:contentVariants$1,children:jsxRuntimeExports.jsxs(ModalContent,{children:[jsxRuntimeExports.jsxs(ModalH1,{$error:!0,children:[jsxRuntimeExports.jsx(AlertIcon,{}),It.injectionScreen_failed_h1]}),jsxRuntimeExports.jsx(ModalBody,{children:It.injectionScreen_failed_p})]})},states$1.FAILED),wt===states$1.REJECTED&&jsxRuntimeExports.jsx(Content$1,{initial:"initial",animate:"animate",exit:"exit",variants:contentVariants$1,children:jsxRuntimeExports.jsxs(ModalContent,{style:{paddingBottom:28},children:[jsxRuntimeExports.jsx(ModalH1,{children:It.injectionScreen_rejected_h1}),jsxRuntimeExports.jsx(ModalBody,{children:It.injectionScreen_rejected_p})]})},states$1.REJECTED),(wt===states$1.CONNECTING||wt===states$1.EXPIRING)&&jsxRuntimeExports.jsx(Content$1,{initial:"initial",animate:"animate",exit:"exit",variants:contentVariants$1,children:jsxRuntimeExports.jsxs(ModalContent,{style:{paddingBottom:28},children:[jsxRuntimeExports.jsx(ModalH1,{children:mt.connector.id==="injected"?It.injectionScreen_connecting_injected_h1:It.injectionScreen_connecting_h1}),jsxRuntimeExports.jsx(ModalBody,{children:mt.connector.id==="injected"?It.injectionScreen_connecting_injected_p:It.injectionScreen_connecting_p})]})},states$1.CONNECTING),wt===states$1.CONNECTED&&jsxRuntimeExports.jsx(Content$1,{initial:"initial",animate:"animate",exit:"exit",variants:contentVariants$1,children:jsxRuntimeExports.jsxs(ModalContent,{children:[jsxRuntimeExports.jsxs(ModalH1,{$valid:!0,children:[jsxRuntimeExports.jsx(TickIcon,{})," ",It.injectionScreen_connected_h1]}),jsxRuntimeExports.jsx(ModalBody,{children:It.injectionScreen_connected_p})]})},states$1.CONNECTED),wt===states$1.NOTCONNECTED&&jsxRuntimeExports.jsx(Content$1,{initial:"initial",animate:"animate",exit:"exit",variants:contentVariants$1,children:jsxRuntimeExports.jsxs(ModalContent,{children:[jsxRuntimeExports.jsx(ModalH1,{children:It.injectionScreen_notconnected_h1}),jsxRuntimeExports.jsx(ModalBody,{children:It.injectionScreen_notconnected_p})]})},states$1.NOTCONNECTED),wt===states$1.UNAVAILABLE&&jsxRuntimeExports.jsx(Content$1,{initial:"initial",animate:"animate",exit:"exit",variants:contentVariants$1,children:bt?jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsxs(ModalContent,{style:{paddingBottom:18},children:[jsxRuntimeExports.jsx(ModalH1,{children:It.injectionScreen_install_h1}),jsxRuntimeExports.jsx(ModalBody,{children:It.injectionScreen_install_p})]}),!mt.isInstalled&&bt&&jsxRuntimeExports.jsx(Button$1,{href:bt,icon:jsxRuntimeExports.jsx(BrowserIcon,{}),children:It.installTheExtension})]}):jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsxs(ModalContent,{style:{paddingBottom:12},children:[jsxRuntimeExports.jsx(ModalH1,{children:It.injectionScreen_unavailable_h1}),jsxRuntimeExports.jsx(ModalBody,{children:It.injectionScreen_unavailable_p})]}),!mt.isInstalled&&Et&&jsxRuntimeExports.jsxs(Button$1,{href:Et==null?void 0:Et.url,icon:jsxRuntimeExports.jsx(BrowserIcon,{browser:Et==null?void 0:Et.name}),children:["Install on ",Et==null?void 0:Et.label]})]})},states$1.UNAVAILABLE)]})})]})}):jsxRuntimeExports.jsx(PageContent,{children:jsxRuntimeExports.jsxs(Container$4,{children:[jsxRuntimeExports.jsx(ModalHeading,{children:"Invalid State"}),jsxRuntimeExports.jsx(ModalContent,{children:jsxRuntimeExports.jsx(Alert,{children:"No connectors match the id given. This state should never happen."})})]})})},QRCodeContainer=styled(motion.div)` z-index: 3; position: relative; overflow: hidden; @@ -3218,7 +3218,7 @@ Vui lòng thử lại.`,injectionScreen_notconnected_h1:"Đăng nhập vào {{ C font-weight: 400; user-select: none; color: var(--ck-dropdown-color, var(--ck-tooltip-color)); -`,ChainSelectDropdown=({children:o,open:et,onClose:tt,offsetX:nt=0,offsetY:rt=8})=>{var ot,it,st;const at=useContext(),ct=useThemeContext(),lt=useLocales(),[dt,ht]=reactExports.useState({x:0,y:0});useLockBodyScroll(et);const pt=reactExports.useRef(null);reactExports.useEffect(()=>{const wt=kt=>{var Tt,Rt,Pt;if(et&&(kt.key==="Escape"&&tt(),kt.key==="ArrowDown"||kt.key==="ArrowUp")){if(!pt.current)return;kt.preventDefault();const $t=(Tt=pt.current)===null||Tt===void 0?void 0:Tt.querySelectorAll(` +`,ChainSelectDropdown=({children:o,open:et,onClose:tt,offsetX:nt=0,offsetY:rt=8})=>{var ot,it,st;const at=useContext(),ct=useThemeContext(),lt=useLocales(),[dt,ht]=reactExports.useState({x:0,y:0});useLockBodyScroll(et);const pt=reactExports.useRef(null);reactExports.useEffect(()=>{const wt=kt=>{var It,Rt,Pt;if(et&&(kt.key==="Escape"&&tt(),kt.key==="ArrowDown"||kt.key==="ArrowUp")){if(!pt.current)return;kt.preventDefault();const jt=(It=pt.current)===null||It===void 0?void 0:It.querySelectorAll(` a[href]:not(:disabled), button:not(:disabled), textarea:not(:disabled), @@ -3226,7 +3226,7 @@ Vui lòng thử lại.`,injectionScreen_notconnected_h1:"Đăng nhập vào {{ C input[type="radio"]:not(:disabled), input[type="checkbox"]:not(:disabled), select:not(:disabled) - `),Ot=$t[0],Bt=$t[$t.length-1];if(kt.key==="ArrowUp")if(document.activeElement===Ot)Bt.focus();else{let zt=(Rt=document==null?void 0:document.activeElement)===null||Rt===void 0?void 0:Rt.previousSibling;for(zt||(zt=Bt);zt.disabled;)zt=zt.previousSibling;zt.focus()}else if(document.activeElement===Bt)Ot.focus();else{let zt=(Pt=document==null?void 0:document.activeElement)===null||Pt===void 0?void 0:Pt.nextSibling;for(zt||(zt=Ot);zt.disabled;)zt=zt.nextSibling;zt.focus()}}};return document.addEventListener("keydown",wt),()=>{document.removeEventListener("keydown",wt)}},[et]);const mt=reactExports.useRef(null),ft=reactExports.useCallback(wt=>{wt&&(mt.current=wt,xt())},[et]),[yt,gt]=useMeasure({debounce:120,offsetSize:!0,scroll:!0}),xt=()=>{if(!mt.current||gt.top+gt.bottom+gt.left+gt.right+gt.height+gt.width===0)return;let wt=gt.left+nt,kt=gt.top+gt.height+rt;mt.current.style.left=`${wt}px`,mt.current.style.top=`${kt}px`};(typeof window<"u"?reactExports.useLayoutEffect:reactExports.useEffect)(xt,[mt.current,gt,et]),reactExports.useEffect(xt,[et,mt.current]);const bt=tt,Et=tt;return reactExports.useEffect(()=>(xt(),window.addEventListener("scroll",bt),window.addEventListener("resize",Et),()=>{window.removeEventListener("scroll",bt),window.removeEventListener("resize",Et)}),[]),jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx("div",{ref:yt,children:o}),jsxRuntimeExports.jsx(AnimatePresence,{children:et&&jsxRuntimeExports.jsx(Portal$2,{children:jsxRuntimeExports.jsx(ResetContainer,{$useTheme:(ot=ct.theme)!==null&&ot!==void 0?ot:at.theme,$useMode:(it=ct.mode)!==null&&it!==void 0?it:at.mode,$customTheme:(st=ct.customTheme)!==null&&st!==void 0?st:at.customTheme,children:jsxRuntimeExports.jsx(FocusTrap,{children:jsxRuntimeExports.jsxs(DropdownWindow,{ref:pt,children:[jsxRuntimeExports.jsx(DropdownOverlay,{onClick:tt}),jsxRuntimeExports.jsxs(DropdownContainer,{ref:ft,style:{left:dt.x,top:dt.y},initial:"collapsed",animate:"open",exit:"collapsed",variants:{collapsed:{transformOrigin:"0 0",opacity:0,scale:.96,z:.01,y:-4,x:0,transition:{duration:.1}},open:{transformOrigin:"0 0",willChange:"opacity,transform",opacity:1,scale:1,z:.01,y:0,x:0,transition:{ease:[.76,0,.24,1],duration:.15}}},children:[jsxRuntimeExports.jsx(DropdownHeading,{children:lt.switchNetworks}),jsxRuntimeExports.jsx(ChainSelectList,{})]})]})})})})})]})},ChainContainer=styled.div` + `),Ot=jt[0],Bt=jt[jt.length-1];if(kt.key==="ArrowUp")if(document.activeElement===Ot)Bt.focus();else{let zt=(Rt=document==null?void 0:document.activeElement)===null||Rt===void 0?void 0:Rt.previousSibling;for(zt||(zt=Bt);zt.disabled;)zt=zt.previousSibling;zt.focus()}else if(document.activeElement===Bt)Ot.focus();else{let zt=(Pt=document==null?void 0:document.activeElement)===null||Pt===void 0?void 0:Pt.nextSibling;for(zt||(zt=Ot);zt.disabled;)zt=zt.nextSibling;zt.focus()}}};return document.addEventListener("keydown",wt),()=>{document.removeEventListener("keydown",wt)}},[et]);const mt=reactExports.useRef(null),ft=reactExports.useCallback(wt=>{wt&&(mt.current=wt,xt())},[et]),[yt,gt]=useMeasure({debounce:120,offsetSize:!0,scroll:!0}),xt=()=>{if(!mt.current||gt.top+gt.bottom+gt.left+gt.right+gt.height+gt.width===0)return;let wt=gt.left+nt,kt=gt.top+gt.height+rt;mt.current.style.left=`${wt}px`,mt.current.style.top=`${kt}px`};(typeof window<"u"?reactExports.useLayoutEffect:reactExports.useEffect)(xt,[mt.current,gt,et]),reactExports.useEffect(xt,[et,mt.current]);const bt=tt,Et=tt;return reactExports.useEffect(()=>(xt(),window.addEventListener("scroll",bt),window.addEventListener("resize",Et),()=>{window.removeEventListener("scroll",bt),window.removeEventListener("resize",Et)}),[]),jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx("div",{ref:yt,children:o}),jsxRuntimeExports.jsx(AnimatePresence,{children:et&&jsxRuntimeExports.jsx(Portal$2,{children:jsxRuntimeExports.jsx(ResetContainer,{$useTheme:(ot=ct.theme)!==null&&ot!==void 0?ot:at.theme,$useMode:(it=ct.mode)!==null&&it!==void 0?it:at.mode,$customTheme:(st=ct.customTheme)!==null&&st!==void 0?st:at.customTheme,children:jsxRuntimeExports.jsx(FocusTrap,{children:jsxRuntimeExports.jsxs(DropdownWindow,{ref:pt,children:[jsxRuntimeExports.jsx(DropdownOverlay,{onClick:tt}),jsxRuntimeExports.jsxs(DropdownContainer,{ref:ft,style:{left:dt.x,top:dt.y},initial:"collapsed",animate:"open",exit:"collapsed",variants:{collapsed:{transformOrigin:"0 0",opacity:0,scale:.96,z:.01,y:-4,x:0,transition:{duration:.1}},open:{transformOrigin:"0 0",willChange:"opacity,transform",opacity:1,scale:1,z:.01,y:0,x:0,transition:{ease:[.76,0,.24,1],duration:.15}}},children:[jsxRuntimeExports.jsx(DropdownHeading,{children:lt.switchNetworks}),jsxRuntimeExports.jsx(ChainSelectList,{})]})]})})})})})]})},ChainContainer=styled.div` --bg: transparent; --color: #333; ${o=>typeof o.size=="string"?Ae` @@ -3591,7 +3591,7 @@ Vui lòng thử lại.`,injectionScreen_notconnected_h1:"Đăng nhập vào {{ C } } `}; -`,SIWEButton=({showSignOutButton:o,onSignIn:et,onSignOut:tt})=>{const nt=useIsMounted(),rt=useLocales(),{setOpen:ot}=useModal(),{isSignedIn:it,isReady:st,isLoading:at,isRejected:ct,isSuccess:lt,isError:dt,signIn:ht,signOut:pt,error:mt}=useSIWE({onSignIn:gt=>et==null?void 0:et(gt),onSignOut:()=>tt==null?void 0:tt()}),{address:ft}=useAccount();function yt(){return lt?rt.signedIn:ct?rt.tryAgain:at?rt.awaitingConfirmation:dt?mt??"Unknown Error":rt.signIn}return nt?o&&it?jsxRuntimeExports.jsx(Button$1,{style:{margin:0},onClick:pt,icon:jsxRuntimeExports.jsx(DisconnectIcon,{}),children:rt.signOut},"button"):ft?jsxRuntimeExports.jsx(Button$1,{style:{margin:0},arrow:it?!1:!at&&!ct,onClick:!at&&!lt?ht:void 0,disabled:at,waiting:at,icon:ct&&jsxRuntimeExports.jsx(motion.div,{initial:{rotate:-270},animate:{rotate:0},transition:{duration:1,ease:[.175,.885,.32,.98]},children:jsxRuntimeExports.jsx(RetryIcon,{style:{opacity:.4}})}),children:yt()},"button"):jsxRuntimeExports.jsx(Button$1,{style:{margin:0},onClick:()=>ot(!0),arrow:!0,children:rt.walletNotConnected},"button"):jsxRuntimeExports.jsx(Button$1,{style:{margin:0},disabled:!0},"loading")},LazyImage=({src:o,alt:et,width:tt,height:nt})=>{const rt=reactExports.useRef(null),[ot,it]=reactExports.useState(!0);return reactExports.useEffect(()=>{rt.current&&rt.current.complete&&rt.current.naturalHeight!==0||it(!1)},[o]),jsxRuntimeExports.jsx("div",{style:{width:tt,height:nt,background:"rgba(0,0,0,0.02)",boxShadow:"inset 0 0 0 1px rgba(0,0,0,0.02)"},children:jsxRuntimeExports.jsx("img",{ref:rt,src:o,alt:et,width:tt,height:nt,onLoad:()=>it(!0),style:{transition:"opacity 0.2s ease",opacity:ot?1:0}})})},transition={duration:.2,ease:[.26,.08,.25,1]},copyTransition={duration:.16,ease:[.26,.08,.25,1]},SignInWithEthereum=()=>{var o,et;const tt=useContext(),{isSignedIn:nt,reset:rt}=useSIWE(),ot=isMobile(),[it,st]=reactExports.useState(nt?"signedIn":"signedOut"),at=useLocales({}),ct=it==="signedIn"?{heading:at.signInWithEthereumScreen_signedIn_heading,h1:at.signInWithEthereumScreen_signedIn_h1,p:at.signInWithEthereumScreen_signedIn_p,button:at.signInWithEthereumScreen_signedIn_button}:{heading:at.signInWithEthereumScreen_signedOut_heading,h1:at.signInWithEthereumScreen_signedOut_h1,p:at.signInWithEthereumScreen_signedOut_p,button:at.signInWithEthereumScreen_signedOut_button};reactExports.useEffect(()=>{nt&&st("signedIn")},[]),reactExports.useEffect(()=>{nt||st("signedOut")},[nt]);const{address:lt}=useAccount(),ht=(()=>{const mt={svg:null,default:null},ft=document.getElementsByTagName("link");return Array.from(ft).forEach(yt=>{(yt.getAttribute("rel")==="icon"||yt.getAttribute("rel")==="shortcut icon")&&yt.getAttribute("href")&&(yt.getAttribute("type")==="image/svg+xml"?mt.svg=yt.getAttribute("href"):mt.default=yt.getAttribute("href"))}),mt})(),pt=(et=(o=getAppIcon())!==null&&o!==void 0?o:ht.svg)!==null&&et!==void 0?et:ht.default;return jsxRuntimeExports.jsx(PageContent,{style:{width:278},children:jsxRuntimeExports.jsxs(ModalContent,{style:{padding:0,marginTop:-10},children:[jsxRuntimeExports.jsx(ContentContainer,{children:jsxRuntimeExports.jsx(AnimatePresence,{exitBeforeEnter:!0,children:jsxRuntimeExports.jsx(motion.div,{initial:ot?!1:{opacity:0,scale:.94},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.94},transition:copyTransition,children:jsxRuntimeExports.jsx(ModalBody,{style:{height:42},children:jsxRuntimeExports.jsx(FitText,{children:ct.h1})})},flattenChildren(ct.h1).toString())})}),jsxRuntimeExports.jsxs(StatusGraphic,{$connected:nt,children:[jsxRuntimeExports.jsx("div",{style:{position:"absolute",inset:0},children:jsxRuntimeExports.jsx(StatusGraphicBgSvg,{width:"262",height:"134",viewBox:"0 0 262 134",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntimeExports.jsx(motion.rect,{x:"0",y:"0",rx:"12",width:"262",height:"134",strokeDasharray:"3 3",animate:{strokeDashoffset:[0,-6]},transition:{duration:.4,ease:"linear",repeat:1/0}})})}),jsxRuntimeExports.jsx(motion.div,{initial:ot?!1:{opacity:0,x:50,scale:.8},animate:{opacity:1,x:0,scale:1},transition,children:jsxRuntimeExports.jsx(LogoContainer,{children:jsxRuntimeExports.jsx(Avatar,{address:lt,size:64})})},"avatarImage"),jsxRuntimeExports.jsx(motion.div,{initial:ot?!1:{scale:.6},animate:{scale:1},transition:{...transition},children:jsxRuntimeExports.jsx(StatusIcon,{children:jsxRuntimeExports.jsx(TickIcon,{})})},"tickIcon"),jsxRuntimeExports.jsx(motion.div,{initial:ot?!1:{opacity:0,x:-40,scale:.8},animate:{opacity:1,x:0,scale:1},transition:{...transition},children:jsxRuntimeExports.jsx(LogoContainer,{children:pt?jsxRuntimeExports.jsx(LazyImage,{src:pt,alt:"app"}):jsxRuntimeExports.jsx(Chains.UnknownChain,{})})},"appLogo")]},"status"),jsxRuntimeExports.jsx(AnimatePresence,{exitBeforeEnter:!0,children:jsxRuntimeExports.jsx(motion.div,{style:{paddingBottom:ot?24:12},initial:ot?!1:{opacity:0,scale:.94},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.94},transition:copyTransition,children:jsxRuntimeExports.jsx(ModalBody,{style:{height:42,marginTop:-1,marginBottom:-3},children:jsxRuntimeExports.jsx(FitText,{children:ct.p})})},flattenChildren(ct.p).toString())}),jsxRuntimeExports.jsx(SIWEButton,{showSignOutButton:it==="signedIn",onSignIn:()=>{setTimeout(()=>{tt.setOpen(!1)},1e3)}})]})})},customThemeDefault$1={},ConnectModal$1=({mode:o="auto",theme:et="auto",customTheme:tt=customThemeDefault$1,lang:nt="en-US"})=>{var rt;const ot=useContext(),{isConnected:it,chain:st}=useAccount(),at=useChainIsSupported(st==null?void 0:st.id),ct=!(!((rt=ot.options)===null||rt===void 0)&&rt.enforceSupportedChains&&it&&!at),lt=ct&&ot.route!==routes.CONNECTORS&&ot.route!==routes.PROFILE,dt=ct&&ot.route!==routes.PROFILE,ht=()=>{ot.route===routes.SIGNINWITHETHEREUM||ot.route===routes.SWITCHNETWORKS?ot.setRoute(routes.PROFILE):ot.route===routes.DOWNLOAD?ot.setRoute(routes.CONNECT):ot.setRoute(routes.CONNECTORS)},pt={onboarding:jsxRuntimeExports.jsx(Introduction,{}),about:jsxRuntimeExports.jsx(About,{}),download:jsxRuntimeExports.jsx(DownloadApp,{}),connectors:jsxRuntimeExports.jsx(Wallets,{}),mobileConnectors:jsxRuntimeExports.jsx(MobileConnectors,{}),connect:jsxRuntimeExports.jsx(ConnectUsing,{}),profile:jsxRuntimeExports.jsx(Profile,{}),switchNetworks:jsxRuntimeExports.jsx(SwitchNetworks,{}),signInWithEthereum:jsxRuntimeExports.jsx(SignInWithEthereum,{})};function mt(){ot.setOpen(!1)}return reactExports.useEffect(()=>{var ft;it?(ot.route!==routes.PROFILE||ot.route!==routes.SIGNINWITHETHEREUM)&&(ot.signInWithEthereum&&!(!((ft=ot.options)===null||ft===void 0)&&ft.disableSiweRedirect)?ot.setRoute(routes.SIGNINWITHETHEREUM):mt()):mt()},[it]),reactExports.useEffect(()=>ot.setMode(o),[o]),reactExports.useEffect(()=>ot.setTheme(et),[et]),reactExports.useEffect(()=>ot.setCustomTheme(tt),[tt]),reactExports.useEffect(()=>ot.setLang(nt),[nt]),reactExports.useEffect(()=>{const ft=getAppName();if(!ft||!ot.open)return;const yt=document.createElement("meta");return yt.setAttribute("property","og:title"),yt.setAttribute("content",ft),document.head.prepend(yt),()=>{document.head.removeChild(yt)}},[ot.open]),jsxRuntimeExports.jsx(ConnectKitThemeProvider,{theme:et,customTheme:tt,mode:o,children:jsxRuntimeExports.jsx(Modal,{open:ot.open,pages:pt,pageId:ot.route,onClose:ct?mt:void 0,onInfo:dt?()=>ot.setRoute(routes.ABOUT):void 0,onBack:lt?ht:void 0})})};function useGoogleFont(o){reactExports.useEffect(()=>{if(!o)return;o=o.replace(/ /g,"+");const et=document.createElement("link");et.href="https://fonts.googleapis.com",et.rel="preconnect";const tt=document.createElement("link");tt.href="https://fonts.gstatic.com",tt.rel="preconnect",tt.crossOrigin="true";const nt=document.createElement("link");return nt.href=`https://fonts.googleapis.com/css2?family=${o}:wght@400;500;600&display=swap`,nt.rel="stylesheet",document.head.appendChild(et),document.head.appendChild(tt),document.head.appendChild(nt),()=>{document.head.removeChild(et),document.head.removeChild(tt),document.head.removeChild(nt)}},[o])}function useThemeFont(o){var et;const nt=(et={web95:"Lato",retro:"Nunito",midnight:"Inter",minimal:"Inter",rounded:"Nunito"}[o])!==null&&et!==void 0?et:null;useGoogleFont(nt??"")}const useConnectCallback=({onConnect:o,onDisconnect:et})=>{useAccountEffect({onConnect:({address:tt,connector:nt,isReconnected:rt})=>{rt||o==null||o({address:tt,connectorId:nt==null?void 0:nt.id})},onDisconnect:()=>et==null?void 0:et()})},routes={ONBOARDING:"onboarding",ABOUT:"about",CONNECTORS:"connectors",MOBILECONNECTORS:"mobileConnectors",CONNECT:"connect",DOWNLOAD:"download",PROFILE:"profile",SWITCHNETWORKS:"switchNetworks",SIGNINWITHETHEREUM:"signInWithEthereum"},Context=reactExports.createContext(null),ConnectKitProvider=({children:o,theme:et="auto",mode:tt="auto",customTheme:nt,options:rt,onConnect:ot,onDisconnect:it,debugMode:st=!1})=>{var at,ct,lt,dt;if(!React.useContext(WagmiContext))throw Error("ConnectKitProvider must be within a WagmiProvider");if(React.useContext(Context))throw new Error("Multiple, nested usages of ConnectKitProvider detected. Please use only one.");useConnectCallback({onConnect:ot,onDisconnect:it});const ht=useChains(),pt=useConnector("injected"),mt={language:"en-US",hideBalance:!1,hideTooltips:!1,hideQuestionMarkCTA:!1,hideNoWalletCTA:!1,walletConnectCTA:"link",hideRecentBadge:!1,avoidLayoutShift:!0,embedGoogleFonts:!1,truncateLongENSAddress:!0,walletConnectName:void 0,reducedMotion:!1,disclaimer:null,bufferPolyfill:!0,customAvatar:void 0,initialChainId:(at=ht==null?void 0:ht[0])===null||at===void 0?void 0:at.id,enforceSupportedChains:!1,ethereumOnboardingUrl:void 0,walletOnboardingUrl:void 0,disableSiweRedirect:!1},ft=Object.assign({},mt,rt);typeof window<"u"&&ft.bufferPolyfill&&(window.Buffer=(ct=window.Buffer)!==null&&ct!==void 0?ct:buffer$2.Buffer);const[yt,gt]=reactExports.useState(et),[xt,vt]=reactExports.useState(tt),[bt,Et]=reactExports.useState(nt??{}),[wt,kt]=reactExports.useState("en-US"),[Tt,Rt]=reactExports.useState(!1),[Pt,$t]=reactExports.useState({id:""}),[Ot,Bt]=reactExports.useState(routes.CONNECTORS),[zt,Ft]=reactExports.useState(""),[Yt,Ht]=reactExports.useState(0);ft.embedGoogleFonts&&useThemeFont(et),reactExports.useEffect(()=>gt(et),[et]),reactExports.useEffect(()=>kt(ft.language||"en-US"),[ft.language]),reactExports.useEffect(()=>Ft(null),[Ot,Tt]);const{chain:Ut,isConnected:qt}=useAccount(),Lt=useChainIsSupported(Ut==null?void 0:Ut.id);reactExports.useEffect(()=>{qt&&ft.enforceSupportedChains&&!Lt&&(Rt(!0),Bt(routes.SWITCHNETWORKS))},[qt,Lt,Ut,Ot,Tt]),reactExports.useEffect(()=>{isFamily()&&(pt==null||pt.connect())},[pt]);const Zt=st?console.log:()=>{},Qt={theme:yt,setTheme:gt,mode:xt,setMode:vt,customTheme:nt,setCustomTheme:Et,lang:wt,setLang:kt,open:Tt,setOpen:Rt,route:Ot,setRoute:Bt,connector:Pt,setConnector:$t,signInWithEthereum:(dt=(lt=React.useContext(SIWEContext))===null||lt===void 0?void 0:lt.enabled)!==null&&dt!==void 0?dt:!1,onConnect:ot,options:ft,errorMessage:zt,debugMode:st,log:Zt,displayError:(Nt,Gt)=>{Ft(Nt),console.log("---------CONNECTKIT DEBUG---------"),console.log(Nt),Gt&&console.table(Gt),console.log("---------/CONNECTKIT DEBUG---------")},resize:Yt,triggerResize:()=>Ht(Nt=>Nt+1)};return reactExports.createElement(Context.Provider,{value:Qt},jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:jsxRuntimeExports.jsx(Web3ContextProvider,{enabled:Tt,children:jsxRuntimeExports.jsxs(Le,{theme:defaultTheme$1,children:[o,jsxRuntimeExports.jsx(ConnectModal$1,{lang:wt,theme:yt,mode:tt,customTheme:bt})]})})}))},useContext=()=>{const o=React.useContext(Context);if(!o)throw Error("ConnectKit Hook must be inside a Provider.");return o},safeRoutes={disconnected:[routes.CONNECTORS,routes.ABOUT,routes.ONBOARDING,routes.MOBILECONNECTORS,routes.ONBOARDING],connected:[routes.PROFILE,routes.SWITCHNETWORKS,routes.SIGNINWITHETHEREUM]},allRoutes=[...safeRoutes.connected,...safeRoutes.disconnected],useModal=({onConnect:o,onDisconnect:et}={})=>{const tt=useContext();useConnectCallback({onConnect:o,onDisconnect:et});const{isConnected:nt}=useAccount(),{signIn:rt}=useSIWE(),ot=()=>{tt.setOpen(!1)},it=()=>{tt.setOpen(!0)},st=at=>{let ct=at;allRoutes.includes(at)?nt?safeRoutes.connected.includes(at)||(ct=routes.PROFILE,tt.log(`Route ${at} is not a valid route when connected, navigating to ${ct} instead.`)):safeRoutes.disconnected.includes(at)||(ct=routes.CONNECTORS,tt.log(`Route ${at} is not a valid route when disconnected, navigating to ${ct} instead.`)):(ct=nt?routes.PROFILE:routes.CONNECTORS,tt.log(`Route ${at} is not a valid route, navigating to ${ct} instead.`)),tt.setRoute(ct),it()};return{open:tt.open,setOpen:at=>{at?st(nt?routes.PROFILE:routes.CONNECTORS):ot()},openAbout:()=>st(routes.ABOUT),openOnboarding:()=>st(routes.ONBOARDING),openProfile:()=>st(routes.PROFILE),openSwitchNetworks:()=>st(routes.SWITCHNETWORKS),openSIWE:at=>{st(routes.SIGNINWITHETHEREUM),at&&rt()}}},TextContainer=styled(motion.div)` +`,SIWEButton=({showSignOutButton:o,onSignIn:et,onSignOut:tt})=>{const nt=useIsMounted(),rt=useLocales(),{setOpen:ot}=useModal(),{isSignedIn:it,isReady:st,isLoading:at,isRejected:ct,isSuccess:lt,isError:dt,signIn:ht,signOut:pt,error:mt}=useSIWE({onSignIn:gt=>et==null?void 0:et(gt),onSignOut:()=>tt==null?void 0:tt()}),{address:ft}=useAccount();function yt(){return lt?rt.signedIn:ct?rt.tryAgain:at?rt.awaitingConfirmation:dt?mt??"Unknown Error":rt.signIn}return nt?o&&it?jsxRuntimeExports.jsx(Button$1,{style:{margin:0},onClick:pt,icon:jsxRuntimeExports.jsx(DisconnectIcon,{}),children:rt.signOut},"button"):ft?jsxRuntimeExports.jsx(Button$1,{style:{margin:0},arrow:it?!1:!at&&!ct,onClick:!at&&!lt?ht:void 0,disabled:at,waiting:at,icon:ct&&jsxRuntimeExports.jsx(motion.div,{initial:{rotate:-270},animate:{rotate:0},transition:{duration:1,ease:[.175,.885,.32,.98]},children:jsxRuntimeExports.jsx(RetryIcon,{style:{opacity:.4}})}),children:yt()},"button"):jsxRuntimeExports.jsx(Button$1,{style:{margin:0},onClick:()=>ot(!0),arrow:!0,children:rt.walletNotConnected},"button"):jsxRuntimeExports.jsx(Button$1,{style:{margin:0},disabled:!0},"loading")},LazyImage=({src:o,alt:et,width:tt,height:nt})=>{const rt=reactExports.useRef(null),[ot,it]=reactExports.useState(!0);return reactExports.useEffect(()=>{rt.current&&rt.current.complete&&rt.current.naturalHeight!==0||it(!1)},[o]),jsxRuntimeExports.jsx("div",{style:{width:tt,height:nt,background:"rgba(0,0,0,0.02)",boxShadow:"inset 0 0 0 1px rgba(0,0,0,0.02)"},children:jsxRuntimeExports.jsx("img",{ref:rt,src:o,alt:et,width:tt,height:nt,onLoad:()=>it(!0),style:{transition:"opacity 0.2s ease",opacity:ot?1:0}})})},transition={duration:.2,ease:[.26,.08,.25,1]},copyTransition={duration:.16,ease:[.26,.08,.25,1]},SignInWithEthereum=()=>{var o,et;const tt=useContext(),{isSignedIn:nt,reset:rt}=useSIWE(),ot=isMobile(),[it,st]=reactExports.useState(nt?"signedIn":"signedOut"),at=useLocales({}),ct=it==="signedIn"?{heading:at.signInWithEthereumScreen_signedIn_heading,h1:at.signInWithEthereumScreen_signedIn_h1,p:at.signInWithEthereumScreen_signedIn_p,button:at.signInWithEthereumScreen_signedIn_button}:{heading:at.signInWithEthereumScreen_signedOut_heading,h1:at.signInWithEthereumScreen_signedOut_h1,p:at.signInWithEthereumScreen_signedOut_p,button:at.signInWithEthereumScreen_signedOut_button};reactExports.useEffect(()=>{nt&&st("signedIn")},[]),reactExports.useEffect(()=>{nt||st("signedOut")},[nt]);const{address:lt}=useAccount(),ht=(()=>{const mt={svg:null,default:null},ft=document.getElementsByTagName("link");return Array.from(ft).forEach(yt=>{(yt.getAttribute("rel")==="icon"||yt.getAttribute("rel")==="shortcut icon")&&yt.getAttribute("href")&&(yt.getAttribute("type")==="image/svg+xml"?mt.svg=yt.getAttribute("href"):mt.default=yt.getAttribute("href"))}),mt})(),pt=(et=(o=getAppIcon())!==null&&o!==void 0?o:ht.svg)!==null&&et!==void 0?et:ht.default;return jsxRuntimeExports.jsx(PageContent,{style:{width:278},children:jsxRuntimeExports.jsxs(ModalContent,{style:{padding:0,marginTop:-10},children:[jsxRuntimeExports.jsx(ContentContainer,{children:jsxRuntimeExports.jsx(AnimatePresence,{exitBeforeEnter:!0,children:jsxRuntimeExports.jsx(motion.div,{initial:ot?!1:{opacity:0,scale:.94},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.94},transition:copyTransition,children:jsxRuntimeExports.jsx(ModalBody,{style:{height:42},children:jsxRuntimeExports.jsx(FitText,{children:ct.h1})})},flattenChildren(ct.h1).toString())})}),jsxRuntimeExports.jsxs(StatusGraphic,{$connected:nt,children:[jsxRuntimeExports.jsx("div",{style:{position:"absolute",inset:0},children:jsxRuntimeExports.jsx(StatusGraphicBgSvg,{width:"262",height:"134",viewBox:"0 0 262 134",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntimeExports.jsx(motion.rect,{x:"0",y:"0",rx:"12",width:"262",height:"134",strokeDasharray:"3 3",animate:{strokeDashoffset:[0,-6]},transition:{duration:.4,ease:"linear",repeat:1/0}})})}),jsxRuntimeExports.jsx(motion.div,{initial:ot?!1:{opacity:0,x:50,scale:.8},animate:{opacity:1,x:0,scale:1},transition,children:jsxRuntimeExports.jsx(LogoContainer,{children:jsxRuntimeExports.jsx(Avatar,{address:lt,size:64})})},"avatarImage"),jsxRuntimeExports.jsx(motion.div,{initial:ot?!1:{scale:.6},animate:{scale:1},transition:{...transition},children:jsxRuntimeExports.jsx(StatusIcon,{children:jsxRuntimeExports.jsx(TickIcon,{})})},"tickIcon"),jsxRuntimeExports.jsx(motion.div,{initial:ot?!1:{opacity:0,x:-40,scale:.8},animate:{opacity:1,x:0,scale:1},transition:{...transition},children:jsxRuntimeExports.jsx(LogoContainer,{children:pt?jsxRuntimeExports.jsx(LazyImage,{src:pt,alt:"app"}):jsxRuntimeExports.jsx(Chains.UnknownChain,{})})},"appLogo")]},"status"),jsxRuntimeExports.jsx(AnimatePresence,{exitBeforeEnter:!0,children:jsxRuntimeExports.jsx(motion.div,{style:{paddingBottom:ot?24:12},initial:ot?!1:{opacity:0,scale:.94},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.94},transition:copyTransition,children:jsxRuntimeExports.jsx(ModalBody,{style:{height:42,marginTop:-1,marginBottom:-3},children:jsxRuntimeExports.jsx(FitText,{children:ct.p})})},flattenChildren(ct.p).toString())}),jsxRuntimeExports.jsx(SIWEButton,{showSignOutButton:it==="signedIn",onSignIn:()=>{setTimeout(()=>{tt.setOpen(!1)},1e3)}})]})})},customThemeDefault$1={},ConnectModal$1=({mode:o="auto",theme:et="auto",customTheme:tt=customThemeDefault$1,lang:nt="en-US"})=>{var rt;const ot=useContext(),{isConnected:it,chain:st}=useAccount(),at=useChainIsSupported(st==null?void 0:st.id),ct=!(!((rt=ot.options)===null||rt===void 0)&&rt.enforceSupportedChains&&it&&!at),lt=ct&&ot.route!==routes.CONNECTORS&&ot.route!==routes.PROFILE,dt=ct&&ot.route!==routes.PROFILE,ht=()=>{ot.route===routes.SIGNINWITHETHEREUM||ot.route===routes.SWITCHNETWORKS?ot.setRoute(routes.PROFILE):ot.route===routes.DOWNLOAD?ot.setRoute(routes.CONNECT):ot.setRoute(routes.CONNECTORS)},pt={onboarding:jsxRuntimeExports.jsx(Introduction,{}),about:jsxRuntimeExports.jsx(About,{}),download:jsxRuntimeExports.jsx(DownloadApp,{}),connectors:jsxRuntimeExports.jsx(Wallets,{}),mobileConnectors:jsxRuntimeExports.jsx(MobileConnectors,{}),connect:jsxRuntimeExports.jsx(ConnectUsing,{}),profile:jsxRuntimeExports.jsx(Profile,{}),switchNetworks:jsxRuntimeExports.jsx(SwitchNetworks,{}),signInWithEthereum:jsxRuntimeExports.jsx(SignInWithEthereum,{})};function mt(){ot.setOpen(!1)}return reactExports.useEffect(()=>{var ft;it?(ot.route!==routes.PROFILE||ot.route!==routes.SIGNINWITHETHEREUM)&&(ot.signInWithEthereum&&!(!((ft=ot.options)===null||ft===void 0)&&ft.disableSiweRedirect)?ot.setRoute(routes.SIGNINWITHETHEREUM):mt()):mt()},[it]),reactExports.useEffect(()=>ot.setMode(o),[o]),reactExports.useEffect(()=>ot.setTheme(et),[et]),reactExports.useEffect(()=>ot.setCustomTheme(tt),[tt]),reactExports.useEffect(()=>ot.setLang(nt),[nt]),reactExports.useEffect(()=>{const ft=getAppName();if(!ft||!ot.open)return;const yt=document.createElement("meta");return yt.setAttribute("property","og:title"),yt.setAttribute("content",ft),document.head.prepend(yt),()=>{document.head.removeChild(yt)}},[ot.open]),jsxRuntimeExports.jsx(ConnectKitThemeProvider,{theme:et,customTheme:tt,mode:o,children:jsxRuntimeExports.jsx(Modal,{open:ot.open,pages:pt,pageId:ot.route,onClose:ct?mt:void 0,onInfo:dt?()=>ot.setRoute(routes.ABOUT):void 0,onBack:lt?ht:void 0})})};function useGoogleFont(o){reactExports.useEffect(()=>{if(!o)return;o=o.replace(/ /g,"+");const et=document.createElement("link");et.href="https://fonts.googleapis.com",et.rel="preconnect";const tt=document.createElement("link");tt.href="https://fonts.gstatic.com",tt.rel="preconnect",tt.crossOrigin="true";const nt=document.createElement("link");return nt.href=`https://fonts.googleapis.com/css2?family=${o}:wght@400;500;600&display=swap`,nt.rel="stylesheet",document.head.appendChild(et),document.head.appendChild(tt),document.head.appendChild(nt),()=>{document.head.removeChild(et),document.head.removeChild(tt),document.head.removeChild(nt)}},[o])}function useThemeFont(o){var et;const nt=(et={web95:"Lato",retro:"Nunito",midnight:"Inter",minimal:"Inter",rounded:"Nunito"}[o])!==null&&et!==void 0?et:null;useGoogleFont(nt??"")}const useConnectCallback=({onConnect:o,onDisconnect:et})=>{useAccountEffect({onConnect:({address:tt,connector:nt,isReconnected:rt})=>{rt||o==null||o({address:tt,connectorId:nt==null?void 0:nt.id})},onDisconnect:()=>et==null?void 0:et()})},routes={ONBOARDING:"onboarding",ABOUT:"about",CONNECTORS:"connectors",MOBILECONNECTORS:"mobileConnectors",CONNECT:"connect",DOWNLOAD:"download",PROFILE:"profile",SWITCHNETWORKS:"switchNetworks",SIGNINWITHETHEREUM:"signInWithEthereum"},Context=reactExports.createContext(null),ConnectKitProvider=({children:o,theme:et="auto",mode:tt="auto",customTheme:nt,options:rt,onConnect:ot,onDisconnect:it,debugMode:st=!1})=>{var at,ct,lt,dt;if(!React.useContext(WagmiContext))throw Error("ConnectKitProvider must be within a WagmiProvider");if(React.useContext(Context))throw new Error("Multiple, nested usages of ConnectKitProvider detected. Please use only one.");useConnectCallback({onConnect:ot,onDisconnect:it});const ht=useChains(),pt=useConnector("injected"),mt={language:"en-US",hideBalance:!1,hideTooltips:!1,hideQuestionMarkCTA:!1,hideNoWalletCTA:!1,walletConnectCTA:"link",hideRecentBadge:!1,avoidLayoutShift:!0,embedGoogleFonts:!1,truncateLongENSAddress:!0,walletConnectName:void 0,reducedMotion:!1,disclaimer:null,bufferPolyfill:!0,customAvatar:void 0,initialChainId:(at=ht==null?void 0:ht[0])===null||at===void 0?void 0:at.id,enforceSupportedChains:!1,ethereumOnboardingUrl:void 0,walletOnboardingUrl:void 0,disableSiweRedirect:!1},ft=Object.assign({},mt,rt);typeof window<"u"&&ft.bufferPolyfill&&(window.Buffer=(ct=window.Buffer)!==null&&ct!==void 0?ct:buffer$2.Buffer);const[yt,gt]=reactExports.useState(et),[xt,vt]=reactExports.useState(tt),[bt,Et]=reactExports.useState(nt??{}),[wt,kt]=reactExports.useState("en-US"),[It,Rt]=reactExports.useState(!1),[Pt,jt]=reactExports.useState({id:""}),[Ot,Bt]=reactExports.useState(routes.CONNECTORS),[zt,Ft]=reactExports.useState(""),[Yt,Ht]=reactExports.useState(0);ft.embedGoogleFonts&&useThemeFont(et),reactExports.useEffect(()=>gt(et),[et]),reactExports.useEffect(()=>kt(ft.language||"en-US"),[ft.language]),reactExports.useEffect(()=>Ft(null),[Ot,It]);const{chain:Ut,isConnected:qt}=useAccount(),Lt=useChainIsSupported(Ut==null?void 0:Ut.id);reactExports.useEffect(()=>{qt&&ft.enforceSupportedChains&&!Lt&&(Rt(!0),Bt(routes.SWITCHNETWORKS))},[qt,Lt,Ut,Ot,It]),reactExports.useEffect(()=>{isFamily()&&(pt==null||pt.connect())},[pt]);const Zt=st?console.log:()=>{},Qt={theme:yt,setTheme:gt,mode:xt,setMode:vt,customTheme:nt,setCustomTheme:Et,lang:wt,setLang:kt,open:It,setOpen:Rt,route:Ot,setRoute:Bt,connector:Pt,setConnector:jt,signInWithEthereum:(dt=(lt=React.useContext(SIWEContext))===null||lt===void 0?void 0:lt.enabled)!==null&&dt!==void 0?dt:!1,onConnect:ot,options:ft,errorMessage:zt,debugMode:st,log:Zt,displayError:(Nt,Gt)=>{Ft(Nt),console.log("---------CONNECTKIT DEBUG---------"),console.log(Nt),Gt&&console.table(Gt),console.log("---------/CONNECTKIT DEBUG---------")},resize:Yt,triggerResize:()=>Ht(Nt=>Nt+1)};return reactExports.createElement(Context.Provider,{value:Qt},jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:jsxRuntimeExports.jsx(Web3ContextProvider,{enabled:It,children:jsxRuntimeExports.jsxs(Le,{theme:defaultTheme$1,children:[o,jsxRuntimeExports.jsx(ConnectModal$1,{lang:wt,theme:yt,mode:tt,customTheme:bt})]})})}))},useContext=()=>{const o=React.useContext(Context);if(!o)throw Error("ConnectKit Hook must be inside a Provider.");return o},safeRoutes={disconnected:[routes.CONNECTORS,routes.ABOUT,routes.ONBOARDING,routes.MOBILECONNECTORS,routes.ONBOARDING],connected:[routes.PROFILE,routes.SWITCHNETWORKS,routes.SIGNINWITHETHEREUM]},allRoutes=[...safeRoutes.connected,...safeRoutes.disconnected],useModal=({onConnect:o,onDisconnect:et}={})=>{const tt=useContext();useConnectCallback({onConnect:o,onDisconnect:et});const{isConnected:nt}=useAccount(),{signIn:rt}=useSIWE(),ot=()=>{tt.setOpen(!1)},it=()=>{tt.setOpen(!0)},st=at=>{let ct=at;allRoutes.includes(at)?nt?safeRoutes.connected.includes(at)||(ct=routes.PROFILE,tt.log(`Route ${at} is not a valid route when connected, navigating to ${ct} instead.`)):safeRoutes.disconnected.includes(at)||(ct=routes.CONNECTORS,tt.log(`Route ${at} is not a valid route when disconnected, navigating to ${ct} instead.`)):(ct=nt?routes.PROFILE:routes.CONNECTORS,tt.log(`Route ${at} is not a valid route, navigating to ${ct} instead.`)),tt.setRoute(ct),it()};return{open:tt.open,setOpen:at=>{at?st(nt?routes.PROFILE:routes.CONNECTORS):ot()},openAbout:()=>st(routes.ABOUT),openOnboarding:()=>st(routes.ONBOARDING),openProfile:()=>st(routes.PROFILE),openSwitchNetworks:()=>st(routes.SWITCHNETWORKS),openSIWE:at=>{st(routes.SIGNINWITHETHEREUM),at&&rt()}}},TextContainer=styled(motion.div)` top: 0; bottom: 0; left: 0; @@ -3870,10 +3870,10 @@ Vui lòng thử lại.`,injectionScreen_notconnected_h1:"Đăng nhập vào {{ C * LICENSE.md file in the root directory of this source tree. * * @license MIT - */function _extends(){return _extends=Object.assign?Object.assign.bind():function(o){for(var et=1;et=0)&&(tt[rt]=o[rt]);return tt}function isModifiedEvent(o){return!!(o.metaKey||o.altKey||o.ctrlKey||o.shiftKey)}function shouldProcessLinkClick(o,et){return o.button===0&&(!et||et==="_self")&&!isModifiedEvent(o)}const _excluded=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","viewTransition"],REACT_ROUTER_VERSION="6";try{window.__reactRouterVersion=REACT_ROUTER_VERSION}catch{}const START_TRANSITION="startTransition",startTransitionImpl=React$1[START_TRANSITION];function BrowserRouter(o){let{basename:et,children:tt,future:nt,window:rt}=o,ot=reactExports.useRef();ot.current==null&&(ot.current=createBrowserHistory({window:rt,v5Compat:!0}));let it=ot.current,[st,at]=reactExports.useState({action:it.action,location:it.location}),{v7_startTransition:ct}=nt||{},lt=reactExports.useCallback(dt=>{ct&&startTransitionImpl?startTransitionImpl(()=>at(dt)):at(dt)},[at,ct]);return reactExports.useLayoutEffect(()=>it.listen(lt),[it,lt]),reactExports.useEffect(()=>logV6DeprecationWarnings(nt),[nt]),reactExports.createElement(Router,{basename:et,children:tt,location:st.location,navigationType:st.action,navigator:it,future:nt})}const isBrowser$1=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",ABSOLUTE_URL_REGEX=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Link=reactExports.forwardRef(function(et,tt){let{onClick:nt,relative:rt,reloadDocument:ot,replace:it,state:st,target:at,to:ct,preventScrollReset:lt,viewTransition:dt}=et,ht=_objectWithoutPropertiesLoose(et,_excluded),{basename:pt}=reactExports.useContext(NavigationContext),mt,ft=!1;if(typeof ct=="string"&&ABSOLUTE_URL_REGEX.test(ct)&&(mt=ct,isBrowser$1))try{let vt=new URL(window.location.href),bt=ct.startsWith("//")?new URL(vt.protocol+ct):new URL(ct),Et=stripBasename(bt.pathname,pt);bt.origin===vt.origin&&Et!=null?ct=Et+bt.search+bt.hash:ft=!0}catch{}let yt=useHref(ct,{relative:rt}),gt=useLinkClickHandler(ct,{replace:it,state:st,target:at,preventScrollReset:lt,relative:rt,viewTransition:dt});function xt(vt){nt&&nt(vt),vt.defaultPrevented||gt(vt)}return reactExports.createElement("a",_extends({},ht,{href:mt||yt,onClick:ft||ot?nt:xt,ref:tt,target:at}))});var DataRouterHook;(function(o){o.UseScrollRestoration="useScrollRestoration",o.UseSubmit="useSubmit",o.UseSubmitFetcher="useSubmitFetcher",o.UseFetcher="useFetcher",o.useViewTransitionState="useViewTransitionState"})(DataRouterHook||(DataRouterHook={}));var DataRouterStateHook;(function(o){o.UseFetcher="useFetcher",o.UseFetchers="useFetchers",o.UseScrollRestoration="useScrollRestoration"})(DataRouterStateHook||(DataRouterStateHook={}));function useLinkClickHandler(o,et){let{target:tt,replace:nt,state:rt,preventScrollReset:ot,relative:it,viewTransition:st}=et===void 0?{}:et,at=useNavigate(),ct=useLocation(),lt=useResolvedPath(o,{relative:it});return reactExports.useCallback(dt=>{if(shouldProcessLinkClick(dt,tt)){dt.preventDefault();let ht=nt!==void 0?nt:createPath(ct)===createPath(lt);at(o,{replace:ht,state:rt,preventScrollReset:ot,relative:it,viewTransition:st})}},[ct,at,lt,nt,rt,tt,o,ot,it,st])}function setRef(o,et){typeof o=="function"?o(et):o!=null&&(o.current=et)}function composeRefs(...o){return et=>o.forEach(tt=>setRef(tt,et))}function useComposedRefs(...o){return reactExports.useCallback(composeRefs(...o),o)}var Slot=reactExports.forwardRef((o,et)=>{const{children:tt,...nt}=o,rt=reactExports.Children.toArray(tt),ot=rt.find(isSlottable);if(ot){const it=ot.props.children,st=rt.map(at=>at===ot?reactExports.Children.count(it)>1?reactExports.Children.only(null):reactExports.isValidElement(it)?it.props.children:null:at);return jsxRuntimeExports.jsx(SlotClone,{...nt,ref:et,children:reactExports.isValidElement(it)?reactExports.cloneElement(it,void 0,st):null})}return jsxRuntimeExports.jsx(SlotClone,{...nt,ref:et,children:tt})});Slot.displayName="Slot";var SlotClone=reactExports.forwardRef((o,et)=>{const{children:tt,...nt}=o;if(reactExports.isValidElement(tt)){const rt=getElementRef$1(tt);return reactExports.cloneElement(tt,{...mergeProps(nt,tt.props),ref:et?composeRefs(et,rt):rt})}return reactExports.Children.count(tt)>1?reactExports.Children.only(null):null});SlotClone.displayName="SlotClone";var Slottable=({children:o})=>jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:o});function isSlottable(o){return reactExports.isValidElement(o)&&o.type===Slottable}function mergeProps(o,et){const tt={...et};for(const nt in et){const rt=o[nt],ot=et[nt];/^on[A-Z]/.test(nt)?rt&&ot?tt[nt]=(...st)=>{ot(...st),rt(...st)}:rt&&(tt[nt]=rt):nt==="style"?tt[nt]={...rt,...ot}:nt==="className"&&(tt[nt]=[rt,ot].filter(Boolean).join(" "))}return{...o,...tt}}function getElementRef$1(o){var nt,rt;let et=(nt=Object.getOwnPropertyDescriptor(o.props,"ref"))==null?void 0:nt.get,tt=et&&"isReactWarning"in et&&et.isReactWarning;return tt?o.ref:(et=(rt=Object.getOwnPropertyDescriptor(o,"ref"))==null?void 0:rt.get,tt=et&&"isReactWarning"in et&&et.isReactWarning,tt?o.props.ref:o.props.ref||o.ref)}function r$1(o){var et,tt,nt="";if(typeof o=="string"||typeof o=="number")nt+=o;else if(typeof o=="object")if(Array.isArray(o))for(et=0;ettypeof o=="boolean"?"".concat(o):o===0?"0":o,cx=clsx$1,cva=(o,et)=>tt=>{var nt;if((et==null?void 0:et.variants)==null)return cx(o,tt==null?void 0:tt.class,tt==null?void 0:tt.className);const{variants:rt,defaultVariants:ot}=et,it=Object.keys(rt).map(ct=>{const lt=tt==null?void 0:tt[ct],dt=ot==null?void 0:ot[ct];if(lt===null)return null;const ht=falsyToString(lt)||falsyToString(dt);return rt[ct][ht]}),st=tt&&Object.entries(tt).reduce((ct,lt)=>{let[dt,ht]=lt;return ht===void 0||(ct[dt]=ht),ct},{}),at=et==null||(nt=et.compoundVariants)===null||nt===void 0?void 0:nt.reduce((ct,lt)=>{let{class:dt,className:ht,...pt}=lt;return Object.entries(pt).every(mt=>{let[ft,yt]=mt;return Array.isArray(yt)?yt.includes({...ot,...st}[ft]):{...ot,...st}[ft]===yt})?[...ct,dt,ht]:ct},[]);return cx(o,it,at,tt==null?void 0:tt.class,tt==null?void 0:tt.className)};function r(o){var et,tt,nt="";if(typeof o=="string"||typeof o=="number")nt+=o;else if(typeof o=="object")if(Array.isArray(o)){var rt=o.length;for(et=0;et{const et=createClassMap(o),{conflictingClassGroups:tt,conflictingClassGroupModifiers:nt}=o;return{getClassGroupId:it=>{const st=it.split(CLASS_PART_SEPARATOR);return st[0]===""&&st.length!==1&&st.shift(),getGroupRecursive(st,et)||getGroupIdForArbitraryProperty(it)},getConflictingClassGroupIds:(it,st)=>{const at=tt[it]||[];return st&&nt[it]?[...at,...nt[it]]:at}}},getGroupRecursive=(o,et)=>{var it;if(o.length===0)return et.classGroupId;const tt=o[0],nt=et.nextPart.get(tt),rt=nt?getGroupRecursive(o.slice(1),nt):void 0;if(rt)return rt;if(et.validators.length===0)return;const ot=o.join(CLASS_PART_SEPARATOR);return(it=et.validators.find(({validator:st})=>st(ot)))==null?void 0:it.classGroupId},arbitraryPropertyRegex=/^\[(.+)\]$/,getGroupIdForArbitraryProperty=o=>{if(arbitraryPropertyRegex.test(o)){const et=arbitraryPropertyRegex.exec(o)[1],tt=et==null?void 0:et.substring(0,et.indexOf(":"));if(tt)return"arbitrary.."+tt}},createClassMap=o=>{const{theme:et,prefix:tt}=o,nt={nextPart:new Map,validators:[]};return getPrefixedClassGroupEntries(Object.entries(o.classGroups),tt).forEach(([ot,it])=>{processClassesRecursively(it,nt,ot,et)}),nt},processClassesRecursively=(o,et,tt,nt)=>{o.forEach(rt=>{if(typeof rt=="string"){const ot=rt===""?et:getPart(et,rt);ot.classGroupId=tt;return}if(typeof rt=="function"){if(isThemeGetter(rt)){processClassesRecursively(rt(nt),et,tt,nt);return}et.validators.push({validator:rt,classGroupId:tt});return}Object.entries(rt).forEach(([ot,it])=>{processClassesRecursively(it,getPart(et,ot),tt,nt)})})},getPart=(o,et)=>{let tt=o;return et.split(CLASS_PART_SEPARATOR).forEach(nt=>{tt.nextPart.has(nt)||tt.nextPart.set(nt,{nextPart:new Map,validators:[]}),tt=tt.nextPart.get(nt)}),tt},isThemeGetter=o=>o.isThemeGetter,getPrefixedClassGroupEntries=(o,et)=>et?o.map(([tt,nt])=>{const rt=nt.map(ot=>typeof ot=="string"?et+ot:typeof ot=="object"?Object.fromEntries(Object.entries(ot).map(([it,st])=>[et+it,st])):ot);return[tt,rt]}):o,createLruCache=o=>{if(o<1)return{get:()=>{},set:()=>{}};let et=0,tt=new Map,nt=new Map;const rt=(ot,it)=>{tt.set(ot,it),et++,et>o&&(et=0,nt=tt,tt=new Map)};return{get(ot){let it=tt.get(ot);if(it!==void 0)return it;if((it=nt.get(ot))!==void 0)return rt(ot,it),it},set(ot,it){tt.has(ot)?tt.set(ot,it):rt(ot,it)}}},IMPORTANT_MODIFIER="!",createParseClassName=o=>{const{separator:et,experimentalParseClassName:tt}=o,nt=et.length===1,rt=et[0],ot=et.length,it=st=>{const at=[];let ct=0,lt=0,dt;for(let yt=0;ytlt?dt-lt:void 0;return{modifiers:at,hasImportantModifier:pt,baseClassName:mt,maybePostfixModifierPosition:ft}};return tt?st=>tt({className:st,parseClassName:it}):it},sortModifiers=o=>{if(o.length<=1)return o;const et=[];let tt=[];return o.forEach(nt=>{nt[0]==="["?(et.push(...tt.sort(),nt),tt=[]):tt.push(nt)}),et.push(...tt.sort()),et},createConfigUtils=o=>({cache:createLruCache(o.cacheSize),parseClassName:createParseClassName(o),...createClassGroupUtils(o)}),SPLIT_CLASSES_REGEX=/\s+/,mergeClassList=(o,et)=>{const{parseClassName:tt,getClassGroupId:nt,getConflictingClassGroupIds:rt}=et,ot=[],it=o.trim().split(SPLIT_CLASSES_REGEX);let st="";for(let at=it.length-1;at>=0;at-=1){const ct=it[at],{modifiers:lt,hasImportantModifier:dt,baseClassName:ht,maybePostfixModifierPosition:pt}=tt(ct);let mt=!!pt,ft=nt(mt?ht.substring(0,pt):ht);if(!ft){if(!mt){st=ct+(st.length>0?" "+st:st);continue}if(ft=nt(ht),!ft){st=ct+(st.length>0?" "+st:st);continue}mt=!1}const yt=sortModifiers(lt).join(":"),gt=dt?yt+IMPORTANT_MODIFIER:yt,xt=gt+ft;if(ot.includes(xt))continue;ot.push(xt);const vt=rt(ft,mt);for(let bt=0;bt0?" "+st:st)}return st};function twJoin(){let o=0,et,tt,nt="";for(;o{if(typeof o=="string")return o;let et,tt="";for(let nt=0;ntdt(lt),o());return tt=createConfigUtils(ct),nt=tt.cache.get,rt=tt.cache.set,ot=st,st(at)}function st(at){const ct=nt(at);if(ct)return ct;const lt=mergeClassList(at,tt);return rt(at,lt),lt}return function(){return ot(twJoin.apply(null,arguments))}}const fromTheme=o=>{const et=tt=>tt[o]||[];return et.isThemeGetter=!0,et},arbitraryValueRegex=/^\[(?:([a-z-]+):)?(.+)\]$/i,fractionRegex=/^\d+\/\d+$/,stringLengths=new Set(["px","full","screen"]),tshirtUnitRegex=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,lengthUnitRegex=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,colorFunctionRegex=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,shadowRegex=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,imageRegex=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,isLength=o=>isNumber(o)||stringLengths.has(o)||fractionRegex.test(o),isArbitraryLength=o=>getIsArbitraryValue(o,"length",isLengthOnly),isNumber=o=>!!o&&!Number.isNaN(Number(o)),isArbitraryNumber=o=>getIsArbitraryValue(o,"number",isNumber),isInteger$1=o=>!!o&&Number.isInteger(Number(o)),isPercent=o=>o.endsWith("%")&&isNumber(o.slice(0,-1)),isArbitraryValue=o=>arbitraryValueRegex.test(o),isTshirtSize=o=>tshirtUnitRegex.test(o),sizeLabels=new Set(["length","size","percentage"]),isArbitrarySize=o=>getIsArbitraryValue(o,sizeLabels,isNever),isArbitraryPosition=o=>getIsArbitraryValue(o,"position",isNever),imageLabels=new Set(["image","url"]),isArbitraryImage=o=>getIsArbitraryValue(o,imageLabels,isImage),isArbitraryShadow=o=>getIsArbitraryValue(o,"",isShadow),isAny=()=>!0,getIsArbitraryValue=(o,et,tt)=>{const nt=arbitraryValueRegex.exec(o);return nt?nt[1]?typeof et=="string"?nt[1]===et:et.has(nt[1]):tt(nt[2]):!1},isLengthOnly=o=>lengthUnitRegex.test(o)&&!colorFunctionRegex.test(o),isNever=()=>!1,isShadow=o=>shadowRegex.test(o),isImage=o=>imageRegex.test(o),getDefaultConfig=()=>{const o=fromTheme("colors"),et=fromTheme("spacing"),tt=fromTheme("blur"),nt=fromTheme("brightness"),rt=fromTheme("borderColor"),ot=fromTheme("borderRadius"),it=fromTheme("borderSpacing"),st=fromTheme("borderWidth"),at=fromTheme("contrast"),ct=fromTheme("grayscale"),lt=fromTheme("hueRotate"),dt=fromTheme("invert"),ht=fromTheme("gap"),pt=fromTheme("gradientColorStops"),mt=fromTheme("gradientColorStopPositions"),ft=fromTheme("inset"),yt=fromTheme("margin"),gt=fromTheme("opacity"),xt=fromTheme("padding"),vt=fromTheme("saturate"),bt=fromTheme("scale"),Et=fromTheme("sepia"),wt=fromTheme("skew"),kt=fromTheme("space"),Tt=fromTheme("translate"),Rt=()=>["auto","contain","none"],Pt=()=>["auto","hidden","clip","visible","scroll"],$t=()=>["auto",isArbitraryValue,et],Ot=()=>[isArbitraryValue,et],Bt=()=>["",isLength,isArbitraryLength],zt=()=>["auto",isNumber,isArbitraryValue],Ft=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],Yt=()=>["solid","dashed","dotted","double","none"],Ht=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],Ut=()=>["start","end","center","between","around","evenly","stretch"],qt=()=>["","0",isArbitraryValue],Lt=()=>["auto","avoid","all","avoid-page","page","left","right","column"],Zt=()=>[isNumber,isArbitraryValue];return{cacheSize:500,separator:":",theme:{colors:[isAny],spacing:[isLength,isArbitraryLength],blur:["none","",isTshirtSize,isArbitraryValue],brightness:Zt(),borderColor:[o],borderRadius:["none","","full",isTshirtSize,isArbitraryValue],borderSpacing:Ot(),borderWidth:Bt(),contrast:Zt(),grayscale:qt(),hueRotate:Zt(),invert:qt(),gap:Ot(),gradientColorStops:[o],gradientColorStopPositions:[isPercent,isArbitraryLength],inset:$t(),margin:$t(),opacity:Zt(),padding:Ot(),saturate:Zt(),scale:Zt(),sepia:qt(),skew:Zt(),space:Ot(),translate:Ot()},classGroups:{aspect:[{aspect:["auto","square","video",isArbitraryValue]}],container:["container"],columns:[{columns:[isTshirtSize]}],"break-after":[{"break-after":Lt()}],"break-before":[{"break-before":Lt()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...Ft(),isArbitraryValue]}],overflow:[{overflow:Pt()}],"overflow-x":[{"overflow-x":Pt()}],"overflow-y":[{"overflow-y":Pt()}],overscroll:[{overscroll:Rt()}],"overscroll-x":[{"overscroll-x":Rt()}],"overscroll-y":[{"overscroll-y":Rt()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[ft]}],"inset-x":[{"inset-x":[ft]}],"inset-y":[{"inset-y":[ft]}],start:[{start:[ft]}],end:[{end:[ft]}],top:[{top:[ft]}],right:[{right:[ft]}],bottom:[{bottom:[ft]}],left:[{left:[ft]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",isInteger$1,isArbitraryValue]}],basis:[{basis:$t()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",isArbitraryValue]}],grow:[{grow:qt()}],shrink:[{shrink:qt()}],order:[{order:["first","last","none",isInteger$1,isArbitraryValue]}],"grid-cols":[{"grid-cols":[isAny]}],"col-start-end":[{col:["auto",{span:["full",isInteger$1,isArbitraryValue]},isArbitraryValue]}],"col-start":[{"col-start":zt()}],"col-end":[{"col-end":zt()}],"grid-rows":[{"grid-rows":[isAny]}],"row-start-end":[{row:["auto",{span:[isInteger$1,isArbitraryValue]},isArbitraryValue]}],"row-start":[{"row-start":zt()}],"row-end":[{"row-end":zt()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",isArbitraryValue]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",isArbitraryValue]}],gap:[{gap:[ht]}],"gap-x":[{"gap-x":[ht]}],"gap-y":[{"gap-y":[ht]}],"justify-content":[{justify:["normal",...Ut()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...Ut(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...Ut(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[xt]}],px:[{px:[xt]}],py:[{py:[xt]}],ps:[{ps:[xt]}],pe:[{pe:[xt]}],pt:[{pt:[xt]}],pr:[{pr:[xt]}],pb:[{pb:[xt]}],pl:[{pl:[xt]}],m:[{m:[yt]}],mx:[{mx:[yt]}],my:[{my:[yt]}],ms:[{ms:[yt]}],me:[{me:[yt]}],mt:[{mt:[yt]}],mr:[{mr:[yt]}],mb:[{mb:[yt]}],ml:[{ml:[yt]}],"space-x":[{"space-x":[kt]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[kt]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",isArbitraryValue,et]}],"min-w":[{"min-w":[isArbitraryValue,et,"min","max","fit"]}],"max-w":[{"max-w":[isArbitraryValue,et,"none","full","min","max","fit","prose",{screen:[isTshirtSize]},isTshirtSize]}],h:[{h:[isArbitraryValue,et,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[isArbitraryValue,et,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[isArbitraryValue,et,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[isArbitraryValue,et,"auto","min","max","fit"]}],"font-size":[{text:["base",isTshirtSize,isArbitraryLength]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",isArbitraryNumber]}],"font-family":[{font:[isAny]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractons"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",isArbitraryValue]}],"line-clamp":[{"line-clamp":["none",isNumber,isArbitraryNumber]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",isLength,isArbitraryValue]}],"list-image":[{"list-image":["none",isArbitraryValue]}],"list-style-type":[{list:["none","disc","decimal",isArbitraryValue]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[o]}],"placeholder-opacity":[{"placeholder-opacity":[gt]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[o]}],"text-opacity":[{"text-opacity":[gt]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...Yt(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",isLength,isArbitraryLength]}],"underline-offset":[{"underline-offset":["auto",isLength,isArbitraryValue]}],"text-decoration-color":[{decoration:[o]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:Ot()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",isArbitraryValue]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",isArbitraryValue]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[gt]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...Ft(),isArbitraryPosition]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",isArbitrarySize]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},isArbitraryImage]}],"bg-color":[{bg:[o]}],"gradient-from-pos":[{from:[mt]}],"gradient-via-pos":[{via:[mt]}],"gradient-to-pos":[{to:[mt]}],"gradient-from":[{from:[pt]}],"gradient-via":[{via:[pt]}],"gradient-to":[{to:[pt]}],rounded:[{rounded:[ot]}],"rounded-s":[{"rounded-s":[ot]}],"rounded-e":[{"rounded-e":[ot]}],"rounded-t":[{"rounded-t":[ot]}],"rounded-r":[{"rounded-r":[ot]}],"rounded-b":[{"rounded-b":[ot]}],"rounded-l":[{"rounded-l":[ot]}],"rounded-ss":[{"rounded-ss":[ot]}],"rounded-se":[{"rounded-se":[ot]}],"rounded-ee":[{"rounded-ee":[ot]}],"rounded-es":[{"rounded-es":[ot]}],"rounded-tl":[{"rounded-tl":[ot]}],"rounded-tr":[{"rounded-tr":[ot]}],"rounded-br":[{"rounded-br":[ot]}],"rounded-bl":[{"rounded-bl":[ot]}],"border-w":[{border:[st]}],"border-w-x":[{"border-x":[st]}],"border-w-y":[{"border-y":[st]}],"border-w-s":[{"border-s":[st]}],"border-w-e":[{"border-e":[st]}],"border-w-t":[{"border-t":[st]}],"border-w-r":[{"border-r":[st]}],"border-w-b":[{"border-b":[st]}],"border-w-l":[{"border-l":[st]}],"border-opacity":[{"border-opacity":[gt]}],"border-style":[{border:[...Yt(),"hidden"]}],"divide-x":[{"divide-x":[st]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[st]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[gt]}],"divide-style":[{divide:Yt()}],"border-color":[{border:[rt]}],"border-color-x":[{"border-x":[rt]}],"border-color-y":[{"border-y":[rt]}],"border-color-s":[{"border-s":[rt]}],"border-color-e":[{"border-e":[rt]}],"border-color-t":[{"border-t":[rt]}],"border-color-r":[{"border-r":[rt]}],"border-color-b":[{"border-b":[rt]}],"border-color-l":[{"border-l":[rt]}],"divide-color":[{divide:[rt]}],"outline-style":[{outline:["",...Yt()]}],"outline-offset":[{"outline-offset":[isLength,isArbitraryValue]}],"outline-w":[{outline:[isLength,isArbitraryLength]}],"outline-color":[{outline:[o]}],"ring-w":[{ring:Bt()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[o]}],"ring-opacity":[{"ring-opacity":[gt]}],"ring-offset-w":[{"ring-offset":[isLength,isArbitraryLength]}],"ring-offset-color":[{"ring-offset":[o]}],shadow:[{shadow:["","inner","none",isTshirtSize,isArbitraryShadow]}],"shadow-color":[{shadow:[isAny]}],opacity:[{opacity:[gt]}],"mix-blend":[{"mix-blend":[...Ht(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":Ht()}],filter:[{filter:["","none"]}],blur:[{blur:[tt]}],brightness:[{brightness:[nt]}],contrast:[{contrast:[at]}],"drop-shadow":[{"drop-shadow":["","none",isTshirtSize,isArbitraryValue]}],grayscale:[{grayscale:[ct]}],"hue-rotate":[{"hue-rotate":[lt]}],invert:[{invert:[dt]}],saturate:[{saturate:[vt]}],sepia:[{sepia:[Et]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[tt]}],"backdrop-brightness":[{"backdrop-brightness":[nt]}],"backdrop-contrast":[{"backdrop-contrast":[at]}],"backdrop-grayscale":[{"backdrop-grayscale":[ct]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[lt]}],"backdrop-invert":[{"backdrop-invert":[dt]}],"backdrop-opacity":[{"backdrop-opacity":[gt]}],"backdrop-saturate":[{"backdrop-saturate":[vt]}],"backdrop-sepia":[{"backdrop-sepia":[Et]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[it]}],"border-spacing-x":[{"border-spacing-x":[it]}],"border-spacing-y":[{"border-spacing-y":[it]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",isArbitraryValue]}],duration:[{duration:Zt()}],ease:[{ease:["linear","in","out","in-out",isArbitraryValue]}],delay:[{delay:Zt()}],animate:[{animate:["none","spin","ping","pulse","bounce",isArbitraryValue]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[bt]}],"scale-x":[{"scale-x":[bt]}],"scale-y":[{"scale-y":[bt]}],rotate:[{rotate:[isInteger$1,isArbitraryValue]}],"translate-x":[{"translate-x":[Tt]}],"translate-y":[{"translate-y":[Tt]}],"skew-x":[{"skew-x":[wt]}],"skew-y":[{"skew-y":[wt]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",isArbitraryValue]}],accent:[{accent:["auto",o]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",isArbitraryValue]}],"caret-color":[{caret:[o]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":Ot()}],"scroll-mx":[{"scroll-mx":Ot()}],"scroll-my":[{"scroll-my":Ot()}],"scroll-ms":[{"scroll-ms":Ot()}],"scroll-me":[{"scroll-me":Ot()}],"scroll-mt":[{"scroll-mt":Ot()}],"scroll-mr":[{"scroll-mr":Ot()}],"scroll-mb":[{"scroll-mb":Ot()}],"scroll-ml":[{"scroll-ml":Ot()}],"scroll-p":[{"scroll-p":Ot()}],"scroll-px":[{"scroll-px":Ot()}],"scroll-py":[{"scroll-py":Ot()}],"scroll-ps":[{"scroll-ps":Ot()}],"scroll-pe":[{"scroll-pe":Ot()}],"scroll-pt":[{"scroll-pt":Ot()}],"scroll-pr":[{"scroll-pr":Ot()}],"scroll-pb":[{"scroll-pb":Ot()}],"scroll-pl":[{"scroll-pl":Ot()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",isArbitraryValue]}],fill:[{fill:[o,"none"]}],"stroke-w":[{stroke:[isLength,isArbitraryLength,isArbitraryNumber]}],stroke:[{stroke:[o,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}},twMerge=createTailwindMerge(getDefaultConfig);function cn(...o){return twMerge(clsx(o))}const buttonVariants=cva("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground shadow hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",outline:"border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2",sm:"h-8 rounded-md px-3 text-xs",lg:"h-10 rounded-md px-8",icon:"h-9 w-9"}},defaultVariants:{variant:"default",size:"default"}}),Button=reactExports.forwardRef(({className:o,variant:et,size:tt,asChild:nt=!1,...rt},ot)=>{const it=nt?Slot:"button";return jsxRuntimeExports.jsx(it,{className:cn("inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50","min-h-[44px] px-4 py-2 md:min-h-[36px] md:px-3 md:py-1.5",buttonVariants({variant:et,size:tt,className:o})),ref:ot,...rt})});Button.displayName="Button";function alloc$2(o=0){return new Uint8Array(o)}function allocUnsafe(o=0){return new Uint8Array(o)}const N1$1=Math.pow(2,7),N2$1=Math.pow(2,14),N3$1=Math.pow(2,21),N4$1=Math.pow(2,28),N5$1=Math.pow(2,35),N6$1=Math.pow(2,42),N7$1=Math.pow(2,49),MSB$2=128,REST$2=127;function encodingLength$3(o){if(oNumber.MAX_SAFE_INTEGER)throw new RangeError("Could not encode varint");return 8}function encodeUint8Array(o,et,tt=0){switch(encodingLength$3(o)){case 8:et[tt++]=o&255|MSB$2,o/=128;case 7:et[tt++]=o&255|MSB$2,o/=128;case 6:et[tt++]=o&255|MSB$2,o/=128;case 5:et[tt++]=o&255|MSB$2,o/=128;case 4:et[tt++]=o&255|MSB$2,o>>>=7;case 3:et[tt++]=o&255|MSB$2,o>>>=7;case 2:et[tt++]=o&255|MSB$2,o>>>=7;case 1:{et[tt++]=o&255,o>>>=7;break}default:throw new Error("unreachable")}return et}function encodeUint8ArrayList(o,et,tt=0){switch(encodingLength$3(o)){case 8:et.set(tt++,o&255|MSB$2),o/=128;case 7:et.set(tt++,o&255|MSB$2),o/=128;case 6:et.set(tt++,o&255|MSB$2),o/=128;case 5:et.set(tt++,o&255|MSB$2),o/=128;case 4:et.set(tt++,o&255|MSB$2),o>>>=7;case 3:et.set(tt++,o&255|MSB$2),o>>>=7;case 2:et.set(tt++,o&255|MSB$2),o>>>=7;case 1:{et.set(tt++,o&255),o>>>=7;break}default:throw new Error("unreachable")}return et}function decodeUint8Array(o,et){let tt=o[et],nt=0;if(nt+=tt&REST$2,tt>>31>0){const tt=~this.lo+1>>>0;let nt=~this.hi>>>0;return tt===0&&(nt=nt+1>>>0),-(tt+nt*4294967296)}return this.lo+this.hi*4294967296}toBigInt(et=!1){if(et)return BigInt(this.lo>>>0)+(BigInt(this.hi>>>0)<<32n);if(this.hi>>>31){const tt=~this.lo+1>>>0;let nt=~this.hi>>>0;return tt===0&&(nt=nt+1>>>0),-(BigInt(tt)+(BigInt(nt)<<32n))}return BigInt(this.lo>>>0)+(BigInt(this.hi>>>0)<<32n)}toString(et=!1){return this.toBigInt(et).toString()}zzEncode(){const et=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^et)>>>0,this.lo=(this.lo<<1^et)>>>0,this}zzDecode(){const et=-(this.lo&1);return this.lo=((this.lo>>>1|this.hi<<31)^et)>>>0,this.hi=(this.hi>>>1^et)>>>0,this}length(){const et=this.lo,tt=(this.lo>>>28|this.hi<<4)>>>0,nt=this.hi>>>24;return nt===0?tt===0?et<16384?et<128?1:2:et<2097152?3:4:tt<16384?tt<128?5:6:tt<2097152?7:8:nt<128?9:10}static fromBigInt(et){if(et===0n)return zero;if(etMIN_SAFE_NUMBER_INTEGER)return this.fromNumber(Number(et));const tt=et<0n;tt&&(et=-et);let nt=et>>32n,rt=et-(nt<<32n);return tt&&(nt=~nt|0n,rt=~rt|0n,++rt>TWO_32&&(rt=0n,++nt>TWO_32&&(nt=0n))),new Er(Number(rt),Number(nt))}static fromNumber(et){if(et===0)return zero;const tt=et<0;tt&&(et=-et);let nt=et>>>0,rt=(et-nt)/4294967296>>>0;return tt&&(rt=~rt>>>0,nt=~nt>>>0,++nt>4294967295&&(nt=0,++rt>4294967295&&(rt=0))),new Er(nt,rt)}static from(et){return typeof et=="number"?Er.fromNumber(et):typeof et=="bigint"?Er.fromBigInt(et):typeof et=="string"?Er.fromBigInt(BigInt(et)):et.low!=null||et.high!=null?new Er(et.low>>>0,et.high>>>0):zero}};const zero=new LongBits$2(0,0);zero.toBigInt=function(){return 0n};zero.zzEncode=zero.zzDecode=function(){return this};zero.length=function(){return 1};const TWO_32=4294967296n;function length$1(o){let et=0,tt=0;for(let nt=0;nt191&&st<224?ot[it++]=(st&31)<<6|o[et++]&63:st>239&&st<365?(st=((st&7)<<18|(o[et++]&63)<<12|(o[et++]&63)<<6|o[et++]&63)-65536,ot[it++]=55296+(st>>10),ot[it++]=56320+(st&1023)):ot[it++]=(st&15)<<12|(o[et++]&63)<<6|o[et++]&63,it>8191&&((rt??(rt=[])).push(String.fromCharCode.apply(String,ot)),it=0);return rt!=null?(it>0&&rt.push(String.fromCharCode.apply(String,ot.slice(0,it))),rt.join("")):String.fromCharCode.apply(String,ot.slice(0,it))}function write$2(o,et,tt){const nt=tt;let rt,ot;for(let it=0;it>6|192,et[tt++]=rt&63|128):(rt&64512)===55296&&((ot=o.charCodeAt(it+1))&64512)===56320?(rt=65536+((rt&1023)<<10)+(ot&1023),++it,et[tt++]=rt>>18|240,et[tt++]=rt>>12&63|128,et[tt++]=rt>>6&63|128,et[tt++]=rt&63|128):(et[tt++]=rt>>12|224,et[tt++]=rt>>6&63|128,et[tt++]=rt&63|128);return tt-nt}function indexOutOfRange$1(o,et){return RangeError(`index out of range: ${o.pos} + ${et??1} > ${o.len}`)}function readFixed32End(o,et){return(o[et-4]|o[et-3]<<8|o[et-2]<<16|o[et-1]<<24)>>>0}class Uint8ArrayReader{constructor(et){Ct(this,"buf");Ct(this,"pos");Ct(this,"len");Ct(this,"_slice",Uint8Array.prototype.subarray);this.buf=et,this.pos=0,this.len=et.length}uint32(){let et=4294967295;if(et=(this.buf[this.pos]&127)>>>0,this.buf[this.pos++]<128||(et=(et|(this.buf[this.pos]&127)<<7)>>>0,this.buf[this.pos++]<128)||(et=(et|(this.buf[this.pos]&127)<<14)>>>0,this.buf[this.pos++]<128)||(et=(et|(this.buf[this.pos]&127)<<21)>>>0,this.buf[this.pos++]<128)||(et=(et|(this.buf[this.pos]&15)<<28)>>>0,this.buf[this.pos++]<128))return et;if((this.pos+=5)>this.len)throw this.pos=this.len,indexOutOfRange$1(this,10);return et}int32(){return this.uint32()|0}sint32(){const et=this.uint32();return et>>>1^-(et&1)|0}bool(){return this.uint32()!==0}fixed32(){if(this.pos+4>this.len)throw indexOutOfRange$1(this,4);return readFixed32End(this.buf,this.pos+=4)}sfixed32(){if(this.pos+4>this.len)throw indexOutOfRange$1(this,4);return readFixed32End(this.buf,this.pos+=4)|0}float(){if(this.pos+4>this.len)throw indexOutOfRange$1(this,4);const et=readFloatLE(this.buf,this.pos);return this.pos+=4,et}double(){if(this.pos+8>this.len)throw indexOutOfRange$1(this,4);const et=readDoubleLE(this.buf,this.pos);return this.pos+=8,et}bytes(){const et=this.uint32(),tt=this.pos,nt=this.pos+et;if(nt>this.len)throw indexOutOfRange$1(this,et);return this.pos+=et,tt===nt?new Uint8Array(0):this.buf.subarray(tt,nt)}string(){const et=this.bytes();return read$2(et,0,et.length)}skip(et){if(typeof et=="number"){if(this.pos+et>this.len)throw indexOutOfRange$1(this,et);this.pos+=et}else do if(this.pos>=this.len)throw indexOutOfRange$1(this);while(this.buf[this.pos++]&128);return this}skipType(et){switch(et){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;(et=this.uint32()&7)!==4;)this.skipType(et);break;case 5:this.skip(4);break;default:throw Error(`invalid wire type ${et} at offset ${this.pos}`)}return this}readLongVarint(){const et=new LongBits$2(0,0);let tt=0;if(this.len-this.pos>4){for(;tt<4;++tt)if(et.lo=(et.lo|(this.buf[this.pos]&127)<>>0,this.buf[this.pos++]<128)return et;if(et.lo=(et.lo|(this.buf[this.pos]&127)<<28)>>>0,et.hi=(et.hi|(this.buf[this.pos]&127)>>4)>>>0,this.buf[this.pos++]<128)return et;tt=0}else{for(;tt<3;++tt){if(this.pos>=this.len)throw indexOutOfRange$1(this);if(et.lo=(et.lo|(this.buf[this.pos]&127)<>>0,this.buf[this.pos++]<128)return et}return et.lo=(et.lo|(this.buf[this.pos++]&127)<>>0,et}if(this.len-this.pos>4){for(;tt<5;++tt)if(et.hi=(et.hi|(this.buf[this.pos]&127)<>>0,this.buf[this.pos++]<128)return et}else for(;tt<5;++tt){if(this.pos>=this.len)throw indexOutOfRange$1(this);if(et.hi=(et.hi|(this.buf[this.pos]&127)<>>0,this.buf[this.pos++]<128)return et}throw Error("invalid varint encoding")}readFixed64(){if(this.pos+8>this.len)throw indexOutOfRange$1(this,8);const et=readFixed32End(this.buf,this.pos+=4),tt=readFixed32End(this.buf,this.pos+=4);return new LongBits$2(et,tt)}int64(){return this.readLongVarint().toBigInt()}int64Number(){return this.readLongVarint().toNumber()}int64String(){return this.readLongVarint().toString()}uint64(){return this.readLongVarint().toBigInt(!0)}uint64Number(){const et=decodeUint8Array(this.buf,this.pos);return this.pos+=encodingLength$3(et),et}uint64String(){return this.readLongVarint().toString(!0)}sint64(){return this.readLongVarint().zzDecode().toBigInt()}sint64Number(){return this.readLongVarint().zzDecode().toNumber()}sint64String(){return this.readLongVarint().zzDecode().toString()}fixed64(){return this.readFixed64().toBigInt()}fixed64Number(){return this.readFixed64().toNumber()}fixed64String(){return this.readFixed64().toString()}sfixed64(){return this.readFixed64().toBigInt()}sfixed64Number(){return this.readFixed64().toNumber()}sfixed64String(){return this.readFixed64().toString()}}function createReader(o){return new Uint8ArrayReader(o instanceof Uint8Array?o:o.subarray())}function decodeMessage(o,et,tt){const nt=createReader(o);return et.decode(nt,void 0,tt)}function equals$2(o,et){if(o===et)return!0;if(o.byteLength!==et.byteLength)return!1;for(let tt=0;tt=255)throw new TypeError("Alphabet too long");for(var tt=new Uint8Array(256),nt=0;nt>>0,bt=new Uint8Array(vt);gt!==xt;){for(var Et=mt[gt],wt=0,kt=vt-1;(Et!==0||wt>>0,bt[kt]=Et%st>>>0,Et=Et/st>>>0;if(Et!==0)throw new Error("Non-zero carry");yt=wt,gt++}for(var Tt=vt-yt;Tt!==vt&&bt[Tt]===0;)Tt++;for(var Rt=at.repeat(ft);Tt>>0,vt=new Uint8Array(xt);mt[ft];){var bt=tt[mt.charCodeAt(ft)];if(bt===255)return;for(var Et=0,wt=xt-1;(bt!==0||Et>>0,vt[wt]=bt%256>>>0,bt=bt/256>>>0;if(bt!==0)throw new Error("Non-zero carry");gt=Et,ft++}if(mt[ft]!==" "){for(var kt=xt-gt;kt!==xt&&vt[kt]===0;)kt++;for(var Tt=new Uint8Array(yt+(xt-kt)),Rt=yt;kt!==xt;)Tt[Rt++]=vt[kt++];return Tt}}}function pt(mt){var ft=ht(mt);if(ft)return ft;throw new Error(`Non-${et} character`)}return{encode:dt,decodeUnsafe:ht,decode:pt}}var src$1=base$1,_brrp__multiformats_scope_baseX=src$1;let Encoder$2=class{constructor(et,tt,nt){Ct(this,"name");Ct(this,"prefix");Ct(this,"baseEncode");this.name=et,this.prefix=tt,this.baseEncode=nt}encode(et){if(et instanceof Uint8Array)return`${this.prefix}${this.baseEncode(et)}`;throw Error("Unknown type, must be binary type")}},Decoder$2=class{constructor(et,tt,nt){Ct(this,"name");Ct(this,"prefix");Ct(this,"baseDecode");Ct(this,"prefixCodePoint");this.name=et,this.prefix=tt;const rt=tt.codePointAt(0);if(rt===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=rt,this.baseDecode=nt}decode(et){if(typeof et=="string"){if(et.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(et)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(et.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(et){return or$2(this,et)}};class ComposedDecoder{constructor(et){Ct(this,"decoders");this.decoders=et}or(et){return or$2(this,et)}decode(et){const tt=et[0],nt=this.decoders[tt];if(nt!=null)return nt.decode(et);throw RangeError(`Unable to decode multibase string ${JSON.stringify(et)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}}function or$2(o,et){return new ComposedDecoder({...o.decoders??{[o.prefix]:o},...et.decoders??{[et.prefix]:et}})}class Codec{constructor(et,tt,nt,rt){Ct(this,"name");Ct(this,"prefix");Ct(this,"baseEncode");Ct(this,"baseDecode");Ct(this,"encoder");Ct(this,"decoder");this.name=et,this.prefix=tt,this.baseEncode=nt,this.baseDecode=rt,this.encoder=new Encoder$2(et,tt,nt),this.decoder=new Decoder$2(et,tt,rt)}encode(et){return this.encoder.encode(et)}decode(et){return this.decoder.decode(et)}}function from$2({name:o,prefix:et,encode:tt,decode:nt}){return new Codec(o,et,tt,nt)}function baseX({name:o,prefix:et,alphabet:tt}){const{encode:nt,decode:rt}=_brrp__multiformats_scope_baseX(tt,o);return from$2({prefix:et,name:o,encode:nt,decode:ot=>coerce(rt(ot))})}function decode$a(o,et,tt,nt){const rt={};for(let lt=0;lt=8&&(st-=8,it[ct++]=255&at>>st)}if(st>=tt||255&at<<8-st)throw new SyntaxError("Unexpected end of data");return it}function encode$9(o,et,tt){const nt=et[et.length-1]==="=",rt=(1<tt;)it-=tt,ot+=et[rt&st>>it];if(it!==0&&(ot+=et[rt&st<(o[tt]=et,o),[]),alphabetCharsToBytes=alphabet.reduce((o,et,tt)=>{const nt=et.codePointAt(0);if(nt==null)throw new Error(`Invalid character: ${et}`);return o[nt]=tt,o},[]);function encode$8(o){return o.reduce((et,tt)=>(et+=alphabetBytesToChars[tt],et),"")}function decode$9(o){const et=[];for(const tt of o){const nt=tt.codePointAt(0);if(nt==null)throw new Error(`Invalid character: ${tt}`);const rt=alphabetCharsToBytes[nt];if(rt==null)throw new Error(`Non-base256emoji character: ${tt}`);et.push(rt)}return new Uint8Array(et)}const base256emoji=from$2({prefix:"🚀",name:"base256emoji",encode:encode$8,decode:decode$9}),base256emoji$1=Object.freeze(Object.defineProperty({__proto__:null,base256emoji},Symbol.toStringTag,{value:"Module"})),base32$2=rfc4648({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),base32upper=rfc4648({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),base32pad=rfc4648({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),base32padupper=rfc4648({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),base32hex=rfc4648({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),base32hexupper=rfc4648({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),base32hexpad=rfc4648({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),base32hexpadupper=rfc4648({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),base32z=rfc4648({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5}),base32$3=Object.freeze(Object.defineProperty({__proto__:null,base32:base32$2,base32hex,base32hexpad,base32hexpadupper,base32hexupper,base32pad,base32padupper,base32upper,base32z},Symbol.toStringTag,{value:"Module"})),base36=baseX({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),base36upper=baseX({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"}),base36$1=Object.freeze(Object.defineProperty({__proto__:null,base36,base36upper},Symbol.toStringTag,{value:"Module"})),base58btc=baseX({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),base58flickr=baseX({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"}),base58=Object.freeze(Object.defineProperty({__proto__:null,base58btc,base58flickr},Symbol.toStringTag,{value:"Module"})),base64$2=rfc4648({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),base64pad=rfc4648({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),base64url=rfc4648({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),base64urlpad=rfc4648({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6}),base64$3=Object.freeze(Object.defineProperty({__proto__:null,base64:base64$2,base64pad,base64url,base64urlpad},Symbol.toStringTag,{value:"Module"})),base8=rfc4648({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3}),base8$1=Object.freeze(Object.defineProperty({__proto__:null,base8},Symbol.toStringTag,{value:"Module"})),identity$1=from$2({prefix:"\0",name:"identity",encode:o=>toString$9(o),decode:o=>fromString$1(o)}),identityBase=Object.freeze(Object.defineProperty({__proto__:null,identity:identity$1},Symbol.toStringTag,{value:"Module"}));new TextEncoder;new TextDecoder;var encode_1=encode$7,MSB$1=128,REST$1=127,MSBALL=~REST$1,INT=Math.pow(2,31);function encode$7(o,et,tt){et=et||[],tt=tt||0;for(var nt=tt;o>=INT;)et[tt++]=o&255|MSB$1,o/=128;for(;o&MSBALL;)et[tt++]=o&255|MSB$1,o>>>=7;return et[tt]=o|0,encode$7.bytes=tt-nt+1,et}var decode$8=read$1,MSB$1$1=128,REST$1$1=127;function read$1(o,nt){var tt=0,nt=nt||0,rt=0,ot=nt,it,st=o.length;do{if(ot>=st)throw read$1.bytes=0,new RangeError("Could not decode varint");it=o[ot++],tt+=rt<28?(it&REST$1$1)<=MSB$1$1);return read$1.bytes=ot-nt,tt}var N1=Math.pow(2,7),N2=Math.pow(2,14),N3=Math.pow(2,21),N4=Math.pow(2,28),N5=Math.pow(2,35),N6=Math.pow(2,42),N7=Math.pow(2,49),N8=Math.pow(2,56),N9=Math.pow(2,63),length=function(o){return ocreate$3(this.code,nt))}else throw Error("Unknown type, must be binary type")}}function sha(o){return async et=>new Uint8Array(await crypto.subtle.digest(o,et))}const sha256=from$1({name:"sha2-256",code:18,encode:sha("SHA-256")});function format(o,et){const{bytes:tt,version:nt}=o;switch(nt){case 0:return toStringV0(tt,baseCache(o),et??base58btc.encoder);default:return toStringV1(tt,baseCache(o),et??base32$2.encoder)}}const cache$1=new WeakMap;function baseCache(o){const et=cache$1.get(o);if(et==null){const tt=new Map;return cache$1.set(o,tt),tt}return et}var Qs;class CID{constructor(et,tt,nt,rt){Ct(this,"code");Ct(this,"version");Ct(this,"multihash");Ct(this,"bytes");Ct(this,"/");Ct(this,Qs,"CID");this.code=tt,this.version=et,this.multihash=nt,this.bytes=rt,this["/"]=rt}get asCID(){return this}get byteOffset(){return this.bytes.byteOffset}get byteLength(){return this.bytes.byteLength}toV0(){switch(this.version){case 0:return this;case 1:{const{code:et,multihash:tt}=this;if(et!==DAG_PB_CODE)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(tt.code!==SHA_256_CODE)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return CID.createV0(tt)}default:throw Error(`Can not convert CID version ${this.version} to version 0. This is a bug please report`)}}toV1(){switch(this.version){case 0:{const{code:et,digest:tt}=this.multihash,nt=create$3(et,tt);return CID.createV1(this.code,nt)}case 1:return this;default:throw Error(`Can not convert CID version ${this.version} to version 1. This is a bug please report`)}}equals(et){return CID.equals(this,et)}static equals(et,tt){const nt=tt;return nt!=null&&et.code===nt.code&&et.version===nt.version&&equals$1(et.multihash,nt.multihash)}toString(et){return format(this,et)}toJSON(){return{"/":format(this)}}link(){return this}[(Qs=Symbol.toStringTag,Symbol.for("nodejs.util.inspect.custom"))](){return`CID(${this.toString()})`}static asCID(et){if(et==null)return null;const tt=et;if(tt instanceof CID)return tt;if(tt["/"]!=null&&tt["/"]===tt.bytes||tt.asCID===tt){const{version:nt,code:rt,multihash:ot,bytes:it}=tt;return new CID(nt,rt,ot,it??encodeCID(nt,rt,ot.bytes))}else if(tt[cidSymbol]===!0){const{version:nt,multihash:rt,code:ot}=tt,it=decode$6(rt);return CID.create(nt,ot,it)}else return null}static create(et,tt,nt){if(typeof tt!="number")throw new Error("String codecs are no longer supported");if(!(nt.bytes instanceof Uint8Array))throw new Error("Invalid digest");switch(et){case 0:{if(tt!==DAG_PB_CODE)throw new Error(`Version 0 CID must use dag-pb (code: ${DAG_PB_CODE}) block encoding`);return new CID(et,tt,nt,nt.bytes)}case 1:{const rt=encodeCID(et,tt,nt.bytes);return new CID(et,tt,nt,rt)}default:throw new Error("Invalid version")}}static createV0(et){return CID.create(0,DAG_PB_CODE,et)}static createV1(et,tt){return CID.create(1,et,tt)}static decode(et){const[tt,nt]=CID.decodeFirst(et);if(nt.length!==0)throw new Error("Incorrect length");return tt}static decodeFirst(et){const tt=CID.inspectBytes(et),nt=tt.size-tt.multihashSize,rt=coerce(et.subarray(nt,nt+tt.multihashSize));if(rt.byteLength!==tt.multihashSize)throw new Error("Incorrect length");const ot=rt.subarray(tt.multihashSize-tt.digestSize),it=new Digest(tt.multihashCode,tt.digestSize,ot,rt);return[tt.version===0?CID.createV0(it):CID.createV1(tt.codec,it),et.subarray(tt.size)]}static inspectBytes(et){let tt=0;const nt=()=>{const[dt,ht]=decode$7(et.subarray(tt));return tt+=ht,dt};let rt=nt(),ot=DAG_PB_CODE;if(rt===18?(rt=0,tt=0):ot=nt(),rt!==0&&rt!==1)throw new RangeError(`Invalid CID version ${rt}`);const it=tt,st=nt(),at=nt(),ct=tt+at,lt=ct-it;return{version:rt,codec:ot,multihashCode:st,digestSize:at,multihashSize:lt,size:ct}}static parse(et,tt){const[nt,rt]=parseCIDtoBytes(et,tt),ot=CID.decode(rt);if(ot.version===0&&et[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return baseCache(ot).set(nt,et),ot}}function parseCIDtoBytes(o,et){switch(o[0]){case"Q":{const tt=et??base58btc;return[base58btc.prefix,tt.decode(`${base58btc.prefix}${o}`)]}case base58btc.prefix:{const tt=et??base58btc;return[base58btc.prefix,tt.decode(o)]}case base32$2.prefix:{const tt=et??base32$2;return[base32$2.prefix,tt.decode(o)]}case base36.prefix:{const tt=et??base36;return[base36.prefix,tt.decode(o)]}default:{if(et==null)throw Error("To parse non base32, base36 or base58btc encoded CID multibase decoder must be provided");return[o[0],et.decode(o)]}}}function toStringV0(o,et,tt){const{prefix:nt}=tt;if(nt!==base58btc.prefix)throw Error(`Cannot string encode V0 in ${tt.name} encoding`);const rt=et.get(nt);if(rt==null){const ot=tt.encode(o).slice(1);return et.set(nt,ot),ot}else return rt}function toStringV1(o,et,tt){const{prefix:nt}=tt,rt=et.get(nt);if(rt==null){const ot=tt.encode(o);return et.set(nt,ot),ot}else return rt}const DAG_PB_CODE=112,SHA_256_CODE=18;function encodeCID(o,et,tt){const nt=encodingLength$2(o),rt=nt+encodingLength$2(et),ot=new Uint8Array(rt+tt.byteLength);return encodeTo(o,ot,0),encodeTo(et,ot,nt),ot.set(tt,rt),ot}const cidSymbol=Symbol.for("@ipld/js-cid/CID"),bases={...identityBase,...base2$1,...base8$1,...base10$1,...base16$1,...base32$3,...base36$1,...base58,...base64$3,...base256emoji$1};function createCodec$1(o,et,tt,nt){return{name:o,prefix:et,encoder:{name:o,prefix:et,encode:tt},decoder:{decode:nt}}}const string$4=createCodec$1("utf8","u",o=>"u"+new TextDecoder("utf8").decode(o),o=>new TextEncoder().encode(o.substring(1))),ascii=createCodec$1("ascii","a",o=>{let et="a";for(let tt=0;tt{o=o.substring(1);const et=allocUnsafe(o.length);for(let tt=0;tt4096)return allocUnsafe(it);rt+it>8192&&(nt=allocUnsafe(8192),rt=0);const st=nt.subarray(rt,rt+=it);return rt&7&&(rt=(rt|7)+1),st}}let Op$1=class{constructor(et,tt,nt){Ct(this,"fn");Ct(this,"len");Ct(this,"next");Ct(this,"val");this.fn=et,this.len=tt,this.next=void 0,this.val=nt}};function noop$2(){}let State$1=class{constructor(et){Ct(this,"head");Ct(this,"tail");Ct(this,"len");Ct(this,"next");this.head=et.head,this.tail=et.tail,this.len=et.len,this.next=et.states}};const bufferPool=pool$1();function alloc$1(o){return globalThis.Buffer!=null?allocUnsafe(o):bufferPool(o)}class Uint8ArrayWriter{constructor(){Ct(this,"len");Ct(this,"head");Ct(this,"tail");Ct(this,"states");this.len=0,this.head=new Op$1(noop$2,0,0),this.tail=this.head,this.states=null}_push(et,tt,nt){return this.tail=this.tail.next=new Op$1(et,tt,nt),this.len+=tt,this}uint32(et){return this.len+=(this.tail=this.tail.next=new VarintOp$1((et=et>>>0)<128?1:et<16384?2:et<2097152?3:et<268435456?4:5,et)).len,this}int32(et){return et<0?this._push(writeVarint64$1,10,LongBits$2.fromNumber(et)):this.uint32(et)}sint32(et){return this.uint32((et<<1^et>>31)>>>0)}uint64(et){const tt=LongBits$2.fromBigInt(et);return this._push(writeVarint64$1,tt.length(),tt)}uint64Number(et){return this._push(encodeUint8Array,encodingLength$3(et),et)}uint64String(et){return this.uint64(BigInt(et))}int64(et){return this.uint64(et)}int64Number(et){return this.uint64Number(et)}int64String(et){return this.uint64String(et)}sint64(et){const tt=LongBits$2.fromBigInt(et).zzEncode();return this._push(writeVarint64$1,tt.length(),tt)}sint64Number(et){const tt=LongBits$2.fromNumber(et).zzEncode();return this._push(writeVarint64$1,tt.length(),tt)}sint64String(et){return this.sint64(BigInt(et))}bool(et){return this._push(writeByte$1,1,et?1:0)}fixed32(et){return this._push(writeFixed32$1,4,et>>>0)}sfixed32(et){return this.fixed32(et)}fixed64(et){const tt=LongBits$2.fromBigInt(et);return this._push(writeFixed32$1,4,tt.lo)._push(writeFixed32$1,4,tt.hi)}fixed64Number(et){const tt=LongBits$2.fromNumber(et);return this._push(writeFixed32$1,4,tt.lo)._push(writeFixed32$1,4,tt.hi)}fixed64String(et){return this.fixed64(BigInt(et))}sfixed64(et){return this.fixed64(et)}sfixed64Number(et){return this.fixed64Number(et)}sfixed64String(et){return this.fixed64String(et)}float(et){return this._push(writeFloatLE,4,et)}double(et){return this._push(writeDoubleLE,8,et)}bytes(et){const tt=et.length>>>0;return tt===0?this._push(writeByte$1,1,0):this.uint32(tt)._push(writeBytes$1,tt,et)}string(et){const tt=length$1(et);return tt!==0?this.uint32(tt)._push(write$2,tt,et):this._push(writeByte$1,1,0)}fork(){return this.states=new State$1(this),this.head=this.tail=new Op$1(noop$2,0,0),this.len=0,this}reset(){return this.states!=null?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new Op$1(noop$2,0,0),this.len=0),this}ldelim(){const et=this.head,tt=this.tail,nt=this.len;return this.reset().uint32(nt),nt!==0&&(this.tail.next=et.next,this.tail=tt,this.len+=nt),this}finish(){let et=this.head.next;const tt=alloc$1(this.len);let nt=0;for(;et!=null;)et.fn(et.val,tt,nt),nt+=et.len,et=et.next;return tt}}function writeByte$1(o,et,tt){et[tt]=o&255}function writeVarint32$1(o,et,tt){for(;o>127;)et[tt++]=o&127|128,o>>>=7;et[tt]=o}let VarintOp$1=class extends Op$1{constructor(tt,nt){super(writeVarint32$1,tt,nt);Ct(this,"next");this.next=void 0}};function writeVarint64$1(o,et,tt){for(;o.hi!==0;)et[tt++]=o.lo&127|128,o.lo=(o.lo>>>7|o.hi<<25)>>>0,o.hi>>>=7;for(;o.lo>127;)et[tt++]=o.lo&127|128,o.lo=o.lo>>>7;et[tt++]=o.lo}function writeFixed32$1(o,et,tt){et[tt]=o&255,et[tt+1]=o>>>8&255,et[tt+2]=o>>>16&255,et[tt+3]=o>>>24}function writeBytes$1(o,et,tt){et.set(o,tt)}globalThis.Buffer!=null&&(Uint8ArrayWriter.prototype.bytes=function(o){const et=o.length>>>0;return this.uint32(et),et>0&&this._push(writeBytesBuffer,et,o),this},Uint8ArrayWriter.prototype.string=function(o){const et=globalThis.Buffer.byteLength(o);return this.uint32(et),et>0&&this._push(writeStringBuffer$1,et,o),this});function writeBytesBuffer(o,et,tt){et.set(o,tt)}function writeStringBuffer$1(o,et,tt){o.length<40?write$2(o,et,tt):et.utf8Write!=null?et.utf8Write(o,tt):et.set(fromString(o),tt)}function createWriter(){return new Uint8ArrayWriter}function encodeMessage(o,et){const tt=createWriter();return et.encode(o,tt,{lengthDelimited:!1}),tt.finish()}var CODEC_TYPES;(function(o){o[o.VARINT=0]="VARINT",o[o.BIT64=1]="BIT64",o[o.LENGTH_DELIMITED=2]="LENGTH_DELIMITED",o[o.START_GROUP=3]="START_GROUP",o[o.END_GROUP=4]="END_GROUP",o[o.BIT32=5]="BIT32"})(CODEC_TYPES||(CODEC_TYPES={}));function createCodec(o,et,tt,nt){return{name:o,type:et,encode:tt,decode:nt}}function enumeration(o){function et(rt){if(o[rt.toString()]==null)throw new Error("Invalid enum value");return o[rt]}const tt=function(ot,it){const st=et(ot);it.int32(st)},nt=function(ot){const it=ot.int32();return et(it)};return createCodec("enum",CODEC_TYPES.VARINT,tt,nt)}function message$1(o,et){return createCodec("message",CODEC_TYPES.LENGTH_DELIMITED,o,et)}class MaxLengthError extends Error{constructor(){super(...arguments);Ct(this,"code","ERR_MAX_LENGTH");Ct(this,"name","MaxLengthError")}}class MaxSizeError extends Error{constructor(){super(...arguments);Ct(this,"code","ERR_MAX_SIZE");Ct(this,"name","MaxSizeError")}}var RateLimitProof$4;(function(o){let et;o.codec=()=>(et==null&&(et=message$1((tt,nt,rt={})=>{rt.lengthDelimited!==!1&&nt.fork(),tt.proof!=null&&tt.proof.byteLength>0&&(nt.uint32(10),nt.bytes(tt.proof)),tt.merkleRoot!=null&&tt.merkleRoot.byteLength>0&&(nt.uint32(18),nt.bytes(tt.merkleRoot)),tt.epoch!=null&&tt.epoch.byteLength>0&&(nt.uint32(26),nt.bytes(tt.epoch)),tt.shareX!=null&&tt.shareX.byteLength>0&&(nt.uint32(34),nt.bytes(tt.shareX)),tt.shareY!=null&&tt.shareY.byteLength>0&&(nt.uint32(42),nt.bytes(tt.shareY)),tt.nullifier!=null&&tt.nullifier.byteLength>0&&(nt.uint32(50),nt.bytes(tt.nullifier)),tt.rlnIdentifier!=null&&tt.rlnIdentifier.byteLength>0&&(nt.uint32(58),nt.bytes(tt.rlnIdentifier)),rt.lengthDelimited!==!1&&nt.ldelim()},(tt,nt,rt={})=>{const ot={proof:alloc$2(0),merkleRoot:alloc$2(0),epoch:alloc$2(0),shareX:alloc$2(0),shareY:alloc$2(0),nullifier:alloc$2(0),rlnIdentifier:alloc$2(0)},it=nt==null?tt.len:tt.pos+nt;for(;tt.pos>>3){case 1:{ot.proof=tt.bytes();break}case 2:{ot.merkleRoot=tt.bytes();break}case 3:{ot.epoch=tt.bytes();break}case 4:{ot.shareX=tt.bytes();break}case 5:{ot.shareY=tt.bytes();break}case 6:{ot.nullifier=tt.bytes();break}case 7:{ot.rlnIdentifier=tt.bytes();break}default:{tt.skipType(st&7);break}}}return ot})),et),o.encode=tt=>encodeMessage(tt,o.codec()),o.decode=(tt,nt)=>decodeMessage(tt,o.codec(),nt)})(RateLimitProof$4||(RateLimitProof$4={}));var WakuMessage$4;(function(o){let et;o.codec=()=>(et==null&&(et=message$1((tt,nt,rt={})=>{rt.lengthDelimited!==!1&&nt.fork(),tt.payload!=null&&tt.payload.byteLength>0&&(nt.uint32(10),nt.bytes(tt.payload)),tt.contentTopic!=null&&tt.contentTopic!==""&&(nt.uint32(18),nt.string(tt.contentTopic)),tt.version!=null&&(nt.uint32(24),nt.uint32(tt.version)),tt.timestamp!=null&&(nt.uint32(80),nt.sint64(tt.timestamp)),tt.meta!=null&&(nt.uint32(90),nt.bytes(tt.meta)),tt.rateLimitProof!=null&&(nt.uint32(170),RateLimitProof$4.codec().encode(tt.rateLimitProof,nt)),tt.ephemeral!=null&&(nt.uint32(248),nt.bool(tt.ephemeral)),rt.lengthDelimited!==!1&&nt.ldelim()},(tt,nt,rt={})=>{var st;const ot={payload:alloc$2(0),contentTopic:""},it=nt==null?tt.len:tt.pos+nt;for(;tt.pos>>3){case 1:{ot.payload=tt.bytes();break}case 2:{ot.contentTopic=tt.string();break}case 3:{ot.version=tt.uint32();break}case 10:{ot.timestamp=tt.sint64();break}case 11:{ot.meta=tt.bytes();break}case 21:{ot.rateLimitProof=RateLimitProof$4.codec().decode(tt,tt.uint32(),{limits:(st=rt.limits)==null?void 0:st.rateLimitProof});break}case 31:{ot.ephemeral=tt.bool();break}default:{tt.skipType(at&7);break}}}return ot})),et),o.encode=tt=>encodeMessage(tt,o.codec()),o.decode=(tt,nt)=>decodeMessage(tt,o.codec(),nt)})(WakuMessage$4||(WakuMessage$4={}));var FilterRequest;(function(o){(function(tt){let nt;tt.codec=()=>(nt==null&&(nt=message$1((rt,ot,it={})=>{it.lengthDelimited!==!1&&ot.fork(),rt.contentTopic!=null&&rt.contentTopic!==""&&(ot.uint32(10),ot.string(rt.contentTopic)),it.lengthDelimited!==!1&&ot.ldelim()},(rt,ot,it={})=>{const st={contentTopic:""},at=ot==null?rt.len:rt.pos+ot;for(;rt.pos>>3){case 1:{st.contentTopic=rt.string();break}default:{rt.skipType(ct&7);break}}}return st})),nt),tt.encode=rt=>encodeMessage(rt,tt.codec()),tt.decode=(rt,ot)=>decodeMessage(rt,tt.codec(),ot)})(o.ContentFilter||(o.ContentFilter={}));let et;o.codec=()=>(et==null&&(et=message$1((tt,nt,rt={})=>{if(rt.lengthDelimited!==!1&&nt.fork(),tt.subscribe!=null&&tt.subscribe!==!1&&(nt.uint32(8),nt.bool(tt.subscribe)),tt.topic!=null&&tt.topic!==""&&(nt.uint32(18),nt.string(tt.topic)),tt.contentFilters!=null)for(const ot of tt.contentFilters)nt.uint32(26),o.ContentFilter.codec().encode(ot,nt);rt.lengthDelimited!==!1&&nt.ldelim()},(tt,nt,rt={})=>{var st,at;const ot={subscribe:!1,topic:"",contentFilters:[]},it=nt==null?tt.len:tt.pos+nt;for(;tt.pos>>3){case 1:{ot.subscribe=tt.bool();break}case 2:{ot.topic=tt.string();break}case 3:{if(((st=rt.limits)==null?void 0:st.contentFilters)!=null&&ot.contentFilters.length===rt.limits.contentFilters)throw new MaxLengthError('Decode error - map field "contentFilters" had too many elements');ot.contentFilters.push(o.ContentFilter.codec().decode(tt,tt.uint32(),{limits:(at=rt.limits)==null?void 0:at.contentFilters$}));break}default:{tt.skipType(ct&7);break}}}return ot})),et),o.encode=tt=>encodeMessage(tt,o.codec()),o.decode=(tt,nt)=>decodeMessage(tt,o.codec(),nt)})(FilterRequest||(FilterRequest={}));var MessagePush$1;(function(o){let et;o.codec=()=>(et==null&&(et=message$1((tt,nt,rt={})=>{if(rt.lengthDelimited!==!1&&nt.fork(),tt.messages!=null)for(const ot of tt.messages)nt.uint32(10),WakuMessage$3.codec().encode(ot,nt);rt.lengthDelimited!==!1&&nt.ldelim()},(tt,nt,rt={})=>{var st,at;const ot={messages:[]},it=nt==null?tt.len:tt.pos+nt;for(;tt.pos>>3){case 1:{if(((st=rt.limits)==null?void 0:st.messages)!=null&&ot.messages.length===rt.limits.messages)throw new MaxLengthError('Decode error - map field "messages" had too many elements');ot.messages.push(WakuMessage$3.codec().decode(tt,tt.uint32(),{limits:(at=rt.limits)==null?void 0:at.messages$}));break}default:{tt.skipType(ct&7);break}}}return ot})),et),o.encode=tt=>encodeMessage(tt,o.codec()),o.decode=(tt,nt)=>decodeMessage(tt,o.codec(),nt)})(MessagePush$1||(MessagePush$1={}));var FilterRpc;(function(o){let et;o.codec=()=>(et==null&&(et=message$1((tt,nt,rt={})=>{rt.lengthDelimited!==!1&&nt.fork(),tt.requestId!=null&&tt.requestId!==""&&(nt.uint32(10),nt.string(tt.requestId)),tt.request!=null&&(nt.uint32(18),FilterRequest.codec().encode(tt.request,nt)),tt.push!=null&&(nt.uint32(26),MessagePush$1.codec().encode(tt.push,nt)),rt.lengthDelimited!==!1&&nt.ldelim()},(tt,nt,rt={})=>{var st,at;const ot={requestId:""},it=nt==null?tt.len:tt.pos+nt;for(;tt.pos>>3){case 1:{ot.requestId=tt.string();break}case 2:{ot.request=FilterRequest.codec().decode(tt,tt.uint32(),{limits:(st=rt.limits)==null?void 0:st.request});break}case 3:{ot.push=MessagePush$1.codec().decode(tt,tt.uint32(),{limits:(at=rt.limits)==null?void 0:at.push});break}default:{tt.skipType(ct&7);break}}}return ot})),et),o.encode=tt=>encodeMessage(tt,o.codec()),o.decode=(tt,nt)=>decodeMessage(tt,o.codec(),nt)})(FilterRpc||(FilterRpc={}));var RateLimitProof$3;(function(o){let et;o.codec=()=>(et==null&&(et=message$1((tt,nt,rt={})=>{rt.lengthDelimited!==!1&&nt.fork(),tt.proof!=null&&tt.proof.byteLength>0&&(nt.uint32(10),nt.bytes(tt.proof)),tt.merkleRoot!=null&&tt.merkleRoot.byteLength>0&&(nt.uint32(18),nt.bytes(tt.merkleRoot)),tt.epoch!=null&&tt.epoch.byteLength>0&&(nt.uint32(26),nt.bytes(tt.epoch)),tt.shareX!=null&&tt.shareX.byteLength>0&&(nt.uint32(34),nt.bytes(tt.shareX)),tt.shareY!=null&&tt.shareY.byteLength>0&&(nt.uint32(42),nt.bytes(tt.shareY)),tt.nullifier!=null&&tt.nullifier.byteLength>0&&(nt.uint32(50),nt.bytes(tt.nullifier)),tt.rlnIdentifier!=null&&tt.rlnIdentifier.byteLength>0&&(nt.uint32(58),nt.bytes(tt.rlnIdentifier)),rt.lengthDelimited!==!1&&nt.ldelim()},(tt,nt,rt={})=>{const ot={proof:alloc$2(0),merkleRoot:alloc$2(0),epoch:alloc$2(0),shareX:alloc$2(0),shareY:alloc$2(0),nullifier:alloc$2(0),rlnIdentifier:alloc$2(0)},it=nt==null?tt.len:tt.pos+nt;for(;tt.pos>>3){case 1:{ot.proof=tt.bytes();break}case 2:{ot.merkleRoot=tt.bytes();break}case 3:{ot.epoch=tt.bytes();break}case 4:{ot.shareX=tt.bytes();break}case 5:{ot.shareY=tt.bytes();break}case 6:{ot.nullifier=tt.bytes();break}case 7:{ot.rlnIdentifier=tt.bytes();break}default:{tt.skipType(st&7);break}}}return ot})),et),o.encode=tt=>encodeMessage(tt,o.codec()),o.decode=(tt,nt)=>decodeMessage(tt,o.codec(),nt)})(RateLimitProof$3||(RateLimitProof$3={}));var WakuMessage$3;(function(o){let et;o.codec=()=>(et==null&&(et=message$1((tt,nt,rt={})=>{rt.lengthDelimited!==!1&&nt.fork(),tt.payload!=null&&tt.payload.byteLength>0&&(nt.uint32(10),nt.bytes(tt.payload)),tt.contentTopic!=null&&tt.contentTopic!==""&&(nt.uint32(18),nt.string(tt.contentTopic)),tt.version!=null&&(nt.uint32(24),nt.uint32(tt.version)),tt.timestamp!=null&&(nt.uint32(80),nt.sint64(tt.timestamp)),tt.meta!=null&&(nt.uint32(90),nt.bytes(tt.meta)),tt.rateLimitProof!=null&&(nt.uint32(170),RateLimitProof$3.codec().encode(tt.rateLimitProof,nt)),tt.ephemeral!=null&&(nt.uint32(248),nt.bool(tt.ephemeral)),rt.lengthDelimited!==!1&&nt.ldelim()},(tt,nt,rt={})=>{var st;const ot={payload:alloc$2(0),contentTopic:""},it=nt==null?tt.len:tt.pos+nt;for(;tt.pos>>3){case 1:{ot.payload=tt.bytes();break}case 2:{ot.contentTopic=tt.string();break}case 3:{ot.version=tt.uint32();break}case 10:{ot.timestamp=tt.sint64();break}case 11:{ot.meta=tt.bytes();break}case 21:{ot.rateLimitProof=RateLimitProof$3.codec().decode(tt,tt.uint32(),{limits:(st=rt.limits)==null?void 0:st.rateLimitProof});break}case 31:{ot.ephemeral=tt.bool();break}default:{tt.skipType(at&7);break}}}return ot})),et),o.encode=tt=>encodeMessage(tt,o.codec()),o.decode=(tt,nt)=>decodeMessage(tt,o.codec(),nt)})(WakuMessage$3||(WakuMessage$3={}));var TopicOnlyMessage;(function(o){let et;o.codec=()=>(et==null&&(et=message$1((tt,nt,rt={})=>{rt.lengthDelimited!==!1&&nt.fork(),tt.contentTopic!=null&&tt.contentTopic!==""&&(nt.uint32(18),nt.string(tt.contentTopic)),rt.lengthDelimited!==!1&&nt.ldelim()},(tt,nt,rt={})=>{const ot={contentTopic:""},it=nt==null?tt.len:tt.pos+nt;for(;tt.pos>>3){case 2:{ot.contentTopic=tt.string();break}default:{tt.skipType(st&7);break}}}return ot})),et),o.encode=tt=>encodeMessage(tt,o.codec()),o.decode=(tt,nt)=>decodeMessage(tt,o.codec(),nt)})(TopicOnlyMessage||(TopicOnlyMessage={}));var FilterSubscribeRequest;(function(o){let et;(function(rt){rt.SUBSCRIBER_PING="SUBSCRIBER_PING",rt.SUBSCRIBE="SUBSCRIBE",rt.UNSUBSCRIBE="UNSUBSCRIBE",rt.UNSUBSCRIBE_ALL="UNSUBSCRIBE_ALL"})(et=o.FilterSubscribeType||(o.FilterSubscribeType={}));let tt;(function(rt){rt[rt.SUBSCRIBER_PING=0]="SUBSCRIBER_PING",rt[rt.SUBSCRIBE=1]="SUBSCRIBE",rt[rt.UNSUBSCRIBE=2]="UNSUBSCRIBE",rt[rt.UNSUBSCRIBE_ALL=3]="UNSUBSCRIBE_ALL"})(tt||(tt={})),function(rt){rt.codec=()=>enumeration(tt)}(et=o.FilterSubscribeType||(o.FilterSubscribeType={}));let nt;o.codec=()=>(nt==null&&(nt=message$1((rt,ot,it={})=>{if(it.lengthDelimited!==!1&&ot.fork(),rt.requestId!=null&&rt.requestId!==""&&(ot.uint32(10),ot.string(rt.requestId)),rt.filterSubscribeType!=null&&tt[rt.filterSubscribeType]!==0&&(ot.uint32(16),o.FilterSubscribeType.codec().encode(rt.filterSubscribeType,ot)),rt.pubsubTopic!=null&&(ot.uint32(82),ot.string(rt.pubsubTopic)),rt.contentTopics!=null)for(const st of rt.contentTopics)ot.uint32(90),ot.string(st);it.lengthDelimited!==!1&&ot.ldelim()},(rt,ot,it={})=>{var ct;const st={requestId:"",filterSubscribeType:et.SUBSCRIBER_PING,contentTopics:[]},at=ot==null?rt.len:rt.pos+ot;for(;rt.pos>>3){case 1:{st.requestId=rt.string();break}case 2:{st.filterSubscribeType=o.FilterSubscribeType.codec().decode(rt);break}case 10:{st.pubsubTopic=rt.string();break}case 11:{if(((ct=it.limits)==null?void 0:ct.contentTopics)!=null&&st.contentTopics.length===it.limits.contentTopics)throw new MaxLengthError('Decode error - map field "contentTopics" had too many elements');st.contentTopics.push(rt.string());break}default:{rt.skipType(lt&7);break}}}return st})),nt),o.encode=rt=>encodeMessage(rt,o.codec()),o.decode=(rt,ot)=>decodeMessage(rt,o.codec(),ot)})(FilterSubscribeRequest||(FilterSubscribeRequest={}));var FilterSubscribeResponse$1;(function(o){let et;o.codec=()=>(et==null&&(et=message$1((tt,nt,rt={})=>{rt.lengthDelimited!==!1&&nt.fork(),tt.requestId!=null&&tt.requestId!==""&&(nt.uint32(10),nt.string(tt.requestId)),tt.statusCode!=null&&tt.statusCode!==0&&(nt.uint32(80),nt.uint32(tt.statusCode)),tt.statusDesc!=null&&(nt.uint32(90),nt.string(tt.statusDesc)),rt.lengthDelimited!==!1&&nt.ldelim()},(tt,nt,rt={})=>{const ot={requestId:"",statusCode:0},it=nt==null?tt.len:tt.pos+nt;for(;tt.pos>>3){case 1:{ot.requestId=tt.string();break}case 10:{ot.statusCode=tt.uint32();break}case 11:{ot.statusDesc=tt.string();break}default:{tt.skipType(st&7);break}}}return ot})),et),o.encode=tt=>encodeMessage(tt,o.codec()),o.decode=(tt,nt)=>decodeMessage(tt,o.codec(),nt)})(FilterSubscribeResponse$1||(FilterSubscribeResponse$1={}));var MessagePush;(function(o){let et;o.codec=()=>(et==null&&(et=message$1((tt,nt,rt={})=>{rt.lengthDelimited!==!1&&nt.fork(),tt.wakuMessage!=null&&(nt.uint32(10),WakuMessage$2.codec().encode(tt.wakuMessage,nt)),tt.pubsubTopic!=null&&(nt.uint32(18),nt.string(tt.pubsubTopic)),rt.lengthDelimited!==!1&&nt.ldelim()},(tt,nt,rt={})=>{var st;const ot={},it=nt==null?tt.len:tt.pos+nt;for(;tt.pos>>3){case 1:{ot.wakuMessage=WakuMessage$2.codec().decode(tt,tt.uint32(),{limits:(st=rt.limits)==null?void 0:st.wakuMessage});break}case 2:{ot.pubsubTopic=tt.string();break}default:{tt.skipType(at&7);break}}}return ot})),et),o.encode=tt=>encodeMessage(tt,o.codec()),o.decode=(tt,nt)=>decodeMessage(tt,o.codec(),nt)})(MessagePush||(MessagePush={}));var RateLimitProof$2;(function(o){let et;o.codec=()=>(et==null&&(et=message$1((tt,nt,rt={})=>{rt.lengthDelimited!==!1&&nt.fork(),tt.proof!=null&&tt.proof.byteLength>0&&(nt.uint32(10),nt.bytes(tt.proof)),tt.merkleRoot!=null&&tt.merkleRoot.byteLength>0&&(nt.uint32(18),nt.bytes(tt.merkleRoot)),tt.epoch!=null&&tt.epoch.byteLength>0&&(nt.uint32(26),nt.bytes(tt.epoch)),tt.shareX!=null&&tt.shareX.byteLength>0&&(nt.uint32(34),nt.bytes(tt.shareX)),tt.shareY!=null&&tt.shareY.byteLength>0&&(nt.uint32(42),nt.bytes(tt.shareY)),tt.nullifier!=null&&tt.nullifier.byteLength>0&&(nt.uint32(50),nt.bytes(tt.nullifier)),tt.rlnIdentifier!=null&&tt.rlnIdentifier.byteLength>0&&(nt.uint32(58),nt.bytes(tt.rlnIdentifier)),rt.lengthDelimited!==!1&&nt.ldelim()},(tt,nt,rt={})=>{const ot={proof:alloc$2(0),merkleRoot:alloc$2(0),epoch:alloc$2(0),shareX:alloc$2(0),shareY:alloc$2(0),nullifier:alloc$2(0),rlnIdentifier:alloc$2(0)},it=nt==null?tt.len:tt.pos+nt;for(;tt.pos>>3){case 1:{ot.proof=tt.bytes();break}case 2:{ot.merkleRoot=tt.bytes();break}case 3:{ot.epoch=tt.bytes();break}case 4:{ot.shareX=tt.bytes();break}case 5:{ot.shareY=tt.bytes();break}case 6:{ot.nullifier=tt.bytes();break}case 7:{ot.rlnIdentifier=tt.bytes();break}default:{tt.skipType(st&7);break}}}return ot})),et),o.encode=tt=>encodeMessage(tt,o.codec()),o.decode=(tt,nt)=>decodeMessage(tt,o.codec(),nt)})(RateLimitProof$2||(RateLimitProof$2={}));var WakuMessage$2;(function(o){let et;o.codec=()=>(et==null&&(et=message$1((tt,nt,rt={})=>{rt.lengthDelimited!==!1&&nt.fork(),tt.payload!=null&&tt.payload.byteLength>0&&(nt.uint32(10),nt.bytes(tt.payload)),tt.contentTopic!=null&&tt.contentTopic!==""&&(nt.uint32(18),nt.string(tt.contentTopic)),tt.version!=null&&(nt.uint32(24),nt.uint32(tt.version)),tt.timestamp!=null&&(nt.uint32(80),nt.sint64(tt.timestamp)),tt.meta!=null&&(nt.uint32(90),nt.bytes(tt.meta)),tt.rateLimitProof!=null&&(nt.uint32(170),RateLimitProof$2.codec().encode(tt.rateLimitProof,nt)),tt.ephemeral!=null&&(nt.uint32(248),nt.bool(tt.ephemeral)),rt.lengthDelimited!==!1&&nt.ldelim()},(tt,nt,rt={})=>{var st;const ot={payload:alloc$2(0),contentTopic:""},it=nt==null?tt.len:tt.pos+nt;for(;tt.pos>>3){case 1:{ot.payload=tt.bytes();break}case 2:{ot.contentTopic=tt.string();break}case 3:{ot.version=tt.uint32();break}case 10:{ot.timestamp=tt.sint64();break}case 11:{ot.meta=tt.bytes();break}case 21:{ot.rateLimitProof=RateLimitProof$2.codec().decode(tt,tt.uint32(),{limits:(st=rt.limits)==null?void 0:st.rateLimitProof});break}case 31:{ot.ephemeral=tt.bool();break}default:{tt.skipType(at&7);break}}}return ot})),et),o.encode=tt=>encodeMessage(tt,o.codec()),o.decode=(tt,nt)=>decodeMessage(tt,o.codec(),nt)})(WakuMessage$2||(WakuMessage$2={}));var PushRequest;(function(o){let et;o.codec=()=>(et==null&&(et=message$1((tt,nt,rt={})=>{rt.lengthDelimited!==!1&&nt.fork(),tt.pubsubTopic!=null&&tt.pubsubTopic!==""&&(nt.uint32(10),nt.string(tt.pubsubTopic)),tt.message!=null&&(nt.uint32(18),WakuMessage$1.codec().encode(tt.message,nt)),rt.lengthDelimited!==!1&&nt.ldelim()},(tt,nt,rt={})=>{var st;const ot={pubsubTopic:""},it=nt==null?tt.len:tt.pos+nt;for(;tt.pos>>3){case 1:{ot.pubsubTopic=tt.string();break}case 2:{ot.message=WakuMessage$1.codec().decode(tt,tt.uint32(),{limits:(st=rt.limits)==null?void 0:st.message});break}default:{tt.skipType(at&7);break}}}return ot})),et),o.encode=tt=>encodeMessage(tt,o.codec()),o.decode=(tt,nt)=>decodeMessage(tt,o.codec(),nt)})(PushRequest||(PushRequest={}));var PushResponse;(function(o){let et;o.codec=()=>(et==null&&(et=message$1((tt,nt,rt={})=>{rt.lengthDelimited!==!1&&nt.fork(),tt.isSuccess!=null&&tt.isSuccess!==!1&&(nt.uint32(8),nt.bool(tt.isSuccess)),tt.info!=null&&(nt.uint32(18),nt.string(tt.info)),rt.lengthDelimited!==!1&&nt.ldelim()},(tt,nt,rt={})=>{const ot={isSuccess:!1},it=nt==null?tt.len:tt.pos+nt;for(;tt.pos>>3){case 1:{ot.isSuccess=tt.bool();break}case 2:{ot.info=tt.string();break}default:{tt.skipType(st&7);break}}}return ot})),et),o.encode=tt=>encodeMessage(tt,o.codec()),o.decode=(tt,nt)=>decodeMessage(tt,o.codec(),nt)})(PushResponse||(PushResponse={}));var PushRpc$1;(function(o){let et;o.codec=()=>(et==null&&(et=message$1((tt,nt,rt={})=>{rt.lengthDelimited!==!1&&nt.fork(),tt.requestId!=null&&tt.requestId!==""&&(nt.uint32(10),nt.string(tt.requestId)),tt.request!=null&&(nt.uint32(18),PushRequest.codec().encode(tt.request,nt)),tt.response!=null&&(nt.uint32(26),PushResponse.codec().encode(tt.response,nt)),rt.lengthDelimited!==!1&&nt.ldelim()},(tt,nt,rt={})=>{var st,at;const ot={requestId:""},it=nt==null?tt.len:tt.pos+nt;for(;tt.pos>>3){case 1:{ot.requestId=tt.string();break}case 2:{ot.request=PushRequest.codec().decode(tt,tt.uint32(),{limits:(st=rt.limits)==null?void 0:st.request});break}case 3:{ot.response=PushResponse.codec().decode(tt,tt.uint32(),{limits:(at=rt.limits)==null?void 0:at.response});break}default:{tt.skipType(ct&7);break}}}return ot})),et),o.encode=tt=>encodeMessage(tt,o.codec()),o.decode=(tt,nt)=>decodeMessage(tt,o.codec(),nt)})(PushRpc$1||(PushRpc$1={}));var RateLimitProof$1;(function(o){let et;o.codec=()=>(et==null&&(et=message$1((tt,nt,rt={})=>{rt.lengthDelimited!==!1&&nt.fork(),tt.proof!=null&&tt.proof.byteLength>0&&(nt.uint32(10),nt.bytes(tt.proof)),tt.merkleRoot!=null&&tt.merkleRoot.byteLength>0&&(nt.uint32(18),nt.bytes(tt.merkleRoot)),tt.epoch!=null&&tt.epoch.byteLength>0&&(nt.uint32(26),nt.bytes(tt.epoch)),tt.shareX!=null&&tt.shareX.byteLength>0&&(nt.uint32(34),nt.bytes(tt.shareX)),tt.shareY!=null&&tt.shareY.byteLength>0&&(nt.uint32(42),nt.bytes(tt.shareY)),tt.nullifier!=null&&tt.nullifier.byteLength>0&&(nt.uint32(50),nt.bytes(tt.nullifier)),tt.rlnIdentifier!=null&&tt.rlnIdentifier.byteLength>0&&(nt.uint32(58),nt.bytes(tt.rlnIdentifier)),rt.lengthDelimited!==!1&&nt.ldelim()},(tt,nt,rt={})=>{const ot={proof:alloc$2(0),merkleRoot:alloc$2(0),epoch:alloc$2(0),shareX:alloc$2(0),shareY:alloc$2(0),nullifier:alloc$2(0),rlnIdentifier:alloc$2(0)},it=nt==null?tt.len:tt.pos+nt;for(;tt.pos>>3){case 1:{ot.proof=tt.bytes();break}case 2:{ot.merkleRoot=tt.bytes();break}case 3:{ot.epoch=tt.bytes();break}case 4:{ot.shareX=tt.bytes();break}case 5:{ot.shareY=tt.bytes();break}case 6:{ot.nullifier=tt.bytes();break}case 7:{ot.rlnIdentifier=tt.bytes();break}default:{tt.skipType(st&7);break}}}return ot})),et),o.encode=tt=>encodeMessage(tt,o.codec()),o.decode=(tt,nt)=>decodeMessage(tt,o.codec(),nt)})(RateLimitProof$1||(RateLimitProof$1={}));var WakuMessage$1;(function(o){let et;o.codec=()=>(et==null&&(et=message$1((tt,nt,rt={})=>{rt.lengthDelimited!==!1&&nt.fork(),tt.payload!=null&&tt.payload.byteLength>0&&(nt.uint32(10),nt.bytes(tt.payload)),tt.contentTopic!=null&&tt.contentTopic!==""&&(nt.uint32(18),nt.string(tt.contentTopic)),tt.version!=null&&(nt.uint32(24),nt.uint32(tt.version)),tt.timestamp!=null&&(nt.uint32(80),nt.sint64(tt.timestamp)),tt.meta!=null&&(nt.uint32(90),nt.bytes(tt.meta)),tt.rateLimitProof!=null&&(nt.uint32(170),RateLimitProof$1.codec().encode(tt.rateLimitProof,nt)),tt.ephemeral!=null&&(nt.uint32(248),nt.bool(tt.ephemeral)),rt.lengthDelimited!==!1&&nt.ldelim()},(tt,nt,rt={})=>{var st;const ot={payload:alloc$2(0),contentTopic:""},it=nt==null?tt.len:tt.pos+nt;for(;tt.pos>>3){case 1:{ot.payload=tt.bytes();break}case 2:{ot.contentTopic=tt.string();break}case 3:{ot.version=tt.uint32();break}case 10:{ot.timestamp=tt.sint64();break}case 11:{ot.meta=tt.bytes();break}case 21:{ot.rateLimitProof=RateLimitProof$1.codec().decode(tt,tt.uint32(),{limits:(st=rt.limits)==null?void 0:st.rateLimitProof});break}case 31:{ot.ephemeral=tt.bool();break}default:{tt.skipType(at&7);break}}}return ot})),et),o.encode=tt=>encodeMessage(tt,o.codec()),o.decode=(tt,nt)=>decodeMessage(tt,o.codec(),nt)})(WakuMessage$1||(WakuMessage$1={}));var WakuMessageKeyValue;(function(o){let et;o.codec=()=>(et==null&&(et=message$1((tt,nt,rt={})=>{rt.lengthDelimited!==!1&&nt.fork(),tt.messageHash!=null&&(nt.uint32(10),nt.bytes(tt.messageHash)),tt.message!=null&&(nt.uint32(18),WakuMessage.codec().encode(tt.message,nt)),tt.pubsubTopic!=null&&(nt.uint32(26),nt.string(tt.pubsubTopic)),rt.lengthDelimited!==!1&&nt.ldelim()},(tt,nt,rt={})=>{var st;const ot={},it=nt==null?tt.len:tt.pos+nt;for(;tt.pos>>3){case 1:{ot.messageHash=tt.bytes();break}case 2:{ot.message=WakuMessage.codec().decode(tt,tt.uint32(),{limits:(st=rt.limits)==null?void 0:st.message});break}case 3:{ot.pubsubTopic=tt.string();break}default:{tt.skipType(at&7);break}}}return ot})),et),o.encode=tt=>encodeMessage(tt,o.codec()),o.decode=(tt,nt)=>decodeMessage(tt,o.codec(),nt)})(WakuMessageKeyValue||(WakuMessageKeyValue={}));var StoreQueryRequest$1;(function(o){let et;o.codec=()=>(et==null&&(et=message$1((tt,nt,rt={})=>{if(rt.lengthDelimited!==!1&&nt.fork(),tt.requestId!=null&&tt.requestId!==""&&(nt.uint32(10),nt.string(tt.requestId)),tt.includeData!=null&&tt.includeData!==!1&&(nt.uint32(16),nt.bool(tt.includeData)),tt.pubsubTopic!=null&&(nt.uint32(82),nt.string(tt.pubsubTopic)),tt.contentTopics!=null)for(const ot of tt.contentTopics)nt.uint32(90),nt.string(ot);if(tt.timeStart!=null&&(nt.uint32(96),nt.sint64(tt.timeStart)),tt.timeEnd!=null&&(nt.uint32(104),nt.sint64(tt.timeEnd)),tt.messageHashes!=null)for(const ot of tt.messageHashes)nt.uint32(162),nt.bytes(ot);tt.paginationCursor!=null&&(nt.uint32(410),nt.bytes(tt.paginationCursor)),tt.paginationForward!=null&&tt.paginationForward!==!1&&(nt.uint32(416),nt.bool(tt.paginationForward)),tt.paginationLimit!=null&&(nt.uint32(424),nt.uint64(tt.paginationLimit)),rt.lengthDelimited!==!1&&nt.ldelim()},(tt,nt,rt={})=>{var st,at;const ot={requestId:"",includeData:!1,contentTopics:[],messageHashes:[],paginationForward:!1},it=nt==null?tt.len:tt.pos+nt;for(;tt.pos>>3){case 1:{ot.requestId=tt.string();break}case 2:{ot.includeData=tt.bool();break}case 10:{ot.pubsubTopic=tt.string();break}case 11:{if(((st=rt.limits)==null?void 0:st.contentTopics)!=null&&ot.contentTopics.length===rt.limits.contentTopics)throw new MaxLengthError('Decode error - map field "contentTopics" had too many elements');ot.contentTopics.push(tt.string());break}case 12:{ot.timeStart=tt.sint64();break}case 13:{ot.timeEnd=tt.sint64();break}case 20:{if(((at=rt.limits)==null?void 0:at.messageHashes)!=null&&ot.messageHashes.length===rt.limits.messageHashes)throw new MaxLengthError('Decode error - map field "messageHashes" had too many elements');ot.messageHashes.push(tt.bytes());break}case 51:{ot.paginationCursor=tt.bytes();break}case 52:{ot.paginationForward=tt.bool();break}case 53:{ot.paginationLimit=tt.uint64();break}default:{tt.skipType(ct&7);break}}}return ot})),et),o.encode=tt=>encodeMessage(tt,o.codec()),o.decode=(tt,nt)=>decodeMessage(tt,o.codec(),nt)})(StoreQueryRequest$1||(StoreQueryRequest$1={}));var StoreQueryResponse$1;(function(o){let et;o.codec=()=>(et==null&&(et=message$1((tt,nt,rt={})=>{if(rt.lengthDelimited!==!1&&nt.fork(),tt.requestId!=null&&tt.requestId!==""&&(nt.uint32(10),nt.string(tt.requestId)),tt.statusCode!=null&&(nt.uint32(80),nt.uint32(tt.statusCode)),tt.statusDesc!=null&&(nt.uint32(90),nt.string(tt.statusDesc)),tt.messages!=null)for(const ot of tt.messages)nt.uint32(162),WakuMessageKeyValue.codec().encode(ot,nt);tt.paginationCursor!=null&&(nt.uint32(410),nt.bytes(tt.paginationCursor)),rt.lengthDelimited!==!1&&nt.ldelim()},(tt,nt,rt={})=>{var st,at;const ot={requestId:"",messages:[]},it=nt==null?tt.len:tt.pos+nt;for(;tt.pos>>3){case 1:{ot.requestId=tt.string();break}case 10:{ot.statusCode=tt.uint32();break}case 11:{ot.statusDesc=tt.string();break}case 20:{if(((st=rt.limits)==null?void 0:st.messages)!=null&&ot.messages.length===rt.limits.messages)throw new MaxLengthError('Decode error - map field "messages" had too many elements');ot.messages.push(WakuMessageKeyValue.codec().decode(tt,tt.uint32(),{limits:(at=rt.limits)==null?void 0:at.messages$}));break}case 51:{ot.paginationCursor=tt.bytes();break}default:{tt.skipType(ct&7);break}}}return ot})),et),o.encode=tt=>encodeMessage(tt,o.codec()),o.decode=(tt,nt)=>decodeMessage(tt,o.codec(),nt)})(StoreQueryResponse$1||(StoreQueryResponse$1={}));var RateLimitProof;(function(o){let et;o.codec=()=>(et==null&&(et=message$1((tt,nt,rt={})=>{rt.lengthDelimited!==!1&&nt.fork(),tt.proof!=null&&tt.proof.byteLength>0&&(nt.uint32(10),nt.bytes(tt.proof)),tt.merkleRoot!=null&&tt.merkleRoot.byteLength>0&&(nt.uint32(18),nt.bytes(tt.merkleRoot)),tt.epoch!=null&&tt.epoch.byteLength>0&&(nt.uint32(26),nt.bytes(tt.epoch)),tt.shareX!=null&&tt.shareX.byteLength>0&&(nt.uint32(34),nt.bytes(tt.shareX)),tt.shareY!=null&&tt.shareY.byteLength>0&&(nt.uint32(42),nt.bytes(tt.shareY)),tt.nullifier!=null&&tt.nullifier.byteLength>0&&(nt.uint32(50),nt.bytes(tt.nullifier)),tt.rlnIdentifier!=null&&tt.rlnIdentifier.byteLength>0&&(nt.uint32(58),nt.bytes(tt.rlnIdentifier)),rt.lengthDelimited!==!1&&nt.ldelim()},(tt,nt,rt={})=>{const ot={proof:alloc$2(0),merkleRoot:alloc$2(0),epoch:alloc$2(0),shareX:alloc$2(0),shareY:alloc$2(0),nullifier:alloc$2(0),rlnIdentifier:alloc$2(0)},it=nt==null?tt.len:tt.pos+nt;for(;tt.pos>>3){case 1:{ot.proof=tt.bytes();break}case 2:{ot.merkleRoot=tt.bytes();break}case 3:{ot.epoch=tt.bytes();break}case 4:{ot.shareX=tt.bytes();break}case 5:{ot.shareY=tt.bytes();break}case 6:{ot.nullifier=tt.bytes();break}case 7:{ot.rlnIdentifier=tt.bytes();break}default:{tt.skipType(st&7);break}}}return ot})),et),o.encode=tt=>encodeMessage(tt,o.codec()),o.decode=(tt,nt)=>decodeMessage(tt,o.codec(),nt)})(RateLimitProof||(RateLimitProof={}));var WakuMessage;(function(o){let et;o.codec=()=>(et==null&&(et=message$1((tt,nt,rt={})=>{rt.lengthDelimited!==!1&&nt.fork(),tt.payload!=null&&tt.payload.byteLength>0&&(nt.uint32(10),nt.bytes(tt.payload)),tt.contentTopic!=null&&tt.contentTopic!==""&&(nt.uint32(18),nt.string(tt.contentTopic)),tt.version!=null&&(nt.uint32(24),nt.uint32(tt.version)),tt.timestamp!=null&&(nt.uint32(80),nt.sint64(tt.timestamp)),tt.meta!=null&&(nt.uint32(90),nt.bytes(tt.meta)),tt.rateLimitProof!=null&&(nt.uint32(170),RateLimitProof.codec().encode(tt.rateLimitProof,nt)),tt.ephemeral!=null&&(nt.uint32(248),nt.bool(tt.ephemeral)),rt.lengthDelimited!==!1&&nt.ldelim()},(tt,nt,rt={})=>{var st;const ot={payload:alloc$2(0),contentTopic:""},it=nt==null?tt.len:tt.pos+nt;for(;tt.pos>>3){case 1:{ot.payload=tt.bytes();break}case 2:{ot.contentTopic=tt.string();break}case 3:{ot.version=tt.uint32();break}case 10:{ot.timestamp=tt.sint64();break}case 11:{ot.meta=tt.bytes();break}case 21:{ot.rateLimitProof=RateLimitProof.codec().decode(tt,tt.uint32(),{limits:(st=rt.limits)==null?void 0:st.rateLimitProof});break}case 31:{ot.ephemeral=tt.bool();break}default:{tt.skipType(at&7);break}}}return ot})),et),o.encode=tt=>encodeMessage(tt,o.codec()),o.decode=(tt,nt)=>decodeMessage(tt,o.codec(),nt)})(WakuMessage||(WakuMessage={}));var PeerInfo;(function(o){let et;o.codec=()=>(et==null&&(et=message$1((tt,nt,rt={})=>{rt.lengthDelimited!==!1&&nt.fork(),tt.enr!=null&&(nt.uint32(10),nt.bytes(tt.enr)),rt.lengthDelimited!==!1&&nt.ldelim()},(tt,nt,rt={})=>{const ot={},it=nt==null?tt.len:tt.pos+nt;for(;tt.pos>>3){case 1:{ot.enr=tt.bytes();break}default:{tt.skipType(st&7);break}}}return ot})),et),o.encode=tt=>encodeMessage(tt,o.codec()),o.decode=(tt,nt)=>decodeMessage(tt,o.codec(),nt)})(PeerInfo||(PeerInfo={}));var PeerExchangeQuery;(function(o){let et;o.codec=()=>(et==null&&(et=message$1((tt,nt,rt={})=>{rt.lengthDelimited!==!1&&nt.fork(),tt.numPeers!=null&&(nt.uint32(8),nt.uint64(tt.numPeers)),rt.lengthDelimited!==!1&&nt.ldelim()},(tt,nt,rt={})=>{const ot={},it=nt==null?tt.len:tt.pos+nt;for(;tt.pos>>3){case 1:{ot.numPeers=tt.uint64();break}default:{tt.skipType(st&7);break}}}return ot})),et),o.encode=tt=>encodeMessage(tt,o.codec()),o.decode=(tt,nt)=>decodeMessage(tt,o.codec(),nt)})(PeerExchangeQuery||(PeerExchangeQuery={}));var PeerExchangeResponse;(function(o){let et;o.codec=()=>(et==null&&(et=message$1((tt,nt,rt={})=>{if(rt.lengthDelimited!==!1&&nt.fork(),tt.peerInfos!=null)for(const ot of tt.peerInfos)nt.uint32(10),PeerInfo.codec().encode(ot,nt);rt.lengthDelimited!==!1&&nt.ldelim()},(tt,nt,rt={})=>{var st,at;const ot={peerInfos:[]},it=nt==null?tt.len:tt.pos+nt;for(;tt.pos>>3){case 1:{if(((st=rt.limits)==null?void 0:st.peerInfos)!=null&&ot.peerInfos.length===rt.limits.peerInfos)throw new MaxLengthError('Decode error - map field "peerInfos" had too many elements');ot.peerInfos.push(PeerInfo.codec().decode(tt,tt.uint32(),{limits:(at=rt.limits)==null?void 0:at.peerInfos$}));break}default:{tt.skipType(ct&7);break}}}return ot})),et),o.encode=tt=>encodeMessage(tt,o.codec()),o.decode=(tt,nt)=>decodeMessage(tt,o.codec(),nt)})(PeerExchangeResponse||(PeerExchangeResponse={}));var PeerExchangeRPC$1;(function(o){let et;o.codec=()=>(et==null&&(et=message$1((tt,nt,rt={})=>{rt.lengthDelimited!==!1&&nt.fork(),tt.query!=null&&(nt.uint32(10),PeerExchangeQuery.codec().encode(tt.query,nt)),tt.response!=null&&(nt.uint32(18),PeerExchangeResponse.codec().encode(tt.response,nt)),rt.lengthDelimited!==!1&&nt.ldelim()},(tt,nt,rt={})=>{var st,at;const ot={},it=nt==null?tt.len:tt.pos+nt;for(;tt.pos>>3){case 1:{ot.query=PeerExchangeQuery.codec().decode(tt,tt.uint32(),{limits:(st=rt.limits)==null?void 0:st.query});break}case 2:{ot.response=PeerExchangeResponse.codec().decode(tt,tt.uint32(),{limits:(at=rt.limits)==null?void 0:at.response});break}default:{tt.skipType(ct&7);break}}}return ot})),et),o.encode=tt=>encodeMessage(tt,o.codec()),o.decode=(tt,nt)=>decodeMessage(tt,o.codec(),nt)})(PeerExchangeRPC$1||(PeerExchangeRPC$1={}));var WakuMetadataRequest;(function(o){let et;o.codec=()=>(et==null&&(et=message$1((tt,nt,rt={})=>{if(rt.lengthDelimited!==!1&&nt.fork(),tt.clusterId!=null&&(nt.uint32(8),nt.uint32(tt.clusterId)),tt.shards!=null)for(const ot of tt.shards)nt.uint32(16),nt.uint32(ot);rt.lengthDelimited!==!1&&nt.ldelim()},(tt,nt,rt={})=>{var st;const ot={shards:[]},it=nt==null?tt.len:tt.pos+nt;for(;tt.pos>>3){case 1:{ot.clusterId=tt.uint32();break}case 2:{if(((st=rt.limits)==null?void 0:st.shards)!=null&&ot.shards.length===rt.limits.shards)throw new MaxLengthError('Decode error - map field "shards" had too many elements');ot.shards.push(tt.uint32());break}default:{tt.skipType(at&7);break}}}return ot})),et),o.encode=tt=>encodeMessage(tt,o.codec()),o.decode=(tt,nt)=>decodeMessage(tt,o.codec(),nt)})(WakuMetadataRequest||(WakuMetadataRequest={}));var WakuMetadataResponse;(function(o){let et;o.codec=()=>(et==null&&(et=message$1((tt,nt,rt={})=>{if(rt.lengthDelimited!==!1&&nt.fork(),tt.clusterId!=null&&(nt.uint32(8),nt.uint32(tt.clusterId)),tt.shards!=null)for(const ot of tt.shards)nt.uint32(16),nt.uint32(ot);rt.lengthDelimited!==!1&&nt.ldelim()},(tt,nt,rt={})=>{var st;const ot={shards:[]},it=nt==null?tt.len:tt.pos+nt;for(;tt.pos>>3){case 1:{ot.clusterId=tt.uint32();break}case 2:{if(((st=rt.limits)==null?void 0:st.shards)!=null&&ot.shards.length===rt.limits.shards)throw new MaxLengthError('Decode error - map field "shards" had too many elements');ot.shards.push(tt.uint32());break}default:{tt.skipType(at&7);break}}}return ot})),et),o.encode=tt=>encodeMessage(tt,o.codec()),o.decode=(tt,nt)=>decodeMessage(tt,o.codec(),nt)})(WakuMetadataResponse||(WakuMetadataResponse={}));function isDefined(o){return!!o}function groupByContentTopic(o){const et=new Map;return o.forEach(tt=>{let nt=et.get(tt.contentTopic);nt||(et.set(tt.contentTopic,[]),nt=et.get(tt.contentTopic)),nt.push(tt)}),et}const FRAME_RATE=60;async function toAsyncIterator(o,et,tt){const nt=FRAME_RATE,rt=[];let ot;ot=await o.subscribeWithUnsubscribe(et,lt=>{rt.push(lt)});const it=Number.isInteger(tt==null?void 0:tt.timeoutMs),st=0,at=Date.now();async function*ct(){for(;;){if(it&&Date.now()-at>=st)return;await wait(nt);const lt=rt.shift();if(!ot&&rt.length===0)return lt;!lt&&ot||(yield lt)}}return{iterator:ct(),async stop(){ot&&(await ot(),ot=void 0)}}}function wait(o){return new Promise(et=>{setTimeout(et,o)})}const MB=1024**2,SIZE_CAP_IN_MB=1;async function isMessageSizeUnderCap(o,et){const tt=await o.toWire(et);return tt?isWireSizeUnderCap(tt):!1}const isWireSizeUnderCap=o=>o.length/MB<=SIZE_CAP_IN_MB;var Protocols;(function(o){o.Relay="relay",o.Store="store",o.LightPush="lightpush",o.Filter="filter"})(Protocols||(Protocols={}));var ProtocolError$1;(function(o){o.GENERIC_FAIL="Generic error",o.ENCODE_FAILED="Failed to encode",o.DECODE_FAILED="Failed to decode",o.EMPTY_PAYLOAD="Payload is empty",o.SIZE_TOO_BIG="Size is too big",o.TOPIC_NOT_CONFIGURED="Topic not configured",o.TOPIC_DECODER_MISMATCH="Topic decoder mismatch",o.INVALID_DECODER_TOPICS="Invalid decoder topics",o.NO_PEER_AVAILABLE="No peer available",o.NO_STREAM_AVAILABLE="No stream available",o.NO_RESPONSE="No response received",o.REMOTE_PEER_REJECTED="Remote peer rejected",o.REQUEST_TIMEOUT="Request timeout",o.RLN_IDENTITY_MISSING="Identity credentials are not set",o.RLN_MEMBERSHIP_INDEX="Membership index is not set",o.RLN_LIMIT_MISSING="User message limit is not set",o.RLN_PROOF_GENERATION="Proof generation failed"})(ProtocolError$1||(ProtocolError$1={}));var Tags;(function(o){o.BOOTSTRAP="bootstrap",o.PEER_EXCHANGE="peer-exchange",o.LOCAL="local-peer-cache"})(Tags||(Tags={}));var EPeersByDiscoveryEvents;(function(o){o.PEER_DISCOVERY_BOOTSTRAP="peer:discovery:bootstrap",o.PEER_DISCOVERY_PEER_EXCHANGE="peer:discovery:peer-exchange",o.PEER_CONNECT_BOOTSTRAP="peer:connected:bootstrap",o.PEER_CONNECT_PEER_EXCHANGE="peer:connected:peer-exchange"})(EPeersByDiscoveryEvents||(EPeersByDiscoveryEvents={}));var EConnectionStateEvents;(function(o){o.CONNECTION_STATUS="waku:connection"})(EConnectionStateEvents||(EConnectionStateEvents={}));const DNS_DISCOVERY_TAG="@waku/bootstrap",DEFAULT_CLUSTER_ID=1,DefaultShardInfo={clusterId:DEFAULT_CLUSTER_ID,shards:[0,1,2,3,4,5,6,7,8]},DefaultNetworkConfig=DefaultShardInfo;var HealthStatus;(function(o){o.Unhealthy="Unhealthy",o.MinimallyHealthy="MinimallyHealthy",o.SufficientlyHealthy="SufficientlyHealthy"})(HealthStatus||(HealthStatus={}));function toString$8(o,et="utf8"){const tt=BASES[et];if(tt==null)throw new Error(`Unsupported encoding "${et}"`);return tt.encoder.encode(o).substring(1)}function hexToBytes$1(o){if(typeof o=="string"){const et=o.replace(/^0x/i,"");return fromString(et.toLowerCase(),"base16")}return o}function numberToBytes(o){const et=new ArrayBuffer(8),tt=new DataView(et);return typeof o=="number"?tt.setFloat64(0,o,!1):tt.setBigInt64(0,o,!1),new Uint8Array(et)}const bytesToHex$1=o=>toString$8(o,"base16"),bytesToUtf8=o=>toString$8(o,"utf8"),utf8ToBytes$1=o=>fromString(o,"utf8");function concat$2(o,et){const tt=o.reduce((ot,it)=>ot+it.length,0),nt=new Uint8Array(tt);let rt=0;for(const ot of o)nt.set(ot,rt),rt+=ot.length;return nt}function isStaticSharding(o){return"clusterId"in o&&"shards"in o&&!("contentTopics"in o)}function isAutoSharding(o){return"contentTopics"in o}function derivePubsubTopicsFromNetworkConfig(o){if(isStaticSharding(o)){if(o.shards.length===0)throw new Error("Invalid shards configuration: please provide at least one shard");return shardInfoToPubsubTopics(o)}else if(isAutoSharding(o)){if(o.contentTopics.length===0)throw new Error("Invalid content topics configuration: please provide at least one content topic");return o.contentTopics.map(et=>contentTopicToPubsubTopic(et,o.clusterId))}else throw new Error("Unknown shard config. Please use ShardInfo or ContentTopicInfo")}const singleShardInfoToPubsubTopic=o=>{if(o.shard===void 0)throw new Error("Invalid shard");return`/waku/2/rs/${o.clusterId??DEFAULT_CLUSTER_ID}/${o.shard}`},shardInfoToPubsubTopics=o=>{if("contentTopics"in o&&o.contentTopics)return Array.from(new Set(o.contentTopics.map(et=>contentTopicToPubsubTopic(et,o.clusterId))));if("shards"in o){if(o.shards===void 0)throw new Error("Invalid shard");return Array.from(new Set(o.shards.map(et=>`/waku/2/rs/${o.clusterId??DEFAULT_CLUSTER_ID}/${et}`)))}else{if("application"in o&&"version"in o)return[contentTopicToPubsubTopic(`/${o.application}/${o.version}/default/default`,o.clusterId)];throw new Error("Missing required configuration in shard parameters")}},pubsubTopicToSingleShardInfo=o=>{const et=o.split("/");if(et.length!=6||et[1]!=="waku"||et[2]!=="2"||et[3]!=="rs")throw new Error("Invalid pubsub topic");const tt=parseInt(et[4]),nt=parseInt(et[5]);if(isNaN(tt)||isNaN(nt))throw new Error("Invalid clusterId or shard");return{clusterId:tt,shard:nt}},pubsubTopicsToShardInfo=o=>{const et=new Set,tt=new Set;for(const ot of o){const{clusterId:it,shard:st}=pubsubTopicToSingleShardInfo(ot);et.add(`${it}:${st}`),tt.add(it)}if(et.size===0)throw new Error("No valid pubsub topics provided");if(tt.size>1)throw new Error("Pubsub topics from multiple cluster IDs are not supported");const nt=tt.values().next().value,rt=Array.from(et).map(ot=>parseInt(ot.split(":")[1]));return{clusterId:nt,shards:rt}};function ensurePubsubTopicIsConfigured(o,et){if(!et.includes(o))throw new Error(`Pubsub topic ${o} has not been configured on this instance. Configured topics are: ${et}. Please update your configuration by passing in the topic during Waku node instantiation.`)}function ensureValidContentTopic(o){const et=o.split("/");if(et.length<5||et.length>6)throw Error("Content topic format is invalid");let tt=0;if(et.length==6){if(tt=parseInt(et[1]),isNaN(tt))throw new Error("Invalid generation field in content topic");if(tt>0)throw new Error("Generation greater than 0 is not supported")}const nt=et.splice(-4);if(nt[0].length==0)throw new Error("Application field cannot be empty");if(nt[1].length==0)throw new Error("Version field cannot be empty");if(nt[2].length==0)throw new Error("Topic name field cannot be empty");if(nt[3].length==0)throw new Error("Encoding field cannot be empty");return{generation:tt,application:nt[0],version:nt[1],topicName:nt[2],encoding:nt[3]}}function contentTopicToShardIndex(o,et=8){const{application:tt,version:nt}=ensureValidContentTopic(o),rt=sha256$2(concat$2([utf8ToBytes$1(tt),utf8ToBytes$1(nt)])),ot=new DataView(rt.buffer.slice(-8));return Number(ot.getBigUint64(0,!1)%BigInt(et))}function contentTopicToPubsubTopic(o,et=DEFAULT_CLUSTER_ID,tt=8){if(!o)throw Error("Content topic must be specified");const nt=contentTopicToShardIndex(o,tt);return`/waku/2/rs/${et}/${nt}`}function determinePubsubTopic(o,et){return typeof et=="string"?et:(et==null?void 0:et.shard)!==void 0?singleShardInfoToPubsubTopic(et):contentTopicToPubsubTopic(o,(et==null?void 0:et.clusterId)??DEFAULT_CLUSTER_ID)}const decodeRelayShard=o=>{if(o=new Uint8Array(o),o.length<3)throw new Error("Insufficient data");const et=new DataView(o.buffer),tt=et.getUint16(0),nt=[];if(o.length===130)for(let rt=0;rt<1024;rt++){const ot=Math.floor(rt/8)+2,it=7-rt%8;et.getUint8(ot)&1<=o.length)throw new Error("Unexpected end of data");nt.push(et.getUint16(it))}}return{clusterId:tt,shards:nt}},encodeRelayShard=o=>{const{clusterId:et,shards:tt}=o,nt=tt.length>=64?130:3+2*tt.length,rt=new ArrayBuffer(nt),ot=new DataView(rt);if(ot.setUint16(0,et),tt.length>=64)for(const it of tt){const st=Math.floor(it/8)+2,at=7-it%8;ot.setUint8(st,ot.getUint8(st)|1<tt.toString().includes("ws")||tt.toString().includes("wss"));if(!et)throw new Error("No ws multiaddr found in the given addresses");return et}var browser={exports:{}},ms$1,hasRequiredMs;function requireMs(){if(hasRequiredMs)return ms$1;hasRequiredMs=1;var o=1e3,et=o*60,tt=et*60,nt=tt*24,rt=nt*7,ot=nt*365.25;ms$1=function(lt,dt){dt=dt||{};var ht=typeof lt;if(ht==="string"&<.length>0)return it(lt);if(ht==="number"&&isFinite(lt))return dt.long?at(lt):st(lt);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(lt))};function it(lt){if(lt=String(lt),!(lt.length>100)){var dt=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(lt);if(dt){var ht=parseFloat(dt[1]),pt=(dt[2]||"ms").toLowerCase();switch(pt){case"years":case"year":case"yrs":case"yr":case"y":return ht*ot;case"weeks":case"week":case"w":return ht*rt;case"days":case"day":case"d":return ht*nt;case"hours":case"hour":case"hrs":case"hr":case"h":return ht*tt;case"minutes":case"minute":case"mins":case"min":case"m":return ht*et;case"seconds":case"second":case"secs":case"sec":case"s":return ht*o;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return ht;default:return}}}}function st(lt){var dt=Math.abs(lt);return dt>=nt?Math.round(lt/nt)+"d":dt>=tt?Math.round(lt/tt)+"h":dt>=et?Math.round(lt/et)+"m":dt>=o?Math.round(lt/o)+"s":lt+"ms"}function at(lt){var dt=Math.abs(lt);return dt>=nt?ct(lt,dt,nt,"day"):dt>=tt?ct(lt,dt,tt,"hour"):dt>=et?ct(lt,dt,et,"minute"):dt>=o?ct(lt,dt,o,"second"):lt+" ms"}function ct(lt,dt,ht,pt){var mt=dt>=ht*1.5;return Math.round(lt/ht)+" "+pt+(mt?"s":"")}return ms$1}function setup$1(o){tt.debug=tt,tt.default=tt,tt.coerce=at,tt.disable=ot,tt.enable=rt,tt.enabled=it,tt.humanize=requireMs(),tt.destroy=ct,Object.keys(o).forEach(lt=>{tt[lt]=o[lt]}),tt.names=[],tt.skips=[],tt.formatters={};function et(lt){let dt=0;for(let ht=0;ht{if(wt==="%%")return"%";bt++;const Tt=tt.formatters[kt];if(typeof Tt=="function"){const Rt=yt[bt];wt=Tt.call(gt,Rt),yt.splice(bt,1),bt--}return wt}),tt.formatArgs.call(gt,yt),(gt.log||tt.log).apply(gt,yt)}return ft.namespace=lt,ft.useColors=tt.useColors(),ft.color=tt.selectColor(lt),ft.extend=nt,ft.destroy=tt.destroy,Object.defineProperty(ft,"enabled",{enumerable:!0,configurable:!1,get:()=>ht!==null?ht:(pt!==tt.namespaces&&(pt=tt.namespaces,mt=tt.enabled(lt)),mt),set:yt=>{ht=yt}}),typeof tt.init=="function"&&tt.init(ft),ft}function nt(lt,dt){const ht=tt(this.namespace+(typeof dt>"u"?":":dt)+lt);return ht.log=this.log,ht}function rt(lt){tt.save(lt),tt.namespaces=lt,tt.names=[],tt.skips=[];let dt;const ht=(typeof lt=="string"?lt:"").split(/[\s,]+/),pt=ht.length;for(dt=0;dt"-"+dt)].join(",");return tt.enable(""),lt}function it(lt){if(lt[lt.length-1]==="*")return!0;let dt,ht;for(dt=0,ht=tt.skips.length;dt{let lt=!1;return()=>{lt||(lt=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),et.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function rt(){if(typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs))return!0;if(typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let lt;return typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&(lt=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(lt[1],10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function ot(lt){if(lt[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+lt[0]+(this.useColors?"%c ":" ")+"+"+o.exports.humanize(this.diff),!this.useColors)return;const dt="color: "+this.color;lt.splice(1,0,dt,"color: inherit");let ht=0,pt=0;lt[0].replace(/%[a-zA-Z%]/g,mt=>{mt!=="%%"&&(ht++,mt==="%c"&&(pt=ht))}),lt.splice(pt,0,dt)}et.log=console.debug||console.log||(()=>{});function it(lt){try{lt?et.storage.setItem("debug",lt):et.storage.removeItem("debug")}catch{}}function st(){let lt;try{lt=et.storage.getItem("debug")}catch{}return!lt&&typeof tt<"u"&&"env"in tt&&(lt=nt.DEBUG),lt}function at(){try{return localStorage}catch{}}o.exports=common$1(et);const{formatters:ct}=o.exports;ct.j=function(lt){try{return JSON.stringify(lt)}catch(dt){return"[UnexpectedJSONParseError]: "+dt.message}}})(browser,browser.exports);var browserExports=browser.exports;const debug=getDefaultExportFromCjs(browserExports),APP_NAME="waku";let Logger$1=class Zo{constructor(et){Ct(this,"_info");Ct(this,"_warn");Ct(this,"_error");this._info=debug(Zo.createDebugNamespace("info",et)),this._warn=debug(Zo.createDebugNamespace("warn",et)),this._error=debug(Zo.createDebugNamespace("error",et))}static createDebugNamespace(et,tt){return tt?`${APP_NAME}:${et}:${tt}`:`${APP_NAME}:${et}`}get info(){return this._info}get warn(){return this._warn}get error(){return this._error}log(et,...tt){const nt=this[et];nt(...tt)}};const log$o=new Logger$1("message:version-0"),OneMillion=BigInt(1e6),Version=0;class DecodedMessage{constructor(et,tt){Ct(this,"pubsubTopic");Ct(this,"proto");this.pubsubTopic=et,this.proto=tt}get ephemeral(){return!!this.proto.ephemeral}get payload(){return this.proto.payload}get contentTopic(){return this.proto.contentTopic}get _rawTimestamp(){return this.proto.timestamp}get timestamp(){try{if(this.proto.timestamp){const et=this.proto.timestamp/OneMillion;return new Date(Number(et))}return}catch{return}}get meta(){return this.proto.meta}get version(){return this.proto.version??0}get rateLimitProof(){return this.proto.rateLimitProof}}let Encoder$1=class{constructor(et,tt=!1,nt,rt){Ct(this,"contentTopic");Ct(this,"ephemeral");Ct(this,"pubsubTopic");Ct(this,"metaSetter");if(this.contentTopic=et,this.ephemeral=tt,this.pubsubTopic=nt,this.metaSetter=rt,!et||et==="")throw new Error("Content topic must be specified")}async toWire(et){return WakuMessage$4.encode(await this.toProtoObj(et))}async toProtoObj(et){const tt=et.timestamp??new Date,nt={payload:et.payload,version:Version,contentTopic:this.contentTopic,timestamp:BigInt(tt.valueOf())*OneMillion,meta:void 0,rateLimitProof:et.rateLimitProof,ephemeral:this.ephemeral};if(this.metaSetter){const rt=this.metaSetter(nt);return{...nt,meta:rt}}return nt}};function createEncoder({pubsubTopic:o,pubsubTopicShardInfo:et,contentTopic:tt,ephemeral:nt,metaSetter:rt}){return new Encoder$1(tt,nt,determinePubsubTopic(tt,o??et),rt)}let Decoder$1=class{constructor(et,tt){Ct(this,"pubsubTopic");Ct(this,"contentTopic");if(this.pubsubTopic=et,this.contentTopic=tt,!tt||tt==="")throw new Error("Content topic must be specified")}fromWireToProtoObj(et){const tt=WakuMessage$4.decode(et);return Promise.resolve({payload:tt.payload,contentTopic:tt.contentTopic,version:tt.version??void 0,timestamp:tt.timestamp??void 0,meta:tt.meta??void 0,rateLimitProof:tt.rateLimitProof??void 0,ephemeral:tt.ephemeral??!1})}async fromProtoObj(et,tt){return tt.version??Version!==0?(log$o.error("Failed to decode due to incorrect version, expected:",Version,", actual:",tt.version),Promise.resolve(void 0)):new DecodedMessage(et,tt)}};function createDecoder(o,et){return new Decoder$1(determinePubsubTopic(o,et),o)}function isAsyncIterable$8(o){return o[Symbol.asyncIterator]!=null}function all$2(o){if(isAsyncIterable$8(o))return(async()=>{const tt=[];for await(const nt of o)tt.push(nt);return tt})();const et=[];for(const tt of o)et.push(tt);return et}function asUint8Array(o){return o}function concat$1(o,et){et==null&&(et=o.reduce((rt,ot)=>rt+ot.length,0));const tt=allocUnsafe(et);let nt=0;for(const rt of o)tt.set(rt,nt),nt+=rt.length;return tt}function equals(o,et){if(o===et)return!0;if(o.byteLength!==et.byteLength)return!1;for(let tt=0;tt0&&this.appendAll(et)}*[(Ys=symbol$1,Symbol.iterator)](){yield*this.bufs}get byteLength(){return this.length}append(...et){this.appendAll(et)}appendAll(et){let tt=0;for(const nt of et)if(nt instanceof Uint8Array)tt+=nt.byteLength,this.bufs.push(nt);else if(isUint8ArrayList(nt))tt+=nt.byteLength,this.bufs.push(...nt.bufs);else throw new Error("Could not append value, must be an Uint8Array or a Uint8ArrayList");this.length+=tt}prepend(...et){this.prependAll(et)}prependAll(et){let tt=0;for(const nt of et.reverse())if(nt instanceof Uint8Array)tt+=nt.byteLength,this.bufs.unshift(nt);else if(isUint8ArrayList(nt))tt+=nt.byteLength,this.bufs.unshift(...nt.bufs);else throw new Error("Could not prepend value, must be an Uint8Array or a Uint8ArrayList");this.length+=tt}get(et){const tt=findBufAndOffset(this.bufs,et);return tt.buf[tt.index]}set(et,tt){const nt=findBufAndOffset(this.bufs,et);nt.buf[nt.index]=tt}write(et,tt=0){if(et instanceof Uint8Array)for(let nt=0;nt0;)if(et>=this.bufs[0].byteLength)et-=this.bufs[0].byteLength,this.length-=this.bufs[0].byteLength,this.bufs.shift();else{this.bufs[0]=this.bufs[0].subarray(et),this.length-=et;break}}}slice(et,tt){const{bufs:nt,length:rt}=this._subList(et,tt);return concat$1(nt,rt)}subarray(et,tt){const{bufs:nt,length:rt}=this._subList(et,tt);return nt.length===1?nt[0]:concat$1(nt,rt)}sublist(et,tt){const{bufs:nt,length:rt}=this._subList(et,tt),ot=new Uint8ArrayList;return ot.length=rt,ot.bufs=[...nt],ot}_subList(et,tt){if(et=et??0,tt=tt??this.length,et<0&&(et=this.length+et),tt<0&&(tt=this.length+tt),et<0||tt>this.length)throw new RangeError("index is out of bounds");if(et===tt)return{bufs:[],length:0};if(et===0&&tt===this.length)return{bufs:this.bufs,length:this.length};const nt=[];let rt=0;for(let ot=0;ot=at)continue;const ct=et>=st&&etst&&tt<=at;if(ct&<){if(et===st&&tt===at){nt.push(it);break}const dt=et-st;nt.push(it.subarray(dt,dt+(tt-et)));break}if(ct){if(et===0){nt.push(it);continue}nt.push(it.subarray(et-st));continue}if(lt){if(tt===at){nt.push(it);break}nt.push(it.subarray(0,tt-st));break}nt.push(it)}return{bufs:nt,length:tt-et}}indexOf(et,tt=0){if(!isUint8ArrayList(et)&&!(et instanceof Uint8Array))throw new TypeError('The "value" argument must be a Uint8ArrayList or Uint8Array');const nt=et instanceof Uint8Array?et:et.subarray();if(tt=Number(tt??0),isNaN(tt)&&(tt=0),tt<0&&(tt=this.length+tt),tt<0&&(tt=0),et.length===0)return tt>this.length?this.length:tt;const rt=nt.byteLength;if(rt===0)throw new TypeError("search must be at least 1 byte long");const ot=256,it=new Int32Array(ot);for(let dt=0;dt=0;ht--){const pt=this.get(dt+ht);if(nt[ht]!==pt){lt=Math.max(1,ht-st[pt]);break}}if(lt===0)return dt}return-1}getInt8(et){const tt=this.subarray(et,et+1);return new DataView(tt.buffer,tt.byteOffset,tt.byteLength).getInt8(0)}setInt8(et,tt){const nt=allocUnsafe(1);new DataView(nt.buffer,nt.byteOffset,nt.byteLength).setInt8(0,tt),this.write(nt,et)}getInt16(et,tt){const nt=this.subarray(et,et+2);return new DataView(nt.buffer,nt.byteOffset,nt.byteLength).getInt16(0,tt)}setInt16(et,tt,nt){const rt=alloc$2(2);new DataView(rt.buffer,rt.byteOffset,rt.byteLength).setInt16(0,tt,nt),this.write(rt,et)}getInt32(et,tt){const nt=this.subarray(et,et+4);return new DataView(nt.buffer,nt.byteOffset,nt.byteLength).getInt32(0,tt)}setInt32(et,tt,nt){const rt=alloc$2(4);new DataView(rt.buffer,rt.byteOffset,rt.byteLength).setInt32(0,tt,nt),this.write(rt,et)}getBigInt64(et,tt){const nt=this.subarray(et,et+8);return new DataView(nt.buffer,nt.byteOffset,nt.byteLength).getBigInt64(0,tt)}setBigInt64(et,tt,nt){const rt=alloc$2(8);new DataView(rt.buffer,rt.byteOffset,rt.byteLength).setBigInt64(0,tt,nt),this.write(rt,et)}getUint8(et){const tt=this.subarray(et,et+1);return new DataView(tt.buffer,tt.byteOffset,tt.byteLength).getUint8(0)}setUint8(et,tt){const nt=allocUnsafe(1);new DataView(nt.buffer,nt.byteOffset,nt.byteLength).setUint8(0,tt),this.write(nt,et)}getUint16(et,tt){const nt=this.subarray(et,et+2);return new DataView(nt.buffer,nt.byteOffset,nt.byteLength).getUint16(0,tt)}setUint16(et,tt,nt){const rt=alloc$2(2);new DataView(rt.buffer,rt.byteOffset,rt.byteLength).setUint16(0,tt,nt),this.write(rt,et)}getUint32(et,tt){const nt=this.subarray(et,et+4);return new DataView(nt.buffer,nt.byteOffset,nt.byteLength).getUint32(0,tt)}setUint32(et,tt,nt){const rt=alloc$2(4);new DataView(rt.buffer,rt.byteOffset,rt.byteLength).setUint32(0,tt,nt),this.write(rt,et)}getBigUint64(et,tt){const nt=this.subarray(et,et+8);return new DataView(nt.buffer,nt.byteOffset,nt.byteLength).getBigUint64(0,tt)}setBigUint64(et,tt,nt){const rt=alloc$2(8);new DataView(rt.buffer,rt.byteOffset,rt.byteLength).setBigUint64(0,tt,nt),this.write(rt,et)}getFloat32(et,tt){const nt=this.subarray(et,et+4);return new DataView(nt.buffer,nt.byteOffset,nt.byteLength).getFloat32(0,tt)}setFloat32(et,tt,nt){const rt=alloc$2(4);new DataView(rt.buffer,rt.byteOffset,rt.byteLength).setFloat32(0,tt,nt),this.write(rt,et)}getFloat64(et,tt){const nt=this.subarray(et,et+8);return new DataView(nt.buffer,nt.byteOffset,nt.byteLength).getFloat64(0,tt)}setFloat64(et,tt,nt){const rt=alloc$2(8);new DataView(rt.buffer,rt.byteOffset,rt.byteLength).setFloat64(0,tt,nt),this.write(rt,et)}equals(et){if(et==null||!(et instanceof Uint8ArrayList)||et.bufs.length!==this.bufs.length)return!1;for(let tt=0;ttrt+ot.byteLength,0)),nt.length=tt,nt}}function isAsyncIterable$7(o){return o[Symbol.asyncIterator]!=null}const defaultEncoder=o=>{const et=encodingLength$3(o),tt=allocUnsafe(et);return encode$a(o,tt),defaultEncoder.bytes=et,tt};defaultEncoder.bytes=0;function encode$5(o,et){et=et??{};const tt=et.lengthEncoder??defaultEncoder;function*nt(rt){const ot=tt(rt.byteLength);ot instanceof Uint8Array?yield ot:yield*ot,rt instanceof Uint8Array?yield rt:yield*rt}return isAsyncIterable$7(o)?async function*(){for await(const rt of o)yield*nt(rt)}():function*(){for(const rt of o)yield*nt(rt)}()}encode$5.single=(o,et)=>{et=et??{};const tt=et.lengthEncoder??defaultEncoder;return new Uint8ArrayList(tt(o.byteLength),o)};let InvalidMessageLengthError$1=class extends Error{constructor(){super(...arguments);Ct(this,"name","InvalidMessageLengthError");Ct(this,"code","ERR_INVALID_MSG_LENGTH")}},InvalidDataLengthError$1=class extends Error{constructor(){super(...arguments);Ct(this,"name","InvalidDataLengthError");Ct(this,"code","ERR_MSG_DATA_TOO_LONG")}},InvalidDataLengthLengthError$1=class extends Error{constructor(){super(...arguments);Ct(this,"name","InvalidDataLengthLengthError");Ct(this,"code","ERR_MSG_LENGTH_TOO_LONG")}},UnexpectedEOFError$1=class extends Error{constructor(){super(...arguments);Ct(this,"name","UnexpectedEOFError");Ct(this,"code","ERR_UNEXPECTED_EOF")}};const MAX_LENGTH_LENGTH=8,MAX_DATA_LENGTH=1024*1024*4;var ReadMode;(function(o){o[o.LENGTH=0]="LENGTH",o[o.DATA=1]="DATA"})(ReadMode||(ReadMode={}));const defaultDecoder=o=>{const et=decode$b(o);return defaultDecoder.bytes=encodingLength$3(et),et};defaultDecoder.bytes=0;function decode$5(o,et){const tt=new Uint8ArrayList;let nt=ReadMode.LENGTH,rt=-1;const ot=(et==null?void 0:et.lengthDecoder)??defaultDecoder,it=(et==null?void 0:et.maxLengthLength)??MAX_LENGTH_LENGTH,st=(et==null?void 0:et.maxDataLength)??MAX_DATA_LENGTH;function*at(){for(;tt.byteLength>0;){if(nt===ReadMode.LENGTH)try{if(rt=ot(tt),rt<0)throw new InvalidMessageLengthError$1("Invalid message length");if(rt>st)throw new InvalidDataLengthError$1("Message length too long");const ct=ot.bytes;tt.consume(ct),(et==null?void 0:et.onLength)!=null&&et.onLength(rt),nt=ReadMode.DATA}catch(ct){if(ct instanceof RangeError){if(tt.byteLength>it)throw new InvalidDataLengthLengthError$1("Message length length too long");break}throw ct}if(nt===ReadMode.DATA){if(tt.byteLength0)throw new UnexpectedEOFError$1("Unexpected end of input")}():function*(){for(const ct of o)tt.append(ct),yield*at();if(tt.byteLength>0)throw new UnexpectedEOFError$1("Unexpected end of input")}()}decode$5.fromReader=(o,et)=>{let tt=1;const nt=async function*(){for(;;)try{const{done:ot,value:it}=await o.next(tt);if(ot===!0)return;it!=null&&(yield it)}catch(ot){if(ot.code==="ERR_UNDER_READ")return{done:!0,value:null};throw ot}finally{tt=1}}();return decode$5(nt,{...et??{},onLength:ot=>{tt=ot}})};function pDefer(){const o={};return o.promise=new Promise((et,tt)=>{o.resolve=et,o.reject=tt}),o}class FixedFIFO{constructor(et){Ct(this,"buffer");Ct(this,"mask");Ct(this,"top");Ct(this,"btm");Ct(this,"next");if(!(et>0)||et-1&et)throw new Error("Max size for a FixedFIFO should be a power of two");this.buffer=new Array(et),this.mask=et-1,this.top=0,this.btm=0,this.next=null}push(et){return this.buffer[this.top]!==void 0?!1:(this.buffer[this.top]=et,this.top=this.top+1&this.mask,!0)}shift(){const et=this.buffer[this.btm];if(et!==void 0)return this.buffer[this.btm]=void 0,this.btm=this.btm+1&this.mask,et}isEmpty(){return this.buffer[this.btm]===void 0}}class FIFO{constructor(et={}){Ct(this,"size");Ct(this,"hwm");Ct(this,"head");Ct(this,"tail");this.hwm=et.splitLimit??16,this.head=new FixedFIFO(this.hwm),this.tail=this.head,this.size=0}calculateSize(et){return(et==null?void 0:et.byteLength)!=null?et.byteLength:1}push(et){if((et==null?void 0:et.value)!=null&&(this.size+=this.calculateSize(et.value)),!this.head.push(et)){const tt=this.head;this.head=tt.next=new FixedFIFO(2*this.head.buffer.length),this.head.push(et)}}shift(){let et=this.tail.shift();if(et===void 0&&this.tail.next!=null){const tt=this.tail.next;this.tail.next=null,this.tail=tt,et=this.tail.shift()}return(et==null?void 0:et.value)!=null&&(this.size-=this.calculateSize(et.value)),et}isEmpty(){return this.head.isEmpty()}}let AbortError$a=class extends Error{constructor(tt,nt){super(tt??"The operation was aborted");Ct(this,"type");Ct(this,"code");this.type="aborted",this.code=nt??"ABORT_ERR"}};function pushable(o={}){return _pushable(tt=>{const nt=tt.shift();if(nt==null)return{done:!0};if(nt.error!=null)throw nt.error;return{done:nt.done===!0,value:nt.value}},o)}function _pushable(o,et){et=et??{};let tt=et.onEnd,nt=new FIFO,rt,ot,it,st=pDefer();const at=async()=>{try{return nt.isEmpty()?it?{done:!0}:await new Promise((yt,gt)=>{ot=xt=>{ot=null,nt.push(xt);try{yt(o(nt))}catch(vt){gt(vt)}return rt}}):o(nt)}finally{nt.isEmpty()&&queueMicrotask(()=>{st.resolve(),st=pDefer()})}},ct=yt=>ot!=null?ot(yt):(nt.push(yt),rt),lt=yt=>(nt=new FIFO,ot!=null?ot({error:yt}):(nt.push({error:yt}),rt)),dt=yt=>{if(it)return rt;if((et==null?void 0:et.objectMode)!==!0&&(yt==null?void 0:yt.byteLength)==null)throw new Error("objectMode was not true but tried to push non-Uint8Array value");return ct({done:!1,value:yt})},ht=yt=>it?rt:(it=!0,yt!=null?lt(yt):ct({done:!0})),pt=()=>(nt=new FIFO,ht(),{done:!0}),mt=yt=>(ht(yt),{done:!0});if(rt={[Symbol.asyncIterator](){return this},next:at,return:pt,throw:mt,push:dt,end:ht,get readableLength(){return nt.size},onEmpty:async yt=>{const gt=yt==null?void 0:yt.signal;if(gt==null||gt.throwIfAborted(),nt.isEmpty())return;let xt,vt;gt!=null&&(xt=new Promise((bt,Et)=>{vt=()=>{Et(new AbortError$a)},gt.addEventListener("abort",vt)}));try{await Promise.race([st.promise,xt])}finally{vt!=null&>!=null&&(gt==null||gt.removeEventListener("abort",vt))}}},tt==null)return rt;const ft=rt;return rt={[Symbol.asyncIterator](){return this},next(){return ft.next()},throw(yt){return ft.throw(yt),tt!=null&&(tt(yt),tt=void 0),{done:!0}},return(){return ft.return(),tt!=null&&(tt(),tt=void 0),{done:!0}},push:dt,end(yt){return ft.end(yt),tt!=null&&(tt(yt),tt=void 0),rt},get readableLength(){return ft.readableLength},onEmpty:yt=>ft.onEmpty(yt)},rt}function isAsyncIterable$6(o){return o[Symbol.asyncIterator]!=null}function merge$2(...o){const et=[];for(const tt of o)isAsyncIterable$6(tt)||et.push(tt);return et.length===o.length?function*(){for(const tt of et)yield*tt}():async function*(){const tt=pushable({objectMode:!0});Promise.resolve().then(async()=>{try{await Promise.all(o.map(async nt=>{for await(const rt of nt)tt.push(rt)})),tt.end()}catch(nt){tt.end(nt)}}),yield*tt}()}function pipe(o,...et){if(o==null)throw new Error("Empty pipeline");if(isDuplex(o)){const nt=o;o=()=>nt.source}else if(isIterable(o)||isAsyncIterable$5(o)){const nt=o;o=()=>nt}const tt=[o,...et];if(tt.length>1&&isDuplex(tt[tt.length-1])&&(tt[tt.length-1]=tt[tt.length-1].sink),tt.length>2)for(let nt=1;nt{let et;for(;o.length>0;)et=o.shift()(et);return et},isAsyncIterable$5=o=>(o==null?void 0:o[Symbol.asyncIterator])!=null,isIterable=o=>(o==null?void 0:o[Symbol.iterator])!=null,isDuplex=o=>o==null?!1:o.sink!=null&&o.source!=null,duplexPipelineFn=o=>et=>{const tt=o.sink(et);if((tt==null?void 0:tt.then)!=null){const nt=pushable({objectMode:!0});tt.then(()=>{nt.end()},it=>{nt.end(it)});let rt;const ot=o.source;if(isAsyncIterable$5(ot))rt=async function*(){yield*ot,nt.end()};else if(isIterable(ot))rt=function*(){yield*ot,nt.end()};else throw new Error("Unknown duplex source type - must be Iterable or AsyncIterable");return merge$2(nt,rt())}return o.source};async function sortPeersByLatency(o,et){return et.length===0?[]:(await Promise.all(et.map(async rt=>{try{const ot=(await o.get(rt.id)).metadata.get("ping");if(!ot)return{peer:rt,ping:1/0};const it=Number(bytesToUtf8(ot));return{peer:rt,ping:it}}catch{return{peer:rt,ping:1/0}}}))).filter(rt=>rt!==null).sort((rt,ot)=>rt.ping-ot.ping).map(rt=>rt.peer)}async function getPeersForProtocol(o,et){const tt=[];return await o.forEach(nt=>{for(let rt=0;rtit.tags.has(Tags.BOOTSTRAP)).slice(0,tt);et>0&&et!it.tags.has(Tags.BOOTSTRAP));if(et===0)return[...nt,...rt];const ot=[...nt];for(;ot.length0;){const it=Math.floor(Math.random()*rt.length),st=rt.splice(it,1)[0];ot.push(st)}return ot}function selectOpenConnection(o){return o.filter(et=>et.status==="open").sort((et,tt)=>tt.timeline.open-et.timeline.open).at(0)}const STREAM_LOCK_KEY="consumed";class StreamManager{constructor(et,tt,nt){Ct(this,"multicodec");Ct(this,"getConnections");Ct(this,"addEventListener");Ct(this,"log");Ct(this,"ongoingCreation",new Set);Ct(this,"streamPool",new Map);Ct(this,"handlePeerUpdateStreamPool",et=>{const{peer:tt}=et.detail;!tt.protocols.includes(this.multicodec)||this.getOpenStreamForCodec(tt.id)||this.scheduleNewStream(tt)});this.multicodec=et,this.getConnections=tt,this.addEventListener=nt,this.log=new Logger$1(`stream-manager:${et}`),this.addEventListener("peer:update",this.handlePeerUpdateStreamPool)}async getStream(et){const tt=et.id.toString(),nt=this.streamPool.get(tt);nt&&(this.streamPool.delete(tt),await nt);let rt=this.getOpenStreamForCodec(et.id);return rt?(this.log.info(`Found existing stream peerId=${et.id.toString()} multicodec=${this.multicodec}`),this.lockStream(et.id.toString(),rt),rt):(rt=await this.createStream(et),this.lockStream(et.id.toString(),rt),rt)}async createStream(et,tt=0){const nt=this.getConnections(et.id),rt=selectOpenConnection(nt);if(!rt)throw new Error(`Failed to get a connection to the peer peerId=${et.id.toString()} multicodec=${this.multicodec}`);let ot,it;for(let st=0;stit.protocol===this.multicodec);if(!(!rt||["done","closed","closing"].includes(rt.writeStatus||"")||this.isStreamLocked(rt)))return rt}lockStream(et,tt){this.log.info(`Locking stream for peerId:${et} streamId:${tt.id}`),tt.metadata[STREAM_LOCK_KEY]=!0}isStreamLocked(et){return!!et.metadata[STREAM_LOCK_KEY]}}class BaseProtocol{constructor(et,tt,nt,rt){Ct(this,"multicodec");Ct(this,"components");Ct(this,"log");Ct(this,"pubsubTopics");Ct(this,"addLibp2pEventListener");Ct(this,"removeLibp2pEventListener");Ct(this,"streamManager");this.multicodec=et,this.components=tt,this.log=nt,this.pubsubTopics=rt,this.addLibp2pEventListener=tt.events.addEventListener.bind(tt.events),this.removeLibp2pEventListener=tt.events.removeEventListener.bind(tt.events),this.streamManager=new StreamManager(et,tt.connectionManager.getConnections.bind(tt.connectionManager),this.addLibp2pEventListener)}async getStream(et){return this.streamManager.getStream(et)}async allPeers(){return getPeersForProtocol(this.components.peerStore,[this.multicodec])}async connectedPeers(){return(await this.allPeers()).filter(tt=>this.components.connectionManager.getConnections(tt.id).length>0)}async getPeers({numPeers:et,maxBootstrapPeers:tt}={maxBootstrapPeers:0,numPeers:0}){const nt=await this.connectedPeers(),rt=filterPeersByDiscovery(nt,et,tt),ot=await sortPeersByLatency(this.components.peerStore,rt);return ot.length===0&&this.log.warn("No peers found. Ensure you have a connection to the network."),ot.length{log$n.error("Failed to register ",FilterCodecs.PUSH,ot)})}async subscribe(tt,nt,rt){const ot=await this.getStream(nt),it=FilterSubscribeRpc.createSubscribeRequest(tt,rt);let st;try{st=await pipe([it.encode()],encode$5,ot,decode$5,async dt=>await all$2(dt))}catch(dt){return log$n.error("Failed to send subscribe request",dt),{success:null,failure:{error:ProtocolError$1.GENERIC_FAIL,peerId:nt.id}}}const{statusCode:at,requestId:ct,statusDesc:lt}=FilterSubscribeResponse.decode(st[0].slice());return at<200||at>=300?(log$n.error(`Filter subscribe request ${ct} failed with status code ${at}: ${lt}`),{failure:{error:ProtocolError$1.REMOTE_PEER_REJECTED,peerId:nt.id},success:null}):{failure:null,success:nt.id}}async unsubscribe(tt,nt,rt){let ot;try{ot=await this.getStream(nt)}catch(st){return log$n.error(`Failed to get a stream for remote peer${nt.id.toString()}`,st),{success:null,failure:{error:ProtocolError$1.NO_STREAM_AVAILABLE,peerId:nt.id}}}const it=FilterSubscribeRpc.createUnsubscribeRequest(tt,rt);try{await pipe([it.encode()],encode$5,ot.sink)}catch(st){return log$n.error("Failed to send unsubscribe request",st),{success:null,failure:{error:ProtocolError$1.GENERIC_FAIL,peerId:nt.id}}}return{success:nt.id,failure:null}}async unsubscribeAll(tt,nt){const rt=await this.getStream(nt),ot=FilterSubscribeRpc.createUnsubscribeAllRequest(tt),it=await pipe([ot.encode()],encode$5,rt,decode$5,async lt=>await all$2(lt));if(!it||!it.length)return{failure:{error:ProtocolError$1.NO_RESPONSE,peerId:nt.id},success:null};const{statusCode:st,requestId:at,statusDesc:ct}=FilterSubscribeResponse.decode(it[0].slice());return st<200||st>=300?(log$n.error(`Filter unsubscribe all request ${at} failed with status code ${st}: ${ct}`),{failure:{error:ProtocolError$1.REMOTE_PEER_REJECTED,peerId:nt.id},success:null}):{failure:null,success:nt.id}}async ping(tt){let nt;try{nt=await this.getStream(tt)}catch(ct){return log$n.error(`Failed to get a stream for remote peer${tt.id.toString()}`,ct),{success:null,failure:{error:ProtocolError$1.NO_STREAM_AVAILABLE,peerId:tt.id}}}const rt=FilterSubscribeRpc.createSubscriberPingRequest();let ot;try{ot=await pipe([rt.encode()],encode$5,nt,decode$5,async ct=>await all$2(ct))}catch(ct){return log$n.error("Failed to send ping request",ct),{success:null,failure:{error:ProtocolError$1.GENERIC_FAIL,peerId:tt.id}}}if(!ot||!ot.length)return{success:null,failure:{error:ProtocolError$1.NO_RESPONSE,peerId:tt.id}};const{statusCode:it,requestId:st,statusDesc:at}=FilterSubscribeResponse.decode(ot[0].slice());return it<200||it>=300?(log$n.error(`Filter ping request ${st} failed with status code ${it}: ${at}`),{success:null,failure:{error:ProtocolError$1.REMOTE_PEER_REJECTED,peerId:tt.id}}):{success:tt.id,failure:null}}onRequest(tt){const{connection:nt,stream:rt}=tt,{remotePeer:ot}=nt;log$n.info(`Received message from ${ot.toString()}`);try{pipe(rt,decode$5,async it=>{for await(const st of it){const at=FilterPushRpc.decode(st.slice()),{pubsubTopic:ct,wakuMessage:lt}=at;if(!lt){log$n.error("Received empty message");return}if(!ct){log$n.error("Pubsub topic missing from push message");return}await this.handleIncomingMessage(ct,lt,nt.remotePeer.toString())}}).then(()=>{log$n.info("Receiving pipe closed.")},async it=>{log$n.error(`Error with receiving pipe on peer:${nt.remotePeer.toString()} -- stream:${rt.id} -- protocol:${rt.protocol}: `,it)})}catch(it){log$n.error("Error decoding message",it)}}}class PushRpc{constructor(et){Ct(this,"proto");this.proto=et}static createRequest(et,tt){return new PushRpc({requestId:v4$2(),request:{message:et,pubsubTopic:tt},response:void 0})}static decode(et){const tt=PushRpc$1.decode(et);return new PushRpc(tt)}encode(){return PushRpc$1.encode(this.proto)}get query(){return this.proto.request}get response(){return this.proto.response}}const RLN_GENERATION_PREFIX_ERROR="could not generate rln-v2 proof",isRLNResponseError=o=>o?o.includes(RLN_GENERATION_PREFIX_ERROR):!1,matchRLNErrorMessage=o=>{const et={[ProtocolError$1.RLN_IDENTITY_MISSING]:ProtocolError$1.RLN_IDENTITY_MISSING,[ProtocolError$1.RLN_MEMBERSHIP_INDEX]:ProtocolError$1.RLN_MEMBERSHIP_INDEX,[ProtocolError$1.RLN_LIMIT_MISSING]:ProtocolError$1.RLN_LIMIT_MISSING},tt=o.toLowerCase();for(const nt in et)if(tt.includes(nt.toLowerCase()))return et[nt];return ProtocolError$1.RLN_PROOF_GENERATION},log$m=new Logger$1("light-push"),LightPushCodec="/vac/waku/lightpush/2.0.0-beta1";class LightPushCore extends BaseProtocol{constructor(tt,nt){super(LightPushCodec,nt.components,log$m,tt);Ct(this,"pubsubTopics");this.pubsubTopics=tt}async preparePushMessage(tt,nt){try{if(!nt.payload||nt.payload.length===0)return log$m.error("Failed to send waku light push: payload is empty"),{query:null,error:ProtocolError$1.EMPTY_PAYLOAD};if(!await isMessageSizeUnderCap(tt,nt))return log$m.error("Failed to send waku light push: message is bigger than 1MB"),{query:null,error:ProtocolError$1.SIZE_TOO_BIG};const rt=await tt.toProtoObj(nt);return rt?{query:PushRpc.createRequest(rt,tt.pubsubTopic),error:null}:(log$m.error("Failed to encode to protoMessage, aborting push"),{query:null,error:ProtocolError$1.ENCODE_FAILED})}catch(rt){return log$m.error("Failed to prepare push message",rt),{query:null,error:ProtocolError$1.GENERIC_FAIL}}}async send(tt,nt,rt){const{query:ot,error:it}=await this.preparePushMessage(tt,nt);if(it||!ot)return{success:null,failure:{error:it,peerId:rt.id}};let st;try{st=await this.getStream(rt)}catch(dt){return log$m.error("Failed to get stream",dt),{success:null,failure:{error:ProtocolError$1.NO_STREAM_AVAILABLE,peerId:rt.id}}}let at;try{at=await pipe([ot.encode()],encode$5,st,decode$5,async dt=>await all$2(dt))}catch(dt){return log$m.error("Failed to send waku light push request",dt),{success:null,failure:{error:ProtocolError$1.GENERIC_FAIL,peerId:rt.id}}}const ct=new Uint8ArrayList;at.forEach(dt=>{ct.append(dt)});let lt;try{lt=PushRpc.decode(ct).response}catch(dt){return log$m.error("Failed to decode push reply",dt),{success:null,failure:{error:ProtocolError$1.DECODE_FAILED,peerId:rt.id}}}if(!lt)return log$m.error("Remote peer fault: No response in PushRPC"),{success:null,failure:{error:ProtocolError$1.NO_RESPONSE,peerId:rt.id}};if(isRLNResponseError(lt.info)){const dt=matchRLNErrorMessage(lt.info);return log$m.error("Remote peer rejected the message: ",dt),{success:null,failure:{error:dt,peerId:rt.id}}}return lt.isSuccess?{success:rt.id,failure:null}:(log$m.error("Remote peer rejected the message: ",lt.info),{success:null,failure:{error:ProtocolError$1.REMOTE_PEER_REJECTED,peerId:rt.id}})}}const EmptyMessage={payload:new Uint8Array,contentTopic:"",version:void 0,timestamp:void 0,meta:void 0,rateLimitProof:void 0,ephemeral:void 0};function toProtoMessage(o){return{...EmptyMessage,...o}}const DEFAULT_PAGE_SIZE=20,MAX_PAGE_SIZE=100,ONE_MILLION=1e6;class StoreQueryRequest{constructor(et){Ct(this,"proto");this.proto=et}static create(et){const tt=new StoreQueryRequest({...et,requestId:v4$2(),timeStart:et.timeStart?BigInt(et.timeStart.getTime()*ONE_MILLION):void 0,timeEnd:et.timeEnd?BigInt(et.timeEnd.getTime()*ONE_MILLION):void 0,messageHashes:et.messageHashes||[],paginationLimit:et.paginationLimit?BigInt(et.paginationLimit):void 0});if(et.pubsubTopic&&!et.contentTopics||!et.pubsubTopic&&et.contentTopics)throw new Error("Both pubsubTopic and contentTopics must be set or unset");if(et.messageHashes&&(et.pubsubTopic||et.contentTopics||et.timeStart||et.timeEnd))throw new Error("Message hash lookup queries cannot include content filter criteria");return tt}static decode(et){const tt=StoreQueryRequest$1.decode(et);return new StoreQueryRequest(tt)}encode(){return StoreQueryRequest$1.encode(this.proto)}}class StoreQueryResponse{constructor(et){Ct(this,"proto");this.proto=et}static decode(et){const tt=StoreQueryResponse$1.decode(et);return new StoreQueryResponse(tt)}encode(){return StoreQueryResponse$1.encode(this.proto)}get statusCode(){return this.proto.statusCode}get statusDesc(){return this.proto.statusDesc}get messages(){return this.proto.messages}get paginationCursor(){return this.proto.paginationCursor}}const log$l=new Logger$1("store"),StoreCodec="/vac/waku/store-query/3.0.0";class StoreCore extends BaseProtocol{constructor(tt,nt){super(StoreCodec,nt.components,log$l,tt);Ct(this,"pubsubTopics");this.pubsubTopics=tt}async*queryPerPage(tt,nt,rt){if(tt.contentTopics.toString()!==Array.from(nt.keys()).toString())throw new Error("Internal error, the decoders should match the query's content topics");let ot=tt.paginationCursor;for(;;){const it=StoreQueryRequest.create({...tt,paginationCursor:ot});let st;try{st=await this.getStream(rt)}catch(ht){log$l.error("Failed to get stream",ht);break}const at=await pipe([it.encode()],encode$5,st,decode$5,async ht=>await all$2(ht)),ct=new Uint8ArrayList;at.forEach(ht=>{ct.append(ht)});const lt=StoreQueryResponse.decode(ct);if(!lt.statusCode||lt.statusCode>=300){const ht=`Store query failed with status code: ${lt.statusCode}, description: ${lt.statusDesc}`;throw log$l.error(ht),new Error(ht)}if(!lt.messages||!lt.messages.length){log$l.warn("Stopping pagination due to empty messages in response");break}if(log$l.info(`${lt.messages.length} messages retrieved from store`),yield lt.messages.map(ht=>{if(!ht.message)return Promise.resolve(void 0);const pt=ht.message.contentTopic;if(pt){const mt=nt.get(pt);if(mt)return mt.fromProtoObj(ht.pubsubTopic||"",toProtoMessage(ht.message))}return Promise.resolve(void 0)}),tt.paginationForward?ot=lt.messages[lt.messages.length-1].messageHash:ot=lt.messages[0].messageHash,lt.messages.length>MAX_PAGE_SIZE&<.messages.length<(tt.paginationLimit||DEFAULT_PAGE_SIZE))break}}}const peerDiscoverySymbol$2=Symbol.for("@libp2p/peer-discovery"),peerIdSymbol$3=Symbol.for("@libp2p/peer-id");function isPeerId$2(o){return!!(o!=null&&o[peerIdSymbol$3])}var ss;let AbortError$9=(ss=class extends Error{constructor(et="The operation was aborted"){super(et),this.name="AbortError"}},Ct(ss,"name","AbortError"),ss);class UnexpectedPeerError extends Error{constructor(et="Unexpected Peer"){super(et),this.name="UnexpectedPeerError"}}Ct(UnexpectedPeerError,"name","UnexpectedPeerError");var as;let InvalidMessageError$3=(as=class extends Error{constructor(et="Invalid message"){super(et),this.name="InvalidMessageError"}},Ct(as,"name","InvalidMessageError"),as);class ProtocolError extends Error{constructor(et="Protocol error"){super(et),this.name="ProtocolError"}}Ct(ProtocolError,"name","ProtocolError");var cs;let TimeoutError$3=(cs=class extends Error{constructor(et="Timed out"){super(et),this.name="TimeoutError"}},Ct(cs,"name","TimeoutError"),cs);function setMaxListeners$9(){}const setMaxListeners$8=(o,...et)=>{try{[...et]}catch{}};var Qn,Zs;let TypedEventEmitter$3=(Zs=class extends EventTarget{constructor(){super();fn(this,Qn,new Map);setMaxListeners$8(1/0,this)}listenerCount(tt){const nt=Mt(this,Qn).get(tt);return nt==null?0:nt.length}addEventListener(tt,nt,rt){super.addEventListener(tt,nt,rt);let ot=Mt(this,Qn).get(tt);ot==null&&(ot=[],Mt(this,Qn).set(tt,ot)),ot.push({callback:nt,once:(rt!==!0&&rt!==!1&&(rt==null?void 0:rt.once))??!1})}removeEventListener(tt,nt,rt){super.removeEventListener(tt.toString(),nt??null,rt);let ot=Mt(this,Qn).get(tt);ot!=null&&(ot=ot.filter(({callback:it})=>it!==nt),Mt(this,Qn).set(tt,ot))}dispatchEvent(tt){const nt=super.dispatchEvent(tt);let rt=Mt(this,Qn).get(tt.type);return rt==null||(rt=rt.filter(({once:ot})=>!ot),Mt(this,Qn).set(tt.type,rt)),nt}safeDispatchEvent(tt,nt={}){return this.dispatchEvent(new CustomEvent(tt,nt))}},Qn=new WeakMap,Zs);const serviceCapabilities$5=Symbol.for("@libp2p/service-capabilities"),RelayPingContentTopic="/relay-ping/1/ping/null",log$k=new Logger$1("keep-alive");class KeepAliveManager{constructor({options:et,relay:tt,libp2p:nt}){Ct(this,"relay");Ct(this,"libp2p");Ct(this,"options");Ct(this,"pingKeepAliveTimers",new Map);Ct(this,"relayKeepAliveTimers",new Map);this.options=et,this.relay=tt,this.libp2p=nt}start(et){this.stop(et);const{pingKeepAlive:tt,relayKeepAlive:nt}=this.options,rt=et.toString();if(tt!==0){const it=setInterval(()=>{(async()=>{let st;try{try{st=await this.libp2p.services.ping.ping(et),log$k.info(`Ping succeeded (${rt})`,st)}catch{log$k.error(`Ping failed for peer (${rt}). + */function _extends(){return _extends=Object.assign?Object.assign.bind():function(o){for(var et=1;et=0)&&(tt[rt]=o[rt]);return tt}function isModifiedEvent(o){return!!(o.metaKey||o.altKey||o.ctrlKey||o.shiftKey)}function shouldProcessLinkClick(o,et){return o.button===0&&(!et||et==="_self")&&!isModifiedEvent(o)}const _excluded=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","viewTransition"],REACT_ROUTER_VERSION="6";try{window.__reactRouterVersion=REACT_ROUTER_VERSION}catch{}const START_TRANSITION="startTransition",startTransitionImpl=React$1[START_TRANSITION];function BrowserRouter(o){let{basename:et,children:tt,future:nt,window:rt}=o,ot=reactExports.useRef();ot.current==null&&(ot.current=createBrowserHistory({window:rt,v5Compat:!0}));let it=ot.current,[st,at]=reactExports.useState({action:it.action,location:it.location}),{v7_startTransition:ct}=nt||{},lt=reactExports.useCallback(dt=>{ct&&startTransitionImpl?startTransitionImpl(()=>at(dt)):at(dt)},[at,ct]);return reactExports.useLayoutEffect(()=>it.listen(lt),[it,lt]),reactExports.useEffect(()=>logV6DeprecationWarnings(nt),[nt]),reactExports.createElement(Router,{basename:et,children:tt,location:st.location,navigationType:st.action,navigator:it,future:nt})}const isBrowser$1=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",ABSOLUTE_URL_REGEX=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Link=reactExports.forwardRef(function(et,tt){let{onClick:nt,relative:rt,reloadDocument:ot,replace:it,state:st,target:at,to:ct,preventScrollReset:lt,viewTransition:dt}=et,ht=_objectWithoutPropertiesLoose(et,_excluded),{basename:pt}=reactExports.useContext(NavigationContext),mt,ft=!1;if(typeof ct=="string"&&ABSOLUTE_URL_REGEX.test(ct)&&(mt=ct,isBrowser$1))try{let vt=new URL(window.location.href),bt=ct.startsWith("//")?new URL(vt.protocol+ct):new URL(ct),Et=stripBasename(bt.pathname,pt);bt.origin===vt.origin&&Et!=null?ct=Et+bt.search+bt.hash:ft=!0}catch{}let yt=useHref(ct,{relative:rt}),gt=useLinkClickHandler(ct,{replace:it,state:st,target:at,preventScrollReset:lt,relative:rt,viewTransition:dt});function xt(vt){nt&&nt(vt),vt.defaultPrevented||gt(vt)}return reactExports.createElement("a",_extends({},ht,{href:mt||yt,onClick:ft||ot?nt:xt,ref:tt,target:at}))});var DataRouterHook;(function(o){o.UseScrollRestoration="useScrollRestoration",o.UseSubmit="useSubmit",o.UseSubmitFetcher="useSubmitFetcher",o.UseFetcher="useFetcher",o.useViewTransitionState="useViewTransitionState"})(DataRouterHook||(DataRouterHook={}));var DataRouterStateHook;(function(o){o.UseFetcher="useFetcher",o.UseFetchers="useFetchers",o.UseScrollRestoration="useScrollRestoration"})(DataRouterStateHook||(DataRouterStateHook={}));function useLinkClickHandler(o,et){let{target:tt,replace:nt,state:rt,preventScrollReset:ot,relative:it,viewTransition:st}=et===void 0?{}:et,at=useNavigate(),ct=useLocation(),lt=useResolvedPath(o,{relative:it});return reactExports.useCallback(dt=>{if(shouldProcessLinkClick(dt,tt)){dt.preventDefault();let ht=nt!==void 0?nt:createPath(ct)===createPath(lt);at(o,{replace:ht,state:rt,preventScrollReset:ot,relative:it,viewTransition:st})}},[ct,at,lt,nt,rt,tt,o,ot,it,st])}function setRef(o,et){typeof o=="function"?o(et):o!=null&&(o.current=et)}function composeRefs(...o){return et=>o.forEach(tt=>setRef(tt,et))}function useComposedRefs(...o){return reactExports.useCallback(composeRefs(...o),o)}var Slot=reactExports.forwardRef((o,et)=>{const{children:tt,...nt}=o,rt=reactExports.Children.toArray(tt),ot=rt.find(isSlottable);if(ot){const it=ot.props.children,st=rt.map(at=>at===ot?reactExports.Children.count(it)>1?reactExports.Children.only(null):reactExports.isValidElement(it)?it.props.children:null:at);return jsxRuntimeExports.jsx(SlotClone,{...nt,ref:et,children:reactExports.isValidElement(it)?reactExports.cloneElement(it,void 0,st):null})}return jsxRuntimeExports.jsx(SlotClone,{...nt,ref:et,children:tt})});Slot.displayName="Slot";var SlotClone=reactExports.forwardRef((o,et)=>{const{children:tt,...nt}=o;if(reactExports.isValidElement(tt)){const rt=getElementRef$1(tt);return reactExports.cloneElement(tt,{...mergeProps(nt,tt.props),ref:et?composeRefs(et,rt):rt})}return reactExports.Children.count(tt)>1?reactExports.Children.only(null):null});SlotClone.displayName="SlotClone";var Slottable=({children:o})=>jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:o});function isSlottable(o){return reactExports.isValidElement(o)&&o.type===Slottable}function mergeProps(o,et){const tt={...et};for(const nt in et){const rt=o[nt],ot=et[nt];/^on[A-Z]/.test(nt)?rt&&ot?tt[nt]=(...st)=>{ot(...st),rt(...st)}:rt&&(tt[nt]=rt):nt==="style"?tt[nt]={...rt,...ot}:nt==="className"&&(tt[nt]=[rt,ot].filter(Boolean).join(" "))}return{...o,...tt}}function getElementRef$1(o){var nt,rt;let et=(nt=Object.getOwnPropertyDescriptor(o.props,"ref"))==null?void 0:nt.get,tt=et&&"isReactWarning"in et&&et.isReactWarning;return tt?o.ref:(et=(rt=Object.getOwnPropertyDescriptor(o,"ref"))==null?void 0:rt.get,tt=et&&"isReactWarning"in et&&et.isReactWarning,tt?o.props.ref:o.props.ref||o.ref)}function r$1(o){var et,tt,nt="";if(typeof o=="string"||typeof o=="number")nt+=o;else if(typeof o=="object")if(Array.isArray(o))for(et=0;ettypeof o=="boolean"?"".concat(o):o===0?"0":o,cx=clsx$1,cva=(o,et)=>tt=>{var nt;if((et==null?void 0:et.variants)==null)return cx(o,tt==null?void 0:tt.class,tt==null?void 0:tt.className);const{variants:rt,defaultVariants:ot}=et,it=Object.keys(rt).map(ct=>{const lt=tt==null?void 0:tt[ct],dt=ot==null?void 0:ot[ct];if(lt===null)return null;const ht=falsyToString(lt)||falsyToString(dt);return rt[ct][ht]}),st=tt&&Object.entries(tt).reduce((ct,lt)=>{let[dt,ht]=lt;return ht===void 0||(ct[dt]=ht),ct},{}),at=et==null||(nt=et.compoundVariants)===null||nt===void 0?void 0:nt.reduce((ct,lt)=>{let{class:dt,className:ht,...pt}=lt;return Object.entries(pt).every(mt=>{let[ft,yt]=mt;return Array.isArray(yt)?yt.includes({...ot,...st}[ft]):{...ot,...st}[ft]===yt})?[...ct,dt,ht]:ct},[]);return cx(o,it,at,tt==null?void 0:tt.class,tt==null?void 0:tt.className)};function r(o){var et,tt,nt="";if(typeof o=="string"||typeof o=="number")nt+=o;else if(typeof o=="object")if(Array.isArray(o)){var rt=o.length;for(et=0;et{const et=createClassMap(o),{conflictingClassGroups:tt,conflictingClassGroupModifiers:nt}=o;return{getClassGroupId:it=>{const st=it.split(CLASS_PART_SEPARATOR);return st[0]===""&&st.length!==1&&st.shift(),getGroupRecursive(st,et)||getGroupIdForArbitraryProperty(it)},getConflictingClassGroupIds:(it,st)=>{const at=tt[it]||[];return st&&nt[it]?[...at,...nt[it]]:at}}},getGroupRecursive=(o,et)=>{var it;if(o.length===0)return et.classGroupId;const tt=o[0],nt=et.nextPart.get(tt),rt=nt?getGroupRecursive(o.slice(1),nt):void 0;if(rt)return rt;if(et.validators.length===0)return;const ot=o.join(CLASS_PART_SEPARATOR);return(it=et.validators.find(({validator:st})=>st(ot)))==null?void 0:it.classGroupId},arbitraryPropertyRegex=/^\[(.+)\]$/,getGroupIdForArbitraryProperty=o=>{if(arbitraryPropertyRegex.test(o)){const et=arbitraryPropertyRegex.exec(o)[1],tt=et==null?void 0:et.substring(0,et.indexOf(":"));if(tt)return"arbitrary.."+tt}},createClassMap=o=>{const{theme:et,prefix:tt}=o,nt={nextPart:new Map,validators:[]};return getPrefixedClassGroupEntries(Object.entries(o.classGroups),tt).forEach(([ot,it])=>{processClassesRecursively(it,nt,ot,et)}),nt},processClassesRecursively=(o,et,tt,nt)=>{o.forEach(rt=>{if(typeof rt=="string"){const ot=rt===""?et:getPart(et,rt);ot.classGroupId=tt;return}if(typeof rt=="function"){if(isThemeGetter(rt)){processClassesRecursively(rt(nt),et,tt,nt);return}et.validators.push({validator:rt,classGroupId:tt});return}Object.entries(rt).forEach(([ot,it])=>{processClassesRecursively(it,getPart(et,ot),tt,nt)})})},getPart=(o,et)=>{let tt=o;return et.split(CLASS_PART_SEPARATOR).forEach(nt=>{tt.nextPart.has(nt)||tt.nextPart.set(nt,{nextPart:new Map,validators:[]}),tt=tt.nextPart.get(nt)}),tt},isThemeGetter=o=>o.isThemeGetter,getPrefixedClassGroupEntries=(o,et)=>et?o.map(([tt,nt])=>{const rt=nt.map(ot=>typeof ot=="string"?et+ot:typeof ot=="object"?Object.fromEntries(Object.entries(ot).map(([it,st])=>[et+it,st])):ot);return[tt,rt]}):o,createLruCache=o=>{if(o<1)return{get:()=>{},set:()=>{}};let et=0,tt=new Map,nt=new Map;const rt=(ot,it)=>{tt.set(ot,it),et++,et>o&&(et=0,nt=tt,tt=new Map)};return{get(ot){let it=tt.get(ot);if(it!==void 0)return it;if((it=nt.get(ot))!==void 0)return rt(ot,it),it},set(ot,it){tt.has(ot)?tt.set(ot,it):rt(ot,it)}}},IMPORTANT_MODIFIER="!",createParseClassName=o=>{const{separator:et,experimentalParseClassName:tt}=o,nt=et.length===1,rt=et[0],ot=et.length,it=st=>{const at=[];let ct=0,lt=0,dt;for(let yt=0;ytlt?dt-lt:void 0;return{modifiers:at,hasImportantModifier:pt,baseClassName:mt,maybePostfixModifierPosition:ft}};return tt?st=>tt({className:st,parseClassName:it}):it},sortModifiers=o=>{if(o.length<=1)return o;const et=[];let tt=[];return o.forEach(nt=>{nt[0]==="["?(et.push(...tt.sort(),nt),tt=[]):tt.push(nt)}),et.push(...tt.sort()),et},createConfigUtils=o=>({cache:createLruCache(o.cacheSize),parseClassName:createParseClassName(o),...createClassGroupUtils(o)}),SPLIT_CLASSES_REGEX=/\s+/,mergeClassList=(o,et)=>{const{parseClassName:tt,getClassGroupId:nt,getConflictingClassGroupIds:rt}=et,ot=[],it=o.trim().split(SPLIT_CLASSES_REGEX);let st="";for(let at=it.length-1;at>=0;at-=1){const ct=it[at],{modifiers:lt,hasImportantModifier:dt,baseClassName:ht,maybePostfixModifierPosition:pt}=tt(ct);let mt=!!pt,ft=nt(mt?ht.substring(0,pt):ht);if(!ft){if(!mt){st=ct+(st.length>0?" "+st:st);continue}if(ft=nt(ht),!ft){st=ct+(st.length>0?" "+st:st);continue}mt=!1}const yt=sortModifiers(lt).join(":"),gt=dt?yt+IMPORTANT_MODIFIER:yt,xt=gt+ft;if(ot.includes(xt))continue;ot.push(xt);const vt=rt(ft,mt);for(let bt=0;bt0?" "+st:st)}return st};function twJoin(){let o=0,et,tt,nt="";for(;o{if(typeof o=="string")return o;let et,tt="";for(let nt=0;ntdt(lt),o());return tt=createConfigUtils(ct),nt=tt.cache.get,rt=tt.cache.set,ot=st,st(at)}function st(at){const ct=nt(at);if(ct)return ct;const lt=mergeClassList(at,tt);return rt(at,lt),lt}return function(){return ot(twJoin.apply(null,arguments))}}const fromTheme=o=>{const et=tt=>tt[o]||[];return et.isThemeGetter=!0,et},arbitraryValueRegex=/^\[(?:([a-z-]+):)?(.+)\]$/i,fractionRegex=/^\d+\/\d+$/,stringLengths=new Set(["px","full","screen"]),tshirtUnitRegex=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,lengthUnitRegex=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,colorFunctionRegex=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,shadowRegex=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,imageRegex=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,isLength=o=>isNumber(o)||stringLengths.has(o)||fractionRegex.test(o),isArbitraryLength=o=>getIsArbitraryValue(o,"length",isLengthOnly),isNumber=o=>!!o&&!Number.isNaN(Number(o)),isArbitraryNumber=o=>getIsArbitraryValue(o,"number",isNumber),isInteger$1=o=>!!o&&Number.isInteger(Number(o)),isPercent=o=>o.endsWith("%")&&isNumber(o.slice(0,-1)),isArbitraryValue=o=>arbitraryValueRegex.test(o),isTshirtSize=o=>tshirtUnitRegex.test(o),sizeLabels=new Set(["length","size","percentage"]),isArbitrarySize=o=>getIsArbitraryValue(o,sizeLabels,isNever),isArbitraryPosition=o=>getIsArbitraryValue(o,"position",isNever),imageLabels=new Set(["image","url"]),isArbitraryImage=o=>getIsArbitraryValue(o,imageLabels,isImage),isArbitraryShadow=o=>getIsArbitraryValue(o,"",isShadow),isAny=()=>!0,getIsArbitraryValue=(o,et,tt)=>{const nt=arbitraryValueRegex.exec(o);return nt?nt[1]?typeof et=="string"?nt[1]===et:et.has(nt[1]):tt(nt[2]):!1},isLengthOnly=o=>lengthUnitRegex.test(o)&&!colorFunctionRegex.test(o),isNever=()=>!1,isShadow=o=>shadowRegex.test(o),isImage=o=>imageRegex.test(o),getDefaultConfig=()=>{const o=fromTheme("colors"),et=fromTheme("spacing"),tt=fromTheme("blur"),nt=fromTheme("brightness"),rt=fromTheme("borderColor"),ot=fromTheme("borderRadius"),it=fromTheme("borderSpacing"),st=fromTheme("borderWidth"),at=fromTheme("contrast"),ct=fromTheme("grayscale"),lt=fromTheme("hueRotate"),dt=fromTheme("invert"),ht=fromTheme("gap"),pt=fromTheme("gradientColorStops"),mt=fromTheme("gradientColorStopPositions"),ft=fromTheme("inset"),yt=fromTheme("margin"),gt=fromTheme("opacity"),xt=fromTheme("padding"),vt=fromTheme("saturate"),bt=fromTheme("scale"),Et=fromTheme("sepia"),wt=fromTheme("skew"),kt=fromTheme("space"),It=fromTheme("translate"),Rt=()=>["auto","contain","none"],Pt=()=>["auto","hidden","clip","visible","scroll"],jt=()=>["auto",isArbitraryValue,et],Ot=()=>[isArbitraryValue,et],Bt=()=>["",isLength,isArbitraryLength],zt=()=>["auto",isNumber,isArbitraryValue],Ft=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],Yt=()=>["solid","dashed","dotted","double","none"],Ht=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],Ut=()=>["start","end","center","between","around","evenly","stretch"],qt=()=>["","0",isArbitraryValue],Lt=()=>["auto","avoid","all","avoid-page","page","left","right","column"],Zt=()=>[isNumber,isArbitraryValue];return{cacheSize:500,separator:":",theme:{colors:[isAny],spacing:[isLength,isArbitraryLength],blur:["none","",isTshirtSize,isArbitraryValue],brightness:Zt(),borderColor:[o],borderRadius:["none","","full",isTshirtSize,isArbitraryValue],borderSpacing:Ot(),borderWidth:Bt(),contrast:Zt(),grayscale:qt(),hueRotate:Zt(),invert:qt(),gap:Ot(),gradientColorStops:[o],gradientColorStopPositions:[isPercent,isArbitraryLength],inset:jt(),margin:jt(),opacity:Zt(),padding:Ot(),saturate:Zt(),scale:Zt(),sepia:qt(),skew:Zt(),space:Ot(),translate:Ot()},classGroups:{aspect:[{aspect:["auto","square","video",isArbitraryValue]}],container:["container"],columns:[{columns:[isTshirtSize]}],"break-after":[{"break-after":Lt()}],"break-before":[{"break-before":Lt()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...Ft(),isArbitraryValue]}],overflow:[{overflow:Pt()}],"overflow-x":[{"overflow-x":Pt()}],"overflow-y":[{"overflow-y":Pt()}],overscroll:[{overscroll:Rt()}],"overscroll-x":[{"overscroll-x":Rt()}],"overscroll-y":[{"overscroll-y":Rt()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[ft]}],"inset-x":[{"inset-x":[ft]}],"inset-y":[{"inset-y":[ft]}],start:[{start:[ft]}],end:[{end:[ft]}],top:[{top:[ft]}],right:[{right:[ft]}],bottom:[{bottom:[ft]}],left:[{left:[ft]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",isInteger$1,isArbitraryValue]}],basis:[{basis:jt()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",isArbitraryValue]}],grow:[{grow:qt()}],shrink:[{shrink:qt()}],order:[{order:["first","last","none",isInteger$1,isArbitraryValue]}],"grid-cols":[{"grid-cols":[isAny]}],"col-start-end":[{col:["auto",{span:["full",isInteger$1,isArbitraryValue]},isArbitraryValue]}],"col-start":[{"col-start":zt()}],"col-end":[{"col-end":zt()}],"grid-rows":[{"grid-rows":[isAny]}],"row-start-end":[{row:["auto",{span:[isInteger$1,isArbitraryValue]},isArbitraryValue]}],"row-start":[{"row-start":zt()}],"row-end":[{"row-end":zt()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",isArbitraryValue]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",isArbitraryValue]}],gap:[{gap:[ht]}],"gap-x":[{"gap-x":[ht]}],"gap-y":[{"gap-y":[ht]}],"justify-content":[{justify:["normal",...Ut()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...Ut(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...Ut(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[xt]}],px:[{px:[xt]}],py:[{py:[xt]}],ps:[{ps:[xt]}],pe:[{pe:[xt]}],pt:[{pt:[xt]}],pr:[{pr:[xt]}],pb:[{pb:[xt]}],pl:[{pl:[xt]}],m:[{m:[yt]}],mx:[{mx:[yt]}],my:[{my:[yt]}],ms:[{ms:[yt]}],me:[{me:[yt]}],mt:[{mt:[yt]}],mr:[{mr:[yt]}],mb:[{mb:[yt]}],ml:[{ml:[yt]}],"space-x":[{"space-x":[kt]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[kt]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",isArbitraryValue,et]}],"min-w":[{"min-w":[isArbitraryValue,et,"min","max","fit"]}],"max-w":[{"max-w":[isArbitraryValue,et,"none","full","min","max","fit","prose",{screen:[isTshirtSize]},isTshirtSize]}],h:[{h:[isArbitraryValue,et,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[isArbitraryValue,et,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[isArbitraryValue,et,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[isArbitraryValue,et,"auto","min","max","fit"]}],"font-size":[{text:["base",isTshirtSize,isArbitraryLength]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",isArbitraryNumber]}],"font-family":[{font:[isAny]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractons"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",isArbitraryValue]}],"line-clamp":[{"line-clamp":["none",isNumber,isArbitraryNumber]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",isLength,isArbitraryValue]}],"list-image":[{"list-image":["none",isArbitraryValue]}],"list-style-type":[{list:["none","disc","decimal",isArbitraryValue]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[o]}],"placeholder-opacity":[{"placeholder-opacity":[gt]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[o]}],"text-opacity":[{"text-opacity":[gt]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...Yt(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",isLength,isArbitraryLength]}],"underline-offset":[{"underline-offset":["auto",isLength,isArbitraryValue]}],"text-decoration-color":[{decoration:[o]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:Ot()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",isArbitraryValue]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",isArbitraryValue]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[gt]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...Ft(),isArbitraryPosition]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",isArbitrarySize]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},isArbitraryImage]}],"bg-color":[{bg:[o]}],"gradient-from-pos":[{from:[mt]}],"gradient-via-pos":[{via:[mt]}],"gradient-to-pos":[{to:[mt]}],"gradient-from":[{from:[pt]}],"gradient-via":[{via:[pt]}],"gradient-to":[{to:[pt]}],rounded:[{rounded:[ot]}],"rounded-s":[{"rounded-s":[ot]}],"rounded-e":[{"rounded-e":[ot]}],"rounded-t":[{"rounded-t":[ot]}],"rounded-r":[{"rounded-r":[ot]}],"rounded-b":[{"rounded-b":[ot]}],"rounded-l":[{"rounded-l":[ot]}],"rounded-ss":[{"rounded-ss":[ot]}],"rounded-se":[{"rounded-se":[ot]}],"rounded-ee":[{"rounded-ee":[ot]}],"rounded-es":[{"rounded-es":[ot]}],"rounded-tl":[{"rounded-tl":[ot]}],"rounded-tr":[{"rounded-tr":[ot]}],"rounded-br":[{"rounded-br":[ot]}],"rounded-bl":[{"rounded-bl":[ot]}],"border-w":[{border:[st]}],"border-w-x":[{"border-x":[st]}],"border-w-y":[{"border-y":[st]}],"border-w-s":[{"border-s":[st]}],"border-w-e":[{"border-e":[st]}],"border-w-t":[{"border-t":[st]}],"border-w-r":[{"border-r":[st]}],"border-w-b":[{"border-b":[st]}],"border-w-l":[{"border-l":[st]}],"border-opacity":[{"border-opacity":[gt]}],"border-style":[{border:[...Yt(),"hidden"]}],"divide-x":[{"divide-x":[st]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[st]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[gt]}],"divide-style":[{divide:Yt()}],"border-color":[{border:[rt]}],"border-color-x":[{"border-x":[rt]}],"border-color-y":[{"border-y":[rt]}],"border-color-s":[{"border-s":[rt]}],"border-color-e":[{"border-e":[rt]}],"border-color-t":[{"border-t":[rt]}],"border-color-r":[{"border-r":[rt]}],"border-color-b":[{"border-b":[rt]}],"border-color-l":[{"border-l":[rt]}],"divide-color":[{divide:[rt]}],"outline-style":[{outline:["",...Yt()]}],"outline-offset":[{"outline-offset":[isLength,isArbitraryValue]}],"outline-w":[{outline:[isLength,isArbitraryLength]}],"outline-color":[{outline:[o]}],"ring-w":[{ring:Bt()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[o]}],"ring-opacity":[{"ring-opacity":[gt]}],"ring-offset-w":[{"ring-offset":[isLength,isArbitraryLength]}],"ring-offset-color":[{"ring-offset":[o]}],shadow:[{shadow:["","inner","none",isTshirtSize,isArbitraryShadow]}],"shadow-color":[{shadow:[isAny]}],opacity:[{opacity:[gt]}],"mix-blend":[{"mix-blend":[...Ht(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":Ht()}],filter:[{filter:["","none"]}],blur:[{blur:[tt]}],brightness:[{brightness:[nt]}],contrast:[{contrast:[at]}],"drop-shadow":[{"drop-shadow":["","none",isTshirtSize,isArbitraryValue]}],grayscale:[{grayscale:[ct]}],"hue-rotate":[{"hue-rotate":[lt]}],invert:[{invert:[dt]}],saturate:[{saturate:[vt]}],sepia:[{sepia:[Et]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[tt]}],"backdrop-brightness":[{"backdrop-brightness":[nt]}],"backdrop-contrast":[{"backdrop-contrast":[at]}],"backdrop-grayscale":[{"backdrop-grayscale":[ct]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[lt]}],"backdrop-invert":[{"backdrop-invert":[dt]}],"backdrop-opacity":[{"backdrop-opacity":[gt]}],"backdrop-saturate":[{"backdrop-saturate":[vt]}],"backdrop-sepia":[{"backdrop-sepia":[Et]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[it]}],"border-spacing-x":[{"border-spacing-x":[it]}],"border-spacing-y":[{"border-spacing-y":[it]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",isArbitraryValue]}],duration:[{duration:Zt()}],ease:[{ease:["linear","in","out","in-out",isArbitraryValue]}],delay:[{delay:Zt()}],animate:[{animate:["none","spin","ping","pulse","bounce",isArbitraryValue]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[bt]}],"scale-x":[{"scale-x":[bt]}],"scale-y":[{"scale-y":[bt]}],rotate:[{rotate:[isInteger$1,isArbitraryValue]}],"translate-x":[{"translate-x":[It]}],"translate-y":[{"translate-y":[It]}],"skew-x":[{"skew-x":[wt]}],"skew-y":[{"skew-y":[wt]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",isArbitraryValue]}],accent:[{accent:["auto",o]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",isArbitraryValue]}],"caret-color":[{caret:[o]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":Ot()}],"scroll-mx":[{"scroll-mx":Ot()}],"scroll-my":[{"scroll-my":Ot()}],"scroll-ms":[{"scroll-ms":Ot()}],"scroll-me":[{"scroll-me":Ot()}],"scroll-mt":[{"scroll-mt":Ot()}],"scroll-mr":[{"scroll-mr":Ot()}],"scroll-mb":[{"scroll-mb":Ot()}],"scroll-ml":[{"scroll-ml":Ot()}],"scroll-p":[{"scroll-p":Ot()}],"scroll-px":[{"scroll-px":Ot()}],"scroll-py":[{"scroll-py":Ot()}],"scroll-ps":[{"scroll-ps":Ot()}],"scroll-pe":[{"scroll-pe":Ot()}],"scroll-pt":[{"scroll-pt":Ot()}],"scroll-pr":[{"scroll-pr":Ot()}],"scroll-pb":[{"scroll-pb":Ot()}],"scroll-pl":[{"scroll-pl":Ot()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",isArbitraryValue]}],fill:[{fill:[o,"none"]}],"stroke-w":[{stroke:[isLength,isArbitraryLength,isArbitraryNumber]}],stroke:[{stroke:[o,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}},twMerge=createTailwindMerge(getDefaultConfig);function cn(...o){return twMerge(clsx(o))}const buttonVariants=cva("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground shadow hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",outline:"border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2",sm:"h-8 rounded-md px-3 text-xs",lg:"h-10 rounded-md px-8",icon:"h-9 w-9"}},defaultVariants:{variant:"default",size:"default"}}),Button=reactExports.forwardRef(({className:o,variant:et,size:tt,asChild:nt=!1,...rt},ot)=>{const it=nt?Slot:"button";return jsxRuntimeExports.jsx(it,{className:cn("inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50","min-h-[44px] px-4 py-2 md:min-h-[36px] md:px-3 md:py-1.5",buttonVariants({variant:et,size:tt,className:o})),ref:ot,...rt})});Button.displayName="Button";function alloc$2(o=0){return new Uint8Array(o)}function allocUnsafe(o=0){return new Uint8Array(o)}const N1$1=Math.pow(2,7),N2$1=Math.pow(2,14),N3$1=Math.pow(2,21),N4$1=Math.pow(2,28),N5$1=Math.pow(2,35),N6$1=Math.pow(2,42),N7$1=Math.pow(2,49),MSB$2=128,REST$2=127;function encodingLength$3(o){if(oNumber.MAX_SAFE_INTEGER)throw new RangeError("Could not encode varint");return 8}function encodeUint8Array(o,et,tt=0){switch(encodingLength$3(o)){case 8:et[tt++]=o&255|MSB$2,o/=128;case 7:et[tt++]=o&255|MSB$2,o/=128;case 6:et[tt++]=o&255|MSB$2,o/=128;case 5:et[tt++]=o&255|MSB$2,o/=128;case 4:et[tt++]=o&255|MSB$2,o>>>=7;case 3:et[tt++]=o&255|MSB$2,o>>>=7;case 2:et[tt++]=o&255|MSB$2,o>>>=7;case 1:{et[tt++]=o&255,o>>>=7;break}default:throw new Error("unreachable")}return et}function encodeUint8ArrayList(o,et,tt=0){switch(encodingLength$3(o)){case 8:et.set(tt++,o&255|MSB$2),o/=128;case 7:et.set(tt++,o&255|MSB$2),o/=128;case 6:et.set(tt++,o&255|MSB$2),o/=128;case 5:et.set(tt++,o&255|MSB$2),o/=128;case 4:et.set(tt++,o&255|MSB$2),o>>>=7;case 3:et.set(tt++,o&255|MSB$2),o>>>=7;case 2:et.set(tt++,o&255|MSB$2),o>>>=7;case 1:{et.set(tt++,o&255),o>>>=7;break}default:throw new Error("unreachable")}return et}function decodeUint8Array(o,et){let tt=o[et],nt=0;if(nt+=tt&REST$2,tt>>31>0){const tt=~this.lo+1>>>0;let nt=~this.hi>>>0;return tt===0&&(nt=nt+1>>>0),-(tt+nt*4294967296)}return this.lo+this.hi*4294967296}toBigInt(et=!1){if(et)return BigInt(this.lo>>>0)+(BigInt(this.hi>>>0)<<32n);if(this.hi>>>31){const tt=~this.lo+1>>>0;let nt=~this.hi>>>0;return tt===0&&(nt=nt+1>>>0),-(BigInt(tt)+(BigInt(nt)<<32n))}return BigInt(this.lo>>>0)+(BigInt(this.hi>>>0)<<32n)}toString(et=!1){return this.toBigInt(et).toString()}zzEncode(){const et=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^et)>>>0,this.lo=(this.lo<<1^et)>>>0,this}zzDecode(){const et=-(this.lo&1);return this.lo=((this.lo>>>1|this.hi<<31)^et)>>>0,this.hi=(this.hi>>>1^et)>>>0,this}length(){const et=this.lo,tt=(this.lo>>>28|this.hi<<4)>>>0,nt=this.hi>>>24;return nt===0?tt===0?et<16384?et<128?1:2:et<2097152?3:4:tt<16384?tt<128?5:6:tt<2097152?7:8:nt<128?9:10}static fromBigInt(et){if(et===0n)return zero;if(etMIN_SAFE_NUMBER_INTEGER)return this.fromNumber(Number(et));const tt=et<0n;tt&&(et=-et);let nt=et>>32n,rt=et-(nt<<32n);return tt&&(nt=~nt|0n,rt=~rt|0n,++rt>TWO_32&&(rt=0n,++nt>TWO_32&&(nt=0n))),new Er(Number(rt),Number(nt))}static fromNumber(et){if(et===0)return zero;const tt=et<0;tt&&(et=-et);let nt=et>>>0,rt=(et-nt)/4294967296>>>0;return tt&&(rt=~rt>>>0,nt=~nt>>>0,++nt>4294967295&&(nt=0,++rt>4294967295&&(rt=0))),new Er(nt,rt)}static from(et){return typeof et=="number"?Er.fromNumber(et):typeof et=="bigint"?Er.fromBigInt(et):typeof et=="string"?Er.fromBigInt(BigInt(et)):et.low!=null||et.high!=null?new Er(et.low>>>0,et.high>>>0):zero}};const zero=new LongBits$2(0,0);zero.toBigInt=function(){return 0n};zero.zzEncode=zero.zzDecode=function(){return this};zero.length=function(){return 1};const TWO_32=4294967296n;function length$1(o){let et=0,tt=0;for(let nt=0;nt191&&st<224?ot[it++]=(st&31)<<6|o[et++]&63:st>239&&st<365?(st=((st&7)<<18|(o[et++]&63)<<12|(o[et++]&63)<<6|o[et++]&63)-65536,ot[it++]=55296+(st>>10),ot[it++]=56320+(st&1023)):ot[it++]=(st&15)<<12|(o[et++]&63)<<6|o[et++]&63,it>8191&&((rt??(rt=[])).push(String.fromCharCode.apply(String,ot)),it=0);return rt!=null?(it>0&&rt.push(String.fromCharCode.apply(String,ot.slice(0,it))),rt.join("")):String.fromCharCode.apply(String,ot.slice(0,it))}function write$2(o,et,tt){const nt=tt;let rt,ot;for(let it=0;it>6|192,et[tt++]=rt&63|128):(rt&64512)===55296&&((ot=o.charCodeAt(it+1))&64512)===56320?(rt=65536+((rt&1023)<<10)+(ot&1023),++it,et[tt++]=rt>>18|240,et[tt++]=rt>>12&63|128,et[tt++]=rt>>6&63|128,et[tt++]=rt&63|128):(et[tt++]=rt>>12|224,et[tt++]=rt>>6&63|128,et[tt++]=rt&63|128);return tt-nt}function indexOutOfRange$1(o,et){return RangeError(`index out of range: ${o.pos} + ${et??1} > ${o.len}`)}function readFixed32End(o,et){return(o[et-4]|o[et-3]<<8|o[et-2]<<16|o[et-1]<<24)>>>0}class Uint8ArrayReader{constructor(et){Ct(this,"buf");Ct(this,"pos");Ct(this,"len");Ct(this,"_slice",Uint8Array.prototype.subarray);this.buf=et,this.pos=0,this.len=et.length}uint32(){let et=4294967295;if(et=(this.buf[this.pos]&127)>>>0,this.buf[this.pos++]<128||(et=(et|(this.buf[this.pos]&127)<<7)>>>0,this.buf[this.pos++]<128)||(et=(et|(this.buf[this.pos]&127)<<14)>>>0,this.buf[this.pos++]<128)||(et=(et|(this.buf[this.pos]&127)<<21)>>>0,this.buf[this.pos++]<128)||(et=(et|(this.buf[this.pos]&15)<<28)>>>0,this.buf[this.pos++]<128))return et;if((this.pos+=5)>this.len)throw this.pos=this.len,indexOutOfRange$1(this,10);return et}int32(){return this.uint32()|0}sint32(){const et=this.uint32();return et>>>1^-(et&1)|0}bool(){return this.uint32()!==0}fixed32(){if(this.pos+4>this.len)throw indexOutOfRange$1(this,4);return readFixed32End(this.buf,this.pos+=4)}sfixed32(){if(this.pos+4>this.len)throw indexOutOfRange$1(this,4);return readFixed32End(this.buf,this.pos+=4)|0}float(){if(this.pos+4>this.len)throw indexOutOfRange$1(this,4);const et=readFloatLE(this.buf,this.pos);return this.pos+=4,et}double(){if(this.pos+8>this.len)throw indexOutOfRange$1(this,4);const et=readDoubleLE(this.buf,this.pos);return this.pos+=8,et}bytes(){const et=this.uint32(),tt=this.pos,nt=this.pos+et;if(nt>this.len)throw indexOutOfRange$1(this,et);return this.pos+=et,tt===nt?new Uint8Array(0):this.buf.subarray(tt,nt)}string(){const et=this.bytes();return read$2(et,0,et.length)}skip(et){if(typeof et=="number"){if(this.pos+et>this.len)throw indexOutOfRange$1(this,et);this.pos+=et}else do if(this.pos>=this.len)throw indexOutOfRange$1(this);while(this.buf[this.pos++]&128);return this}skipType(et){switch(et){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;(et=this.uint32()&7)!==4;)this.skipType(et);break;case 5:this.skip(4);break;default:throw Error(`invalid wire type ${et} at offset ${this.pos}`)}return this}readLongVarint(){const et=new LongBits$2(0,0);let tt=0;if(this.len-this.pos>4){for(;tt<4;++tt)if(et.lo=(et.lo|(this.buf[this.pos]&127)<>>0,this.buf[this.pos++]<128)return et;if(et.lo=(et.lo|(this.buf[this.pos]&127)<<28)>>>0,et.hi=(et.hi|(this.buf[this.pos]&127)>>4)>>>0,this.buf[this.pos++]<128)return et;tt=0}else{for(;tt<3;++tt){if(this.pos>=this.len)throw indexOutOfRange$1(this);if(et.lo=(et.lo|(this.buf[this.pos]&127)<>>0,this.buf[this.pos++]<128)return et}return et.lo=(et.lo|(this.buf[this.pos++]&127)<>>0,et}if(this.len-this.pos>4){for(;tt<5;++tt)if(et.hi=(et.hi|(this.buf[this.pos]&127)<>>0,this.buf[this.pos++]<128)return et}else for(;tt<5;++tt){if(this.pos>=this.len)throw indexOutOfRange$1(this);if(et.hi=(et.hi|(this.buf[this.pos]&127)<>>0,this.buf[this.pos++]<128)return et}throw Error("invalid varint encoding")}readFixed64(){if(this.pos+8>this.len)throw indexOutOfRange$1(this,8);const et=readFixed32End(this.buf,this.pos+=4),tt=readFixed32End(this.buf,this.pos+=4);return new LongBits$2(et,tt)}int64(){return this.readLongVarint().toBigInt()}int64Number(){return this.readLongVarint().toNumber()}int64String(){return this.readLongVarint().toString()}uint64(){return this.readLongVarint().toBigInt(!0)}uint64Number(){const et=decodeUint8Array(this.buf,this.pos);return this.pos+=encodingLength$3(et),et}uint64String(){return this.readLongVarint().toString(!0)}sint64(){return this.readLongVarint().zzDecode().toBigInt()}sint64Number(){return this.readLongVarint().zzDecode().toNumber()}sint64String(){return this.readLongVarint().zzDecode().toString()}fixed64(){return this.readFixed64().toBigInt()}fixed64Number(){return this.readFixed64().toNumber()}fixed64String(){return this.readFixed64().toString()}sfixed64(){return this.readFixed64().toBigInt()}sfixed64Number(){return this.readFixed64().toNumber()}sfixed64String(){return this.readFixed64().toString()}}function createReader(o){return new Uint8ArrayReader(o instanceof Uint8Array?o:o.subarray())}function decodeMessage(o,et,tt){const nt=createReader(o);return et.decode(nt,void 0,tt)}function equals$2(o,et){if(o===et)return!0;if(o.byteLength!==et.byteLength)return!1;for(let tt=0;tt=255)throw new TypeError("Alphabet too long");for(var tt=new Uint8Array(256),nt=0;nt>>0,bt=new Uint8Array(vt);gt!==xt;){for(var Et=mt[gt],wt=0,kt=vt-1;(Et!==0||wt>>0,bt[kt]=Et%st>>>0,Et=Et/st>>>0;if(Et!==0)throw new Error("Non-zero carry");yt=wt,gt++}for(var It=vt-yt;It!==vt&&bt[It]===0;)It++;for(var Rt=at.repeat(ft);It>>0,vt=new Uint8Array(xt);mt[ft];){var bt=tt[mt.charCodeAt(ft)];if(bt===255)return;for(var Et=0,wt=xt-1;(bt!==0||Et>>0,vt[wt]=bt%256>>>0,bt=bt/256>>>0;if(bt!==0)throw new Error("Non-zero carry");gt=Et,ft++}if(mt[ft]!==" "){for(var kt=xt-gt;kt!==xt&&vt[kt]===0;)kt++;for(var It=new Uint8Array(yt+(xt-kt)),Rt=yt;kt!==xt;)It[Rt++]=vt[kt++];return It}}}function pt(mt){var ft=ht(mt);if(ft)return ft;throw new Error(`Non-${et} character`)}return{encode:dt,decodeUnsafe:ht,decode:pt}}var src$1=base$1,_brrp__multiformats_scope_baseX=src$1;let Encoder$2=class{constructor(et,tt,nt){Ct(this,"name");Ct(this,"prefix");Ct(this,"baseEncode");this.name=et,this.prefix=tt,this.baseEncode=nt}encode(et){if(et instanceof Uint8Array)return`${this.prefix}${this.baseEncode(et)}`;throw Error("Unknown type, must be binary type")}},Decoder$2=class{constructor(et,tt,nt){Ct(this,"name");Ct(this,"prefix");Ct(this,"baseDecode");Ct(this,"prefixCodePoint");this.name=et,this.prefix=tt;const rt=tt.codePointAt(0);if(rt===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=rt,this.baseDecode=nt}decode(et){if(typeof et=="string"){if(et.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(et)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(et.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(et){return or$2(this,et)}};class ComposedDecoder{constructor(et){Ct(this,"decoders");this.decoders=et}or(et){return or$2(this,et)}decode(et){const tt=et[0],nt=this.decoders[tt];if(nt!=null)return nt.decode(et);throw RangeError(`Unable to decode multibase string ${JSON.stringify(et)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}}function or$2(o,et){return new ComposedDecoder({...o.decoders??{[o.prefix]:o},...et.decoders??{[et.prefix]:et}})}class Codec{constructor(et,tt,nt,rt){Ct(this,"name");Ct(this,"prefix");Ct(this,"baseEncode");Ct(this,"baseDecode");Ct(this,"encoder");Ct(this,"decoder");this.name=et,this.prefix=tt,this.baseEncode=nt,this.baseDecode=rt,this.encoder=new Encoder$2(et,tt,nt),this.decoder=new Decoder$2(et,tt,rt)}encode(et){return this.encoder.encode(et)}decode(et){return this.decoder.decode(et)}}function from$2({name:o,prefix:et,encode:tt,decode:nt}){return new Codec(o,et,tt,nt)}function baseX({name:o,prefix:et,alphabet:tt}){const{encode:nt,decode:rt}=_brrp__multiformats_scope_baseX(tt,o);return from$2({prefix:et,name:o,encode:nt,decode:ot=>coerce(rt(ot))})}function decode$a(o,et,tt,nt){const rt={};for(let lt=0;lt=8&&(st-=8,it[ct++]=255&at>>st)}if(st>=tt||255&at<<8-st)throw new SyntaxError("Unexpected end of data");return it}function encode$9(o,et,tt){const nt=et[et.length-1]==="=",rt=(1<tt;)it-=tt,ot+=et[rt&st>>it];if(it!==0&&(ot+=et[rt&st<(o[tt]=et,o),[]),alphabetCharsToBytes=alphabet.reduce((o,et,tt)=>{const nt=et.codePointAt(0);if(nt==null)throw new Error(`Invalid character: ${et}`);return o[nt]=tt,o},[]);function encode$8(o){return o.reduce((et,tt)=>(et+=alphabetBytesToChars[tt],et),"")}function decode$9(o){const et=[];for(const tt of o){const nt=tt.codePointAt(0);if(nt==null)throw new Error(`Invalid character: ${tt}`);const rt=alphabetCharsToBytes[nt];if(rt==null)throw new Error(`Non-base256emoji character: ${tt}`);et.push(rt)}return new Uint8Array(et)}const base256emoji=from$2({prefix:"🚀",name:"base256emoji",encode:encode$8,decode:decode$9}),base256emoji$1=Object.freeze(Object.defineProperty({__proto__:null,base256emoji},Symbol.toStringTag,{value:"Module"})),base32$2=rfc4648({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),base32upper=rfc4648({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),base32pad=rfc4648({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),base32padupper=rfc4648({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),base32hex=rfc4648({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),base32hexupper=rfc4648({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),base32hexpad=rfc4648({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),base32hexpadupper=rfc4648({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),base32z=rfc4648({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5}),base32$3=Object.freeze(Object.defineProperty({__proto__:null,base32:base32$2,base32hex,base32hexpad,base32hexpadupper,base32hexupper,base32pad,base32padupper,base32upper,base32z},Symbol.toStringTag,{value:"Module"})),base36=baseX({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),base36upper=baseX({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"}),base36$1=Object.freeze(Object.defineProperty({__proto__:null,base36,base36upper},Symbol.toStringTag,{value:"Module"})),base58btc=baseX({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),base58flickr=baseX({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"}),base58=Object.freeze(Object.defineProperty({__proto__:null,base58btc,base58flickr},Symbol.toStringTag,{value:"Module"})),base64$2=rfc4648({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),base64pad=rfc4648({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),base64url=rfc4648({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),base64urlpad=rfc4648({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6}),base64$3=Object.freeze(Object.defineProperty({__proto__:null,base64:base64$2,base64pad,base64url,base64urlpad},Symbol.toStringTag,{value:"Module"})),base8=rfc4648({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3}),base8$1=Object.freeze(Object.defineProperty({__proto__:null,base8},Symbol.toStringTag,{value:"Module"})),identity$1=from$2({prefix:"\0",name:"identity",encode:o=>toString$9(o),decode:o=>fromString$1(o)}),identityBase=Object.freeze(Object.defineProperty({__proto__:null,identity:identity$1},Symbol.toStringTag,{value:"Module"}));new TextEncoder;new TextDecoder;var encode_1=encode$7,MSB$1=128,REST$1=127,MSBALL=~REST$1,INT=Math.pow(2,31);function encode$7(o,et,tt){et=et||[],tt=tt||0;for(var nt=tt;o>=INT;)et[tt++]=o&255|MSB$1,o/=128;for(;o&MSBALL;)et[tt++]=o&255|MSB$1,o>>>=7;return et[tt]=o|0,encode$7.bytes=tt-nt+1,et}var decode$8=read$1,MSB$1$1=128,REST$1$1=127;function read$1(o,nt){var tt=0,nt=nt||0,rt=0,ot=nt,it,st=o.length;do{if(ot>=st)throw read$1.bytes=0,new RangeError("Could not decode varint");it=o[ot++],tt+=rt<28?(it&REST$1$1)<=MSB$1$1);return read$1.bytes=ot-nt,tt}var N1=Math.pow(2,7),N2=Math.pow(2,14),N3=Math.pow(2,21),N4=Math.pow(2,28),N5=Math.pow(2,35),N6=Math.pow(2,42),N7=Math.pow(2,49),N8=Math.pow(2,56),N9=Math.pow(2,63),length=function(o){return ocreate$3(this.code,nt))}else throw Error("Unknown type, must be binary type")}}function sha(o){return async et=>new Uint8Array(await crypto.subtle.digest(o,et))}const sha256=from$1({name:"sha2-256",code:18,encode:sha("SHA-256")});function format(o,et){const{bytes:tt,version:nt}=o;switch(nt){case 0:return toStringV0(tt,baseCache(o),et??base58btc.encoder);default:return toStringV1(tt,baseCache(o),et??base32$2.encoder)}}const cache$1=new WeakMap;function baseCache(o){const et=cache$1.get(o);if(et==null){const tt=new Map;return cache$1.set(o,tt),tt}return et}var Qs;class CID{constructor(et,tt,nt,rt){Ct(this,"code");Ct(this,"version");Ct(this,"multihash");Ct(this,"bytes");Ct(this,"/");Ct(this,Qs,"CID");this.code=tt,this.version=et,this.multihash=nt,this.bytes=rt,this["/"]=rt}get asCID(){return this}get byteOffset(){return this.bytes.byteOffset}get byteLength(){return this.bytes.byteLength}toV0(){switch(this.version){case 0:return this;case 1:{const{code:et,multihash:tt}=this;if(et!==DAG_PB_CODE)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(tt.code!==SHA_256_CODE)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return CID.createV0(tt)}default:throw Error(`Can not convert CID version ${this.version} to version 0. This is a bug please report`)}}toV1(){switch(this.version){case 0:{const{code:et,digest:tt}=this.multihash,nt=create$3(et,tt);return CID.createV1(this.code,nt)}case 1:return this;default:throw Error(`Can not convert CID version ${this.version} to version 1. This is a bug please report`)}}equals(et){return CID.equals(this,et)}static equals(et,tt){const nt=tt;return nt!=null&&et.code===nt.code&&et.version===nt.version&&equals$1(et.multihash,nt.multihash)}toString(et){return format(this,et)}toJSON(){return{"/":format(this)}}link(){return this}[(Qs=Symbol.toStringTag,Symbol.for("nodejs.util.inspect.custom"))](){return`CID(${this.toString()})`}static asCID(et){if(et==null)return null;const tt=et;if(tt instanceof CID)return tt;if(tt["/"]!=null&&tt["/"]===tt.bytes||tt.asCID===tt){const{version:nt,code:rt,multihash:ot,bytes:it}=tt;return new CID(nt,rt,ot,it??encodeCID(nt,rt,ot.bytes))}else if(tt[cidSymbol]===!0){const{version:nt,multihash:rt,code:ot}=tt,it=decode$6(rt);return CID.create(nt,ot,it)}else return null}static create(et,tt,nt){if(typeof tt!="number")throw new Error("String codecs are no longer supported");if(!(nt.bytes instanceof Uint8Array))throw new Error("Invalid digest");switch(et){case 0:{if(tt!==DAG_PB_CODE)throw new Error(`Version 0 CID must use dag-pb (code: ${DAG_PB_CODE}) block encoding`);return new CID(et,tt,nt,nt.bytes)}case 1:{const rt=encodeCID(et,tt,nt.bytes);return new CID(et,tt,nt,rt)}default:throw new Error("Invalid version")}}static createV0(et){return CID.create(0,DAG_PB_CODE,et)}static createV1(et,tt){return CID.create(1,et,tt)}static decode(et){const[tt,nt]=CID.decodeFirst(et);if(nt.length!==0)throw new Error("Incorrect length");return tt}static decodeFirst(et){const tt=CID.inspectBytes(et),nt=tt.size-tt.multihashSize,rt=coerce(et.subarray(nt,nt+tt.multihashSize));if(rt.byteLength!==tt.multihashSize)throw new Error("Incorrect length");const ot=rt.subarray(tt.multihashSize-tt.digestSize),it=new Digest(tt.multihashCode,tt.digestSize,ot,rt);return[tt.version===0?CID.createV0(it):CID.createV1(tt.codec,it),et.subarray(tt.size)]}static inspectBytes(et){let tt=0;const nt=()=>{const[dt,ht]=decode$7(et.subarray(tt));return tt+=ht,dt};let rt=nt(),ot=DAG_PB_CODE;if(rt===18?(rt=0,tt=0):ot=nt(),rt!==0&&rt!==1)throw new RangeError(`Invalid CID version ${rt}`);const it=tt,st=nt(),at=nt(),ct=tt+at,lt=ct-it;return{version:rt,codec:ot,multihashCode:st,digestSize:at,multihashSize:lt,size:ct}}static parse(et,tt){const[nt,rt]=parseCIDtoBytes(et,tt),ot=CID.decode(rt);if(ot.version===0&&et[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return baseCache(ot).set(nt,et),ot}}function parseCIDtoBytes(o,et){switch(o[0]){case"Q":{const tt=et??base58btc;return[base58btc.prefix,tt.decode(`${base58btc.prefix}${o}`)]}case base58btc.prefix:{const tt=et??base58btc;return[base58btc.prefix,tt.decode(o)]}case base32$2.prefix:{const tt=et??base32$2;return[base32$2.prefix,tt.decode(o)]}case base36.prefix:{const tt=et??base36;return[base36.prefix,tt.decode(o)]}default:{if(et==null)throw Error("To parse non base32, base36 or base58btc encoded CID multibase decoder must be provided");return[o[0],et.decode(o)]}}}function toStringV0(o,et,tt){const{prefix:nt}=tt;if(nt!==base58btc.prefix)throw Error(`Cannot string encode V0 in ${tt.name} encoding`);const rt=et.get(nt);if(rt==null){const ot=tt.encode(o).slice(1);return et.set(nt,ot),ot}else return rt}function toStringV1(o,et,tt){const{prefix:nt}=tt,rt=et.get(nt);if(rt==null){const ot=tt.encode(o);return et.set(nt,ot),ot}else return rt}const DAG_PB_CODE=112,SHA_256_CODE=18;function encodeCID(o,et,tt){const nt=encodingLength$2(o),rt=nt+encodingLength$2(et),ot=new Uint8Array(rt+tt.byteLength);return encodeTo(o,ot,0),encodeTo(et,ot,nt),ot.set(tt,rt),ot}const cidSymbol=Symbol.for("@ipld/js-cid/CID"),bases={...identityBase,...base2$1,...base8$1,...base10$1,...base16$1,...base32$3,...base36$1,...base58,...base64$3,...base256emoji$1};function createCodec$1(o,et,tt,nt){return{name:o,prefix:et,encoder:{name:o,prefix:et,encode:tt},decoder:{decode:nt}}}const string$4=createCodec$1("utf8","u",o=>"u"+new TextDecoder("utf8").decode(o),o=>new TextEncoder().encode(o.substring(1))),ascii=createCodec$1("ascii","a",o=>{let et="a";for(let tt=0;tt{o=o.substring(1);const et=allocUnsafe(o.length);for(let tt=0;tt4096)return allocUnsafe(it);rt+it>8192&&(nt=allocUnsafe(8192),rt=0);const st=nt.subarray(rt,rt+=it);return rt&7&&(rt=(rt|7)+1),st}}let Op$1=class{constructor(et,tt,nt){Ct(this,"fn");Ct(this,"len");Ct(this,"next");Ct(this,"val");this.fn=et,this.len=tt,this.next=void 0,this.val=nt}};function noop$2(){}let State$1=class{constructor(et){Ct(this,"head");Ct(this,"tail");Ct(this,"len");Ct(this,"next");this.head=et.head,this.tail=et.tail,this.len=et.len,this.next=et.states}};const bufferPool=pool$1();function alloc$1(o){return globalThis.Buffer!=null?allocUnsafe(o):bufferPool(o)}class Uint8ArrayWriter{constructor(){Ct(this,"len");Ct(this,"head");Ct(this,"tail");Ct(this,"states");this.len=0,this.head=new Op$1(noop$2,0,0),this.tail=this.head,this.states=null}_push(et,tt,nt){return this.tail=this.tail.next=new Op$1(et,tt,nt),this.len+=tt,this}uint32(et){return this.len+=(this.tail=this.tail.next=new VarintOp$1((et=et>>>0)<128?1:et<16384?2:et<2097152?3:et<268435456?4:5,et)).len,this}int32(et){return et<0?this._push(writeVarint64$1,10,LongBits$2.fromNumber(et)):this.uint32(et)}sint32(et){return this.uint32((et<<1^et>>31)>>>0)}uint64(et){const tt=LongBits$2.fromBigInt(et);return this._push(writeVarint64$1,tt.length(),tt)}uint64Number(et){return this._push(encodeUint8Array,encodingLength$3(et),et)}uint64String(et){return this.uint64(BigInt(et))}int64(et){return this.uint64(et)}int64Number(et){return this.uint64Number(et)}int64String(et){return this.uint64String(et)}sint64(et){const tt=LongBits$2.fromBigInt(et).zzEncode();return this._push(writeVarint64$1,tt.length(),tt)}sint64Number(et){const tt=LongBits$2.fromNumber(et).zzEncode();return this._push(writeVarint64$1,tt.length(),tt)}sint64String(et){return this.sint64(BigInt(et))}bool(et){return this._push(writeByte$1,1,et?1:0)}fixed32(et){return this._push(writeFixed32$1,4,et>>>0)}sfixed32(et){return this.fixed32(et)}fixed64(et){const tt=LongBits$2.fromBigInt(et);return this._push(writeFixed32$1,4,tt.lo)._push(writeFixed32$1,4,tt.hi)}fixed64Number(et){const tt=LongBits$2.fromNumber(et);return this._push(writeFixed32$1,4,tt.lo)._push(writeFixed32$1,4,tt.hi)}fixed64String(et){return this.fixed64(BigInt(et))}sfixed64(et){return this.fixed64(et)}sfixed64Number(et){return this.fixed64Number(et)}sfixed64String(et){return this.fixed64String(et)}float(et){return this._push(writeFloatLE,4,et)}double(et){return this._push(writeDoubleLE,8,et)}bytes(et){const tt=et.length>>>0;return tt===0?this._push(writeByte$1,1,0):this.uint32(tt)._push(writeBytes$1,tt,et)}string(et){const tt=length$1(et);return tt!==0?this.uint32(tt)._push(write$2,tt,et):this._push(writeByte$1,1,0)}fork(){return this.states=new State$1(this),this.head=this.tail=new Op$1(noop$2,0,0),this.len=0,this}reset(){return this.states!=null?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new Op$1(noop$2,0,0),this.len=0),this}ldelim(){const et=this.head,tt=this.tail,nt=this.len;return this.reset().uint32(nt),nt!==0&&(this.tail.next=et.next,this.tail=tt,this.len+=nt),this}finish(){let et=this.head.next;const tt=alloc$1(this.len);let nt=0;for(;et!=null;)et.fn(et.val,tt,nt),nt+=et.len,et=et.next;return tt}}function writeByte$1(o,et,tt){et[tt]=o&255}function writeVarint32$1(o,et,tt){for(;o>127;)et[tt++]=o&127|128,o>>>=7;et[tt]=o}let VarintOp$1=class extends Op$1{constructor(tt,nt){super(writeVarint32$1,tt,nt);Ct(this,"next");this.next=void 0}};function writeVarint64$1(o,et,tt){for(;o.hi!==0;)et[tt++]=o.lo&127|128,o.lo=(o.lo>>>7|o.hi<<25)>>>0,o.hi>>>=7;for(;o.lo>127;)et[tt++]=o.lo&127|128,o.lo=o.lo>>>7;et[tt++]=o.lo}function writeFixed32$1(o,et,tt){et[tt]=o&255,et[tt+1]=o>>>8&255,et[tt+2]=o>>>16&255,et[tt+3]=o>>>24}function writeBytes$1(o,et,tt){et.set(o,tt)}globalThis.Buffer!=null&&(Uint8ArrayWriter.prototype.bytes=function(o){const et=o.length>>>0;return this.uint32(et),et>0&&this._push(writeBytesBuffer,et,o),this},Uint8ArrayWriter.prototype.string=function(o){const et=globalThis.Buffer.byteLength(o);return this.uint32(et),et>0&&this._push(writeStringBuffer$1,et,o),this});function writeBytesBuffer(o,et,tt){et.set(o,tt)}function writeStringBuffer$1(o,et,tt){o.length<40?write$2(o,et,tt):et.utf8Write!=null?et.utf8Write(o,tt):et.set(fromString(o),tt)}function createWriter(){return new Uint8ArrayWriter}function encodeMessage(o,et){const tt=createWriter();return et.encode(o,tt,{lengthDelimited:!1}),tt.finish()}var CODEC_TYPES;(function(o){o[o.VARINT=0]="VARINT",o[o.BIT64=1]="BIT64",o[o.LENGTH_DELIMITED=2]="LENGTH_DELIMITED",o[o.START_GROUP=3]="START_GROUP",o[o.END_GROUP=4]="END_GROUP",o[o.BIT32=5]="BIT32"})(CODEC_TYPES||(CODEC_TYPES={}));function createCodec(o,et,tt,nt){return{name:o,type:et,encode:tt,decode:nt}}function enumeration(o){function et(rt){if(o[rt.toString()]==null)throw new Error("Invalid enum value");return o[rt]}const tt=function(ot,it){const st=et(ot);it.int32(st)},nt=function(ot){const it=ot.int32();return et(it)};return createCodec("enum",CODEC_TYPES.VARINT,tt,nt)}function message$1(o,et){return createCodec("message",CODEC_TYPES.LENGTH_DELIMITED,o,et)}class MaxLengthError extends Error{constructor(){super(...arguments);Ct(this,"code","ERR_MAX_LENGTH");Ct(this,"name","MaxLengthError")}}class MaxSizeError extends Error{constructor(){super(...arguments);Ct(this,"code","ERR_MAX_SIZE");Ct(this,"name","MaxSizeError")}}var RateLimitProof$4;(function(o){let et;o.codec=()=>(et==null&&(et=message$1((tt,nt,rt={})=>{rt.lengthDelimited!==!1&&nt.fork(),tt.proof!=null&&tt.proof.byteLength>0&&(nt.uint32(10),nt.bytes(tt.proof)),tt.merkleRoot!=null&&tt.merkleRoot.byteLength>0&&(nt.uint32(18),nt.bytes(tt.merkleRoot)),tt.epoch!=null&&tt.epoch.byteLength>0&&(nt.uint32(26),nt.bytes(tt.epoch)),tt.shareX!=null&&tt.shareX.byteLength>0&&(nt.uint32(34),nt.bytes(tt.shareX)),tt.shareY!=null&&tt.shareY.byteLength>0&&(nt.uint32(42),nt.bytes(tt.shareY)),tt.nullifier!=null&&tt.nullifier.byteLength>0&&(nt.uint32(50),nt.bytes(tt.nullifier)),tt.rlnIdentifier!=null&&tt.rlnIdentifier.byteLength>0&&(nt.uint32(58),nt.bytes(tt.rlnIdentifier)),rt.lengthDelimited!==!1&&nt.ldelim()},(tt,nt,rt={})=>{const ot={proof:alloc$2(0),merkleRoot:alloc$2(0),epoch:alloc$2(0),shareX:alloc$2(0),shareY:alloc$2(0),nullifier:alloc$2(0),rlnIdentifier:alloc$2(0)},it=nt==null?tt.len:tt.pos+nt;for(;tt.pos>>3){case 1:{ot.proof=tt.bytes();break}case 2:{ot.merkleRoot=tt.bytes();break}case 3:{ot.epoch=tt.bytes();break}case 4:{ot.shareX=tt.bytes();break}case 5:{ot.shareY=tt.bytes();break}case 6:{ot.nullifier=tt.bytes();break}case 7:{ot.rlnIdentifier=tt.bytes();break}default:{tt.skipType(st&7);break}}}return ot})),et),o.encode=tt=>encodeMessage(tt,o.codec()),o.decode=(tt,nt)=>decodeMessage(tt,o.codec(),nt)})(RateLimitProof$4||(RateLimitProof$4={}));var WakuMessage$4;(function(o){let et;o.codec=()=>(et==null&&(et=message$1((tt,nt,rt={})=>{rt.lengthDelimited!==!1&&nt.fork(),tt.payload!=null&&tt.payload.byteLength>0&&(nt.uint32(10),nt.bytes(tt.payload)),tt.contentTopic!=null&&tt.contentTopic!==""&&(nt.uint32(18),nt.string(tt.contentTopic)),tt.version!=null&&(nt.uint32(24),nt.uint32(tt.version)),tt.timestamp!=null&&(nt.uint32(80),nt.sint64(tt.timestamp)),tt.meta!=null&&(nt.uint32(90),nt.bytes(tt.meta)),tt.rateLimitProof!=null&&(nt.uint32(170),RateLimitProof$4.codec().encode(tt.rateLimitProof,nt)),tt.ephemeral!=null&&(nt.uint32(248),nt.bool(tt.ephemeral)),rt.lengthDelimited!==!1&&nt.ldelim()},(tt,nt,rt={})=>{var st;const ot={payload:alloc$2(0),contentTopic:""},it=nt==null?tt.len:tt.pos+nt;for(;tt.pos>>3){case 1:{ot.payload=tt.bytes();break}case 2:{ot.contentTopic=tt.string();break}case 3:{ot.version=tt.uint32();break}case 10:{ot.timestamp=tt.sint64();break}case 11:{ot.meta=tt.bytes();break}case 21:{ot.rateLimitProof=RateLimitProof$4.codec().decode(tt,tt.uint32(),{limits:(st=rt.limits)==null?void 0:st.rateLimitProof});break}case 31:{ot.ephemeral=tt.bool();break}default:{tt.skipType(at&7);break}}}return ot})),et),o.encode=tt=>encodeMessage(tt,o.codec()),o.decode=(tt,nt)=>decodeMessage(tt,o.codec(),nt)})(WakuMessage$4||(WakuMessage$4={}));var FilterRequest;(function(o){(function(tt){let nt;tt.codec=()=>(nt==null&&(nt=message$1((rt,ot,it={})=>{it.lengthDelimited!==!1&&ot.fork(),rt.contentTopic!=null&&rt.contentTopic!==""&&(ot.uint32(10),ot.string(rt.contentTopic)),it.lengthDelimited!==!1&&ot.ldelim()},(rt,ot,it={})=>{const st={contentTopic:""},at=ot==null?rt.len:rt.pos+ot;for(;rt.pos>>3){case 1:{st.contentTopic=rt.string();break}default:{rt.skipType(ct&7);break}}}return st})),nt),tt.encode=rt=>encodeMessage(rt,tt.codec()),tt.decode=(rt,ot)=>decodeMessage(rt,tt.codec(),ot)})(o.ContentFilter||(o.ContentFilter={}));let et;o.codec=()=>(et==null&&(et=message$1((tt,nt,rt={})=>{if(rt.lengthDelimited!==!1&&nt.fork(),tt.subscribe!=null&&tt.subscribe!==!1&&(nt.uint32(8),nt.bool(tt.subscribe)),tt.topic!=null&&tt.topic!==""&&(nt.uint32(18),nt.string(tt.topic)),tt.contentFilters!=null)for(const ot of tt.contentFilters)nt.uint32(26),o.ContentFilter.codec().encode(ot,nt);rt.lengthDelimited!==!1&&nt.ldelim()},(tt,nt,rt={})=>{var st,at;const ot={subscribe:!1,topic:"",contentFilters:[]},it=nt==null?tt.len:tt.pos+nt;for(;tt.pos>>3){case 1:{ot.subscribe=tt.bool();break}case 2:{ot.topic=tt.string();break}case 3:{if(((st=rt.limits)==null?void 0:st.contentFilters)!=null&&ot.contentFilters.length===rt.limits.contentFilters)throw new MaxLengthError('Decode error - map field "contentFilters" had too many elements');ot.contentFilters.push(o.ContentFilter.codec().decode(tt,tt.uint32(),{limits:(at=rt.limits)==null?void 0:at.contentFilters$}));break}default:{tt.skipType(ct&7);break}}}return ot})),et),o.encode=tt=>encodeMessage(tt,o.codec()),o.decode=(tt,nt)=>decodeMessage(tt,o.codec(),nt)})(FilterRequest||(FilterRequest={}));var MessagePush$1;(function(o){let et;o.codec=()=>(et==null&&(et=message$1((tt,nt,rt={})=>{if(rt.lengthDelimited!==!1&&nt.fork(),tt.messages!=null)for(const ot of tt.messages)nt.uint32(10),WakuMessage$3.codec().encode(ot,nt);rt.lengthDelimited!==!1&&nt.ldelim()},(tt,nt,rt={})=>{var st,at;const ot={messages:[]},it=nt==null?tt.len:tt.pos+nt;for(;tt.pos>>3){case 1:{if(((st=rt.limits)==null?void 0:st.messages)!=null&&ot.messages.length===rt.limits.messages)throw new MaxLengthError('Decode error - map field "messages" had too many elements');ot.messages.push(WakuMessage$3.codec().decode(tt,tt.uint32(),{limits:(at=rt.limits)==null?void 0:at.messages$}));break}default:{tt.skipType(ct&7);break}}}return ot})),et),o.encode=tt=>encodeMessage(tt,o.codec()),o.decode=(tt,nt)=>decodeMessage(tt,o.codec(),nt)})(MessagePush$1||(MessagePush$1={}));var FilterRpc;(function(o){let et;o.codec=()=>(et==null&&(et=message$1((tt,nt,rt={})=>{rt.lengthDelimited!==!1&&nt.fork(),tt.requestId!=null&&tt.requestId!==""&&(nt.uint32(10),nt.string(tt.requestId)),tt.request!=null&&(nt.uint32(18),FilterRequest.codec().encode(tt.request,nt)),tt.push!=null&&(nt.uint32(26),MessagePush$1.codec().encode(tt.push,nt)),rt.lengthDelimited!==!1&&nt.ldelim()},(tt,nt,rt={})=>{var st,at;const ot={requestId:""},it=nt==null?tt.len:tt.pos+nt;for(;tt.pos>>3){case 1:{ot.requestId=tt.string();break}case 2:{ot.request=FilterRequest.codec().decode(tt,tt.uint32(),{limits:(st=rt.limits)==null?void 0:st.request});break}case 3:{ot.push=MessagePush$1.codec().decode(tt,tt.uint32(),{limits:(at=rt.limits)==null?void 0:at.push});break}default:{tt.skipType(ct&7);break}}}return ot})),et),o.encode=tt=>encodeMessage(tt,o.codec()),o.decode=(tt,nt)=>decodeMessage(tt,o.codec(),nt)})(FilterRpc||(FilterRpc={}));var RateLimitProof$3;(function(o){let et;o.codec=()=>(et==null&&(et=message$1((tt,nt,rt={})=>{rt.lengthDelimited!==!1&&nt.fork(),tt.proof!=null&&tt.proof.byteLength>0&&(nt.uint32(10),nt.bytes(tt.proof)),tt.merkleRoot!=null&&tt.merkleRoot.byteLength>0&&(nt.uint32(18),nt.bytes(tt.merkleRoot)),tt.epoch!=null&&tt.epoch.byteLength>0&&(nt.uint32(26),nt.bytes(tt.epoch)),tt.shareX!=null&&tt.shareX.byteLength>0&&(nt.uint32(34),nt.bytes(tt.shareX)),tt.shareY!=null&&tt.shareY.byteLength>0&&(nt.uint32(42),nt.bytes(tt.shareY)),tt.nullifier!=null&&tt.nullifier.byteLength>0&&(nt.uint32(50),nt.bytes(tt.nullifier)),tt.rlnIdentifier!=null&&tt.rlnIdentifier.byteLength>0&&(nt.uint32(58),nt.bytes(tt.rlnIdentifier)),rt.lengthDelimited!==!1&&nt.ldelim()},(tt,nt,rt={})=>{const ot={proof:alloc$2(0),merkleRoot:alloc$2(0),epoch:alloc$2(0),shareX:alloc$2(0),shareY:alloc$2(0),nullifier:alloc$2(0),rlnIdentifier:alloc$2(0)},it=nt==null?tt.len:tt.pos+nt;for(;tt.pos>>3){case 1:{ot.proof=tt.bytes();break}case 2:{ot.merkleRoot=tt.bytes();break}case 3:{ot.epoch=tt.bytes();break}case 4:{ot.shareX=tt.bytes();break}case 5:{ot.shareY=tt.bytes();break}case 6:{ot.nullifier=tt.bytes();break}case 7:{ot.rlnIdentifier=tt.bytes();break}default:{tt.skipType(st&7);break}}}return ot})),et),o.encode=tt=>encodeMessage(tt,o.codec()),o.decode=(tt,nt)=>decodeMessage(tt,o.codec(),nt)})(RateLimitProof$3||(RateLimitProof$3={}));var WakuMessage$3;(function(o){let et;o.codec=()=>(et==null&&(et=message$1((tt,nt,rt={})=>{rt.lengthDelimited!==!1&&nt.fork(),tt.payload!=null&&tt.payload.byteLength>0&&(nt.uint32(10),nt.bytes(tt.payload)),tt.contentTopic!=null&&tt.contentTopic!==""&&(nt.uint32(18),nt.string(tt.contentTopic)),tt.version!=null&&(nt.uint32(24),nt.uint32(tt.version)),tt.timestamp!=null&&(nt.uint32(80),nt.sint64(tt.timestamp)),tt.meta!=null&&(nt.uint32(90),nt.bytes(tt.meta)),tt.rateLimitProof!=null&&(nt.uint32(170),RateLimitProof$3.codec().encode(tt.rateLimitProof,nt)),tt.ephemeral!=null&&(nt.uint32(248),nt.bool(tt.ephemeral)),rt.lengthDelimited!==!1&&nt.ldelim()},(tt,nt,rt={})=>{var st;const ot={payload:alloc$2(0),contentTopic:""},it=nt==null?tt.len:tt.pos+nt;for(;tt.pos>>3){case 1:{ot.payload=tt.bytes();break}case 2:{ot.contentTopic=tt.string();break}case 3:{ot.version=tt.uint32();break}case 10:{ot.timestamp=tt.sint64();break}case 11:{ot.meta=tt.bytes();break}case 21:{ot.rateLimitProof=RateLimitProof$3.codec().decode(tt,tt.uint32(),{limits:(st=rt.limits)==null?void 0:st.rateLimitProof});break}case 31:{ot.ephemeral=tt.bool();break}default:{tt.skipType(at&7);break}}}return ot})),et),o.encode=tt=>encodeMessage(tt,o.codec()),o.decode=(tt,nt)=>decodeMessage(tt,o.codec(),nt)})(WakuMessage$3||(WakuMessage$3={}));var TopicOnlyMessage;(function(o){let et;o.codec=()=>(et==null&&(et=message$1((tt,nt,rt={})=>{rt.lengthDelimited!==!1&&nt.fork(),tt.contentTopic!=null&&tt.contentTopic!==""&&(nt.uint32(18),nt.string(tt.contentTopic)),rt.lengthDelimited!==!1&&nt.ldelim()},(tt,nt,rt={})=>{const ot={contentTopic:""},it=nt==null?tt.len:tt.pos+nt;for(;tt.pos>>3){case 2:{ot.contentTopic=tt.string();break}default:{tt.skipType(st&7);break}}}return ot})),et),o.encode=tt=>encodeMessage(tt,o.codec()),o.decode=(tt,nt)=>decodeMessage(tt,o.codec(),nt)})(TopicOnlyMessage||(TopicOnlyMessage={}));var FilterSubscribeRequest;(function(o){let et;(function(rt){rt.SUBSCRIBER_PING="SUBSCRIBER_PING",rt.SUBSCRIBE="SUBSCRIBE",rt.UNSUBSCRIBE="UNSUBSCRIBE",rt.UNSUBSCRIBE_ALL="UNSUBSCRIBE_ALL"})(et=o.FilterSubscribeType||(o.FilterSubscribeType={}));let tt;(function(rt){rt[rt.SUBSCRIBER_PING=0]="SUBSCRIBER_PING",rt[rt.SUBSCRIBE=1]="SUBSCRIBE",rt[rt.UNSUBSCRIBE=2]="UNSUBSCRIBE",rt[rt.UNSUBSCRIBE_ALL=3]="UNSUBSCRIBE_ALL"})(tt||(tt={})),function(rt){rt.codec=()=>enumeration(tt)}(et=o.FilterSubscribeType||(o.FilterSubscribeType={}));let nt;o.codec=()=>(nt==null&&(nt=message$1((rt,ot,it={})=>{if(it.lengthDelimited!==!1&&ot.fork(),rt.requestId!=null&&rt.requestId!==""&&(ot.uint32(10),ot.string(rt.requestId)),rt.filterSubscribeType!=null&&tt[rt.filterSubscribeType]!==0&&(ot.uint32(16),o.FilterSubscribeType.codec().encode(rt.filterSubscribeType,ot)),rt.pubsubTopic!=null&&(ot.uint32(82),ot.string(rt.pubsubTopic)),rt.contentTopics!=null)for(const st of rt.contentTopics)ot.uint32(90),ot.string(st);it.lengthDelimited!==!1&&ot.ldelim()},(rt,ot,it={})=>{var ct;const st={requestId:"",filterSubscribeType:et.SUBSCRIBER_PING,contentTopics:[]},at=ot==null?rt.len:rt.pos+ot;for(;rt.pos>>3){case 1:{st.requestId=rt.string();break}case 2:{st.filterSubscribeType=o.FilterSubscribeType.codec().decode(rt);break}case 10:{st.pubsubTopic=rt.string();break}case 11:{if(((ct=it.limits)==null?void 0:ct.contentTopics)!=null&&st.contentTopics.length===it.limits.contentTopics)throw new MaxLengthError('Decode error - map field "contentTopics" had too many elements');st.contentTopics.push(rt.string());break}default:{rt.skipType(lt&7);break}}}return st})),nt),o.encode=rt=>encodeMessage(rt,o.codec()),o.decode=(rt,ot)=>decodeMessage(rt,o.codec(),ot)})(FilterSubscribeRequest||(FilterSubscribeRequest={}));var FilterSubscribeResponse$1;(function(o){let et;o.codec=()=>(et==null&&(et=message$1((tt,nt,rt={})=>{rt.lengthDelimited!==!1&&nt.fork(),tt.requestId!=null&&tt.requestId!==""&&(nt.uint32(10),nt.string(tt.requestId)),tt.statusCode!=null&&tt.statusCode!==0&&(nt.uint32(80),nt.uint32(tt.statusCode)),tt.statusDesc!=null&&(nt.uint32(90),nt.string(tt.statusDesc)),rt.lengthDelimited!==!1&&nt.ldelim()},(tt,nt,rt={})=>{const ot={requestId:"",statusCode:0},it=nt==null?tt.len:tt.pos+nt;for(;tt.pos>>3){case 1:{ot.requestId=tt.string();break}case 10:{ot.statusCode=tt.uint32();break}case 11:{ot.statusDesc=tt.string();break}default:{tt.skipType(st&7);break}}}return ot})),et),o.encode=tt=>encodeMessage(tt,o.codec()),o.decode=(tt,nt)=>decodeMessage(tt,o.codec(),nt)})(FilterSubscribeResponse$1||(FilterSubscribeResponse$1={}));var MessagePush;(function(o){let et;o.codec=()=>(et==null&&(et=message$1((tt,nt,rt={})=>{rt.lengthDelimited!==!1&&nt.fork(),tt.wakuMessage!=null&&(nt.uint32(10),WakuMessage$2.codec().encode(tt.wakuMessage,nt)),tt.pubsubTopic!=null&&(nt.uint32(18),nt.string(tt.pubsubTopic)),rt.lengthDelimited!==!1&&nt.ldelim()},(tt,nt,rt={})=>{var st;const ot={},it=nt==null?tt.len:tt.pos+nt;for(;tt.pos>>3){case 1:{ot.wakuMessage=WakuMessage$2.codec().decode(tt,tt.uint32(),{limits:(st=rt.limits)==null?void 0:st.wakuMessage});break}case 2:{ot.pubsubTopic=tt.string();break}default:{tt.skipType(at&7);break}}}return ot})),et),o.encode=tt=>encodeMessage(tt,o.codec()),o.decode=(tt,nt)=>decodeMessage(tt,o.codec(),nt)})(MessagePush||(MessagePush={}));var RateLimitProof$2;(function(o){let et;o.codec=()=>(et==null&&(et=message$1((tt,nt,rt={})=>{rt.lengthDelimited!==!1&&nt.fork(),tt.proof!=null&&tt.proof.byteLength>0&&(nt.uint32(10),nt.bytes(tt.proof)),tt.merkleRoot!=null&&tt.merkleRoot.byteLength>0&&(nt.uint32(18),nt.bytes(tt.merkleRoot)),tt.epoch!=null&&tt.epoch.byteLength>0&&(nt.uint32(26),nt.bytes(tt.epoch)),tt.shareX!=null&&tt.shareX.byteLength>0&&(nt.uint32(34),nt.bytes(tt.shareX)),tt.shareY!=null&&tt.shareY.byteLength>0&&(nt.uint32(42),nt.bytes(tt.shareY)),tt.nullifier!=null&&tt.nullifier.byteLength>0&&(nt.uint32(50),nt.bytes(tt.nullifier)),tt.rlnIdentifier!=null&&tt.rlnIdentifier.byteLength>0&&(nt.uint32(58),nt.bytes(tt.rlnIdentifier)),rt.lengthDelimited!==!1&&nt.ldelim()},(tt,nt,rt={})=>{const ot={proof:alloc$2(0),merkleRoot:alloc$2(0),epoch:alloc$2(0),shareX:alloc$2(0),shareY:alloc$2(0),nullifier:alloc$2(0),rlnIdentifier:alloc$2(0)},it=nt==null?tt.len:tt.pos+nt;for(;tt.pos>>3){case 1:{ot.proof=tt.bytes();break}case 2:{ot.merkleRoot=tt.bytes();break}case 3:{ot.epoch=tt.bytes();break}case 4:{ot.shareX=tt.bytes();break}case 5:{ot.shareY=tt.bytes();break}case 6:{ot.nullifier=tt.bytes();break}case 7:{ot.rlnIdentifier=tt.bytes();break}default:{tt.skipType(st&7);break}}}return ot})),et),o.encode=tt=>encodeMessage(tt,o.codec()),o.decode=(tt,nt)=>decodeMessage(tt,o.codec(),nt)})(RateLimitProof$2||(RateLimitProof$2={}));var WakuMessage$2;(function(o){let et;o.codec=()=>(et==null&&(et=message$1((tt,nt,rt={})=>{rt.lengthDelimited!==!1&&nt.fork(),tt.payload!=null&&tt.payload.byteLength>0&&(nt.uint32(10),nt.bytes(tt.payload)),tt.contentTopic!=null&&tt.contentTopic!==""&&(nt.uint32(18),nt.string(tt.contentTopic)),tt.version!=null&&(nt.uint32(24),nt.uint32(tt.version)),tt.timestamp!=null&&(nt.uint32(80),nt.sint64(tt.timestamp)),tt.meta!=null&&(nt.uint32(90),nt.bytes(tt.meta)),tt.rateLimitProof!=null&&(nt.uint32(170),RateLimitProof$2.codec().encode(tt.rateLimitProof,nt)),tt.ephemeral!=null&&(nt.uint32(248),nt.bool(tt.ephemeral)),rt.lengthDelimited!==!1&&nt.ldelim()},(tt,nt,rt={})=>{var st;const ot={payload:alloc$2(0),contentTopic:""},it=nt==null?tt.len:tt.pos+nt;for(;tt.pos>>3){case 1:{ot.payload=tt.bytes();break}case 2:{ot.contentTopic=tt.string();break}case 3:{ot.version=tt.uint32();break}case 10:{ot.timestamp=tt.sint64();break}case 11:{ot.meta=tt.bytes();break}case 21:{ot.rateLimitProof=RateLimitProof$2.codec().decode(tt,tt.uint32(),{limits:(st=rt.limits)==null?void 0:st.rateLimitProof});break}case 31:{ot.ephemeral=tt.bool();break}default:{tt.skipType(at&7);break}}}return ot})),et),o.encode=tt=>encodeMessage(tt,o.codec()),o.decode=(tt,nt)=>decodeMessage(tt,o.codec(),nt)})(WakuMessage$2||(WakuMessage$2={}));var PushRequest;(function(o){let et;o.codec=()=>(et==null&&(et=message$1((tt,nt,rt={})=>{rt.lengthDelimited!==!1&&nt.fork(),tt.pubsubTopic!=null&&tt.pubsubTopic!==""&&(nt.uint32(10),nt.string(tt.pubsubTopic)),tt.message!=null&&(nt.uint32(18),WakuMessage$1.codec().encode(tt.message,nt)),rt.lengthDelimited!==!1&&nt.ldelim()},(tt,nt,rt={})=>{var st;const ot={pubsubTopic:""},it=nt==null?tt.len:tt.pos+nt;for(;tt.pos>>3){case 1:{ot.pubsubTopic=tt.string();break}case 2:{ot.message=WakuMessage$1.codec().decode(tt,tt.uint32(),{limits:(st=rt.limits)==null?void 0:st.message});break}default:{tt.skipType(at&7);break}}}return ot})),et),o.encode=tt=>encodeMessage(tt,o.codec()),o.decode=(tt,nt)=>decodeMessage(tt,o.codec(),nt)})(PushRequest||(PushRequest={}));var PushResponse;(function(o){let et;o.codec=()=>(et==null&&(et=message$1((tt,nt,rt={})=>{rt.lengthDelimited!==!1&&nt.fork(),tt.isSuccess!=null&&tt.isSuccess!==!1&&(nt.uint32(8),nt.bool(tt.isSuccess)),tt.info!=null&&(nt.uint32(18),nt.string(tt.info)),rt.lengthDelimited!==!1&&nt.ldelim()},(tt,nt,rt={})=>{const ot={isSuccess:!1},it=nt==null?tt.len:tt.pos+nt;for(;tt.pos>>3){case 1:{ot.isSuccess=tt.bool();break}case 2:{ot.info=tt.string();break}default:{tt.skipType(st&7);break}}}return ot})),et),o.encode=tt=>encodeMessage(tt,o.codec()),o.decode=(tt,nt)=>decodeMessage(tt,o.codec(),nt)})(PushResponse||(PushResponse={}));var PushRpc$1;(function(o){let et;o.codec=()=>(et==null&&(et=message$1((tt,nt,rt={})=>{rt.lengthDelimited!==!1&&nt.fork(),tt.requestId!=null&&tt.requestId!==""&&(nt.uint32(10),nt.string(tt.requestId)),tt.request!=null&&(nt.uint32(18),PushRequest.codec().encode(tt.request,nt)),tt.response!=null&&(nt.uint32(26),PushResponse.codec().encode(tt.response,nt)),rt.lengthDelimited!==!1&&nt.ldelim()},(tt,nt,rt={})=>{var st,at;const ot={requestId:""},it=nt==null?tt.len:tt.pos+nt;for(;tt.pos>>3){case 1:{ot.requestId=tt.string();break}case 2:{ot.request=PushRequest.codec().decode(tt,tt.uint32(),{limits:(st=rt.limits)==null?void 0:st.request});break}case 3:{ot.response=PushResponse.codec().decode(tt,tt.uint32(),{limits:(at=rt.limits)==null?void 0:at.response});break}default:{tt.skipType(ct&7);break}}}return ot})),et),o.encode=tt=>encodeMessage(tt,o.codec()),o.decode=(tt,nt)=>decodeMessage(tt,o.codec(),nt)})(PushRpc$1||(PushRpc$1={}));var RateLimitProof$1;(function(o){let et;o.codec=()=>(et==null&&(et=message$1((tt,nt,rt={})=>{rt.lengthDelimited!==!1&&nt.fork(),tt.proof!=null&&tt.proof.byteLength>0&&(nt.uint32(10),nt.bytes(tt.proof)),tt.merkleRoot!=null&&tt.merkleRoot.byteLength>0&&(nt.uint32(18),nt.bytes(tt.merkleRoot)),tt.epoch!=null&&tt.epoch.byteLength>0&&(nt.uint32(26),nt.bytes(tt.epoch)),tt.shareX!=null&&tt.shareX.byteLength>0&&(nt.uint32(34),nt.bytes(tt.shareX)),tt.shareY!=null&&tt.shareY.byteLength>0&&(nt.uint32(42),nt.bytes(tt.shareY)),tt.nullifier!=null&&tt.nullifier.byteLength>0&&(nt.uint32(50),nt.bytes(tt.nullifier)),tt.rlnIdentifier!=null&&tt.rlnIdentifier.byteLength>0&&(nt.uint32(58),nt.bytes(tt.rlnIdentifier)),rt.lengthDelimited!==!1&&nt.ldelim()},(tt,nt,rt={})=>{const ot={proof:alloc$2(0),merkleRoot:alloc$2(0),epoch:alloc$2(0),shareX:alloc$2(0),shareY:alloc$2(0),nullifier:alloc$2(0),rlnIdentifier:alloc$2(0)},it=nt==null?tt.len:tt.pos+nt;for(;tt.pos>>3){case 1:{ot.proof=tt.bytes();break}case 2:{ot.merkleRoot=tt.bytes();break}case 3:{ot.epoch=tt.bytes();break}case 4:{ot.shareX=tt.bytes();break}case 5:{ot.shareY=tt.bytes();break}case 6:{ot.nullifier=tt.bytes();break}case 7:{ot.rlnIdentifier=tt.bytes();break}default:{tt.skipType(st&7);break}}}return ot})),et),o.encode=tt=>encodeMessage(tt,o.codec()),o.decode=(tt,nt)=>decodeMessage(tt,o.codec(),nt)})(RateLimitProof$1||(RateLimitProof$1={}));var WakuMessage$1;(function(o){let et;o.codec=()=>(et==null&&(et=message$1((tt,nt,rt={})=>{rt.lengthDelimited!==!1&&nt.fork(),tt.payload!=null&&tt.payload.byteLength>0&&(nt.uint32(10),nt.bytes(tt.payload)),tt.contentTopic!=null&&tt.contentTopic!==""&&(nt.uint32(18),nt.string(tt.contentTopic)),tt.version!=null&&(nt.uint32(24),nt.uint32(tt.version)),tt.timestamp!=null&&(nt.uint32(80),nt.sint64(tt.timestamp)),tt.meta!=null&&(nt.uint32(90),nt.bytes(tt.meta)),tt.rateLimitProof!=null&&(nt.uint32(170),RateLimitProof$1.codec().encode(tt.rateLimitProof,nt)),tt.ephemeral!=null&&(nt.uint32(248),nt.bool(tt.ephemeral)),rt.lengthDelimited!==!1&&nt.ldelim()},(tt,nt,rt={})=>{var st;const ot={payload:alloc$2(0),contentTopic:""},it=nt==null?tt.len:tt.pos+nt;for(;tt.pos>>3){case 1:{ot.payload=tt.bytes();break}case 2:{ot.contentTopic=tt.string();break}case 3:{ot.version=tt.uint32();break}case 10:{ot.timestamp=tt.sint64();break}case 11:{ot.meta=tt.bytes();break}case 21:{ot.rateLimitProof=RateLimitProof$1.codec().decode(tt,tt.uint32(),{limits:(st=rt.limits)==null?void 0:st.rateLimitProof});break}case 31:{ot.ephemeral=tt.bool();break}default:{tt.skipType(at&7);break}}}return ot})),et),o.encode=tt=>encodeMessage(tt,o.codec()),o.decode=(tt,nt)=>decodeMessage(tt,o.codec(),nt)})(WakuMessage$1||(WakuMessage$1={}));var WakuMessageKeyValue;(function(o){let et;o.codec=()=>(et==null&&(et=message$1((tt,nt,rt={})=>{rt.lengthDelimited!==!1&&nt.fork(),tt.messageHash!=null&&(nt.uint32(10),nt.bytes(tt.messageHash)),tt.message!=null&&(nt.uint32(18),WakuMessage.codec().encode(tt.message,nt)),tt.pubsubTopic!=null&&(nt.uint32(26),nt.string(tt.pubsubTopic)),rt.lengthDelimited!==!1&&nt.ldelim()},(tt,nt,rt={})=>{var st;const ot={},it=nt==null?tt.len:tt.pos+nt;for(;tt.pos>>3){case 1:{ot.messageHash=tt.bytes();break}case 2:{ot.message=WakuMessage.codec().decode(tt,tt.uint32(),{limits:(st=rt.limits)==null?void 0:st.message});break}case 3:{ot.pubsubTopic=tt.string();break}default:{tt.skipType(at&7);break}}}return ot})),et),o.encode=tt=>encodeMessage(tt,o.codec()),o.decode=(tt,nt)=>decodeMessage(tt,o.codec(),nt)})(WakuMessageKeyValue||(WakuMessageKeyValue={}));var StoreQueryRequest$1;(function(o){let et;o.codec=()=>(et==null&&(et=message$1((tt,nt,rt={})=>{if(rt.lengthDelimited!==!1&&nt.fork(),tt.requestId!=null&&tt.requestId!==""&&(nt.uint32(10),nt.string(tt.requestId)),tt.includeData!=null&&tt.includeData!==!1&&(nt.uint32(16),nt.bool(tt.includeData)),tt.pubsubTopic!=null&&(nt.uint32(82),nt.string(tt.pubsubTopic)),tt.contentTopics!=null)for(const ot of tt.contentTopics)nt.uint32(90),nt.string(ot);if(tt.timeStart!=null&&(nt.uint32(96),nt.sint64(tt.timeStart)),tt.timeEnd!=null&&(nt.uint32(104),nt.sint64(tt.timeEnd)),tt.messageHashes!=null)for(const ot of tt.messageHashes)nt.uint32(162),nt.bytes(ot);tt.paginationCursor!=null&&(nt.uint32(410),nt.bytes(tt.paginationCursor)),tt.paginationForward!=null&&tt.paginationForward!==!1&&(nt.uint32(416),nt.bool(tt.paginationForward)),tt.paginationLimit!=null&&(nt.uint32(424),nt.uint64(tt.paginationLimit)),rt.lengthDelimited!==!1&&nt.ldelim()},(tt,nt,rt={})=>{var st,at;const ot={requestId:"",includeData:!1,contentTopics:[],messageHashes:[],paginationForward:!1},it=nt==null?tt.len:tt.pos+nt;for(;tt.pos>>3){case 1:{ot.requestId=tt.string();break}case 2:{ot.includeData=tt.bool();break}case 10:{ot.pubsubTopic=tt.string();break}case 11:{if(((st=rt.limits)==null?void 0:st.contentTopics)!=null&&ot.contentTopics.length===rt.limits.contentTopics)throw new MaxLengthError('Decode error - map field "contentTopics" had too many elements');ot.contentTopics.push(tt.string());break}case 12:{ot.timeStart=tt.sint64();break}case 13:{ot.timeEnd=tt.sint64();break}case 20:{if(((at=rt.limits)==null?void 0:at.messageHashes)!=null&&ot.messageHashes.length===rt.limits.messageHashes)throw new MaxLengthError('Decode error - map field "messageHashes" had too many elements');ot.messageHashes.push(tt.bytes());break}case 51:{ot.paginationCursor=tt.bytes();break}case 52:{ot.paginationForward=tt.bool();break}case 53:{ot.paginationLimit=tt.uint64();break}default:{tt.skipType(ct&7);break}}}return ot})),et),o.encode=tt=>encodeMessage(tt,o.codec()),o.decode=(tt,nt)=>decodeMessage(tt,o.codec(),nt)})(StoreQueryRequest$1||(StoreQueryRequest$1={}));var StoreQueryResponse$1;(function(o){let et;o.codec=()=>(et==null&&(et=message$1((tt,nt,rt={})=>{if(rt.lengthDelimited!==!1&&nt.fork(),tt.requestId!=null&&tt.requestId!==""&&(nt.uint32(10),nt.string(tt.requestId)),tt.statusCode!=null&&(nt.uint32(80),nt.uint32(tt.statusCode)),tt.statusDesc!=null&&(nt.uint32(90),nt.string(tt.statusDesc)),tt.messages!=null)for(const ot of tt.messages)nt.uint32(162),WakuMessageKeyValue.codec().encode(ot,nt);tt.paginationCursor!=null&&(nt.uint32(410),nt.bytes(tt.paginationCursor)),rt.lengthDelimited!==!1&&nt.ldelim()},(tt,nt,rt={})=>{var st,at;const ot={requestId:"",messages:[]},it=nt==null?tt.len:tt.pos+nt;for(;tt.pos>>3){case 1:{ot.requestId=tt.string();break}case 10:{ot.statusCode=tt.uint32();break}case 11:{ot.statusDesc=tt.string();break}case 20:{if(((st=rt.limits)==null?void 0:st.messages)!=null&&ot.messages.length===rt.limits.messages)throw new MaxLengthError('Decode error - map field "messages" had too many elements');ot.messages.push(WakuMessageKeyValue.codec().decode(tt,tt.uint32(),{limits:(at=rt.limits)==null?void 0:at.messages$}));break}case 51:{ot.paginationCursor=tt.bytes();break}default:{tt.skipType(ct&7);break}}}return ot})),et),o.encode=tt=>encodeMessage(tt,o.codec()),o.decode=(tt,nt)=>decodeMessage(tt,o.codec(),nt)})(StoreQueryResponse$1||(StoreQueryResponse$1={}));var RateLimitProof;(function(o){let et;o.codec=()=>(et==null&&(et=message$1((tt,nt,rt={})=>{rt.lengthDelimited!==!1&&nt.fork(),tt.proof!=null&&tt.proof.byteLength>0&&(nt.uint32(10),nt.bytes(tt.proof)),tt.merkleRoot!=null&&tt.merkleRoot.byteLength>0&&(nt.uint32(18),nt.bytes(tt.merkleRoot)),tt.epoch!=null&&tt.epoch.byteLength>0&&(nt.uint32(26),nt.bytes(tt.epoch)),tt.shareX!=null&&tt.shareX.byteLength>0&&(nt.uint32(34),nt.bytes(tt.shareX)),tt.shareY!=null&&tt.shareY.byteLength>0&&(nt.uint32(42),nt.bytes(tt.shareY)),tt.nullifier!=null&&tt.nullifier.byteLength>0&&(nt.uint32(50),nt.bytes(tt.nullifier)),tt.rlnIdentifier!=null&&tt.rlnIdentifier.byteLength>0&&(nt.uint32(58),nt.bytes(tt.rlnIdentifier)),rt.lengthDelimited!==!1&&nt.ldelim()},(tt,nt,rt={})=>{const ot={proof:alloc$2(0),merkleRoot:alloc$2(0),epoch:alloc$2(0),shareX:alloc$2(0),shareY:alloc$2(0),nullifier:alloc$2(0),rlnIdentifier:alloc$2(0)},it=nt==null?tt.len:tt.pos+nt;for(;tt.pos>>3){case 1:{ot.proof=tt.bytes();break}case 2:{ot.merkleRoot=tt.bytes();break}case 3:{ot.epoch=tt.bytes();break}case 4:{ot.shareX=tt.bytes();break}case 5:{ot.shareY=tt.bytes();break}case 6:{ot.nullifier=tt.bytes();break}case 7:{ot.rlnIdentifier=tt.bytes();break}default:{tt.skipType(st&7);break}}}return ot})),et),o.encode=tt=>encodeMessage(tt,o.codec()),o.decode=(tt,nt)=>decodeMessage(tt,o.codec(),nt)})(RateLimitProof||(RateLimitProof={}));var WakuMessage;(function(o){let et;o.codec=()=>(et==null&&(et=message$1((tt,nt,rt={})=>{rt.lengthDelimited!==!1&&nt.fork(),tt.payload!=null&&tt.payload.byteLength>0&&(nt.uint32(10),nt.bytes(tt.payload)),tt.contentTopic!=null&&tt.contentTopic!==""&&(nt.uint32(18),nt.string(tt.contentTopic)),tt.version!=null&&(nt.uint32(24),nt.uint32(tt.version)),tt.timestamp!=null&&(nt.uint32(80),nt.sint64(tt.timestamp)),tt.meta!=null&&(nt.uint32(90),nt.bytes(tt.meta)),tt.rateLimitProof!=null&&(nt.uint32(170),RateLimitProof.codec().encode(tt.rateLimitProof,nt)),tt.ephemeral!=null&&(nt.uint32(248),nt.bool(tt.ephemeral)),rt.lengthDelimited!==!1&&nt.ldelim()},(tt,nt,rt={})=>{var st;const ot={payload:alloc$2(0),contentTopic:""},it=nt==null?tt.len:tt.pos+nt;for(;tt.pos>>3){case 1:{ot.payload=tt.bytes();break}case 2:{ot.contentTopic=tt.string();break}case 3:{ot.version=tt.uint32();break}case 10:{ot.timestamp=tt.sint64();break}case 11:{ot.meta=tt.bytes();break}case 21:{ot.rateLimitProof=RateLimitProof.codec().decode(tt,tt.uint32(),{limits:(st=rt.limits)==null?void 0:st.rateLimitProof});break}case 31:{ot.ephemeral=tt.bool();break}default:{tt.skipType(at&7);break}}}return ot})),et),o.encode=tt=>encodeMessage(tt,o.codec()),o.decode=(tt,nt)=>decodeMessage(tt,o.codec(),nt)})(WakuMessage||(WakuMessage={}));var PeerInfo;(function(o){let et;o.codec=()=>(et==null&&(et=message$1((tt,nt,rt={})=>{rt.lengthDelimited!==!1&&nt.fork(),tt.enr!=null&&(nt.uint32(10),nt.bytes(tt.enr)),rt.lengthDelimited!==!1&&nt.ldelim()},(tt,nt,rt={})=>{const ot={},it=nt==null?tt.len:tt.pos+nt;for(;tt.pos>>3){case 1:{ot.enr=tt.bytes();break}default:{tt.skipType(st&7);break}}}return ot})),et),o.encode=tt=>encodeMessage(tt,o.codec()),o.decode=(tt,nt)=>decodeMessage(tt,o.codec(),nt)})(PeerInfo||(PeerInfo={}));var PeerExchangeQuery;(function(o){let et;o.codec=()=>(et==null&&(et=message$1((tt,nt,rt={})=>{rt.lengthDelimited!==!1&&nt.fork(),tt.numPeers!=null&&(nt.uint32(8),nt.uint64(tt.numPeers)),rt.lengthDelimited!==!1&&nt.ldelim()},(tt,nt,rt={})=>{const ot={},it=nt==null?tt.len:tt.pos+nt;for(;tt.pos>>3){case 1:{ot.numPeers=tt.uint64();break}default:{tt.skipType(st&7);break}}}return ot})),et),o.encode=tt=>encodeMessage(tt,o.codec()),o.decode=(tt,nt)=>decodeMessage(tt,o.codec(),nt)})(PeerExchangeQuery||(PeerExchangeQuery={}));var PeerExchangeResponse;(function(o){let et;o.codec=()=>(et==null&&(et=message$1((tt,nt,rt={})=>{if(rt.lengthDelimited!==!1&&nt.fork(),tt.peerInfos!=null)for(const ot of tt.peerInfos)nt.uint32(10),PeerInfo.codec().encode(ot,nt);rt.lengthDelimited!==!1&&nt.ldelim()},(tt,nt,rt={})=>{var st,at;const ot={peerInfos:[]},it=nt==null?tt.len:tt.pos+nt;for(;tt.pos>>3){case 1:{if(((st=rt.limits)==null?void 0:st.peerInfos)!=null&&ot.peerInfos.length===rt.limits.peerInfos)throw new MaxLengthError('Decode error - map field "peerInfos" had too many elements');ot.peerInfos.push(PeerInfo.codec().decode(tt,tt.uint32(),{limits:(at=rt.limits)==null?void 0:at.peerInfos$}));break}default:{tt.skipType(ct&7);break}}}return ot})),et),o.encode=tt=>encodeMessage(tt,o.codec()),o.decode=(tt,nt)=>decodeMessage(tt,o.codec(),nt)})(PeerExchangeResponse||(PeerExchangeResponse={}));var PeerExchangeRPC$1;(function(o){let et;o.codec=()=>(et==null&&(et=message$1((tt,nt,rt={})=>{rt.lengthDelimited!==!1&&nt.fork(),tt.query!=null&&(nt.uint32(10),PeerExchangeQuery.codec().encode(tt.query,nt)),tt.response!=null&&(nt.uint32(18),PeerExchangeResponse.codec().encode(tt.response,nt)),rt.lengthDelimited!==!1&&nt.ldelim()},(tt,nt,rt={})=>{var st,at;const ot={},it=nt==null?tt.len:tt.pos+nt;for(;tt.pos>>3){case 1:{ot.query=PeerExchangeQuery.codec().decode(tt,tt.uint32(),{limits:(st=rt.limits)==null?void 0:st.query});break}case 2:{ot.response=PeerExchangeResponse.codec().decode(tt,tt.uint32(),{limits:(at=rt.limits)==null?void 0:at.response});break}default:{tt.skipType(ct&7);break}}}return ot})),et),o.encode=tt=>encodeMessage(tt,o.codec()),o.decode=(tt,nt)=>decodeMessage(tt,o.codec(),nt)})(PeerExchangeRPC$1||(PeerExchangeRPC$1={}));var WakuMetadataRequest;(function(o){let et;o.codec=()=>(et==null&&(et=message$1((tt,nt,rt={})=>{if(rt.lengthDelimited!==!1&&nt.fork(),tt.clusterId!=null&&(nt.uint32(8),nt.uint32(tt.clusterId)),tt.shards!=null)for(const ot of tt.shards)nt.uint32(16),nt.uint32(ot);rt.lengthDelimited!==!1&&nt.ldelim()},(tt,nt,rt={})=>{var st;const ot={shards:[]},it=nt==null?tt.len:tt.pos+nt;for(;tt.pos>>3){case 1:{ot.clusterId=tt.uint32();break}case 2:{if(((st=rt.limits)==null?void 0:st.shards)!=null&&ot.shards.length===rt.limits.shards)throw new MaxLengthError('Decode error - map field "shards" had too many elements');ot.shards.push(tt.uint32());break}default:{tt.skipType(at&7);break}}}return ot})),et),o.encode=tt=>encodeMessage(tt,o.codec()),o.decode=(tt,nt)=>decodeMessage(tt,o.codec(),nt)})(WakuMetadataRequest||(WakuMetadataRequest={}));var WakuMetadataResponse;(function(o){let et;o.codec=()=>(et==null&&(et=message$1((tt,nt,rt={})=>{if(rt.lengthDelimited!==!1&&nt.fork(),tt.clusterId!=null&&(nt.uint32(8),nt.uint32(tt.clusterId)),tt.shards!=null)for(const ot of tt.shards)nt.uint32(16),nt.uint32(ot);rt.lengthDelimited!==!1&&nt.ldelim()},(tt,nt,rt={})=>{var st;const ot={shards:[]},it=nt==null?tt.len:tt.pos+nt;for(;tt.pos>>3){case 1:{ot.clusterId=tt.uint32();break}case 2:{if(((st=rt.limits)==null?void 0:st.shards)!=null&&ot.shards.length===rt.limits.shards)throw new MaxLengthError('Decode error - map field "shards" had too many elements');ot.shards.push(tt.uint32());break}default:{tt.skipType(at&7);break}}}return ot})),et),o.encode=tt=>encodeMessage(tt,o.codec()),o.decode=(tt,nt)=>decodeMessage(tt,o.codec(),nt)})(WakuMetadataResponse||(WakuMetadataResponse={}));function isDefined(o){return!!o}function groupByContentTopic(o){const et=new Map;return o.forEach(tt=>{let nt=et.get(tt.contentTopic);nt||(et.set(tt.contentTopic,[]),nt=et.get(tt.contentTopic)),nt.push(tt)}),et}const FRAME_RATE=60;async function toAsyncIterator(o,et,tt){const nt=FRAME_RATE,rt=[];let ot;ot=await o.subscribeWithUnsubscribe(et,lt=>{rt.push(lt)});const it=Number.isInteger(tt==null?void 0:tt.timeoutMs),st=0,at=Date.now();async function*ct(){for(;;){if(it&&Date.now()-at>=st)return;await wait(nt);const lt=rt.shift();if(!ot&&rt.length===0)return lt;!lt&&ot||(yield lt)}}return{iterator:ct(),async stop(){ot&&(await ot(),ot=void 0)}}}function wait(o){return new Promise(et=>{setTimeout(et,o)})}const MB=1024**2,SIZE_CAP_IN_MB=1;async function isMessageSizeUnderCap(o,et){const tt=await o.toWire(et);return tt?isWireSizeUnderCap(tt):!1}const isWireSizeUnderCap=o=>o.length/MB<=SIZE_CAP_IN_MB;var Protocols;(function(o){o.Relay="relay",o.Store="store",o.LightPush="lightpush",o.Filter="filter"})(Protocols||(Protocols={}));var ProtocolError$1;(function(o){o.GENERIC_FAIL="Generic error",o.ENCODE_FAILED="Failed to encode",o.DECODE_FAILED="Failed to decode",o.EMPTY_PAYLOAD="Payload is empty",o.SIZE_TOO_BIG="Size is too big",o.TOPIC_NOT_CONFIGURED="Topic not configured",o.TOPIC_DECODER_MISMATCH="Topic decoder mismatch",o.INVALID_DECODER_TOPICS="Invalid decoder topics",o.NO_PEER_AVAILABLE="No peer available",o.NO_STREAM_AVAILABLE="No stream available",o.NO_RESPONSE="No response received",o.REMOTE_PEER_REJECTED="Remote peer rejected",o.REQUEST_TIMEOUT="Request timeout",o.RLN_IDENTITY_MISSING="Identity credentials are not set",o.RLN_MEMBERSHIP_INDEX="Membership index is not set",o.RLN_LIMIT_MISSING="User message limit is not set",o.RLN_PROOF_GENERATION="Proof generation failed"})(ProtocolError$1||(ProtocolError$1={}));var Tags;(function(o){o.BOOTSTRAP="bootstrap",o.PEER_EXCHANGE="peer-exchange",o.LOCAL="local-peer-cache"})(Tags||(Tags={}));var EPeersByDiscoveryEvents;(function(o){o.PEER_DISCOVERY_BOOTSTRAP="peer:discovery:bootstrap",o.PEER_DISCOVERY_PEER_EXCHANGE="peer:discovery:peer-exchange",o.PEER_CONNECT_BOOTSTRAP="peer:connected:bootstrap",o.PEER_CONNECT_PEER_EXCHANGE="peer:connected:peer-exchange"})(EPeersByDiscoveryEvents||(EPeersByDiscoveryEvents={}));var EConnectionStateEvents;(function(o){o.CONNECTION_STATUS="waku:connection"})(EConnectionStateEvents||(EConnectionStateEvents={}));const DNS_DISCOVERY_TAG="@waku/bootstrap",DEFAULT_CLUSTER_ID=1,DefaultShardInfo={clusterId:DEFAULT_CLUSTER_ID,shards:[0,1,2,3,4,5,6,7,8]},DefaultNetworkConfig=DefaultShardInfo;var HealthStatus;(function(o){o.Unhealthy="Unhealthy",o.MinimallyHealthy="MinimallyHealthy",o.SufficientlyHealthy="SufficientlyHealthy"})(HealthStatus||(HealthStatus={}));function toString$8(o,et="utf8"){const tt=BASES[et];if(tt==null)throw new Error(`Unsupported encoding "${et}"`);return tt.encoder.encode(o).substring(1)}function hexToBytes$1(o){if(typeof o=="string"){const et=o.replace(/^0x/i,"");return fromString(et.toLowerCase(),"base16")}return o}function numberToBytes(o){const et=new ArrayBuffer(8),tt=new DataView(et);return typeof o=="number"?tt.setFloat64(0,o,!1):tt.setBigInt64(0,o,!1),new Uint8Array(et)}const bytesToHex$1=o=>toString$8(o,"base16"),bytesToUtf8=o=>toString$8(o,"utf8"),utf8ToBytes$1=o=>fromString(o,"utf8");function concat$2(o,et){const tt=o.reduce((ot,it)=>ot+it.length,0),nt=new Uint8Array(tt);let rt=0;for(const ot of o)nt.set(ot,rt),rt+=ot.length;return nt}function isStaticSharding(o){return"clusterId"in o&&"shards"in o&&!("contentTopics"in o)}function isAutoSharding(o){return"contentTopics"in o}function derivePubsubTopicsFromNetworkConfig(o){if(isStaticSharding(o)){if(o.shards.length===0)throw new Error("Invalid shards configuration: please provide at least one shard");return shardInfoToPubsubTopics(o)}else if(isAutoSharding(o)){if(o.contentTopics.length===0)throw new Error("Invalid content topics configuration: please provide at least one content topic");return o.contentTopics.map(et=>contentTopicToPubsubTopic(et,o.clusterId))}else throw new Error("Unknown shard config. Please use ShardInfo or ContentTopicInfo")}const singleShardInfoToPubsubTopic=o=>{if(o.shard===void 0)throw new Error("Invalid shard");return`/waku/2/rs/${o.clusterId??DEFAULT_CLUSTER_ID}/${o.shard}`},shardInfoToPubsubTopics=o=>{if("contentTopics"in o&&o.contentTopics)return Array.from(new Set(o.contentTopics.map(et=>contentTopicToPubsubTopic(et,o.clusterId))));if("shards"in o){if(o.shards===void 0)throw new Error("Invalid shard");return Array.from(new Set(o.shards.map(et=>`/waku/2/rs/${o.clusterId??DEFAULT_CLUSTER_ID}/${et}`)))}else{if("application"in o&&"version"in o)return[contentTopicToPubsubTopic(`/${o.application}/${o.version}/default/default`,o.clusterId)];throw new Error("Missing required configuration in shard parameters")}},pubsubTopicToSingleShardInfo=o=>{const et=o.split("/");if(et.length!=6||et[1]!=="waku"||et[2]!=="2"||et[3]!=="rs")throw new Error("Invalid pubsub topic");const tt=parseInt(et[4]),nt=parseInt(et[5]);if(isNaN(tt)||isNaN(nt))throw new Error("Invalid clusterId or shard");return{clusterId:tt,shard:nt}},pubsubTopicsToShardInfo=o=>{const et=new Set,tt=new Set;for(const ot of o){const{clusterId:it,shard:st}=pubsubTopicToSingleShardInfo(ot);et.add(`${it}:${st}`),tt.add(it)}if(et.size===0)throw new Error("No valid pubsub topics provided");if(tt.size>1)throw new Error("Pubsub topics from multiple cluster IDs are not supported");const nt=tt.values().next().value,rt=Array.from(et).map(ot=>parseInt(ot.split(":")[1]));return{clusterId:nt,shards:rt}};function ensurePubsubTopicIsConfigured(o,et){if(!et.includes(o))throw new Error(`Pubsub topic ${o} has not been configured on this instance. Configured topics are: ${et}. Please update your configuration by passing in the topic during Waku node instantiation.`)}function ensureValidContentTopic(o){const et=o.split("/");if(et.length<5||et.length>6)throw Error("Content topic format is invalid");let tt=0;if(et.length==6){if(tt=parseInt(et[1]),isNaN(tt))throw new Error("Invalid generation field in content topic");if(tt>0)throw new Error("Generation greater than 0 is not supported")}const nt=et.splice(-4);if(nt[0].length==0)throw new Error("Application field cannot be empty");if(nt[1].length==0)throw new Error("Version field cannot be empty");if(nt[2].length==0)throw new Error("Topic name field cannot be empty");if(nt[3].length==0)throw new Error("Encoding field cannot be empty");return{generation:tt,application:nt[0],version:nt[1],topicName:nt[2],encoding:nt[3]}}function contentTopicToShardIndex(o,et=8){const{application:tt,version:nt}=ensureValidContentTopic(o),rt=sha256$2(concat$2([utf8ToBytes$1(tt),utf8ToBytes$1(nt)])),ot=new DataView(rt.buffer.slice(-8));return Number(ot.getBigUint64(0,!1)%BigInt(et))}function contentTopicToPubsubTopic(o,et=DEFAULT_CLUSTER_ID,tt=8){if(!o)throw Error("Content topic must be specified");const nt=contentTopicToShardIndex(o,tt);return`/waku/2/rs/${et}/${nt}`}function determinePubsubTopic(o,et){return typeof et=="string"?et:(et==null?void 0:et.shard)!==void 0?singleShardInfoToPubsubTopic(et):contentTopicToPubsubTopic(o,(et==null?void 0:et.clusterId)??DEFAULT_CLUSTER_ID)}const decodeRelayShard=o=>{if(o=new Uint8Array(o),o.length<3)throw new Error("Insufficient data");const et=new DataView(o.buffer),tt=et.getUint16(0),nt=[];if(o.length===130)for(let rt=0;rt<1024;rt++){const ot=Math.floor(rt/8)+2,it=7-rt%8;et.getUint8(ot)&1<=o.length)throw new Error("Unexpected end of data");nt.push(et.getUint16(it))}}return{clusterId:tt,shards:nt}},encodeRelayShard=o=>{const{clusterId:et,shards:tt}=o,nt=tt.length>=64?130:3+2*tt.length,rt=new ArrayBuffer(nt),ot=new DataView(rt);if(ot.setUint16(0,et),tt.length>=64)for(const it of tt){const st=Math.floor(it/8)+2,at=7-it%8;ot.setUint8(st,ot.getUint8(st)|1<tt.toString().includes("ws")||tt.toString().includes("wss"));if(!et)throw new Error("No ws multiaddr found in the given addresses");return et}var browser={exports:{}},ms$1,hasRequiredMs;function requireMs(){if(hasRequiredMs)return ms$1;hasRequiredMs=1;var o=1e3,et=o*60,tt=et*60,nt=tt*24,rt=nt*7,ot=nt*365.25;ms$1=function(lt,dt){dt=dt||{};var ht=typeof lt;if(ht==="string"&<.length>0)return it(lt);if(ht==="number"&&isFinite(lt))return dt.long?at(lt):st(lt);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(lt))};function it(lt){if(lt=String(lt),!(lt.length>100)){var dt=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(lt);if(dt){var ht=parseFloat(dt[1]),pt=(dt[2]||"ms").toLowerCase();switch(pt){case"years":case"year":case"yrs":case"yr":case"y":return ht*ot;case"weeks":case"week":case"w":return ht*rt;case"days":case"day":case"d":return ht*nt;case"hours":case"hour":case"hrs":case"hr":case"h":return ht*tt;case"minutes":case"minute":case"mins":case"min":case"m":return ht*et;case"seconds":case"second":case"secs":case"sec":case"s":return ht*o;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return ht;default:return}}}}function st(lt){var dt=Math.abs(lt);return dt>=nt?Math.round(lt/nt)+"d":dt>=tt?Math.round(lt/tt)+"h":dt>=et?Math.round(lt/et)+"m":dt>=o?Math.round(lt/o)+"s":lt+"ms"}function at(lt){var dt=Math.abs(lt);return dt>=nt?ct(lt,dt,nt,"day"):dt>=tt?ct(lt,dt,tt,"hour"):dt>=et?ct(lt,dt,et,"minute"):dt>=o?ct(lt,dt,o,"second"):lt+" ms"}function ct(lt,dt,ht,pt){var mt=dt>=ht*1.5;return Math.round(lt/ht)+" "+pt+(mt?"s":"")}return ms$1}function setup$1(o){tt.debug=tt,tt.default=tt,tt.coerce=at,tt.disable=ot,tt.enable=rt,tt.enabled=it,tt.humanize=requireMs(),tt.destroy=ct,Object.keys(o).forEach(lt=>{tt[lt]=o[lt]}),tt.names=[],tt.skips=[],tt.formatters={};function et(lt){let dt=0;for(let ht=0;ht{if(wt==="%%")return"%";bt++;const It=tt.formatters[kt];if(typeof It=="function"){const Rt=yt[bt];wt=It.call(gt,Rt),yt.splice(bt,1),bt--}return wt}),tt.formatArgs.call(gt,yt),(gt.log||tt.log).apply(gt,yt)}return ft.namespace=lt,ft.useColors=tt.useColors(),ft.color=tt.selectColor(lt),ft.extend=nt,ft.destroy=tt.destroy,Object.defineProperty(ft,"enabled",{enumerable:!0,configurable:!1,get:()=>ht!==null?ht:(pt!==tt.namespaces&&(pt=tt.namespaces,mt=tt.enabled(lt)),mt),set:yt=>{ht=yt}}),typeof tt.init=="function"&&tt.init(ft),ft}function nt(lt,dt){const ht=tt(this.namespace+(typeof dt>"u"?":":dt)+lt);return ht.log=this.log,ht}function rt(lt){tt.save(lt),tt.namespaces=lt,tt.names=[],tt.skips=[];let dt;const ht=(typeof lt=="string"?lt:"").split(/[\s,]+/),pt=ht.length;for(dt=0;dt"-"+dt)].join(",");return tt.enable(""),lt}function it(lt){if(lt[lt.length-1]==="*")return!0;let dt,ht;for(dt=0,ht=tt.skips.length;dt{let lt=!1;return()=>{lt||(lt=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),et.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function rt(){if(typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs))return!0;if(typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let lt;return typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&(lt=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(lt[1],10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function ot(lt){if(lt[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+lt[0]+(this.useColors?"%c ":" ")+"+"+o.exports.humanize(this.diff),!this.useColors)return;const dt="color: "+this.color;lt.splice(1,0,dt,"color: inherit");let ht=0,pt=0;lt[0].replace(/%[a-zA-Z%]/g,mt=>{mt!=="%%"&&(ht++,mt==="%c"&&(pt=ht))}),lt.splice(pt,0,dt)}et.log=console.debug||console.log||(()=>{});function it(lt){try{lt?et.storage.setItem("debug",lt):et.storage.removeItem("debug")}catch{}}function st(){let lt;try{lt=et.storage.getItem("debug")}catch{}return!lt&&typeof tt<"u"&&"env"in tt&&(lt=nt.DEBUG),lt}function at(){try{return localStorage}catch{}}o.exports=common$1(et);const{formatters:ct}=o.exports;ct.j=function(lt){try{return JSON.stringify(lt)}catch(dt){return"[UnexpectedJSONParseError]: "+dt.message}}})(browser,browser.exports);var browserExports=browser.exports;const debug=getDefaultExportFromCjs(browserExports),APP_NAME="waku";let Logger$1=class Zo{constructor(et){Ct(this,"_info");Ct(this,"_warn");Ct(this,"_error");this._info=debug(Zo.createDebugNamespace("info",et)),this._warn=debug(Zo.createDebugNamespace("warn",et)),this._error=debug(Zo.createDebugNamespace("error",et))}static createDebugNamespace(et,tt){return tt?`${APP_NAME}:${et}:${tt}`:`${APP_NAME}:${et}`}get info(){return this._info}get warn(){return this._warn}get error(){return this._error}log(et,...tt){const nt=this[et];nt(...tt)}};const log$o=new Logger$1("message:version-0"),OneMillion=BigInt(1e6),Version=0;class DecodedMessage{constructor(et,tt){Ct(this,"pubsubTopic");Ct(this,"proto");this.pubsubTopic=et,this.proto=tt}get ephemeral(){return!!this.proto.ephemeral}get payload(){return this.proto.payload}get contentTopic(){return this.proto.contentTopic}get _rawTimestamp(){return this.proto.timestamp}get timestamp(){try{if(this.proto.timestamp){const et=this.proto.timestamp/OneMillion;return new Date(Number(et))}return}catch{return}}get meta(){return this.proto.meta}get version(){return this.proto.version??0}get rateLimitProof(){return this.proto.rateLimitProof}}let Encoder$1=class{constructor(et,tt=!1,nt,rt){Ct(this,"contentTopic");Ct(this,"ephemeral");Ct(this,"pubsubTopic");Ct(this,"metaSetter");if(this.contentTopic=et,this.ephemeral=tt,this.pubsubTopic=nt,this.metaSetter=rt,!et||et==="")throw new Error("Content topic must be specified")}async toWire(et){return WakuMessage$4.encode(await this.toProtoObj(et))}async toProtoObj(et){const tt=et.timestamp??new Date,nt={payload:et.payload,version:Version,contentTopic:this.contentTopic,timestamp:BigInt(tt.valueOf())*OneMillion,meta:void 0,rateLimitProof:et.rateLimitProof,ephemeral:this.ephemeral};if(this.metaSetter){const rt=this.metaSetter(nt);return{...nt,meta:rt}}return nt}};function createEncoder({pubsubTopic:o,pubsubTopicShardInfo:et,contentTopic:tt,ephemeral:nt,metaSetter:rt}){return new Encoder$1(tt,nt,determinePubsubTopic(tt,o??et),rt)}let Decoder$1=class{constructor(et,tt){Ct(this,"pubsubTopic");Ct(this,"contentTopic");if(this.pubsubTopic=et,this.contentTopic=tt,!tt||tt==="")throw new Error("Content topic must be specified")}fromWireToProtoObj(et){const tt=WakuMessage$4.decode(et);return Promise.resolve({payload:tt.payload,contentTopic:tt.contentTopic,version:tt.version??void 0,timestamp:tt.timestamp??void 0,meta:tt.meta??void 0,rateLimitProof:tt.rateLimitProof??void 0,ephemeral:tt.ephemeral??!1})}async fromProtoObj(et,tt){return tt.version??Version!==0?(log$o.error("Failed to decode due to incorrect version, expected:",Version,", actual:",tt.version),Promise.resolve(void 0)):new DecodedMessage(et,tt)}};function createDecoder(o,et){return new Decoder$1(determinePubsubTopic(o,et),o)}function isAsyncIterable$8(o){return o[Symbol.asyncIterator]!=null}function all$2(o){if(isAsyncIterable$8(o))return(async()=>{const tt=[];for await(const nt of o)tt.push(nt);return tt})();const et=[];for(const tt of o)et.push(tt);return et}function asUint8Array(o){return o}function concat$1(o,et){et==null&&(et=o.reduce((rt,ot)=>rt+ot.length,0));const tt=allocUnsafe(et);let nt=0;for(const rt of o)tt.set(rt,nt),nt+=rt.length;return tt}function equals(o,et){if(o===et)return!0;if(o.byteLength!==et.byteLength)return!1;for(let tt=0;tt0&&this.appendAll(et)}*[(Ys=symbol$1,Symbol.iterator)](){yield*this.bufs}get byteLength(){return this.length}append(...et){this.appendAll(et)}appendAll(et){let tt=0;for(const nt of et)if(nt instanceof Uint8Array)tt+=nt.byteLength,this.bufs.push(nt);else if(isUint8ArrayList(nt))tt+=nt.byteLength,this.bufs.push(...nt.bufs);else throw new Error("Could not append value, must be an Uint8Array or a Uint8ArrayList");this.length+=tt}prepend(...et){this.prependAll(et)}prependAll(et){let tt=0;for(const nt of et.reverse())if(nt instanceof Uint8Array)tt+=nt.byteLength,this.bufs.unshift(nt);else if(isUint8ArrayList(nt))tt+=nt.byteLength,this.bufs.unshift(...nt.bufs);else throw new Error("Could not prepend value, must be an Uint8Array or a Uint8ArrayList");this.length+=tt}get(et){const tt=findBufAndOffset(this.bufs,et);return tt.buf[tt.index]}set(et,tt){const nt=findBufAndOffset(this.bufs,et);nt.buf[nt.index]=tt}write(et,tt=0){if(et instanceof Uint8Array)for(let nt=0;nt0;)if(et>=this.bufs[0].byteLength)et-=this.bufs[0].byteLength,this.length-=this.bufs[0].byteLength,this.bufs.shift();else{this.bufs[0]=this.bufs[0].subarray(et),this.length-=et;break}}}slice(et,tt){const{bufs:nt,length:rt}=this._subList(et,tt);return concat$1(nt,rt)}subarray(et,tt){const{bufs:nt,length:rt}=this._subList(et,tt);return nt.length===1?nt[0]:concat$1(nt,rt)}sublist(et,tt){const{bufs:nt,length:rt}=this._subList(et,tt),ot=new Uint8ArrayList;return ot.length=rt,ot.bufs=[...nt],ot}_subList(et,tt){if(et=et??0,tt=tt??this.length,et<0&&(et=this.length+et),tt<0&&(tt=this.length+tt),et<0||tt>this.length)throw new RangeError("index is out of bounds");if(et===tt)return{bufs:[],length:0};if(et===0&&tt===this.length)return{bufs:this.bufs,length:this.length};const nt=[];let rt=0;for(let ot=0;ot=at)continue;const ct=et>=st&&etst&&tt<=at;if(ct&<){if(et===st&&tt===at){nt.push(it);break}const dt=et-st;nt.push(it.subarray(dt,dt+(tt-et)));break}if(ct){if(et===0){nt.push(it);continue}nt.push(it.subarray(et-st));continue}if(lt){if(tt===at){nt.push(it);break}nt.push(it.subarray(0,tt-st));break}nt.push(it)}return{bufs:nt,length:tt-et}}indexOf(et,tt=0){if(!isUint8ArrayList(et)&&!(et instanceof Uint8Array))throw new TypeError('The "value" argument must be a Uint8ArrayList or Uint8Array');const nt=et instanceof Uint8Array?et:et.subarray();if(tt=Number(tt??0),isNaN(tt)&&(tt=0),tt<0&&(tt=this.length+tt),tt<0&&(tt=0),et.length===0)return tt>this.length?this.length:tt;const rt=nt.byteLength;if(rt===0)throw new TypeError("search must be at least 1 byte long");const ot=256,it=new Int32Array(ot);for(let dt=0;dt=0;ht--){const pt=this.get(dt+ht);if(nt[ht]!==pt){lt=Math.max(1,ht-st[pt]);break}}if(lt===0)return dt}return-1}getInt8(et){const tt=this.subarray(et,et+1);return new DataView(tt.buffer,tt.byteOffset,tt.byteLength).getInt8(0)}setInt8(et,tt){const nt=allocUnsafe(1);new DataView(nt.buffer,nt.byteOffset,nt.byteLength).setInt8(0,tt),this.write(nt,et)}getInt16(et,tt){const nt=this.subarray(et,et+2);return new DataView(nt.buffer,nt.byteOffset,nt.byteLength).getInt16(0,tt)}setInt16(et,tt,nt){const rt=alloc$2(2);new DataView(rt.buffer,rt.byteOffset,rt.byteLength).setInt16(0,tt,nt),this.write(rt,et)}getInt32(et,tt){const nt=this.subarray(et,et+4);return new DataView(nt.buffer,nt.byteOffset,nt.byteLength).getInt32(0,tt)}setInt32(et,tt,nt){const rt=alloc$2(4);new DataView(rt.buffer,rt.byteOffset,rt.byteLength).setInt32(0,tt,nt),this.write(rt,et)}getBigInt64(et,tt){const nt=this.subarray(et,et+8);return new DataView(nt.buffer,nt.byteOffset,nt.byteLength).getBigInt64(0,tt)}setBigInt64(et,tt,nt){const rt=alloc$2(8);new DataView(rt.buffer,rt.byteOffset,rt.byteLength).setBigInt64(0,tt,nt),this.write(rt,et)}getUint8(et){const tt=this.subarray(et,et+1);return new DataView(tt.buffer,tt.byteOffset,tt.byteLength).getUint8(0)}setUint8(et,tt){const nt=allocUnsafe(1);new DataView(nt.buffer,nt.byteOffset,nt.byteLength).setUint8(0,tt),this.write(nt,et)}getUint16(et,tt){const nt=this.subarray(et,et+2);return new DataView(nt.buffer,nt.byteOffset,nt.byteLength).getUint16(0,tt)}setUint16(et,tt,nt){const rt=alloc$2(2);new DataView(rt.buffer,rt.byteOffset,rt.byteLength).setUint16(0,tt,nt),this.write(rt,et)}getUint32(et,tt){const nt=this.subarray(et,et+4);return new DataView(nt.buffer,nt.byteOffset,nt.byteLength).getUint32(0,tt)}setUint32(et,tt,nt){const rt=alloc$2(4);new DataView(rt.buffer,rt.byteOffset,rt.byteLength).setUint32(0,tt,nt),this.write(rt,et)}getBigUint64(et,tt){const nt=this.subarray(et,et+8);return new DataView(nt.buffer,nt.byteOffset,nt.byteLength).getBigUint64(0,tt)}setBigUint64(et,tt,nt){const rt=alloc$2(8);new DataView(rt.buffer,rt.byteOffset,rt.byteLength).setBigUint64(0,tt,nt),this.write(rt,et)}getFloat32(et,tt){const nt=this.subarray(et,et+4);return new DataView(nt.buffer,nt.byteOffset,nt.byteLength).getFloat32(0,tt)}setFloat32(et,tt,nt){const rt=alloc$2(4);new DataView(rt.buffer,rt.byteOffset,rt.byteLength).setFloat32(0,tt,nt),this.write(rt,et)}getFloat64(et,tt){const nt=this.subarray(et,et+8);return new DataView(nt.buffer,nt.byteOffset,nt.byteLength).getFloat64(0,tt)}setFloat64(et,tt,nt){const rt=alloc$2(8);new DataView(rt.buffer,rt.byteOffset,rt.byteLength).setFloat64(0,tt,nt),this.write(rt,et)}equals(et){if(et==null||!(et instanceof Uint8ArrayList)||et.bufs.length!==this.bufs.length)return!1;for(let tt=0;ttrt+ot.byteLength,0)),nt.length=tt,nt}}function isAsyncIterable$7(o){return o[Symbol.asyncIterator]!=null}const defaultEncoder=o=>{const et=encodingLength$3(o),tt=allocUnsafe(et);return encode$a(o,tt),defaultEncoder.bytes=et,tt};defaultEncoder.bytes=0;function encode$5(o,et){et=et??{};const tt=et.lengthEncoder??defaultEncoder;function*nt(rt){const ot=tt(rt.byteLength);ot instanceof Uint8Array?yield ot:yield*ot,rt instanceof Uint8Array?yield rt:yield*rt}return isAsyncIterable$7(o)?async function*(){for await(const rt of o)yield*nt(rt)}():function*(){for(const rt of o)yield*nt(rt)}()}encode$5.single=(o,et)=>{et=et??{};const tt=et.lengthEncoder??defaultEncoder;return new Uint8ArrayList(tt(o.byteLength),o)};let InvalidMessageLengthError$1=class extends Error{constructor(){super(...arguments);Ct(this,"name","InvalidMessageLengthError");Ct(this,"code","ERR_INVALID_MSG_LENGTH")}},InvalidDataLengthError$1=class extends Error{constructor(){super(...arguments);Ct(this,"name","InvalidDataLengthError");Ct(this,"code","ERR_MSG_DATA_TOO_LONG")}},InvalidDataLengthLengthError$1=class extends Error{constructor(){super(...arguments);Ct(this,"name","InvalidDataLengthLengthError");Ct(this,"code","ERR_MSG_LENGTH_TOO_LONG")}},UnexpectedEOFError$1=class extends Error{constructor(){super(...arguments);Ct(this,"name","UnexpectedEOFError");Ct(this,"code","ERR_UNEXPECTED_EOF")}};const MAX_LENGTH_LENGTH=8,MAX_DATA_LENGTH=1024*1024*4;var ReadMode;(function(o){o[o.LENGTH=0]="LENGTH",o[o.DATA=1]="DATA"})(ReadMode||(ReadMode={}));const defaultDecoder=o=>{const et=decode$b(o);return defaultDecoder.bytes=encodingLength$3(et),et};defaultDecoder.bytes=0;function decode$5(o,et){const tt=new Uint8ArrayList;let nt=ReadMode.LENGTH,rt=-1;const ot=(et==null?void 0:et.lengthDecoder)??defaultDecoder,it=(et==null?void 0:et.maxLengthLength)??MAX_LENGTH_LENGTH,st=(et==null?void 0:et.maxDataLength)??MAX_DATA_LENGTH;function*at(){for(;tt.byteLength>0;){if(nt===ReadMode.LENGTH)try{if(rt=ot(tt),rt<0)throw new InvalidMessageLengthError$1("Invalid message length");if(rt>st)throw new InvalidDataLengthError$1("Message length too long");const ct=ot.bytes;tt.consume(ct),(et==null?void 0:et.onLength)!=null&&et.onLength(rt),nt=ReadMode.DATA}catch(ct){if(ct instanceof RangeError){if(tt.byteLength>it)throw new InvalidDataLengthLengthError$1("Message length length too long");break}throw ct}if(nt===ReadMode.DATA){if(tt.byteLength0)throw new UnexpectedEOFError$1("Unexpected end of input")}():function*(){for(const ct of o)tt.append(ct),yield*at();if(tt.byteLength>0)throw new UnexpectedEOFError$1("Unexpected end of input")}()}decode$5.fromReader=(o,et)=>{let tt=1;const nt=async function*(){for(;;)try{const{done:ot,value:it}=await o.next(tt);if(ot===!0)return;it!=null&&(yield it)}catch(ot){if(ot.code==="ERR_UNDER_READ")return{done:!0,value:null};throw ot}finally{tt=1}}();return decode$5(nt,{...et??{},onLength:ot=>{tt=ot}})};function pDefer(){const o={};return o.promise=new Promise((et,tt)=>{o.resolve=et,o.reject=tt}),o}class FixedFIFO{constructor(et){Ct(this,"buffer");Ct(this,"mask");Ct(this,"top");Ct(this,"btm");Ct(this,"next");if(!(et>0)||et-1&et)throw new Error("Max size for a FixedFIFO should be a power of two");this.buffer=new Array(et),this.mask=et-1,this.top=0,this.btm=0,this.next=null}push(et){return this.buffer[this.top]!==void 0?!1:(this.buffer[this.top]=et,this.top=this.top+1&this.mask,!0)}shift(){const et=this.buffer[this.btm];if(et!==void 0)return this.buffer[this.btm]=void 0,this.btm=this.btm+1&this.mask,et}isEmpty(){return this.buffer[this.btm]===void 0}}class FIFO{constructor(et={}){Ct(this,"size");Ct(this,"hwm");Ct(this,"head");Ct(this,"tail");this.hwm=et.splitLimit??16,this.head=new FixedFIFO(this.hwm),this.tail=this.head,this.size=0}calculateSize(et){return(et==null?void 0:et.byteLength)!=null?et.byteLength:1}push(et){if((et==null?void 0:et.value)!=null&&(this.size+=this.calculateSize(et.value)),!this.head.push(et)){const tt=this.head;this.head=tt.next=new FixedFIFO(2*this.head.buffer.length),this.head.push(et)}}shift(){let et=this.tail.shift();if(et===void 0&&this.tail.next!=null){const tt=this.tail.next;this.tail.next=null,this.tail=tt,et=this.tail.shift()}return(et==null?void 0:et.value)!=null&&(this.size-=this.calculateSize(et.value)),et}isEmpty(){return this.head.isEmpty()}}let AbortError$a=class extends Error{constructor(tt,nt){super(tt??"The operation was aborted");Ct(this,"type");Ct(this,"code");this.type="aborted",this.code=nt??"ABORT_ERR"}};function pushable(o={}){return _pushable(tt=>{const nt=tt.shift();if(nt==null)return{done:!0};if(nt.error!=null)throw nt.error;return{done:nt.done===!0,value:nt.value}},o)}function _pushable(o,et){et=et??{};let tt=et.onEnd,nt=new FIFO,rt,ot,it,st=pDefer();const at=async()=>{try{return nt.isEmpty()?it?{done:!0}:await new Promise((yt,gt)=>{ot=xt=>{ot=null,nt.push(xt);try{yt(o(nt))}catch(vt){gt(vt)}return rt}}):o(nt)}finally{nt.isEmpty()&&queueMicrotask(()=>{st.resolve(),st=pDefer()})}},ct=yt=>ot!=null?ot(yt):(nt.push(yt),rt),lt=yt=>(nt=new FIFO,ot!=null?ot({error:yt}):(nt.push({error:yt}),rt)),dt=yt=>{if(it)return rt;if((et==null?void 0:et.objectMode)!==!0&&(yt==null?void 0:yt.byteLength)==null)throw new Error("objectMode was not true but tried to push non-Uint8Array value");return ct({done:!1,value:yt})},ht=yt=>it?rt:(it=!0,yt!=null?lt(yt):ct({done:!0})),pt=()=>(nt=new FIFO,ht(),{done:!0}),mt=yt=>(ht(yt),{done:!0});if(rt={[Symbol.asyncIterator](){return this},next:at,return:pt,throw:mt,push:dt,end:ht,get readableLength(){return nt.size},onEmpty:async yt=>{const gt=yt==null?void 0:yt.signal;if(gt==null||gt.throwIfAborted(),nt.isEmpty())return;let xt,vt;gt!=null&&(xt=new Promise((bt,Et)=>{vt=()=>{Et(new AbortError$a)},gt.addEventListener("abort",vt)}));try{await Promise.race([st.promise,xt])}finally{vt!=null&>!=null&&(gt==null||gt.removeEventListener("abort",vt))}}},tt==null)return rt;const ft=rt;return rt={[Symbol.asyncIterator](){return this},next(){return ft.next()},throw(yt){return ft.throw(yt),tt!=null&&(tt(yt),tt=void 0),{done:!0}},return(){return ft.return(),tt!=null&&(tt(),tt=void 0),{done:!0}},push:dt,end(yt){return ft.end(yt),tt!=null&&(tt(yt),tt=void 0),rt},get readableLength(){return ft.readableLength},onEmpty:yt=>ft.onEmpty(yt)},rt}function isAsyncIterable$6(o){return o[Symbol.asyncIterator]!=null}function merge$2(...o){const et=[];for(const tt of o)isAsyncIterable$6(tt)||et.push(tt);return et.length===o.length?function*(){for(const tt of et)yield*tt}():async function*(){const tt=pushable({objectMode:!0});Promise.resolve().then(async()=>{try{await Promise.all(o.map(async nt=>{for await(const rt of nt)tt.push(rt)})),tt.end()}catch(nt){tt.end(nt)}}),yield*tt}()}function pipe(o,...et){if(o==null)throw new Error("Empty pipeline");if(isDuplex(o)){const nt=o;o=()=>nt.source}else if(isIterable(o)||isAsyncIterable$5(o)){const nt=o;o=()=>nt}const tt=[o,...et];if(tt.length>1&&isDuplex(tt[tt.length-1])&&(tt[tt.length-1]=tt[tt.length-1].sink),tt.length>2)for(let nt=1;nt{let et;for(;o.length>0;)et=o.shift()(et);return et},isAsyncIterable$5=o=>(o==null?void 0:o[Symbol.asyncIterator])!=null,isIterable=o=>(o==null?void 0:o[Symbol.iterator])!=null,isDuplex=o=>o==null?!1:o.sink!=null&&o.source!=null,duplexPipelineFn=o=>et=>{const tt=o.sink(et);if((tt==null?void 0:tt.then)!=null){const nt=pushable({objectMode:!0});tt.then(()=>{nt.end()},it=>{nt.end(it)});let rt;const ot=o.source;if(isAsyncIterable$5(ot))rt=async function*(){yield*ot,nt.end()};else if(isIterable(ot))rt=function*(){yield*ot,nt.end()};else throw new Error("Unknown duplex source type - must be Iterable or AsyncIterable");return merge$2(nt,rt())}return o.source};async function sortPeersByLatency(o,et){return et.length===0?[]:(await Promise.all(et.map(async rt=>{try{const ot=(await o.get(rt.id)).metadata.get("ping");if(!ot)return{peer:rt,ping:1/0};const it=Number(bytesToUtf8(ot));return{peer:rt,ping:it}}catch{return{peer:rt,ping:1/0}}}))).filter(rt=>rt!==null).sort((rt,ot)=>rt.ping-ot.ping).map(rt=>rt.peer)}async function getPeersForProtocol(o,et){const tt=[];return await o.forEach(nt=>{for(let rt=0;rtit.tags.has(Tags.BOOTSTRAP)).slice(0,tt);et>0&&et!it.tags.has(Tags.BOOTSTRAP));if(et===0)return[...nt,...rt];const ot=[...nt];for(;ot.length0;){const it=Math.floor(Math.random()*rt.length),st=rt.splice(it,1)[0];ot.push(st)}return ot}function selectOpenConnection(o){return o.filter(et=>et.status==="open").sort((et,tt)=>tt.timeline.open-et.timeline.open).at(0)}const STREAM_LOCK_KEY="consumed";class StreamManager{constructor(et,tt,nt){Ct(this,"multicodec");Ct(this,"getConnections");Ct(this,"addEventListener");Ct(this,"log");Ct(this,"ongoingCreation",new Set);Ct(this,"streamPool",new Map);Ct(this,"handlePeerUpdateStreamPool",et=>{const{peer:tt}=et.detail;!tt.protocols.includes(this.multicodec)||this.getOpenStreamForCodec(tt.id)||this.scheduleNewStream(tt)});this.multicodec=et,this.getConnections=tt,this.addEventListener=nt,this.log=new Logger$1(`stream-manager:${et}`),this.addEventListener("peer:update",this.handlePeerUpdateStreamPool)}async getStream(et){const tt=et.id.toString(),nt=this.streamPool.get(tt);nt&&(this.streamPool.delete(tt),await nt);let rt=this.getOpenStreamForCodec(et.id);return rt?(this.log.info(`Found existing stream peerId=${et.id.toString()} multicodec=${this.multicodec}`),this.lockStream(et.id.toString(),rt),rt):(rt=await this.createStream(et),this.lockStream(et.id.toString(),rt),rt)}async createStream(et,tt=0){const nt=this.getConnections(et.id),rt=selectOpenConnection(nt);if(!rt)throw new Error(`Failed to get a connection to the peer peerId=${et.id.toString()} multicodec=${this.multicodec}`);let ot,it;for(let st=0;stit.protocol===this.multicodec);if(!(!rt||["done","closed","closing"].includes(rt.writeStatus||"")||this.isStreamLocked(rt)))return rt}lockStream(et,tt){this.log.info(`Locking stream for peerId:${et} streamId:${tt.id}`),tt.metadata[STREAM_LOCK_KEY]=!0}isStreamLocked(et){return!!et.metadata[STREAM_LOCK_KEY]}}class BaseProtocol{constructor(et,tt,nt,rt){Ct(this,"multicodec");Ct(this,"components");Ct(this,"log");Ct(this,"pubsubTopics");Ct(this,"addLibp2pEventListener");Ct(this,"removeLibp2pEventListener");Ct(this,"streamManager");this.multicodec=et,this.components=tt,this.log=nt,this.pubsubTopics=rt,this.addLibp2pEventListener=tt.events.addEventListener.bind(tt.events),this.removeLibp2pEventListener=tt.events.removeEventListener.bind(tt.events),this.streamManager=new StreamManager(et,tt.connectionManager.getConnections.bind(tt.connectionManager),this.addLibp2pEventListener)}async getStream(et){return this.streamManager.getStream(et)}async allPeers(){return getPeersForProtocol(this.components.peerStore,[this.multicodec])}async connectedPeers(){return(await this.allPeers()).filter(tt=>this.components.connectionManager.getConnections(tt.id).length>0)}async getPeers({numPeers:et,maxBootstrapPeers:tt}={maxBootstrapPeers:0,numPeers:0}){const nt=await this.connectedPeers(),rt=filterPeersByDiscovery(nt,et,tt),ot=await sortPeersByLatency(this.components.peerStore,rt);return ot.length===0&&this.log.warn("No peers found. Ensure you have a connection to the network."),ot.length{log$n.error("Failed to register ",FilterCodecs.PUSH,ot)})}async subscribe(tt,nt,rt){const ot=await this.getStream(nt),it=FilterSubscribeRpc.createSubscribeRequest(tt,rt);let st;try{st=await pipe([it.encode()],encode$5,ot,decode$5,async dt=>await all$2(dt))}catch(dt){return log$n.error("Failed to send subscribe request",dt),{success:null,failure:{error:ProtocolError$1.GENERIC_FAIL,peerId:nt.id}}}const{statusCode:at,requestId:ct,statusDesc:lt}=FilterSubscribeResponse.decode(st[0].slice());return at<200||at>=300?(log$n.error(`Filter subscribe request ${ct} failed with status code ${at}: ${lt}`),{failure:{error:ProtocolError$1.REMOTE_PEER_REJECTED,peerId:nt.id},success:null}):{failure:null,success:nt.id}}async unsubscribe(tt,nt,rt){let ot;try{ot=await this.getStream(nt)}catch(st){return log$n.error(`Failed to get a stream for remote peer${nt.id.toString()}`,st),{success:null,failure:{error:ProtocolError$1.NO_STREAM_AVAILABLE,peerId:nt.id}}}const it=FilterSubscribeRpc.createUnsubscribeRequest(tt,rt);try{await pipe([it.encode()],encode$5,ot.sink)}catch(st){return log$n.error("Failed to send unsubscribe request",st),{success:null,failure:{error:ProtocolError$1.GENERIC_FAIL,peerId:nt.id}}}return{success:nt.id,failure:null}}async unsubscribeAll(tt,nt){const rt=await this.getStream(nt),ot=FilterSubscribeRpc.createUnsubscribeAllRequest(tt),it=await pipe([ot.encode()],encode$5,rt,decode$5,async lt=>await all$2(lt));if(!it||!it.length)return{failure:{error:ProtocolError$1.NO_RESPONSE,peerId:nt.id},success:null};const{statusCode:st,requestId:at,statusDesc:ct}=FilterSubscribeResponse.decode(it[0].slice());return st<200||st>=300?(log$n.error(`Filter unsubscribe all request ${at} failed with status code ${st}: ${ct}`),{failure:{error:ProtocolError$1.REMOTE_PEER_REJECTED,peerId:nt.id},success:null}):{failure:null,success:nt.id}}async ping(tt){let nt;try{nt=await this.getStream(tt)}catch(ct){return log$n.error(`Failed to get a stream for remote peer${tt.id.toString()}`,ct),{success:null,failure:{error:ProtocolError$1.NO_STREAM_AVAILABLE,peerId:tt.id}}}const rt=FilterSubscribeRpc.createSubscriberPingRequest();let ot;try{ot=await pipe([rt.encode()],encode$5,nt,decode$5,async ct=>await all$2(ct))}catch(ct){return log$n.error("Failed to send ping request",ct),{success:null,failure:{error:ProtocolError$1.GENERIC_FAIL,peerId:tt.id}}}if(!ot||!ot.length)return{success:null,failure:{error:ProtocolError$1.NO_RESPONSE,peerId:tt.id}};const{statusCode:it,requestId:st,statusDesc:at}=FilterSubscribeResponse.decode(ot[0].slice());return it<200||it>=300?(log$n.error(`Filter ping request ${st} failed with status code ${it}: ${at}`),{success:null,failure:{error:ProtocolError$1.REMOTE_PEER_REJECTED,peerId:tt.id}}):{success:tt.id,failure:null}}onRequest(tt){const{connection:nt,stream:rt}=tt,{remotePeer:ot}=nt;log$n.info(`Received message from ${ot.toString()}`);try{pipe(rt,decode$5,async it=>{for await(const st of it){const at=FilterPushRpc.decode(st.slice()),{pubsubTopic:ct,wakuMessage:lt}=at;if(!lt){log$n.error("Received empty message");return}if(!ct){log$n.error("Pubsub topic missing from push message");return}await this.handleIncomingMessage(ct,lt,nt.remotePeer.toString())}}).then(()=>{log$n.info("Receiving pipe closed.")},async it=>{log$n.error(`Error with receiving pipe on peer:${nt.remotePeer.toString()} -- stream:${rt.id} -- protocol:${rt.protocol}: `,it)})}catch(it){log$n.error("Error decoding message",it)}}}class PushRpc{constructor(et){Ct(this,"proto");this.proto=et}static createRequest(et,tt){return new PushRpc({requestId:v4$2(),request:{message:et,pubsubTopic:tt},response:void 0})}static decode(et){const tt=PushRpc$1.decode(et);return new PushRpc(tt)}encode(){return PushRpc$1.encode(this.proto)}get query(){return this.proto.request}get response(){return this.proto.response}}const RLN_GENERATION_PREFIX_ERROR="could not generate rln-v2 proof",isRLNResponseError=o=>o?o.includes(RLN_GENERATION_PREFIX_ERROR):!1,matchRLNErrorMessage=o=>{const et={[ProtocolError$1.RLN_IDENTITY_MISSING]:ProtocolError$1.RLN_IDENTITY_MISSING,[ProtocolError$1.RLN_MEMBERSHIP_INDEX]:ProtocolError$1.RLN_MEMBERSHIP_INDEX,[ProtocolError$1.RLN_LIMIT_MISSING]:ProtocolError$1.RLN_LIMIT_MISSING},tt=o.toLowerCase();for(const nt in et)if(tt.includes(nt.toLowerCase()))return et[nt];return ProtocolError$1.RLN_PROOF_GENERATION},log$m=new Logger$1("light-push"),LightPushCodec="/vac/waku/lightpush/2.0.0-beta1";class LightPushCore extends BaseProtocol{constructor(tt,nt){super(LightPushCodec,nt.components,log$m,tt);Ct(this,"pubsubTopics");this.pubsubTopics=tt}async preparePushMessage(tt,nt){try{if(!nt.payload||nt.payload.length===0)return log$m.error("Failed to send waku light push: payload is empty"),{query:null,error:ProtocolError$1.EMPTY_PAYLOAD};if(!await isMessageSizeUnderCap(tt,nt))return log$m.error("Failed to send waku light push: message is bigger than 1MB"),{query:null,error:ProtocolError$1.SIZE_TOO_BIG};const rt=await tt.toProtoObj(nt);return rt?{query:PushRpc.createRequest(rt,tt.pubsubTopic),error:null}:(log$m.error("Failed to encode to protoMessage, aborting push"),{query:null,error:ProtocolError$1.ENCODE_FAILED})}catch(rt){return log$m.error("Failed to prepare push message",rt),{query:null,error:ProtocolError$1.GENERIC_FAIL}}}async send(tt,nt,rt){const{query:ot,error:it}=await this.preparePushMessage(tt,nt);if(it||!ot)return{success:null,failure:{error:it,peerId:rt.id}};let st;try{st=await this.getStream(rt)}catch(dt){return log$m.error("Failed to get stream",dt),{success:null,failure:{error:ProtocolError$1.NO_STREAM_AVAILABLE,peerId:rt.id}}}let at;try{at=await pipe([ot.encode()],encode$5,st,decode$5,async dt=>await all$2(dt))}catch(dt){return log$m.error("Failed to send waku light push request",dt),{success:null,failure:{error:ProtocolError$1.GENERIC_FAIL,peerId:rt.id}}}const ct=new Uint8ArrayList;at.forEach(dt=>{ct.append(dt)});let lt;try{lt=PushRpc.decode(ct).response}catch(dt){return log$m.error("Failed to decode push reply",dt),{success:null,failure:{error:ProtocolError$1.DECODE_FAILED,peerId:rt.id}}}if(!lt)return log$m.error("Remote peer fault: No response in PushRPC"),{success:null,failure:{error:ProtocolError$1.NO_RESPONSE,peerId:rt.id}};if(isRLNResponseError(lt.info)){const dt=matchRLNErrorMessage(lt.info);return log$m.error("Remote peer rejected the message: ",dt),{success:null,failure:{error:dt,peerId:rt.id}}}return lt.isSuccess?{success:rt.id,failure:null}:(log$m.error("Remote peer rejected the message: ",lt.info),{success:null,failure:{error:ProtocolError$1.REMOTE_PEER_REJECTED,peerId:rt.id}})}}const EmptyMessage={payload:new Uint8Array,contentTopic:"",version:void 0,timestamp:void 0,meta:void 0,rateLimitProof:void 0,ephemeral:void 0};function toProtoMessage(o){return{...EmptyMessage,...o}}const DEFAULT_PAGE_SIZE=20,MAX_PAGE_SIZE=100,ONE_MILLION=1e6;class StoreQueryRequest{constructor(et){Ct(this,"proto");this.proto=et}static create(et){const tt=new StoreQueryRequest({...et,requestId:v4$2(),timeStart:et.timeStart?BigInt(et.timeStart.getTime()*ONE_MILLION):void 0,timeEnd:et.timeEnd?BigInt(et.timeEnd.getTime()*ONE_MILLION):void 0,messageHashes:et.messageHashes||[],paginationLimit:et.paginationLimit?BigInt(et.paginationLimit):void 0});if(et.pubsubTopic&&!et.contentTopics||!et.pubsubTopic&&et.contentTopics)throw new Error("Both pubsubTopic and contentTopics must be set or unset");if(et.messageHashes&&(et.pubsubTopic||et.contentTopics||et.timeStart||et.timeEnd))throw new Error("Message hash lookup queries cannot include content filter criteria");return tt}static decode(et){const tt=StoreQueryRequest$1.decode(et);return new StoreQueryRequest(tt)}encode(){return StoreQueryRequest$1.encode(this.proto)}}class StoreQueryResponse{constructor(et){Ct(this,"proto");this.proto=et}static decode(et){const tt=StoreQueryResponse$1.decode(et);return new StoreQueryResponse(tt)}encode(){return StoreQueryResponse$1.encode(this.proto)}get statusCode(){return this.proto.statusCode}get statusDesc(){return this.proto.statusDesc}get messages(){return this.proto.messages}get paginationCursor(){return this.proto.paginationCursor}}const log$l=new Logger$1("store"),StoreCodec="/vac/waku/store-query/3.0.0";class StoreCore extends BaseProtocol{constructor(tt,nt){super(StoreCodec,nt.components,log$l,tt);Ct(this,"pubsubTopics");this.pubsubTopics=tt}async*queryPerPage(tt,nt,rt){if(tt.contentTopics.toString()!==Array.from(nt.keys()).toString())throw new Error("Internal error, the decoders should match the query's content topics");let ot=tt.paginationCursor;for(;;){const it=StoreQueryRequest.create({...tt,paginationCursor:ot});let st;try{st=await this.getStream(rt)}catch(ht){log$l.error("Failed to get stream",ht);break}const at=await pipe([it.encode()],encode$5,st,decode$5,async ht=>await all$2(ht)),ct=new Uint8ArrayList;at.forEach(ht=>{ct.append(ht)});const lt=StoreQueryResponse.decode(ct);if(!lt.statusCode||lt.statusCode>=300){const ht=`Store query failed with status code: ${lt.statusCode}, description: ${lt.statusDesc}`;throw log$l.error(ht),new Error(ht)}if(!lt.messages||!lt.messages.length){log$l.warn("Stopping pagination due to empty messages in response");break}if(log$l.info(`${lt.messages.length} messages retrieved from store`),yield lt.messages.map(ht=>{if(!ht.message)return Promise.resolve(void 0);const pt=ht.message.contentTopic;if(pt){const mt=nt.get(pt);if(mt)return mt.fromProtoObj(ht.pubsubTopic||"",toProtoMessage(ht.message))}return Promise.resolve(void 0)}),tt.paginationForward?ot=lt.messages[lt.messages.length-1].messageHash:ot=lt.messages[0].messageHash,lt.messages.length>MAX_PAGE_SIZE&<.messages.length<(tt.paginationLimit||DEFAULT_PAGE_SIZE))break}}}const peerDiscoverySymbol$2=Symbol.for("@libp2p/peer-discovery"),peerIdSymbol$3=Symbol.for("@libp2p/peer-id");function isPeerId$2(o){return!!(o!=null&&o[peerIdSymbol$3])}var ss;let AbortError$9=(ss=class extends Error{constructor(et="The operation was aborted"){super(et),this.name="AbortError"}},Ct(ss,"name","AbortError"),ss);class UnexpectedPeerError extends Error{constructor(et="Unexpected Peer"){super(et),this.name="UnexpectedPeerError"}}Ct(UnexpectedPeerError,"name","UnexpectedPeerError");var as;let InvalidMessageError$3=(as=class extends Error{constructor(et="Invalid message"){super(et),this.name="InvalidMessageError"}},Ct(as,"name","InvalidMessageError"),as);class ProtocolError extends Error{constructor(et="Protocol error"){super(et),this.name="ProtocolError"}}Ct(ProtocolError,"name","ProtocolError");var cs;let TimeoutError$3=(cs=class extends Error{constructor(et="Timed out"){super(et),this.name="TimeoutError"}},Ct(cs,"name","TimeoutError"),cs);function setMaxListeners$9(){}const setMaxListeners$8=(o,...et)=>{try{[...et]}catch{}};var Qn,Zs;let TypedEventEmitter$3=(Zs=class extends EventTarget{constructor(){super();fn(this,Qn,new Map);setMaxListeners$8(1/0,this)}listenerCount(tt){const nt=Mt(this,Qn).get(tt);return nt==null?0:nt.length}addEventListener(tt,nt,rt){super.addEventListener(tt,nt,rt);let ot=Mt(this,Qn).get(tt);ot==null&&(ot=[],Mt(this,Qn).set(tt,ot)),ot.push({callback:nt,once:(rt!==!0&&rt!==!1&&(rt==null?void 0:rt.once))??!1})}removeEventListener(tt,nt,rt){super.removeEventListener(tt.toString(),nt??null,rt);let ot=Mt(this,Qn).get(tt);ot!=null&&(ot=ot.filter(({callback:it})=>it!==nt),Mt(this,Qn).set(tt,ot))}dispatchEvent(tt){const nt=super.dispatchEvent(tt);let rt=Mt(this,Qn).get(tt.type);return rt==null||(rt=rt.filter(({once:ot})=>!ot),Mt(this,Qn).set(tt.type,rt)),nt}safeDispatchEvent(tt,nt={}){return this.dispatchEvent(new CustomEvent(tt,nt))}},Qn=new WeakMap,Zs);const serviceCapabilities$5=Symbol.for("@libp2p/service-capabilities"),RelayPingContentTopic="/relay-ping/1/ping/null",log$k=new Logger$1("keep-alive");class KeepAliveManager{constructor({options:et,relay:tt,libp2p:nt}){Ct(this,"relay");Ct(this,"libp2p");Ct(this,"options");Ct(this,"pingKeepAliveTimers",new Map);Ct(this,"relayKeepAliveTimers",new Map);this.options=et,this.relay=tt,this.libp2p=nt}start(et){this.stop(et);const{pingKeepAlive:tt,relayKeepAlive:nt}=this.options,rt=et.toString();if(tt!==0){const it=setInterval(()=>{(async()=>{let st;try{try{st=await this.libp2p.services.ping.ping(et),log$k.info(`Ping succeeded (${rt})`,st)}catch{log$k.error(`Ping failed for peer (${rt}). Next ping will be attempted in ${tt} seconds. `);return}try{await this.libp2p.peerStore.merge(et,{metadata:{ping:utf8ToBytes$1(st.toString())}})}catch(at){log$k.error("Failed to update ping",at)}}catch(at){log$k.error(`Ping failed (${rt})`,at)}})()},tt*1e3);this.pingKeepAliveTimers.set(rt,it)}const ot=this.relay;if(ot&&nt!==0){const it=this.scheduleRelayPings(ot,nt,et.toString());this.relayKeepAliveTimers.set(et,it)}}stop(et){var nt;const tt=et.toString();this.pingKeepAliveTimers.has(tt)&&(clearInterval(this.pingKeepAliveTimers.get(tt)),this.pingKeepAliveTimers.delete(tt)),this.relayKeepAliveTimers.has(et)&&((nt=this.relayKeepAliveTimers.get(et))==null||nt.map(clearInterval),this.relayKeepAliveTimers.delete(et))}stopAll(){for(const et of[...Object.values(this.pingKeepAliveTimers),...Object.values(this.relayKeepAliveTimers)])clearInterval(et);this.pingKeepAliveTimers.clear(),this.relayKeepAliveTimers.clear()}connectionsExist(){return this.pingKeepAliveTimers.size>0||this.relayKeepAliveTimers.size>0}scheduleRelayPings(et,tt,nt){const rt=[];for(const ot of et.pubsubTopics){if(!et.getMeshPeers(ot).includes(nt))continue;const st=createEncoder({pubsubTopicShardInfo:pubsubTopicToSingleShardInfo(ot),contentTopic:RelayPingContentTopic,ephemeral:!0}),at=setInterval(()=>{log$k.info("Sending Waku Relay ping message"),et.send(st,{payload:new Uint8Array([1])}).catch(ct=>log$k.error("Failed to send relay ping",ct))},tt*1e3);rt.push(at)}return rt}}const log$j=new Logger$1("connection-manager"),DEFAULT_MAX_BOOTSTRAP_PEERS_ALLOWED=1,DEFAULT_MAX_DIAL_ATTEMPTS_FOR_PEER=3,DEFAULT_MAX_PARALLEL_DIALS=3,Pr=class Pr extends TypedEventEmitter$3{constructor(tt,nt,rt,ot,it){super();Ct(this,"configuredPubsubTopics");Ct(this,"keepAliveManager");Ct(this,"options");Ct(this,"libp2p");Ct(this,"dialAttemptsForPeer",new Map);Ct(this,"dialErrorsForPeer",new Map);Ct(this,"currentActiveParallelDialCount",0);Ct(this,"pendingPeerDialQueue",[]);Ct(this,"isP2PNetworkConnected",!1);Ct(this,"onEventHandlers",{"peer:discovery":tt=>{(async()=>{const{id:nt}=tt.detail;await this.dispatchDiscoveryEvent(nt);try{await this.attemptDial(nt)}catch(rt){log$j.error(`Error dialing peer ${nt.toString()} : ${rt}`)}})()},"peer:connect":tt=>{(async()=>{log$j.info(`Connected to peer ${tt.detail.toString()}`);const nt=tt.detail;this.keepAliveManager.start(nt),(await this.getTagNamesForPeer(nt)).includes(Tags.BOOTSTRAP)?this.libp2p.getConnections().filter(it=>it.tags.includes(Tags.BOOTSTRAP)).length>this.options.maxBootstrapPeersAllowed?await this.dropConnection(nt):this.dispatchEvent(new CustomEvent(EPeersByDiscoveryEvents.PEER_CONNECT_BOOTSTRAP,{detail:nt})):this.dispatchEvent(new CustomEvent(EPeersByDiscoveryEvents.PEER_CONNECT_PEER_EXCHANGE,{detail:nt})),this.setP2PNetworkConnected()})()},"peer:disconnect":tt=>{(async()=>(this.keepAliveManager.stop(tt.detail),this.setP2PNetworkDisconnected()))()},"browser:network":()=>{this.dispatchWakuConnectionEvent()}});this.configuredPubsubTopics=rt,this.libp2p=tt,this.configuredPubsubTopics=rt,this.options={maxDialAttemptsForPeer:DEFAULT_MAX_DIAL_ATTEMPTS_FOR_PEER,maxBootstrapPeersAllowed:DEFAULT_MAX_BOOTSTRAP_PEERS_ALLOWED,maxParallelDials:DEFAULT_MAX_PARALLEL_DIALS,...it},this.keepAliveManager=new KeepAliveManager({relay:ot,libp2p:tt,options:nt}),this.startEventListeners().then(()=>log$j.info("Connection Manager is now running")).catch(st=>log$j.error("Unexpected error while running service",st)),this.dialPeerStorePeers().catch(st=>log$j.error("Unexpected error while dialing peer store peers",st))}isConnected(){var tt;return globalThis!=null&&globalThis.navigator&&!((tt=globalThis==null?void 0:globalThis.navigator)!=null&&tt.onLine)?!1:this.isP2PNetworkConnected}static create(tt,nt,rt,ot,it,st){let at=Pr.instances.get(tt);return at||(at=new Pr(nt,rt,ot,it,st),Pr.instances.set(tt,at)),at}stop(){this.keepAliveManager.stopAll(),this.libp2p.removeEventListener("peer:connect",this.onEventHandlers["peer:connect"]),this.libp2p.removeEventListener("peer:disconnect",this.onEventHandlers["peer:disconnect"]),this.libp2p.removeEventListener("peer:discovery",this.onEventHandlers["peer:discovery"]),this.stopNetworkStatusListener()}async dropConnection(tt){try{this.keepAliveManager.stop(tt),await this.libp2p.hangUp(tt),log$j.info(`Dropped connection with peer ${tt.toString()}`)}catch(nt){log$j.error(`Error dropping connection with peer ${tt.toString()} - ${nt}`)}}async getPeersByDiscovery(){const tt=await this.libp2p.peerStore.all(),nt=this.libp2p.getConnections().map(lt=>lt.remotePeer),rt=[],ot=[],it=[],st=[],at=[],ct=[];for(const lt of tt){const dt=await this.getTagNamesForPeer(lt.id);dt.includes(Tags.BOOTSTRAP)?rt.push(lt):dt.includes(Tags.PEER_EXCHANGE)?ot.push(lt):dt.includes(Tags.LOCAL)&&it.push(lt)}for(const lt of nt){const dt=await this.libp2p.peerStore.get(lt),ht=await this.getTagNamesForPeer(lt);ht.includes(Tags.BOOTSTRAP)?st.push(dt):ht.includes(Tags.PEER_EXCHANGE)?at.push(dt):ht.includes(Tags.LOCAL)&&ct.push(dt)}return{DISCOVERED:{[Tags.BOOTSTRAP]:rt,[Tags.PEER_EXCHANGE]:ot,[Tags.LOCAL]:it},CONNECTED:{[Tags.BOOTSTRAP]:st,[Tags.PEER_EXCHANGE]:at,[Tags.LOCAL]:ct}}}async dialPeerStorePeers(){const tt=await this.libp2p.peerStore.all(),nt=[];for(const rt of tt)this.libp2p.getConnections().find(ot=>ot.remotePeer===rt.id)||nt.push(this.attemptDial(rt.id));try{await Promise.all(nt)}catch(rt){log$j.error("Unexpected error while dialing peer store peers",rt)}}async startEventListeners(){this.startPeerDiscoveryListener(),this.startPeerConnectionListener(),this.startPeerDisconnectionListener(),this.startNetworkStatusListener()}async dialPeer(tt){this.currentActiveParallelDialCount+=1;let nt=0;for(;nt{ot.tags=Array.from(new Set([...ot.tags,...rt]))}),this.dialAttemptsForPeer.set(tt.toString(),-1),this.keepAliveManager.start(tt);break}catch(rt){rt instanceof AggregateError?log$j.error(`Error dialing peer ${tt.toString()} - ${rt.errors}`):log$j.error(`Error dialing peer ${tt.toString()} - ${rt.message}`),this.dialErrorsForPeer.set(tt.toString(),rt),nt++,this.dialAttemptsForPeer.set(tt.toString(),nt)}if(this.currentActiveParallelDialCount--,this.processDialQueue(),nt===this.options.maxDialAttemptsForPeer)try{const rt=this.dialErrorsForPeer.get(tt.toString());if(rt){let ot;rt instanceof AggregateError?rt.errors?rt.errors.length===0?log$j.warn("Errors array is empty for AggregateError"):ot=JSON.stringify(rt.errors[0]):log$j.warn("No errors array found for AggregateError"):ot=rt.message,log$j.info(`Deleting undialable peer ${tt.toString()} from peer store. Reason: ${ot}`)}this.dialErrorsForPeer.delete(tt.toString()),await this.libp2p.peerStore.delete(tt),await this.attemptDnsDiscovery()}catch(rt){throw new Error(`Error deleting undialable peer ${tt.toString()} from peer store - ${rt}`)}}async attemptDnsDiscovery(){if(this.libp2p.getConnections().length>0||(await this.libp2p.peerStore.all()).length>0)return;log$j.info("Attempting to trigger DNS discovery.");const tt=Object.values(this.libp2p.components.components).find(nt=>nt&&nt.toString?nt.toString().includes(DNS_DISCOVERY_TAG):!1);tt&&await tt.findPeers()}processDialQueue(){if(this.pendingPeerDialQueue.length>0&&this.currentActiveParallelDialCount{log$j.error(nt)})}}startPeerDiscoveryListener(){this.libp2p.addEventListener("peer:discovery",this.onEventHandlers["peer:discovery"])}startPeerConnectionListener(){this.libp2p.addEventListener("peer:connect",this.onEventHandlers["peer:connect"])}startPeerDisconnectionListener(){this.libp2p.addEventListener("peer:disconnect",this.onEventHandlers["peer:disconnect"])}async attemptDial(tt){if(await this.shouldDialPeer(tt)){if(this.currentActiveParallelDialCount>=this.options.maxParallelDials){this.pendingPeerDialQueue.push(tt);return}await this.dialPeer(tt)}}async shouldDialPeer(tt){if(this.libp2p.getConnections(tt).length>0)return log$j.warn(`Already connected to peer ${tt.toString()}. Not dialing.`),!1;if(!await this.isPeerTopicConfigured(tt)){const st=await this.getPeerShardInfo(tt,this.libp2p.peerStore);return log$j.warn(`Discovered peer ${tt.toString()} with ShardInfo ${st} is not part of any of the configured pubsub topics (${this.configuredPubsubTopics}). - Not dialing.`),!1}return await this.isPeerDialableBasedOnBootstrapStatus(tt)?this.dialAttemptsForPeer.has(tt.toString())?(log$j.warn(`Peer ${tt.toString()} has already been attempted dial before, or already has a dial attempt in progress, skipping dial`),!1):!0:(log$j.warn(`Peer ${tt.toString()} is not dialable based on bootstrap status. Not dialing.`),!1)}async isPeerDialableBasedOnBootstrapStatus(tt){return(await this.getTagNamesForPeer(tt)).some(it=>it===Tags.BOOTSTRAP)?this.libp2p.getConnections().filter(it=>it.tags.find(st=>st===Tags.BOOTSTRAP)).lengththis.configuredPubsubTopics.includes(it)):!0}async getPeerShardInfo(tt,nt){const ot=(await nt.get(tt)).metadata.get("shardInfo");if(ot)return decodeRelayShard(ot)}startNetworkStatusListener(){try{globalThis.addEventListener("online",this.onEventHandlers["browser:network"]),globalThis.addEventListener("offline",this.onEventHandlers["browser:network"])}catch(tt){log$j.error(`Failed to start network listener: ${tt}`)}}stopNetworkStatusListener(){try{globalThis.removeEventListener("online",this.onEventHandlers["browser:network"]),globalThis.removeEventListener("offline",this.onEventHandlers["browser:network"])}catch(tt){log$j.error(`Failed to stop network listener: ${tt}`)}}setP2PNetworkConnected(){this.isP2PNetworkConnected||(this.isP2PNetworkConnected=!0,this.dispatchWakuConnectionEvent())}setP2PNetworkDisconnected(){this.isP2PNetworkConnected&&this.libp2p.getConnections().length===0&&(this.isP2PNetworkConnected=!1,this.dispatchWakuConnectionEvent())}dispatchWakuConnectionEvent(){this.dispatchEvent(new CustomEvent(EConnectionStateEvents.CONNECTION_STATUS,{detail:this.isConnected()}))}};Ct(Pr,"instances",new Map);let ConnectionManager=Pr;const wr=class wr{constructor(){Ct(this,"health");this.health={overallStatus:HealthStatus.Unhealthy,protocolStatuses:new Map}}static getInstance(){return wr.instance||(wr.instance=new wr),wr.instance}getHealthStatus(){return this.health.overallStatus}getProtocolStatus(et){return this.health.protocolStatuses.get(et)}updateProtocolHealth(et,tt){const nt=this.getNameFromMulticodec(et);let rt=HealthStatus.Unhealthy;tt==1?rt=HealthStatus.MinimallyHealthy:tt>=2&&(rt=HealthStatus.SufficientlyHealthy),this.health.protocolStatuses.set(nt,{name:nt,status:rt,lastUpdate:new Date}),this.updateOverallHealth()}getNameFromMulticodec(et){let tt;if(et.includes("filter"))tt=Protocols.Filter;else if(et.includes("lightpush"))tt=Protocols.LightPush;else if(et.includes("store"))tt=Protocols.Store;else throw new Error(`Unknown protocol: ${et}`);return tt}updateOverallHealth(){const tt=[Protocols.LightPush,Protocols.Filter].map(nt=>{var rt;return(rt=this.getProtocolStatus(nt))==null?void 0:rt.status});tt.some(nt=>nt===HealthStatus.Unhealthy)?this.health.overallStatus=HealthStatus.Unhealthy:tt.some(nt=>nt===HealthStatus.MinimallyHealthy)?this.health.overallStatus=HealthStatus.MinimallyHealthy:this.health.overallStatus=HealthStatus.SufficientlyHealthy}};Ct(wr,"instance");let HealthManager=wr;const getHealthManager=()=>HealthManager.getInstance(),log$i=new Logger$1("metadata"),MetadataCodec="/vac/waku/metadata/1.0.0";class Metadata extends BaseProtocol{constructor(tt,nt){super(MetadataCodec,nt.components,log$i,tt);Ct(this,"pubsubTopics");Ct(this,"libp2pComponents");Ct(this,"handshakesConfirmed",new Map);this.pubsubTopics=tt,this.libp2pComponents=nt,nt.registrar.handle(MetadataCodec,rt=>{this.onRequest(rt)})}async query(tt){const nt=WakuMetadataRequest.encode(pubsubTopicsToShardInfo(this.pubsubTopics)),rt=await this.libp2pComponents.peerStore.get(tt);if(!rt)return{shardInfo:null,error:ProtocolError$1.NO_PEER_AVAILABLE};let ot;try{ot=await this.getStream(rt)}catch(ct){return log$i.error("Failed to get stream",ct),{shardInfo:null,error:ProtocolError$1.NO_STREAM_AVAILABLE}}const it=await pipe([nt],encode$5,ot,decode$5,async ct=>await all$2(ct)),{error:st,shardInfo:at}=this.decodeMetadataResponse(it);return st?{shardInfo:null,error:st}:(await this.savePeerShardInfo(tt,at),{shardInfo:at,error:null})}async confirmOrAttemptHandshake(tt){const nt=this.handshakesConfirmed.get(tt.toString());return nt?{shardInfo:nt,error:null}:await this.query(tt)}async onRequest(tt){try{const{stream:nt,connection:rt}=tt,ot=WakuMetadataResponse.encode(pubsubTopicsToShardInfo(this.pubsubTopics)),it=await pipe([ot],encode$5,nt,decode$5,async ct=>await all$2(ct)),{error:st,shardInfo:at}=this.decodeMetadataResponse(it);if(st)return;await this.savePeerShardInfo(rt.remotePeer,at)}catch(nt){log$i.error("Error handling metadata request",nt)}}decodeMetadataResponse(tt){const nt=new Uint8ArrayList;tt.forEach(ot=>{nt.append(ot)});const rt=WakuMetadataResponse.decode(nt);return rt?{shardInfo:rt,error:null}:(log$i.error("Error decoding metadata response"),{shardInfo:null,error:ProtocolError$1.DECODE_FAILED})}async savePeerShardInfo(tt,nt){await this.libp2pComponents.peerStore.merge(tt,{metadata:{shardInfo:encodeRelayShard(nt)}}),this.handshakesConfirmed.set(tt.toString(),nt)}}function wakuMetadata(o){return et=>new Metadata(o,et)}class Parser{constructor(){Ct(this,"index",0);Ct(this,"input","")}new(et){return this.index=0,this.input=et,this}readAtomically(et){const tt=this.index,nt=et();return nt===void 0&&(this.index=tt),nt}parseWith(et){const tt=et();if(this.index===this.input.length)return tt}peekChar(){if(!(this.index>=this.input.length))return this.input[this.index]}readChar(){if(!(this.index>=this.input.length))return this.input[this.index++]}readGivenChar(et){return this.readAtomically(()=>{const tt=this.readChar();if(tt===et)return tt})}readSeparator(et,tt,nt){return this.readAtomically(()=>{if(!(tt>0&&this.readGivenChar(et)===void 0))return nt()})}readNumber(et,tt,nt,rt){return this.readAtomically(()=>{let ot=0,it=0;const st=this.peekChar();if(st===void 0)return;const at=st==="0",ct=2**(8*rt)-1;for(;;){const lt=this.readAtomically(()=>{const dt=this.readChar();if(dt===void 0)return;const ht=Number.parseInt(dt,et);if(!Number.isNaN(ht))return ht});if(lt===void 0)break;if(ot*=et,ot+=lt,ot>ct||(it+=1,tt!==void 0&&it>tt))return}if(it!==0)return!nt&&at&&it>1?void 0:ot})}readIPv4Addr(){return this.readAtomically(()=>{const et=new Uint8Array(4);for(let tt=0;ttthis.readNumber(10,3,!1,1));if(nt===void 0)return;et[tt]=nt}return et})}readIPv6Addr(){const et=tt=>{for(let nt=0;ntthis.readIPv4Addr());if(it!==void 0)return tt[rt]=it[0],tt[rt+1]=it[1],tt[rt+2]=it[2],tt[rt+3]=it[3],[rt+4,!0]}const ot=this.readSeparator(":",nt,()=>this.readNumber(16,4,!0,2));if(ot===void 0)return[rt,!1];tt[rt]=ot>>8,tt[rt+1]=ot&255}return[tt.length,!1]};return this.readAtomically(()=>{const tt=new Uint8Array(16),[nt,rt]=et(tt);if(nt===16)return tt;if(rt||this.readGivenChar(":")===void 0||this.readGivenChar(":")===void 0)return;const ot=new Uint8Array(14),it=16-(nt+2),[st]=et(ot.subarray(0,it));return tt.set(ot.subarray(0,st),16-st),tt})}readIPAddr(){return this.readIPv4Addr()??this.readIPv6Addr()}}const MAX_IPV6_LENGTH=45,MAX_IPV4_LENGTH=15,parser=new Parser;function parseIPv4(o){if(!(o.length>MAX_IPV4_LENGTH))return parser.new(o).parseWith(()=>parser.readIPv4Addr())}function parseIPv6(o){if(o.includes("%")&&(o=o.split("%")[0]),!(o.length>MAX_IPV6_LENGTH))return parser.new(o).parseWith(()=>parser.readIPv6Addr())}function parseIP(o){if(o.includes("%")&&(o=o.split("%")[0]),!(o.length>MAX_IPV6_LENGTH))return parser.new(o).parseWith(()=>parser.readIPAddr())}function isIPv4(o){return!!parseIPv4(o)}function isIPv6(o){return!!parseIPv6(o)}function isIP(o){return!!parseIP(o)}const isV4=isIPv4,isV6=isIPv6,toBytes$1=function(o){let et=0;if(o=o.toString().trim(),isV4(o)){const tt=new Uint8Array(et+4);return o.split(/\./g).forEach(nt=>{tt[et++]=parseInt(nt,10)&255}),tt}if(isV6(o)){const tt=o.split(":",8);let nt;for(nt=0;nt0;nt--)ot.push("0");tt.splice.apply(tt,ot)}const rt=new Uint8Array(et+16);for(nt=0;nt>8&255,rt[et++]=ot&255}return rt}throw new Error("invalid ip address")},toString$7=function(o,et=0,tt){et=~~et,tt=tt??o.length-et;const nt=new DataView(o.buffer);if(tt===4){const rt=[];for(let ot=0;ot{const et=createProtocol(...o);codes[et.code]=et,names[et.name]=et});function createProtocol(o,et,tt,nt,rt){return{code:o,size:et,name:tt,resolvable:!!nt,path:!!rt}}function getProtocol(o){if(typeof o=="number"){if(codes[o]!=null)return codes[o];throw new Error(`no protocol with code: ${o}`)}else if(typeof o=="string"){if(names[o]!=null)return names[o];throw new Error(`no protocol with name: ${o}`)}throw new Error(`invalid protocol id type: ${typeof o}`)}getProtocol("ip4");getProtocol("ip6");getProtocol("ipcidr");function convertToString(o,et){switch(getProtocol(o).code){case 4:case 41:return bytes2ip(et);case 42:return bytes2str(et);case 6:case 273:case 33:case 132:return bytes2port(et).toString();case 53:case 54:case 55:case 56:case 400:case 449:case 777:return bytes2str(et);case 421:return bytes2mh(et);case 444:return bytes2onion(et);case 445:return bytes2onion(et);case 466:return bytes2mb(et);case 481:return globalThis.encodeURIComponent(bytes2str(et));default:return toString$8(et,"base16")}}function convertToBytes(o,et){switch(getProtocol(o).code){case 4:return ip2bytes(et);case 41:return ip2bytes(et);case 42:return str2bytes(et);case 6:case 273:case 33:case 132:return port2bytes(parseInt(et,10));case 53:case 54:case 55:case 56:case 400:case 449:case 777:return str2bytes(et);case 421:return mh2bytes(et);case 444:return onion2bytes(et);case 445:return onion32bytes(et);case 466:return mb2bytes(et);case 481:return str2bytes(globalThis.decodeURIComponent(et));default:return fromString(et,"base16")}}const decoders=Object.values(bases).map(o=>o.decoder),anybaseDecoder=function(){let o=decoders[0].or(decoders[1]);return decoders.slice(2).forEach(et=>o=o.or(et)),o}();function ip2bytes(o){if(!isIP(o))throw new Error("invalid ip address");return toBytes$1(o)}function bytes2ip(o){const et=toString$7(o,0,o.length);if(et==null)throw new Error("ipBuff is required");if(!isIP(et))throw new Error("invalid ip address");return et}function port2bytes(o){const et=new ArrayBuffer(2);return new DataView(et).setUint16(0,o),new Uint8Array(et)}function bytes2port(o){return new DataView(o.buffer).getUint16(o.byteOffset)}function str2bytes(o){const et=fromString(o),tt=Uint8Array.from(encode$a(et.length));return concat$1([tt,et],tt.length+et.length)}function bytes2str(o){const et=decode$b(o);if(o=o.slice(encodingLength$3(et)),o.length!==et)throw new Error("inconsistent lengths");return toString$8(o)}function mh2bytes(o){let et;o[0]==="Q"||o[0]==="1"?et=decode$6(base58btc.decode(`z${o}`)).bytes:et=CID.parse(o).multihash.bytes;const tt=Uint8Array.from(encode$a(et.length));return concat$1([tt,et],tt.length+et.length)}function mb2bytes(o){const et=anybaseDecoder.decode(o),tt=Uint8Array.from(encode$a(et.length));return concat$1([tt,et],tt.length+et.length)}function bytes2mb(o){const et=decode$b(o),tt=o.slice(encodingLength$3(et));if(tt.length!==et)throw new Error("inconsistent lengths");return"u"+toString$8(tt,"base64url")}function bytes2mh(o){const et=decode$b(o),tt=o.slice(encodingLength$3(et));if(tt.length!==et)throw new Error("inconsistent lengths");return toString$8(tt,"base58btc")}function onion2bytes(o){const et=o.split(":");if(et.length!==2)throw new Error(`failed to parse onion addr: ["'${et.join('", "')}'"]' does not contain a port number`);if(et[0].length!==16)throw new Error(`failed to parse onion addr: ${et[0]} not a Tor onion address.`);const tt=base32$2.decode("b"+et[0]),nt=parseInt(et[1],10);if(nt<1||nt>65536)throw new Error("Port number is not in range(1, 65536)");const rt=port2bytes(nt);return concat$1([tt,rt],tt.length+rt.length)}function onion32bytes(o){const et=o.split(":");if(et.length!==2)throw new Error(`failed to parse onion addr: ["'${et.join('", "')}'"]' does not contain a port number`);if(et[0].length!==56)throw new Error(`failed to parse onion addr: ${et[0]} not a Tor onion3 address.`);const tt=base32$2.decode(`b${et[0]}`),nt=parseInt(et[1],10);if(nt<1||nt>65536)throw new Error("Port number is not in range(1, 65536)");const rt=port2bytes(nt);return concat$1([tt,rt],tt.length+rt.length)}function bytes2onion(o){const et=o.slice(0,o.length-2),tt=o.slice(o.length-2),nt=toString$8(et,"base32"),rt=bytes2port(tt);return`${nt}:${rt}`}function stringToMultiaddrParts(o){o=cleanPath(o);const et=[],tt=[];let nt=null;const rt=o.split("/").slice(1);if(rt.length===1&&rt[0]==="")return{bytes:new Uint8Array,string:"/",tuples:[],stringTuples:[],path:null};for(let ot=0;ot=rt.length)throw ParseError("invalid address: "+o);if(st.path===!0){nt=cleanPath(rt.slice(ot).join("/")),et.push([st.code,convertToBytes(st.code,nt)]),tt.push([st.code,nt]);break}const at=convertToBytes(st.code,rt[ot]);et.push([st.code,at]),tt.push([st.code,convertToString(st.code,at)])}return{string:stringTuplesToString(tt),bytes:tuplesToBytes(et),tuples:et,stringTuples:tt,path:nt}}function bytesToMultiaddrParts(o){const et=[],tt=[];let nt=null,rt=0;for(;rto.length)throw ParseError("Invalid address Uint8Array: "+toString$8(o,"base16"));et.push([ot,ct]);const lt=convertToString(ot,ct);if(tt.push([ot,lt]),st.path===!0){nt=lt;break}}return{bytes:Uint8Array.from(o),string:stringTuplesToString(tt),tuples:et,stringTuples:tt,path:nt}}function stringTuplesToString(o){const et=[];return o.map(tt=>{const nt=getProtocol(tt[0]);return et.push(nt.name),tt.length>1&&tt[1]!=null&&et.push(tt[1]),null}),cleanPath(et.join("/"))}function tuplesToBytes(o){return concat$1(o.map(et=>{const tt=getProtocol(et[0]);let nt=Uint8Array.from(encode$a(tt.code));return et.length>1&&et[1]!=null&&(nt=concat$1([nt,et[1]])),nt}))}function sizeForAddr(o,et){if(o.size>0)return o.size/8;if(o.size===0)return 0;{const tt=decode$b(et instanceof Uint8Array?et:Uint8Array.from(et));return tt+encodingLength$3(tt)}}function cleanPath(o){return"/"+o.trim().split("/").filter(et=>et).join("/")}function ParseError(o){return new Error("Error parsing address: "+o)}const inspect$1=Symbol.for("nodejs.util.inspect.custom"),symbol=Symbol.for("@multiformats/js-multiaddr/multiaddr"),DNS_CODES=[getProtocol("dns").code,getProtocol("dns4").code,getProtocol("dns6").code,getProtocol("dnsaddr").code];class NoAvailableResolverError extends Error{constructor(et="No available resolver"){super(et),this.name="NoAvailableResolverError"}}var Xs,Kr,xr,so,ao;const Lr=class Lr{constructor(et){Ct(this,"bytes");fn(this,Kr);fn(this,xr);fn(this,so);fn(this,ao);Ct(this,Xs,!0);et==null&&(et="");let tt;if(et instanceof Uint8Array)tt=bytesToMultiaddrParts(et);else if(typeof et=="string"){if(et.length>0&&et.charAt(0)!=="/")throw new Error(`multiaddr "${et}" must start with a "/"`);tt=stringToMultiaddrParts(et)}else if(isMultiaddr(et))tt=bytesToMultiaddrParts(et.bytes);else throw new Error("addr must be a string, Buffer, or another Multiaddr");this.bytes=tt.bytes,un(this,Kr,tt.string),un(this,xr,tt.tuples),un(this,so,tt.stringTuples),un(this,ao,tt.path)}toString(){return Mt(this,Kr)}toJSON(){return this.toString()}toOptions(){let et,tt,nt,rt,ot="";const it=getProtocol("tcp"),st=getProtocol("udp"),at=getProtocol("ip4"),ct=getProtocol("ip6"),lt=getProtocol("dns6"),dt=getProtocol("ip6zone");for(const[pt,mt]of this.stringTuples())pt===dt.code&&(ot=`%${mt??""}`),DNS_CODES.includes(pt)&&(tt=it.name,rt=443,nt=`${mt??""}${ot}`,et=pt===lt.code?6:4),(pt===it.code||pt===st.code)&&(tt=getProtocol(pt).name,rt=parseInt(mt??"")),(pt===at.code||pt===ct.code)&&(tt=getProtocol(pt).name,nt=`${mt??""}${ot}`,et=pt===ct.code?6:4);if(et==null||tt==null||nt==null||rt==null)throw new Error('multiaddr must have a valid format: "/{ip4, ip6, dns4, dns6, dnsaddr}/{address}/{tcp, udp}/{port}".');return{family:et,host:nt,transport:tt,port:rt}}protos(){return Mt(this,xr).map(([et])=>Object.assign({},getProtocol(et)))}protoCodes(){return Mt(this,xr).map(([et])=>et)}protoNames(){return Mt(this,xr).map(([et])=>getProtocol(et).name)}tuples(){return Mt(this,xr)}stringTuples(){return Mt(this,so)}encapsulate(et){return et=new Lr(et),new Lr(this.toString()+et.toString())}decapsulate(et){const tt=et.toString(),nt=this.toString(),rt=nt.lastIndexOf(tt);if(rt<0)throw new Error(`Address ${this.toString()} does not contain subaddress: ${et.toString()}`);return new Lr(nt.slice(0,rt))}decapsulateCode(et){const tt=this.tuples();for(let nt=tt.length-1;nt>=0;nt--)if(tt[nt][0]===et)return new Lr(tuplesToBytes(tt.slice(0,nt)));return this}getPeerId(){try{let et=[];this.stringTuples().forEach(([nt,rt])=>{nt===names.p2p.code&&et.push([nt,rt]),nt===names["p2p-circuit"].code&&(et=[])});const tt=et.pop();if((tt==null?void 0:tt[1])!=null){const nt=tt[1];return nt[0]==="Q"||nt[0]==="1"?toString$8(base58btc.decode(`z${nt}`),"base58btc"):toString$8(CID.parse(nt).multihash.bytes,"base58btc")}return null}catch{return null}}getPath(){return Mt(this,ao)}equals(et){return equals(this.bytes,et.bytes)}async resolve(et){const tt=this.protos().find(ot=>ot.resolvable);if(tt==null)return[this];const nt=resolvers$1.get(tt.name);if(nt==null)throw new NoAvailableResolverError(`no available resolver for ${tt.name}`);return(await nt(this,et)).map(ot=>multiaddr(ot))}nodeAddress(){const et=this.toOptions();if(et.transport!=="tcp"&&et.transport!=="udp")throw new Error(`multiaddr must have a valid format - no protocol with name: "${et.transport}". Must have a valid transport protocol: "{tcp, udp}"`);return{family:et.family,address:et.host,port:et.port}}isThinWaistAddress(et){const tt=(et??this).protos();return!(tt.length!==2||tt[0].code!==4&&tt[0].code!==41||tt[1].code!==6&&tt[1].code!==273)}[(Xs=symbol,inspect$1)](){return`Multiaddr(${Mt(this,Kr)})`}};Kr=new WeakMap,xr=new WeakMap,so=new WeakMap,ao=new WeakMap;let Multiaddr=Lr;const resolvers$1=new Map;function isMultiaddr(o){return!!(o!=null&&o[symbol])}function multiaddr(o){return new Multiaddr(o)}const E_CANCELED=new Error("request for lock canceled");var __awaiter$2=function(o,et,tt,nt){function rt(ot){return ot instanceof tt?ot:new tt(function(it){it(ot)})}return new(tt||(tt=Promise))(function(ot,it){function st(lt){try{ct(nt.next(lt))}catch(dt){it(dt)}}function at(lt){try{ct(nt.throw(lt))}catch(dt){it(dt)}}function ct(lt){lt.done?ot(lt.value):rt(lt.value).then(st,at)}ct((nt=nt.apply(o,et||[])).next())})};class Semaphore{constructor(et,tt=E_CANCELED){this._value=et,this._cancelError=tt,this._queue=[],this._weightedWaiters=[]}acquire(et=1,tt=0){if(et<=0)throw new Error(`invalid weight ${et}: must be positive`);return new Promise((nt,rt)=>{const ot={resolve:nt,reject:rt,weight:et,priority:tt},it=findIndexFromEnd(this._queue,st=>tt<=st.priority);it===-1&&et<=this._value?this._dispatchItem(ot):this._queue.splice(it+1,0,ot)})}runExclusive(et){return __awaiter$2(this,arguments,void 0,function*(tt,nt=1,rt=0){const[ot,it]=yield this.acquire(nt,rt);try{return yield tt(ot)}finally{it()}})}waitForUnlock(et=1,tt=0){if(et<=0)throw new Error(`invalid weight ${et}: must be positive`);return this._couldLockImmediately(et,tt)?Promise.resolve():new Promise(nt=>{this._weightedWaiters[et-1]||(this._weightedWaiters[et-1]=[]),insertSorted(this._weightedWaiters[et-1],{resolve:nt,priority:tt})})}isLocked(){return this._value<=0}getValue(){return this._value}setValue(et){this._value=et,this._dispatchQueue()}release(et=1){if(et<=0)throw new Error(`invalid weight ${et}: must be positive`);this._value+=et,this._dispatchQueue()}cancel(){this._queue.forEach(et=>et.reject(this._cancelError)),this._queue=[]}_dispatchQueue(){for(this._drainUnlockWaiters();this._queue.length>0&&this._queue[0].weight<=this._value;)this._dispatchItem(this._queue.shift()),this._drainUnlockWaiters()}_dispatchItem(et){const tt=this._value;this._value-=et.weight,et.resolve([tt,this._newReleaser(et.weight)])}_newReleaser(et){let tt=!1;return()=>{tt||(tt=!0,this.release(et))}}_drainUnlockWaiters(){if(this._queue.length===0)for(let et=this._value;et>0;et--){const tt=this._weightedWaiters[et-1];tt&&(tt.forEach(nt=>nt.resolve()),this._weightedWaiters[et-1]=[])}else{const et=this._queue[0].priority;for(let tt=this._value;tt>0;tt--){const nt=this._weightedWaiters[tt-1];if(!nt)continue;const rt=nt.findIndex(ot=>ot.priority<=et);(rt===-1?nt:nt.splice(0,rt)).forEach(ot=>ot.resolve())}}}_couldLockImmediately(et,tt){return(this._queue.length===0||this._queue[0].priorityet.priority<=nt.priority);o.splice(tt+1,0,et)}function findIndexFromEnd(o,et){for(let tt=o.length-1;tt>=0;tt--)if(et(o[tt]))return tt;return-1}var __awaiter$1=function(o,et,tt,nt){function rt(ot){return ot instanceof tt?ot:new tt(function(it){it(ot)})}return new(tt||(tt=Promise))(function(ot,it){function st(lt){try{ct(nt.next(lt))}catch(dt){it(dt)}}function at(lt){try{ct(nt.throw(lt))}catch(dt){it(dt)}}function ct(lt){lt.done?ot(lt.value):rt(lt.value).then(st,at)}ct((nt=nt.apply(o,et||[])).next())})};class Mutex{constructor(et){this._semaphore=new Semaphore(1,et)}acquire(){return __awaiter$1(this,arguments,void 0,function*(et=0){const[,tt]=yield this._semaphore.acquire(1,et);return tt})}runExclusive(et,tt=0){return this._semaphore.runExclusive(()=>et(),1,tt)}isLocked(){return this._semaphore.isLocked()}waitForUnlock(et=0){return this._semaphore.waitForUnlock(1,et)}release(){this._semaphore.isLocked()&&this._semaphore.release()}cancel(){return this._semaphore.cancel()}}class PeerManager{constructor(et,tt,nt){Ct(this,"connectionManager");Ct(this,"core");Ct(this,"log");Ct(this,"peers",new Map);Ct(this,"healthManager");Ct(this,"readMutex",new Mutex);Ct(this,"writeMutex",new Mutex);Ct(this,"writeLockHolder",null);this.connectionManager=et,this.core=tt,this.log=nt,this.healthManager=getHealthManager(),this.healthManager.updateProtocolHealth(this.core.multicodec,0)}getWriteLockHolder(){return this.writeLockHolder}getPeers(){return Array.from(this.peers.values())}async addPeer(et){return this.writeMutex.runExclusive(async()=>{this.writeLockHolder=`addPeer: ${et.id.toString()}`,await this.connectionManager.attemptDial(et.id),this.peers.set(et.id.toString(),et),this.log.info(`Added and dialed peer: ${et.id.toString()}`),this.healthManager.updateProtocolHealth(this.core.multicodec,this.peers.size),this.writeLockHolder=null})}async removePeer(et){return this.writeMutex.runExclusive(()=>{this.writeLockHolder=`removePeer: ${et.toString()}`,this.peers.delete(et.toString()),this.log.info(`Removed peer: ${et.toString()}`),this.healthManager.updateProtocolHealth(this.core.multicodec,this.peers.size),this.writeLockHolder=null})}async getPeerCount(){return this.readMutex.runExclusive(()=>this.peers.size)}async hasPeers(){return this.readMutex.runExclusive(()=>this.peers.size>0)}async removeExcessPeers(et){this.log.info(`Removing ${et} excess peer(s)`);const tt=Array.from(this.peers.values()).slice(0,et);for(const nt of tt)await this.removePeer(nt.id)}async findAndAddPeers(et){const tt=await this.findPeers(et);return tt.length===0?(this.log.warn("No additional peers found"),[]):this.addMultiplePeers(tt)}async findPeers(et){const tt=await this.core.getPeers();return this.readMutex.runExclusive(async()=>tt.filter(rt=>!this.peers.has(rt.id.toString())).slice(0,et))}async addMultiplePeers(et){const tt=[];for(const nt of et)await this.addPeer(nt),tt.push(nt);return tt}}const DEFAULT_NUM_PEERS_TO_USE=2,DEFAULT_MAINTAIN_PEERS_INTERVAL=3e4;class BaseProtocolSDK{constructor(et,tt,nt){Ct(this,"core");Ct(this,"connectionManager");Ct(this,"peerManager");Ct(this,"numPeersToUse");Ct(this,"maintainPeersIntervalId",null);Ct(this,"log");this.core=et,this.connectionManager=tt,this.log=new Logger$1(`sdk:${et.multicodec}`),this.numPeersToUse=(nt==null?void 0:nt.numPeersToUse)??DEFAULT_NUM_PEERS_TO_USE;const rt=(nt==null?void 0:nt.maintainPeersInterval)??DEFAULT_MAINTAIN_PEERS_INTERVAL;this.peerManager=new PeerManager(tt,et,this.log),this.log.info(`Initializing BaseProtocolSDK with numPeersToUse: ${this.numPeersToUse}, maintainPeersInterval: ${rt}ms`),this.startMaintainPeersInterval(rt)}get connectedPeers(){return this.peerManager.getPeers().slice(0,this.numPeersToUse)}async renewPeer(et){this.log.info(`Attempting to renew peer ${et}`);const tt=await this.peerManager.findPeers(1);if(tt.length===0){this.log.error("Failed to find a new peer to replace the disconnected one");return}return await this.peerManager.removePeer(et),await this.peerManager.addPeer(tt[0]),this.log.info(`Successfully renewed peer. New peer: ${tt[0].id}`),tt[0]}stopMaintainPeersInterval(){this.maintainPeersIntervalId?(clearInterval(this.maintainPeersIntervalId),this.maintainPeersIntervalId=null,this.log.info("Maintain peers interval stopped")):this.log.info("Maintain peers interval was not running")}async hasPeers(et={}){const{forceUseAllPeers:tt=!1,maxAttempts:nt=3}=et;this.log.info(`Checking for peers. forceUseAllPeers: ${tt}, maxAttempts: ${nt}`);for(let rt=0;rt0)return this.log.info(`At least one peer connected (${this.connectedPeers.length}), not forcing use of all peers`),!0;if(this.connectedPeers.length>=this.numPeersToUse)return this.log.info(`Required number of peers (${this.numPeersToUse}) reached`),!0;this.log.warn(`Found only ${this.connectedPeers.length}/${this.numPeersToUse} required peers. Retrying...`)}return this.log.error(`Failed to find required number of peers (${this.numPeersToUse}) after ${nt} attempts`),!1}async startMaintainPeersInterval(et){this.log.info(`Starting maintain peers interval with ${et}ms interval`);try{this.maintainPeersIntervalId=setInterval(()=>{this.log.info("Running scheduled peer maintenance"),this.maintainPeers().catch(tt=>{this.log.error("Error during scheduled peer maintenance:",tt)})},et),this.log.info("Maintain peers interval started successfully")}catch(tt){throw this.log.error("Error starting maintain peers interval:",tt),tt}}async maintainPeers(){try{const et=await this.peerManager.getPeerCount(),tt=this.numPeersToUse-et;if(this.log.info(`Current peer count: ${et}, target: ${this.numPeersToUse}`),tt===0){this.log.info("Peer count is at target, no maintenance required");return}tt>0?(this.log.info(`Attempting to add ${tt} peer(s)`),await this.peerManager.findAndAddPeers(tt)):(this.log.info(`Attempting to remove ${Math.abs(tt)} excess peer(s)`),await this.peerManager.removeExcessPeers(Math.abs(tt)));const nt=await this.peerManager.getPeerCount();this.log.info(`Peer maintenance completed. Initial count: ${et}, Final count: ${nt}`)}catch(et){this.log.error("Error during peer maintenance",{error:et})}}}const DEFAULT_KEEP_ALIVE=6e4,DEFAULT_LIGHT_PUSH_FILTER_CHECK=!1,DEFAULT_LIGHT_PUSH_FILTER_CHECK_INTERVAL=1e4,DEFAULT_SUBSCRIBE_OPTIONS={keepAlive:DEFAULT_KEEP_ALIVE,enableLightPushFilterCheck:DEFAULT_LIGHT_PUSH_FILTER_CHECK};function messageHash(o,et){const tt=utf8ToBytes$1(o),nt=utf8ToBytes$1(et.contentTopic),rt=tryConvertTimestampToBytes(et.timestamp),ot=concat$2([tt,et.payload,nt,et.meta,rt].filter(isDefined));return sha256$2(ot)}function tryConvertTimestampToBytes(o){if(!o)return;let et;return typeof o=="bigint"?et=o:et=BigInt(o.valueOf())*1000000n,numberToBytes(et)}function messageHashStr(o,et){const tt=messageHash(o,et);return bytesToHex$1(tt)}const log$h=new Logger$1("sdk:receiver:reliability_monitor"),DEFAULT_MAX_PINGS=3,MESSAGE_VERIFICATION_DELAY=5e3;class ReceiverReliabilityMonitor{constructor(et,tt,nt,rt,ot,it,st){Ct(this,"pubsubTopic");Ct(this,"getPeers");Ct(this,"renewPeer");Ct(this,"getContentTopics");Ct(this,"protocolSubscribe");Ct(this,"addLibp2pEventListener");Ct(this,"sendLightPushMessage");Ct(this,"receivedMessagesFormPeer",new Set);Ct(this,"receivedMessages",new Set);Ct(this,"scheduledVerification",new Map);Ct(this,"verifiedPeers",new Set);Ct(this,"peerFailures",new Map);Ct(this,"maxPingFailures",DEFAULT_MAX_PINGS);Ct(this,"peerRenewalLocks",new Set);this.pubsubTopic=et,this.getPeers=tt,this.renewPeer=nt,this.getContentTopics=rt,this.protocolSubscribe=ot,this.addLibp2pEventListener=it,this.sendLightPushMessage=st,this.addLibp2pEventListener("peer:disconnect",at=>{const ct=at.detail;this.getPeers().some(lt=>lt.id.equals(ct))&&this.renewAndSubscribePeer(ct)})}setMaxPingFailures(et){et!==void 0&&(this.maxPingFailures=et)}async handlePingResult(et,tt){if(tt!=null&&tt.success){this.peerFailures.delete(et.toString());return}const nt=(this.peerFailures.get(et.toString())||0)+1;if(this.peerFailures.set(et.toString(),nt),nt>=this.maxPingFailures)try{log$h.info(`Attempting to renew ${et.toString()} due to ping failures.`),await this.renewAndSubscribePeer(et),this.peerFailures.delete(et.toString())}catch(rt){log$h.error(`Failed to renew peer ${et.toString()}: ${rt}.`)}}notifyMessageReceived(et,tt){const nt=this.buildMessageHash(tt);return this.verifiedPeers.add(et),this.receivedMessagesFormPeer.add(`${et}-${nt}`),log$h.info(`notifyMessage received debug: ephemeral:${tt.ephemeral} ${bytesToUtf8(tt.payload)}`),log$h.info(`notifyMessage received: peer:${et} message:${nt}`),this.receivedMessages.has(nt)?!0:(this.receivedMessages.add(nt),!1)}notifyMessageSent(et,tt){const nt=et.toString(),rt=this.buildMessageHash(tt);if(log$h.info(`notifyMessage sent debug: ${bytesToUtf8(tt.payload)}`),this.scheduledVerification.has(nt)){log$h.warn(`notifyMessage sent: attempting to schedule verification for pending peer:${nt} message:${rt}`);return}const ot=setTimeout(async()=>{const it=this.verifiedPeers.has(nt),st=this.receivedMessagesFormPeer.has(`${nt}-${rt}`);if(it||st){log$h.info(`notifyMessage sent setTimeout: verified that peer pushes filter messages, peer:${nt} message:${rt}`);return}log$h.warn(`notifyMessage sent setTimeout: peer didn't return probe message, attempting renewAndSubscribe, peer:${nt} message:${rt}`),this.scheduledVerification.delete(nt),await this.renewAndSubscribePeer(et)},MESSAGE_VERIFICATION_DELAY);this.scheduledVerification.set(nt,ot)}shouldVerifyPeer(et){const tt=et.toString(),nt=this.verifiedPeers.has(tt),rt=this.scheduledVerification.has(tt);return!(nt||rt)}buildMessageHash(et){return messageHashStr(this.pubsubTopic,et)}async renewAndSubscribePeer(et){const tt=et.toString();try{if(this.peerRenewalLocks.has(tt)){log$h.info(`Peer ${tt} is already being renewed.`);return}this.peerRenewalLocks.add(tt);const nt=await this.renewPeer(et);if(!nt){log$h.warn(`Failed to renew peer ${tt}: No new peer found.`);return}return await this.protocolSubscribe(this.pubsubTopic,nt,this.getContentTopics()),await this.sendLightPushMessage(nt),this.peerFailures.delete(tt),nt}catch(nt){log$h.error(`Failed to renew peer ${tt}: ${nt}.`);return}finally{this.peerRenewalLocks.delete(tt)}}}const Nr=class Nr{static createReceiverMonitor(et,tt,nt,rt,ot,it,st){if(Nr.receiverMonitors.has(et))return Nr.receiverMonitors.get(et);const at=new ReceiverReliabilityMonitor(et,tt,nt,rt,ot,it,st);return Nr.receiverMonitors.set(et,at),at}constructor(){}static stop(et){this.receiverMonitors.delete(et)}static stopAll(){for(const[et,tt]of this.receiverMonitors)tt.setMaxPingFailures(void 0),this.receiverMonitors.delete(et)}};Ct(Nr,"receiverMonitors",new Map);let ReliabilityMonitorManager=Nr;const log$g=new Logger$1("sdk:filter:subscription_manager");class SubscriptionManager{constructor(et,tt,nt,rt,ot,it,st){Ct(this,"pubsubTopic");Ct(this,"protocol");Ct(this,"connectionManager");Ct(this,"getPeers");Ct(this,"renewPeer");Ct(this,"libp2p");Ct(this,"lightPush");Ct(this,"reliabilityMonitor");Ct(this,"keepAliveTimeout",DEFAULT_KEEP_ALIVE);Ct(this,"keepAliveInterval",null);Ct(this,"enableLightPushFilterCheck",DEFAULT_LIGHT_PUSH_FILTER_CHECK);Ct(this,"subscriptionCallbacks");this.pubsubTopic=et,this.protocol=tt,this.connectionManager=nt,this.getPeers=rt,this.renewPeer=ot,this.libp2p=it,this.lightPush=st,this.pubsubTopic=et,this.subscriptionCallbacks=new Map,this.reliabilityMonitor=ReliabilityMonitorManager.createReceiverMonitor(this.pubsubTopic,this.getPeers.bind(this),this.renewPeer.bind(this),()=>Array.from(this.subscriptionCallbacks.keys()),this.protocol.subscribe.bind(this.protocol),this.protocol.addLibp2pEventListener.bind(this.protocol),this.sendLightPushCheckMessage.bind(this))}async subscribe(et,tt,nt=DEFAULT_SUBSCRIBE_OPTIONS){this.reliabilityMonitor.setMaxPingFailures(nt.pingsBeforePeerRenewed),this.keepAliveTimeout=nt.keepAlive||DEFAULT_KEEP_ALIVE,this.enableLightPushFilterCheck=(nt==null?void 0:nt.enableLightPushFilterCheck)||DEFAULT_LIGHT_PUSH_FILTER_CHECK;const rt=Array.isArray(et)?et:[et];for(const lt of rt)if(lt.pubsubTopic!==this.pubsubTopic)return{failures:[{error:ProtocolError$1.TOPIC_DECODER_MISMATCH}],successes:[]};this.enableLightPushFilterCheck&&rt.push(createDecoder(this.buildLightPushContentTopic(),this.pubsubTopic));const ot=groupByContentTopic(rt),it=Array.from(ot.keys()),st=this.getPeers().map(async lt=>this.subscribeWithPeerVerification(lt,it)),at=await Promise.allSettled(st),ct=this.handleResult(at,"subscribe");return ot.forEach((lt,dt)=>{const ht={decoders:lt,callback:tt};dt!==this.buildLightPushContentTopic()&&this.subscriptionCallbacks.set(dt,ht)}),this.startSubscriptionsMaintenance(this.keepAliveTimeout),ct}async unsubscribe(et){const tt=this.getPeers().map(async ot=>{const it=await this.protocol.unsubscribe(this.pubsubTopic,ot,et);return et.forEach(st=>{this.subscriptionCallbacks.delete(st)}),it}),nt=await Promise.allSettled(tt),rt=this.handleResult(nt,"unsubscribe");return this.subscriptionCallbacks.size===0&&this.stopSubscriptionsMaintenance(),rt}async ping(et){log$g.info("Sending keep-alive ping");const nt=(et?[et]:this.getPeers().map(ot=>ot.id)).map(ot=>this.pingSpecificPeer(ot)),rt=await Promise.allSettled(nt);return this.handleResult(rt,"ping")}async unsubscribeAll(){const et=this.getPeers().map(async rt=>this.protocol.unsubscribeAll(this.pubsubTopic,rt)),tt=await Promise.allSettled(et);this.subscriptionCallbacks.clear();const nt=this.handleResult(tt,"unsubscribeAll");return this.stopSubscriptionsMaintenance(),nt}async processIncomingMessage(et,tt){if(this.reliabilityMonitor.notifyMessageReceived(tt,et)){log$g.info("Message already received, skipping");return}const{contentTopic:rt}=et,ot=this.subscriptionCallbacks.get(rt);if(!ot){log$g.error("No subscription callback available for ",rt);return}log$g.info("Processing message with content topic ",rt," on pubsub topic ",this.pubsubTopic),await pushMessage(ot,this.pubsubTopic,et)}async subscribeWithPeerVerification(et,tt){const nt=await this.protocol.subscribe(this.pubsubTopic,et,tt);return await this.sendLightPushCheckMessage(et),nt}handleResult(et,tt){const nt={failures:[],successes:[]};for(const rt of et)if(rt.status==="rejected")log$g.error(`Failed to resolve ${tt} promise successfully: `,rt.reason),nt.failures.push({error:ProtocolError$1.GENERIC_FAIL});else{const ot=rt.value;ot.failure?nt.failures.push(ot.failure):nt.successes.push(ot.success)}return nt}async pingSpecificPeer(et){var rt,ot;const tt=this.getPeers().find(it=>it.id.equals(et));if(!tt)return{success:null,failure:{peerId:et,error:ProtocolError$1.NO_PEER_AVAILABLE}};let nt;try{nt=await this.protocol.ping(tt)}catch{nt={success:null,failure:{peerId:et,error:ProtocolError$1.GENERIC_FAIL}}}return log$g.info(`Received result from filter ping peerId:${et.toString()} success:${(rt=nt.success)==null?void 0:rt.toString()} failure:${(ot=nt.failure)==null?void 0:ot.error}`),await this.reliabilityMonitor.handlePingResult(et,nt),nt}startSubscriptionsMaintenance(et){log$g.info("Starting subscriptions maintenance"),this.startKeepAlivePings(et),this.startConnectionListener()}stopSubscriptionsMaintenance(){log$g.info("Stopping subscriptions maintenance"),this.stopKeepAlivePings(),this.stopConnectionListener()}startConnectionListener(){this.connectionManager.addEventListener(EConnectionStateEvents.CONNECTION_STATUS,this.connectionListener.bind(this))}stopConnectionListener(){this.connectionManager.removeEventListener(EConnectionStateEvents.CONNECTION_STATUS,this.connectionListener.bind(this))}async connectionListener({detail:et}){if(!et){this.stopKeepAlivePings();return}try{await this.ping()}catch(tt){log$g.error(`networkStateListener failed to recover: ${tt}`)}this.startKeepAlivePings(this.keepAliveTimeout)}startKeepAlivePings(et){if(this.keepAliveInterval){log$g.info("Recurring pings already set up.");return}this.keepAliveInterval=setInterval(()=>{this.ping()},et)}stopKeepAlivePings(){if(!this.keepAliveInterval){log$g.info("Already stopped recurring pings.");return}log$g.info("Stopping recurring pings."),clearInterval(this.keepAliveInterval),this.keepAliveInterval=null}async sendLightPushCheckMessage(et){if(this.lightPush&&this.libp2p&&this.reliabilityMonitor.shouldVerifyPeer(et.id)){const tt=createEncoder({contentTopic:this.buildLightPushContentTopic(),pubsubTopic:this.pubsubTopic,ephemeral:!0}),nt={payload:new Uint8Array(1)},rt=await tt.toProtoObj(nt);setTimeout(async()=>{const ot=await this.lightPush.protocol.send(tt,nt,et);if(this.reliabilityMonitor.notifyMessageSent(et.id,rt),ot.failure){log$g.error(`failed to send lightPush ping message to peer:${et.id.toString()} ${ot.failure.error}`);return}},DEFAULT_LIGHT_PUSH_FILTER_CHECK_INTERVAL)}}buildLightPushContentTopic(){return`/js-waku-subscription-ping/1/${this.libp2p.peerId.toString()}/utf8`}}async function pushMessage(o,et,tt){const{decoders:nt,callback:rt}=o,{contentTopic:ot}=tt;if(!ot){log$g.warn("Message has no content topic, skipping");return}try{const it=nt.map(at=>at.fromProtoObj(et,tt).then(ct=>ct||Promise.reject("Decoding failed"))),st=await Promise.any(it);await rt(st)}catch(it){log$g.error("Error decoding message",it)}}const log$f=new Logger$1("sdk:filter");class Filter extends BaseProtocolSDK{constructor(tt,nt,rt,ot){super(new FilterCore(async(it,st,at)=>{const ct=this.getActiveSubscription(it);if(!ct){log$f.error(`No subscription locally registered for topic ${it}`);return}await ct.processIncomingMessage(st,at)},tt.configuredPubsubTopics,nt),tt,{numPeersToUse:ot==null?void 0:ot.numPeersToUse});Ct(this,"libp2p");Ct(this,"lightPush");Ct(this,"protocol");Ct(this,"activeSubscriptions",new Map);this.libp2p=nt,this.lightPush=rt,this.protocol=this.core,this.activeSubscriptions=new Map}async subscribe(tt,nt,rt,ot=DEFAULT_SUBSCRIBE_OPTIONS){const it=this.getUniquePubsubTopics(tt);if(it.length!==1)return{subscription:null,error:ProtocolError$1.INVALID_DECODER_TOPICS,results:null};const st=it[0],{subscription:at,error:ct}=await this.createSubscription(st,rt);if(ct)return{subscription:null,error:ct,results:null};const{failures:lt,successes:dt}=await at.subscribe(tt,nt,ot);return{subscription:at,error:null,results:{failures:lt,successes:dt}}}async createSubscription(tt,nt){var st;nt={autoRetry:!0,...nt};const rt=typeof tt=="string"?tt:(st=shardInfoToPubsubTopics(tt))==null?void 0:st[0];return ensurePubsubTopicIsConfigured(rt,this.protocol.pubsubTopics),await this.hasPeers(nt)?(log$f.info(`Creating filter subscription with ${this.connectedPeers.length} peers: `,this.connectedPeers.map(at=>at.id.toString())),{error:null,subscription:this.getActiveSubscription(rt)??this.setActiveSubscription(rt,new SubscriptionManager(rt,this.protocol,this.connectionManager,()=>this.connectedPeers,this.renewPeer.bind(this),this.libp2p,this.lightPush))}):{error:ProtocolError$1.NO_PEER_AVAILABLE,subscription:null}}async subscribeWithUnsubscribe(tt,nt,rt=DEFAULT_SUBSCRIBE_OPTIONS){const ot=this.getUniquePubsubTopics(tt);if(ot.length===0)throw Error("Failed to subscribe: no pubsubTopic found on decoders provided.");if(ot.length>1)throw Error("Failed to subscribe: all decoders should have the same pubsub topic. Use createSubscription to be more agile.");const{subscription:it,error:st}=await this.createSubscription(ot[0]);if(st)throw Error(`Failed to create subscription: ${st}`);await it.subscribe(tt,nt,rt);const at=Array.from(groupByContentTopic(Array.isArray(tt)?tt:[tt]).keys());return async()=>{await it.unsubscribe(at)}}toSubscriptionIterator(tt){return toAsyncIterator(this,tt)}getActiveSubscription(tt){return this.activeSubscriptions.get(tt)}setActiveSubscription(tt,nt){return this.activeSubscriptions.set(tt,nt),nt}getUniquePubsubTopics(tt){return Array.isArray(tt)?tt.length===0?[]:[...new Set(tt.map(rt=>rt.pubsubTopic))]:[tt.pubsubTopic]}}function wakuFilter(o,et,tt){return nt=>new Filter(o,nt,et,tt)}const log$e=new Logger$1("sdk:light-push"),DEFAULT_MAX_ATTEMPTS=3,DEFAULT_SEND_OPTIONS={autoRetry:!1,maxAttempts:DEFAULT_MAX_ATTEMPTS};class LightPush{constructor(et,tt,nt){Ct(this,"libp2p");Ct(this,"numPeersToUse",DEFAULT_NUM_PEERS_TO_USE);Ct(this,"protocol");this.libp2p=tt,this.numPeersToUse=(nt==null?void 0:nt.numPeersToUse)??DEFAULT_NUM_PEERS_TO_USE,this.protocol=new LightPushCore(et.configuredPubsubTopics,tt)}async send(et,tt,nt=DEFAULT_SEND_OPTIONS){const rt=[],ot=[],{pubsubTopic:it}=et;try{ensurePubsubTopicIsConfigured(it,this.protocol.pubsubTopics)}catch{return log$e.error("Failed to send waku light push: pubsub topic not configured"),{successes:rt,failures:[{error:ProtocolError$1.TOPIC_NOT_CONFIGURED}]}}const st=await this.getConnectedPeers();if(st.length===0)return{successes:rt,failures:[{error:ProtocolError$1.NO_PEER_AVAILABLE}]};const at=await Promise.allSettled(st.map(ct=>this.protocol.send(et,tt,ct)));for(const ct of at){if(ct.status!=="fulfilled"){log$e.error("Failed unexpectedly while sending:",ct.reason),ot.push({error:ProtocolError$1.GENERIC_FAIL});continue}const{failure:lt,success:dt}=ct.value;if(dt){rt.push(dt);continue}lt&&(ot.push(lt),nt!=null&&nt.autoRetry&&this.attemptRetries(ht=>this.protocol.send(et,tt,ht),nt.maxAttempts))}return getHealthManager().updateProtocolHealth(this.protocol.multicodec,rt.length),{successes:rt,failures:ot}}async attemptRetries(et,tt){var rt;tt=tt||DEFAULT_MAX_ATTEMPTS;const nt=await this.getConnectedPeers();if(nt.length===0){log$e.warn("Cannot retry with no connected peers.");return}for(let ot=0;ot{try{return await this.libp2p.peerStore.get(nt)}catch{return null}}))).filter(nt=>!!nt).filter(nt=>nt.protocols.includes(LightPushCodec)).slice(0,this.numPeersToUse)}}function wakuLightPush(o,et={}){return tt=>new LightPush(o,tt,et)}const DEFAULT_NUM_PEERS=1,log$d=new Logger$1("waku:store:sdk");class Store extends BaseProtocolSDK{constructor(tt,nt){super(new StoreCore(tt.configuredPubsubTopics,nt),tt,{numPeersToUse:DEFAULT_NUM_PEERS});Ct(this,"protocol");this.protocol=this.core}async*queryGenerator(tt,nt){const{pubsubTopic:rt,contentTopics:ot,decodersAsMap:it}=this.validateDecodersAndPubsubTopic(tt),st={pubsubTopic:rt,contentTopics:ot,includeData:!0,paginationForward:!0,...nt},at=(await this.protocol.getPeers({numPeers:this.numPeersToUse,maxBootstrapPeers:1}))[0];if(!at)throw log$d.error("No peers available to query"),new Error("No peers available to query");log$d.info(`Querying store with options: ${JSON.stringify(nt)}`);const ct=this.protocol.queryPerPage(st,it,at);for await(const lt of ct)yield lt}async queryWithOrderedCallback(tt,nt,rt){log$d.info("Querying store with ordered callback");for await(const ot of this.queryGenerator(tt,rt))if(await this.processMessages(ot,nt))break}async queryWithPromiseCallback(tt,nt,rt){log$d.info("Querying store with promise callback");let ot=!1;for await(const it of this.queryGenerator(tt,rt)){const st=it.map(async at=>{ot||(ot=!!await nt(at))});if(await Promise.all(st),ot)break}}async processMessages(tt,nt){let rt=!1;const it=(await Promise.all(tt)).filter(isDefined);return await Promise.all(it.map(async st=>{st&&!rt&&(rt=!!await nt(st))})),rt}createCursor(tt){return messageHash(tt.pubsubTopic,tt)}validateDecodersAndPubsubTopic(tt){if(tt.length===0)throw log$d.error("No decoders provided"),new Error("No decoders provided");const nt=Array.from(new Set(tt.map(st=>st.pubsubTopic)));if(nt.length>1)throw log$d.error("API does not support querying multiple pubsub topics at once"),new Error("API does not support querying multiple pubsub topics at once");const rt=nt[0];ensurePubsubTopicIsConfigured(rt,this.protocol.pubsubTopics);const ot=new Map;tt.forEach(st=>{if(ot.has(st.contentTopic))throw log$d.error("API does not support different decoder per content topic"),new Error("API does not support different decoder per content topic");ot.set(st.contentTopic,st)});const it=tt.filter(st=>st.pubsubTopic===rt).map(st=>st.contentTopic);if(it.length===0)throw log$d.error(`No decoders found for topic ${rt}`),new Error("No decoders found for topic "+rt);return{pubsubTopic:rt,contentTopics:it,decodersAsMap:ot}}}function wakuStore(o){return et=>new Store(o,et)}const log$c=new Logger$1("wait-for-remote-peer");async function waitForRemotePeer(o,et,tt){et=et!=null&&et.length?et:getEnabledProtocols(o);const nt=o.libp2p.getConnections();if(!o.isStarted())throw Error("Waku node is not started");for(const ot of et)switch(ot){case Protocols.Relay:if(!o.relay)throw Error("Cannot wait for Relay peer: protocol not mounted");break;case Protocols.LightPush:if(!o.lightPush)throw Error("Cannot wait for LightPush peer: protocol not mounted");break;case Protocols.Store:if(!o.store)throw Error("Cannot wait for Store peer: protocol not mounted");break;case Protocols.Filter:if(!o.filter)throw Error("Cannot wait for Filter peer: protocol not mounted");break}const rt=[waitForProtocols(o,et)];nt.length>0&&!et.includes(Protocols.Relay)&&rt.push(waitForMetadata(o,et)),tt?await rejectOnTimeout(Promise.any(rt),tt,"Timed out waiting for a remote peer."):await Promise.any(rt)}async function waitForProtocols(o,et){const tt=[];return o.relay&&et.includes(Protocols.Relay)&&tt.push(o.relay.waitForPeers()),o.store&&et.includes(Protocols.Store)&&tt.push(waitForConnectedPeer(StoreCodec,o.libp2p)),o.lightPush&&et.includes(Protocols.LightPush)&&tt.push(waitForConnectedPeer(LightPushCodec,o.libp2p)),o.filter&&et.includes(Protocols.Filter)&&tt.push(waitForConnectedPeer(FilterCodecs.SUBSCRIBE,o.libp2p)),Promise.all(tt)}async function waitForConnectedPeer(o,et){log$c.info(`Waiting for ${o} peer.`),await new Promise(tt=>{const nt=async rt=>{var ot,it;if((it=(ot=rt.detail)==null?void 0:ot.protocols)!=null&&it.includes(o)){const st=et.services.metadata;if(!st){et.removeEventListener("peer:identify",nt),tt();return}try{await st.confirmOrAttemptHandshake(rt.detail.peerId),et.removeEventListener("peer:identify",nt),tt()}catch(at){at.code==="ERR_CONNECTION_BEING_CLOSED"&&log$c.error("Connection closed. Some peers can be on different shard."),log$c.error(`Error waiting for metadata: ${at}`)}}};et.addEventListener("peer:identify",nt)})}async function waitForMetadata(o,et){const tt=o.libp2p.getPeers(),nt=o.libp2p.services.metadata,rt=mapProtocolsToCodecs(et);if(!tt.length||!nt){log$c.info(`Skipping waitForMetadata due to missing connections:${tt.length} or metadataService:${!!nt}`);return}for(const ot of tt)try{const it=await o.libp2p.peerStore.get(ot);if(it.protocols.some(at=>rt.has(at))&&!(await nt.confirmOrAttemptHandshake(ot)).error&&(it.protocols.forEach(lt=>{rt.has(lt)&&rt.set(lt,!0)}),Array.from(rt.values()).every(lt=>lt)))return}catch(it){it.code==="ERR_CONNECTION_BEING_CLOSED"&&log$c.error("Connection closed. Some peers can be on different shard."),log$c.error(`Error while iterating through peers: ${it}`);continue}}const awaitTimeout=(o,et)=>new Promise((tt,nt)=>setTimeout(()=>nt(Error(et)),o));async function rejectOnTimeout(o,et,tt){await Promise.race([o,awaitTimeout(et,tt)])}function getEnabledProtocols(o){const et=[];return o.relay&&et.push(Protocols.Relay),o.filter&&et.push(Protocols.Filter),o.store&&et.push(Protocols.Store),o.lightPush&&et.push(Protocols.LightPush),et}function mapProtocolsToCodecs(o){const et=new Map,tt={[Protocols.Filter]:FilterCodecs.SUBSCRIBE,[Protocols.LightPush]:LightPushCodec,[Protocols.Store]:StoreCodec};for(const nt of o)tt[nt]&&et.set(tt[nt],!1);return et}const DefaultPingKeepAliveValueSecs=5*60,DefaultRelayKeepAliveValueSecs=5*60,DefaultUserAgent="js-waku",DefaultPingMaxInboundStreams=10,log$b=new Logger$1("waku");class WakuNode{constructor(et,tt,nt,rt,ot){Ct(this,"pubsubTopics");Ct(this,"libp2p");Ct(this,"relay");Ct(this,"store");Ct(this,"filter");Ct(this,"lightPush");Ct(this,"connectionManager");Ct(this,"health");this.pubsubTopics=et,this.relay=ot,this.libp2p=nt,rt={filter:!1,lightpush:!1,store:!1,...rt};const it=tt.pingKeepAlive||DefaultPingKeepAliveValueSecs,st=this.relay?tt.relayKeepAlive||DefaultRelayKeepAliveValueSecs:0,at=this.libp2p.peerId.toString();if(this.connectionManager=ConnectionManager.create(at,nt,{pingKeepAlive:it,relayKeepAlive:st},this.pubsubTopics,this.relay),this.health=getHealthManager(),rt.store){const ct=wakuStore(this.connectionManager);this.store=ct(nt)}if(rt.lightpush){const ct=wakuLightPush(this.connectionManager,tt);this.lightPush=ct(nt)}if(rt.filter){const ct=wakuFilter(this.connectionManager,this.lightPush,tt);this.filter=ct(nt)}log$b.info("Waku node created",at,`relay: ${!!this.relay}, store: ${!!this.store}, light push: ${!!this.lightPush}, filter: ${!!this.filter}`)}get peerId(){return this.libp2p.peerId}get protocols(){return this.libp2p.getProtocols()}async dial(et,tt){const nt=tt??[],rt=this.mapToPeerIdOrMultiaddr(et);typeof tt>"u"&&(this.relay&&nt.push(Protocols.Relay),this.store&&nt.push(Protocols.Store),this.filter&&nt.push(Protocols.Filter),this.lightPush&&nt.push(Protocols.LightPush));const ot=[];return nt.includes(Protocols.Relay)&&(this.relay?this.relay.gossipSub.multicodecs.forEach(it=>ot.push(it)):log$b.error("Relay codec not included in dial codec: protocol not mounted locally")),nt.includes(Protocols.Store)&&(this.store?ot.push(this.store.protocol.multicodec):log$b.error("Store codec not included in dial codec: protocol not mounted locally")),nt.includes(Protocols.LightPush)&&(this.lightPush?ot.push(this.lightPush.protocol.multicodec):log$b.error("Light Push codec not included in dial codec: protocol not mounted locally")),nt.includes(Protocols.Filter)&&(this.filter?ot.push(this.filter.protocol.multicodec):log$b.error("Filter codec not included in dial codec: protocol not mounted locally")),log$b.info(`Dialing to ${rt.toString()} with protocols ${nt}`),this.libp2p.dialProtocol(rt,ot)}async start(){await this.libp2p.start()}async stop(){ReliabilityMonitorManager.stopAll(),this.connectionManager.stop(),await this.libp2p.stop()}async waitForPeers(et,tt){return waitForRemotePeer(this,et,tt)}isStarted(){return this.libp2p.status=="started"}isConnected(){return this.connectionManager.isConnected()}mapToPeerIdOrMultiaddr(et){return isPeerId$2(et)?et:multiaddr(et)}}var ls;let InvalidParametersError$3=(ls=class extends Error{constructor(et="Invalid parameters"){super(et),this.name="InvalidParametersError"}},Ct(ls,"name","InvalidParametersError"),ls);class InvalidPublicKeyError extends Error{constructor(et="Invalid public key"){super(et),this.name="InvalidPublicKeyError"}}Ct(InvalidPublicKeyError,"name","InvalidPublicKeyError");var us;let UnsupportedKeyTypeError$1=(us=class extends Error{constructor(et="Unsupported key type"){super(et),this.name="UnsupportedKeyTypeError"}},Ct(us,"name","UnsupportedKeyTypeError"),us);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const _0n$2=BigInt(0),_1n$3=BigInt(1),_2n$2=BigInt(2),_8n$2=BigInt(8),VERIFY_DEFAULT={zip215:!0};function validateOpts$1(o){const et=validateBasic(o);return validateObject(o,{hash:"function",a:"bigint",d:"bigint",randomBytes:"function"},{adjustScalarBytes:"function",domain:"function",uvRatio:"function",mapToCurve:"function"}),Object.freeze({...et})}function twistedEdwards(o){const et=validateOpts$1(o),{Fp:tt,n:nt,prehash:rt,hash:ot,randomBytes:it,nByteLength:st,h:at}=et,ct=_2n$2<{try{return{isValid:!0,value:tt.sqrt(Yt*tt.inv(Ht))}}catch{return{isValid:!1,value:_0n$2}}}),pt=et.adjustScalarBytes||(Yt=>Yt),mt=et.domain||((Yt,Ht,Ut)=>{if(abool("phflag",Ut),Ht.length||Ut)throw new Error("Contexts/pre-hash are not supported");return Yt});function ft(Yt,Ht){aInRange("coordinate "+Yt,Ht,_0n$2,ct)}function yt(Yt){if(!(Yt instanceof vt))throw new Error("ExtendedPoint expected")}const gt=memoized((Yt,Ht)=>{const{ex:Ut,ey:qt,ez:Lt}=Yt,Zt=Yt.is0();Ht==null&&(Ht=Zt?_8n$2:tt.inv(Lt));const Qt=lt(Ut*Ht),Nt=lt(qt*Ht),Gt=lt(Lt*Ht);if(Zt)return{x:_0n$2,y:_1n$3};if(Gt!==_1n$3)throw new Error("invZ was invalid");return{x:Qt,y:Nt}}),xt=memoized(Yt=>{const{a:Ht,d:Ut}=et;if(Yt.is0())throw new Error("bad point: ZERO");const{ex:qt,ey:Lt,ez:Zt,et:Qt}=Yt,Nt=lt(qt*qt),Gt=lt(Lt*Lt),nn=lt(Zt*Zt),Wt=lt(nn*nn),hn=lt(Nt*Ht),Xt=lt(nn*lt(hn+Gt)),Jt=lt(Wt+lt(Ut*lt(Nt*Gt)));if(Xt!==Jt)throw new Error("bad point: equation left != right (1)");const tn=lt(qt*Lt),_t=lt(Zt*Qt);if(tn!==_t)throw new Error("bad point: equation left != right (2)");return!0});class vt{constructor(Ht,Ut,qt,Lt){this.ex=Ht,this.ey=Ut,this.ez=qt,this.et=Lt,ft("x",Ht),ft("y",Ut),ft("z",qt),ft("t",Lt),Object.freeze(this)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static fromAffine(Ht){if(Ht instanceof vt)throw new Error("extended point not allowed");const{x:Ut,y:qt}=Ht||{};return ft("x",Ut),ft("y",qt),new vt(Ut,qt,_1n$3,lt(Ut*qt))}static normalizeZ(Ht){const Ut=tt.invertBatch(Ht.map(qt=>qt.ez));return Ht.map((qt,Lt)=>qt.toAffine(Ut[Lt])).map(vt.fromAffine)}static msm(Ht,Ut){return pippenger(vt,dt,Ht,Ut)}_setWindowSize(Ht){wt.setWindowSize(this,Ht)}assertValidity(){xt(this)}equals(Ht){yt(Ht);const{ex:Ut,ey:qt,ez:Lt}=this,{ex:Zt,ey:Qt,ez:Nt}=Ht,Gt=lt(Ut*Nt),nn=lt(Zt*Lt),Wt=lt(qt*Nt),hn=lt(Qt*Lt);return Gt===nn&&Wt===hn}is0(){return this.equals(vt.ZERO)}negate(){return new vt(lt(-this.ex),this.ey,this.ez,lt(-this.et))}double(){const{a:Ht}=et,{ex:Ut,ey:qt,ez:Lt}=this,Zt=lt(Ut*Ut),Qt=lt(qt*qt),Nt=lt(_2n$2*lt(Lt*Lt)),Gt=lt(Ht*Zt),nn=Ut+qt,Wt=lt(lt(nn*nn)-Zt-Qt),hn=Gt+Qt,Xt=hn-Nt,Jt=Gt-Qt,tn=lt(Wt*Xt),_t=lt(hn*Jt),Dt=lt(Wt*Jt),Vt=lt(Xt*hn);return new vt(tn,_t,Vt,Dt)}add(Ht){yt(Ht);const{a:Ut,d:qt}=et,{ex:Lt,ey:Zt,ez:Qt,et:Nt}=this,{ex:Gt,ey:nn,ez:Wt,et:hn}=Ht;if(Ut===BigInt(-1)){const mn=lt((Zt-Lt)*(nn+Gt)),wn=lt((Zt+Lt)*(nn-Gt)),In=lt(wn-mn);if(In===_0n$2)return this.double();const Pn=lt(Qt*_2n$2*hn),yn=lt(Nt*_2n$2*Wt),En=yn+Pn,on=wn+mn,It=yn-Pn,St=lt(En*In),At=lt(on*It),jt=lt(En*It),Kt=lt(In*on);return new vt(St,At,Kt,jt)}const Xt=lt(Lt*Gt),Jt=lt(Zt*nn),tn=lt(Nt*qt*hn),_t=lt(Qt*Wt),Dt=lt((Lt+Zt)*(Gt+nn)-Xt-Jt),Vt=_t-tn,en=_t+tn,an=lt(Jt-Ut*Xt),dn=lt(Dt*Vt),ln=lt(en*an),pn=lt(Dt*an),kn=lt(Vt*en);return new vt(dn,ln,kn,pn)}subtract(Ht){return this.add(Ht.negate())}wNAF(Ht){return wt.wNAFCached(this,Ht,vt.normalizeZ)}multiply(Ht){const Ut=Ht;aInRange("scalar",Ut,_1n$3,nt);const{p:qt,f:Lt}=this.wNAF(Ut);return vt.normalizeZ([qt,Lt])[0]}multiplyUnsafe(Ht){const Ut=Ht;return aInRange("scalar",Ut,_0n$2,nt),Ut===_0n$2?Et:this.equals(Et)||Ut===_1n$3?this:this.equals(bt)?this.wNAF(Ut).p:wt.unsafeLadder(this,Ut)}isSmallOrder(){return this.multiplyUnsafe(at).is0()}isTorsionFree(){return wt.unsafeLadder(this,nt).is0()}toAffine(Ht){return gt(this,Ht)}clearCofactor(){const{h:Ht}=et;return Ht===_1n$3?this:this.multiplyUnsafe(Ht)}static fromHex(Ht,Ut=!1){const{d:qt,a:Lt}=et,Zt=tt.BYTES;Ht=ensureBytes$1("pointHex",Ht,Zt),abool("zip215",Ut);const Qt=Ht.slice(),Nt=Ht[Zt-1];Qt[Zt-1]=Nt&-129;const Gt=bytesToNumberLE(Qt),nn=Ut?ct:tt.ORDER;aInRange("pointHex.y",Gt,_0n$2,nn);const Wt=lt(Gt*Gt),hn=lt(Wt-_1n$3),Xt=lt(qt*Wt-Lt);let{isValid:Jt,value:tn}=ht(hn,Xt);if(!Jt)throw new Error("Point.fromHex: invalid y coordinate");const _t=(tn&_1n$3)===_1n$3,Dt=(Nt&128)!==0;if(!Ut&&tn===_0n$2&&Dt)throw new Error("Point.fromHex: x=0 and x_0=1");return Dt!==_t&&(tn=lt(-tn)),vt.fromAffine({x:tn,y:Gt})}static fromPrivateKey(Ht){return Rt(Ht).point}toRawBytes(){const{x:Ht,y:Ut}=this.toAffine(),qt=numberToBytesLE(Ut,tt.BYTES);return qt[qt.length-1]|=Ht&_1n$3?128:0,qt}toHex(){return bytesToHex$2(this.toRawBytes())}}vt.BASE=new vt(et.Gx,et.Gy,_1n$3,lt(et.Gx*et.Gy)),vt.ZERO=new vt(_0n$2,_1n$3,_1n$3,_0n$2);const{BASE:bt,ZERO:Et}=vt,wt=wNAF(vt,st*8);function kt(Yt){return mod$1(Yt,nt)}function Tt(Yt){return kt(bytesToNumberLE(Yt))}function Rt(Yt){const Ht=st;Yt=ensureBytes$1("private key",Yt,Ht);const Ut=ensureBytes$1("hashed private key",ot(Yt),2*Ht),qt=pt(Ut.slice(0,Ht)),Lt=Ut.slice(Ht,2*Ht),Zt=Tt(qt),Qt=bt.multiply(Zt),Nt=Qt.toRawBytes();return{head:qt,prefix:Lt,scalar:Zt,point:Qt,pointBytes:Nt}}function Pt(Yt){return Rt(Yt).pointBytes}function $t(Yt=new Uint8Array,...Ht){const Ut=concatBytes$1(...Ht);return Tt(ot(mt(Ut,ensureBytes$1("context",Yt),!!rt)))}function Ot(Yt,Ht,Ut={}){Yt=ensureBytes$1("message",Yt),rt&&(Yt=rt(Yt));const{prefix:qt,scalar:Lt,pointBytes:Zt}=Rt(Ht),Qt=$t(Ut.context,qt,Yt),Nt=bt.multiply(Qt).toRawBytes(),Gt=$t(Ut.context,Nt,Zt,Yt),nn=kt(Qt+Gt*Lt);aInRange("signature.s",nn,_0n$2,nt);const Wt=concatBytes$1(Nt,numberToBytesLE(nn,tt.BYTES));return ensureBytes$1("result",Wt,st*2)}const Bt=VERIFY_DEFAULT;function zt(Yt,Ht,Ut,qt=Bt){const{context:Lt,zip215:Zt}=qt,Qt=tt.BYTES;Yt=ensureBytes$1("signature",Yt,2*Qt),Ht=ensureBytes$1("message",Ht),Zt!==void 0&&abool("zip215",Zt),rt&&(Ht=rt(Ht));const Nt=bytesToNumberLE(Yt.slice(Qt,2*Qt));let Gt,nn,Wt;try{Gt=vt.fromHex(Ut,Zt),nn=vt.fromHex(Yt.slice(0,Qt),Zt),Wt=bt.multiplyUnsafe(Nt)}catch{return!1}if(!Zt&&Gt.isSmallOrder())return!1;const hn=$t(Lt,nn.toRawBytes(),Gt.toRawBytes(),Ht);return nn.add(Gt.multiplyUnsafe(hn)).subtract(Wt).clearCofactor().equals(vt.ZERO)}return bt._setWindowSize(8),{CURVE:et,getPublicKey:Pt,sign:Ot,verify:zt,ExtendedPoint:vt,utils:{getExtendedPublicKey:Rt,randomPrivateKey:()=>it(tt.BYTES),precompute(Yt=8,Ht=vt.BASE){return Ht._setWindowSize(Yt),Ht.multiply(BigInt(3)),Ht}}}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const _0n$1=BigInt(0),_1n$2=BigInt(1);function validateOpts(o){return validateObject(o,{a:"bigint"},{montgomeryBits:"isSafeInteger",nByteLength:"isSafeInteger",adjustScalarBytes:"function",domain:"function",powPminus2:"function",Gu:"bigint"}),Object.freeze({...o})}function montgomery(o){const et=validateOpts(o),{P:tt}=et,nt=xt=>mod$1(xt,tt),rt=et.montgomeryBits,ot=Math.ceil(rt/8),it=et.nByteLength,st=et.adjustScalarBytes||(xt=>xt),at=et.powPminus2||(xt=>pow(xt,tt-BigInt(2),tt));function ct(xt,vt,bt){const Et=nt(xt*(vt-bt));return vt=nt(vt-Et),bt=nt(bt+Et),[vt,bt]}const lt=(et.a-BigInt(2))/BigInt(4);function dt(xt,vt){aInRange("u",xt,_0n$1,tt),aInRange("scalar",vt,_0n$1,tt);const bt=vt,Et=xt;let wt=_1n$2,kt=_0n$1,Tt=xt,Rt=_1n$2,Pt=_0n$1,$t;for(let Bt=BigInt(rt-1);Bt>=_0n$1;Bt--){const zt=bt>>Bt&_1n$2;Pt^=zt,$t=ct(Pt,wt,Tt),wt=$t[0],Tt=$t[1],$t=ct(Pt,kt,Rt),kt=$t[0],Rt=$t[1],Pt=zt;const Ft=wt+kt,Yt=nt(Ft*Ft),Ht=wt-kt,Ut=nt(Ht*Ht),qt=Yt-Ut,Lt=Tt+Rt,Zt=Tt-Rt,Qt=nt(Zt*Ft),Nt=nt(Lt*Ht),Gt=Qt+Nt,nn=Qt-Nt;Tt=nt(Gt*Gt),Rt=nt(Et*nt(nn*nn)),wt=nt(Yt*Ut),kt=nt(qt*(Yt+nt(lt*qt)))}$t=ct(Pt,wt,Tt),wt=$t[0],Tt=$t[1],$t=ct(Pt,kt,Rt),kt=$t[0],Rt=$t[1];const Ot=at(kt);return nt(wt*Ot)}function ht(xt){return numberToBytesLE(nt(xt),ot)}function pt(xt){const vt=ensureBytes$1("u coordinate",xt,ot);return it===32&&(vt[31]&=127),bytesToNumberLE(vt)}function mt(xt){const vt=ensureBytes$1("scalar",xt),bt=vt.length;if(bt!==ot&&bt!==it)throw new Error(`Expected ${ot} or ${it} bytes, got ${bt}`);return bytesToNumberLE(st(vt))}function ft(xt,vt){const bt=pt(vt),Et=mt(xt),wt=dt(bt,Et);if(wt===_0n$1)throw new Error("Invalid private or public key received");return ht(wt)}const yt=ht(et.Gu);function gt(xt){return ft(xt,yt)}return{scalarMult:ft,scalarMultBase:gt,getSharedSecret:(xt,vt)=>ft(xt,vt),getPublicKey:xt=>gt(xt),utils:{randomPrivateKey:()=>et.randomBytes(et.nByteLength)},GuBytes:yt}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const ED25519_P=BigInt("57896044618658097711785492504343953926634992332820282019728792003956564819949"),ED25519_SQRT_M1=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752");BigInt(0);const _1n$1=BigInt(1),_2n$1=BigInt(2),_3n$1=BigInt(3),_5n=BigInt(5),_8n$1=BigInt(8);function ed25519_pow_2_252_3(o){const et=BigInt(10),tt=BigInt(20),nt=BigInt(40),rt=BigInt(80),ot=ED25519_P,st=o*o%ot*o%ot,at=pow2$1(st,_2n$1,ot)*st%ot,ct=pow2$1(at,_1n$1,ot)*o%ot,lt=pow2$1(ct,_5n,ot)*ct%ot,dt=pow2$1(lt,et,ot)*lt%ot,ht=pow2$1(dt,tt,ot)*dt%ot,pt=pow2$1(ht,nt,ot)*ht%ot,mt=pow2$1(pt,rt,ot)*pt%ot,ft=pow2$1(mt,rt,ot)*pt%ot,yt=pow2$1(ft,et,ot)*lt%ot;return{pow_p_5_8:pow2$1(yt,_2n$1,ot)*o%ot,b2:st}}function adjustScalarBytes(o){return o[0]&=248,o[31]&=127,o[31]|=64,o}function uvRatio(o,et){const tt=ED25519_P,nt=mod$1(et*et*et,tt),rt=mod$1(nt*nt*et,tt),ot=ed25519_pow_2_252_3(o*rt).pow_p_5_8;let it=mod$1(o*nt*ot,tt);const st=mod$1(et*it*it,tt),at=it,ct=mod$1(it*ED25519_SQRT_M1,tt),lt=st===o,dt=st===mod$1(-o,tt),ht=st===mod$1(-o*ED25519_SQRT_M1,tt);return lt&&(it=at),(dt||ht)&&(it=ct),isNegativeLE(it,tt)&&(it=mod$1(-it,tt)),{isValid:lt||dt,value:it}}const Fp=Field$1(ED25519_P,void 0,!0),ed25519Defaults={a:BigInt(-1),d:BigInt("37095705934669439343138083508754565189542113879843219016388785533085940283555"),Fp,n:BigInt("7237005577332262213973186563042994240857116359379907606001950938285454250989"),h:_8n$1,Gx:BigInt("15112221349535400772501151409588531511454012693041857206046113283949847762202"),Gy:BigInt("46316835694926478169428394003475163141307993866256225615783033603165251855960"),hash:sha512,randomBytes:randomBytes$1,adjustScalarBytes,uvRatio},ed25519=twistedEdwards(ed25519Defaults),x25519=montgomery({P:ED25519_P,a:BigInt(486662),montgomeryBits:255,nByteLength:32,Gu:BigInt(9),powPminus2:o=>{const et=ED25519_P,{pow_p_5_8:tt,b2:nt}=ed25519_pow_2_252_3(o);return mod$1(pow2$1(tt,_3n$1,et)*nt,et)},adjustScalarBytes,randomBytes:randomBytes$1}),PUBLIC_KEY_BYTE_LENGTH=32,PRIVATE_KEY_BYTE_LENGTH=64,KEYS_BYTE_LENGTH=32;function generateKey(){const o=ed25519.utils.randomPrivateKey(),et=ed25519.getPublicKey(o);return{privateKey:concatKeys(o,et),publicKey:et}}function hashAndSign(o,et){const tt=o.subarray(0,KEYS_BYTE_LENGTH);return ed25519.sign(et instanceof Uint8Array?et:et.subarray(),tt)}function hashAndVerify$2(o,et,tt){return ed25519.verify(et,tt instanceof Uint8Array?tt:tt.subarray(),o)}function concatKeys(o,et){const tt=new Uint8Array(PRIVATE_KEY_BYTE_LENGTH);for(let nt=0;ntenumeration(__KeyTypeValues)})(KeyType||(KeyType={}));var PublicKey;(function(o){let et;o.codec=()=>(et==null&&(et=message$1((tt,nt,rt={})=>{rt.lengthDelimited!==!1&&nt.fork(),tt.Type!=null&&(nt.uint32(8),KeyType.codec().encode(tt.Type,nt)),tt.Data!=null&&(nt.uint32(18),nt.bytes(tt.Data)),rt.lengthDelimited!==!1&&nt.ldelim()},(tt,nt,rt={})=>{const ot={},it=nt==null?tt.len:tt.pos+nt;for(;tt.pos>>3){case 1:{ot.Type=KeyType.codec().decode(tt);break}case 2:{ot.Data=tt.bytes();break}default:{tt.skipType(st&7);break}}}return ot})),et),o.encode=tt=>encodeMessage(tt,o.codec()),o.decode=(tt,nt)=>decodeMessage(tt,o.codec(),nt)})(PublicKey||(PublicKey={}));var PrivateKey;(function(o){let et;o.codec=()=>(et==null&&(et=message$1((tt,nt,rt={})=>{rt.lengthDelimited!==!1&&nt.fork(),tt.Type!=null&&(nt.uint32(8),KeyType.codec().encode(tt.Type,nt)),tt.Data!=null&&(nt.uint32(18),nt.bytes(tt.Data)),rt.lengthDelimited!==!1&&nt.ldelim()},(tt,nt,rt={})=>{const ot={},it=nt==null?tt.len:tt.pos+nt;for(;tt.pos>>3){case 1:{ot.Type=KeyType.codec().decode(tt);break}case 2:{ot.Data=tt.bytes();break}default:{tt.skipType(st&7);break}}}return ot})),et),o.encode=tt=>encodeMessage(tt,o.codec()),o.decode=(tt,nt)=>decodeMessage(tt,o.codec(),nt)})(PrivateKey||(PrivateKey={}));/*! + Not dialing.`),!1}return await this.isPeerDialableBasedOnBootstrapStatus(tt)?this.dialAttemptsForPeer.has(tt.toString())?(log$j.warn(`Peer ${tt.toString()} has already been attempted dial before, or already has a dial attempt in progress, skipping dial`),!1):!0:(log$j.warn(`Peer ${tt.toString()} is not dialable based on bootstrap status. Not dialing.`),!1)}async isPeerDialableBasedOnBootstrapStatus(tt){return(await this.getTagNamesForPeer(tt)).some(it=>it===Tags.BOOTSTRAP)?this.libp2p.getConnections().filter(it=>it.tags.find(st=>st===Tags.BOOTSTRAP)).lengththis.configuredPubsubTopics.includes(it)):!0}async getPeerShardInfo(tt,nt){const ot=(await nt.get(tt)).metadata.get("shardInfo");if(ot)return decodeRelayShard(ot)}startNetworkStatusListener(){try{globalThis.addEventListener("online",this.onEventHandlers["browser:network"]),globalThis.addEventListener("offline",this.onEventHandlers["browser:network"])}catch(tt){log$j.error(`Failed to start network listener: ${tt}`)}}stopNetworkStatusListener(){try{globalThis.removeEventListener("online",this.onEventHandlers["browser:network"]),globalThis.removeEventListener("offline",this.onEventHandlers["browser:network"])}catch(tt){log$j.error(`Failed to stop network listener: ${tt}`)}}setP2PNetworkConnected(){this.isP2PNetworkConnected||(this.isP2PNetworkConnected=!0,this.dispatchWakuConnectionEvent())}setP2PNetworkDisconnected(){this.isP2PNetworkConnected&&this.libp2p.getConnections().length===0&&(this.isP2PNetworkConnected=!1,this.dispatchWakuConnectionEvent())}dispatchWakuConnectionEvent(){this.dispatchEvent(new CustomEvent(EConnectionStateEvents.CONNECTION_STATUS,{detail:this.isConnected()}))}};Ct(Pr,"instances",new Map);let ConnectionManager=Pr;const wr=class wr{constructor(){Ct(this,"health");this.health={overallStatus:HealthStatus.Unhealthy,protocolStatuses:new Map}}static getInstance(){return wr.instance||(wr.instance=new wr),wr.instance}getHealthStatus(){return this.health.overallStatus}getProtocolStatus(et){return this.health.protocolStatuses.get(et)}updateProtocolHealth(et,tt){const nt=this.getNameFromMulticodec(et);let rt=HealthStatus.Unhealthy;tt==1?rt=HealthStatus.MinimallyHealthy:tt>=2&&(rt=HealthStatus.SufficientlyHealthy),this.health.protocolStatuses.set(nt,{name:nt,status:rt,lastUpdate:new Date}),this.updateOverallHealth()}getNameFromMulticodec(et){let tt;if(et.includes("filter"))tt=Protocols.Filter;else if(et.includes("lightpush"))tt=Protocols.LightPush;else if(et.includes("store"))tt=Protocols.Store;else throw new Error(`Unknown protocol: ${et}`);return tt}updateOverallHealth(){const tt=[Protocols.LightPush,Protocols.Filter].map(nt=>{var rt;return(rt=this.getProtocolStatus(nt))==null?void 0:rt.status});tt.some(nt=>nt===HealthStatus.Unhealthy)?this.health.overallStatus=HealthStatus.Unhealthy:tt.some(nt=>nt===HealthStatus.MinimallyHealthy)?this.health.overallStatus=HealthStatus.MinimallyHealthy:this.health.overallStatus=HealthStatus.SufficientlyHealthy}};Ct(wr,"instance");let HealthManager=wr;const getHealthManager=()=>HealthManager.getInstance(),log$i=new Logger$1("metadata"),MetadataCodec="/vac/waku/metadata/1.0.0";class Metadata extends BaseProtocol{constructor(tt,nt){super(MetadataCodec,nt.components,log$i,tt);Ct(this,"pubsubTopics");Ct(this,"libp2pComponents");Ct(this,"handshakesConfirmed",new Map);this.pubsubTopics=tt,this.libp2pComponents=nt,nt.registrar.handle(MetadataCodec,rt=>{this.onRequest(rt)})}async query(tt){const nt=WakuMetadataRequest.encode(pubsubTopicsToShardInfo(this.pubsubTopics)),rt=await this.libp2pComponents.peerStore.get(tt);if(!rt)return{shardInfo:null,error:ProtocolError$1.NO_PEER_AVAILABLE};let ot;try{ot=await this.getStream(rt)}catch(ct){return log$i.error("Failed to get stream",ct),{shardInfo:null,error:ProtocolError$1.NO_STREAM_AVAILABLE}}const it=await pipe([nt],encode$5,ot,decode$5,async ct=>await all$2(ct)),{error:st,shardInfo:at}=this.decodeMetadataResponse(it);return st?{shardInfo:null,error:st}:(await this.savePeerShardInfo(tt,at),{shardInfo:at,error:null})}async confirmOrAttemptHandshake(tt){const nt=this.handshakesConfirmed.get(tt.toString());return nt?{shardInfo:nt,error:null}:await this.query(tt)}async onRequest(tt){try{const{stream:nt,connection:rt}=tt,ot=WakuMetadataResponse.encode(pubsubTopicsToShardInfo(this.pubsubTopics)),it=await pipe([ot],encode$5,nt,decode$5,async ct=>await all$2(ct)),{error:st,shardInfo:at}=this.decodeMetadataResponse(it);if(st)return;await this.savePeerShardInfo(rt.remotePeer,at)}catch(nt){log$i.error("Error handling metadata request",nt)}}decodeMetadataResponse(tt){const nt=new Uint8ArrayList;tt.forEach(ot=>{nt.append(ot)});const rt=WakuMetadataResponse.decode(nt);return rt?{shardInfo:rt,error:null}:(log$i.error("Error decoding metadata response"),{shardInfo:null,error:ProtocolError$1.DECODE_FAILED})}async savePeerShardInfo(tt,nt){await this.libp2pComponents.peerStore.merge(tt,{metadata:{shardInfo:encodeRelayShard(nt)}}),this.handshakesConfirmed.set(tt.toString(),nt)}}function wakuMetadata(o){return et=>new Metadata(o,et)}class Parser{constructor(){Ct(this,"index",0);Ct(this,"input","")}new(et){return this.index=0,this.input=et,this}readAtomically(et){const tt=this.index,nt=et();return nt===void 0&&(this.index=tt),nt}parseWith(et){const tt=et();if(this.index===this.input.length)return tt}peekChar(){if(!(this.index>=this.input.length))return this.input[this.index]}readChar(){if(!(this.index>=this.input.length))return this.input[this.index++]}readGivenChar(et){return this.readAtomically(()=>{const tt=this.readChar();if(tt===et)return tt})}readSeparator(et,tt,nt){return this.readAtomically(()=>{if(!(tt>0&&this.readGivenChar(et)===void 0))return nt()})}readNumber(et,tt,nt,rt){return this.readAtomically(()=>{let ot=0,it=0;const st=this.peekChar();if(st===void 0)return;const at=st==="0",ct=2**(8*rt)-1;for(;;){const lt=this.readAtomically(()=>{const dt=this.readChar();if(dt===void 0)return;const ht=Number.parseInt(dt,et);if(!Number.isNaN(ht))return ht});if(lt===void 0)break;if(ot*=et,ot+=lt,ot>ct||(it+=1,tt!==void 0&&it>tt))return}if(it!==0)return!nt&&at&&it>1?void 0:ot})}readIPv4Addr(){return this.readAtomically(()=>{const et=new Uint8Array(4);for(let tt=0;ttthis.readNumber(10,3,!1,1));if(nt===void 0)return;et[tt]=nt}return et})}readIPv6Addr(){const et=tt=>{for(let nt=0;ntthis.readIPv4Addr());if(it!==void 0)return tt[rt]=it[0],tt[rt+1]=it[1],tt[rt+2]=it[2],tt[rt+3]=it[3],[rt+4,!0]}const ot=this.readSeparator(":",nt,()=>this.readNumber(16,4,!0,2));if(ot===void 0)return[rt,!1];tt[rt]=ot>>8,tt[rt+1]=ot&255}return[tt.length,!1]};return this.readAtomically(()=>{const tt=new Uint8Array(16),[nt,rt]=et(tt);if(nt===16)return tt;if(rt||this.readGivenChar(":")===void 0||this.readGivenChar(":")===void 0)return;const ot=new Uint8Array(14),it=16-(nt+2),[st]=et(ot.subarray(0,it));return tt.set(ot.subarray(0,st),16-st),tt})}readIPAddr(){return this.readIPv4Addr()??this.readIPv6Addr()}}const MAX_IPV6_LENGTH=45,MAX_IPV4_LENGTH=15,parser=new Parser;function parseIPv4(o){if(!(o.length>MAX_IPV4_LENGTH))return parser.new(o).parseWith(()=>parser.readIPv4Addr())}function parseIPv6(o){if(o.includes("%")&&(o=o.split("%")[0]),!(o.length>MAX_IPV6_LENGTH))return parser.new(o).parseWith(()=>parser.readIPv6Addr())}function parseIP(o){if(o.includes("%")&&(o=o.split("%")[0]),!(o.length>MAX_IPV6_LENGTH))return parser.new(o).parseWith(()=>parser.readIPAddr())}function isIPv4(o){return!!parseIPv4(o)}function isIPv6(o){return!!parseIPv6(o)}function isIP(o){return!!parseIP(o)}const isV4=isIPv4,isV6=isIPv6,toBytes$1=function(o){let et=0;if(o=o.toString().trim(),isV4(o)){const tt=new Uint8Array(et+4);return o.split(/\./g).forEach(nt=>{tt[et++]=parseInt(nt,10)&255}),tt}if(isV6(o)){const tt=o.split(":",8);let nt;for(nt=0;nt0;nt--)ot.push("0");tt.splice.apply(tt,ot)}const rt=new Uint8Array(et+16);for(nt=0;nt>8&255,rt[et++]=ot&255}return rt}throw new Error("invalid ip address")},toString$7=function(o,et=0,tt){et=~~et,tt=tt??o.length-et;const nt=new DataView(o.buffer);if(tt===4){const rt=[];for(let ot=0;ot{const et=createProtocol(...o);codes[et.code]=et,names[et.name]=et});function createProtocol(o,et,tt,nt,rt){return{code:o,size:et,name:tt,resolvable:!!nt,path:!!rt}}function getProtocol(o){if(typeof o=="number"){if(codes[o]!=null)return codes[o];throw new Error(`no protocol with code: ${o}`)}else if(typeof o=="string"){if(names[o]!=null)return names[o];throw new Error(`no protocol with name: ${o}`)}throw new Error(`invalid protocol id type: ${typeof o}`)}getProtocol("ip4");getProtocol("ip6");getProtocol("ipcidr");function convertToString(o,et){switch(getProtocol(o).code){case 4:case 41:return bytes2ip(et);case 42:return bytes2str(et);case 6:case 273:case 33:case 132:return bytes2port(et).toString();case 53:case 54:case 55:case 56:case 400:case 449:case 777:return bytes2str(et);case 421:return bytes2mh(et);case 444:return bytes2onion(et);case 445:return bytes2onion(et);case 466:return bytes2mb(et);case 481:return globalThis.encodeURIComponent(bytes2str(et));default:return toString$8(et,"base16")}}function convertToBytes(o,et){switch(getProtocol(o).code){case 4:return ip2bytes(et);case 41:return ip2bytes(et);case 42:return str2bytes(et);case 6:case 273:case 33:case 132:return port2bytes(parseInt(et,10));case 53:case 54:case 55:case 56:case 400:case 449:case 777:return str2bytes(et);case 421:return mh2bytes(et);case 444:return onion2bytes(et);case 445:return onion32bytes(et);case 466:return mb2bytes(et);case 481:return str2bytes(globalThis.decodeURIComponent(et));default:return fromString(et,"base16")}}const decoders=Object.values(bases).map(o=>o.decoder),anybaseDecoder=function(){let o=decoders[0].or(decoders[1]);return decoders.slice(2).forEach(et=>o=o.or(et)),o}();function ip2bytes(o){if(!isIP(o))throw new Error("invalid ip address");return toBytes$1(o)}function bytes2ip(o){const et=toString$7(o,0,o.length);if(et==null)throw new Error("ipBuff is required");if(!isIP(et))throw new Error("invalid ip address");return et}function port2bytes(o){const et=new ArrayBuffer(2);return new DataView(et).setUint16(0,o),new Uint8Array(et)}function bytes2port(o){return new DataView(o.buffer).getUint16(o.byteOffset)}function str2bytes(o){const et=fromString(o),tt=Uint8Array.from(encode$a(et.length));return concat$1([tt,et],tt.length+et.length)}function bytes2str(o){const et=decode$b(o);if(o=o.slice(encodingLength$3(et)),o.length!==et)throw new Error("inconsistent lengths");return toString$8(o)}function mh2bytes(o){let et;o[0]==="Q"||o[0]==="1"?et=decode$6(base58btc.decode(`z${o}`)).bytes:et=CID.parse(o).multihash.bytes;const tt=Uint8Array.from(encode$a(et.length));return concat$1([tt,et],tt.length+et.length)}function mb2bytes(o){const et=anybaseDecoder.decode(o),tt=Uint8Array.from(encode$a(et.length));return concat$1([tt,et],tt.length+et.length)}function bytes2mb(o){const et=decode$b(o),tt=o.slice(encodingLength$3(et));if(tt.length!==et)throw new Error("inconsistent lengths");return"u"+toString$8(tt,"base64url")}function bytes2mh(o){const et=decode$b(o),tt=o.slice(encodingLength$3(et));if(tt.length!==et)throw new Error("inconsistent lengths");return toString$8(tt,"base58btc")}function onion2bytes(o){const et=o.split(":");if(et.length!==2)throw new Error(`failed to parse onion addr: ["'${et.join('", "')}'"]' does not contain a port number`);if(et[0].length!==16)throw new Error(`failed to parse onion addr: ${et[0]} not a Tor onion address.`);const tt=base32$2.decode("b"+et[0]),nt=parseInt(et[1],10);if(nt<1||nt>65536)throw new Error("Port number is not in range(1, 65536)");const rt=port2bytes(nt);return concat$1([tt,rt],tt.length+rt.length)}function onion32bytes(o){const et=o.split(":");if(et.length!==2)throw new Error(`failed to parse onion addr: ["'${et.join('", "')}'"]' does not contain a port number`);if(et[0].length!==56)throw new Error(`failed to parse onion addr: ${et[0]} not a Tor onion3 address.`);const tt=base32$2.decode(`b${et[0]}`),nt=parseInt(et[1],10);if(nt<1||nt>65536)throw new Error("Port number is not in range(1, 65536)");const rt=port2bytes(nt);return concat$1([tt,rt],tt.length+rt.length)}function bytes2onion(o){const et=o.slice(0,o.length-2),tt=o.slice(o.length-2),nt=toString$8(et,"base32"),rt=bytes2port(tt);return`${nt}:${rt}`}function stringToMultiaddrParts(o){o=cleanPath(o);const et=[],tt=[];let nt=null;const rt=o.split("/").slice(1);if(rt.length===1&&rt[0]==="")return{bytes:new Uint8Array,string:"/",tuples:[],stringTuples:[],path:null};for(let ot=0;ot=rt.length)throw ParseError("invalid address: "+o);if(st.path===!0){nt=cleanPath(rt.slice(ot).join("/")),et.push([st.code,convertToBytes(st.code,nt)]),tt.push([st.code,nt]);break}const at=convertToBytes(st.code,rt[ot]);et.push([st.code,at]),tt.push([st.code,convertToString(st.code,at)])}return{string:stringTuplesToString(tt),bytes:tuplesToBytes(et),tuples:et,stringTuples:tt,path:nt}}function bytesToMultiaddrParts(o){const et=[],tt=[];let nt=null,rt=0;for(;rto.length)throw ParseError("Invalid address Uint8Array: "+toString$8(o,"base16"));et.push([ot,ct]);const lt=convertToString(ot,ct);if(tt.push([ot,lt]),st.path===!0){nt=lt;break}}return{bytes:Uint8Array.from(o),string:stringTuplesToString(tt),tuples:et,stringTuples:tt,path:nt}}function stringTuplesToString(o){const et=[];return o.map(tt=>{const nt=getProtocol(tt[0]);return et.push(nt.name),tt.length>1&&tt[1]!=null&&et.push(tt[1]),null}),cleanPath(et.join("/"))}function tuplesToBytes(o){return concat$1(o.map(et=>{const tt=getProtocol(et[0]);let nt=Uint8Array.from(encode$a(tt.code));return et.length>1&&et[1]!=null&&(nt=concat$1([nt,et[1]])),nt}))}function sizeForAddr(o,et){if(o.size>0)return o.size/8;if(o.size===0)return 0;{const tt=decode$b(et instanceof Uint8Array?et:Uint8Array.from(et));return tt+encodingLength$3(tt)}}function cleanPath(o){return"/"+o.trim().split("/").filter(et=>et).join("/")}function ParseError(o){return new Error("Error parsing address: "+o)}const inspect$1=Symbol.for("nodejs.util.inspect.custom"),symbol=Symbol.for("@multiformats/js-multiaddr/multiaddr"),DNS_CODES=[getProtocol("dns").code,getProtocol("dns4").code,getProtocol("dns6").code,getProtocol("dnsaddr").code];class NoAvailableResolverError extends Error{constructor(et="No available resolver"){super(et),this.name="NoAvailableResolverError"}}var Xs,Kr,xr,so,ao;const Lr=class Lr{constructor(et){Ct(this,"bytes");fn(this,Kr);fn(this,xr);fn(this,so);fn(this,ao);Ct(this,Xs,!0);et==null&&(et="");let tt;if(et instanceof Uint8Array)tt=bytesToMultiaddrParts(et);else if(typeof et=="string"){if(et.length>0&&et.charAt(0)!=="/")throw new Error(`multiaddr "${et}" must start with a "/"`);tt=stringToMultiaddrParts(et)}else if(isMultiaddr(et))tt=bytesToMultiaddrParts(et.bytes);else throw new Error("addr must be a string, Buffer, or another Multiaddr");this.bytes=tt.bytes,un(this,Kr,tt.string),un(this,xr,tt.tuples),un(this,so,tt.stringTuples),un(this,ao,tt.path)}toString(){return Mt(this,Kr)}toJSON(){return this.toString()}toOptions(){let et,tt,nt,rt,ot="";const it=getProtocol("tcp"),st=getProtocol("udp"),at=getProtocol("ip4"),ct=getProtocol("ip6"),lt=getProtocol("dns6"),dt=getProtocol("ip6zone");for(const[pt,mt]of this.stringTuples())pt===dt.code&&(ot=`%${mt??""}`),DNS_CODES.includes(pt)&&(tt=it.name,rt=443,nt=`${mt??""}${ot}`,et=pt===lt.code?6:4),(pt===it.code||pt===st.code)&&(tt=getProtocol(pt).name,rt=parseInt(mt??"")),(pt===at.code||pt===ct.code)&&(tt=getProtocol(pt).name,nt=`${mt??""}${ot}`,et=pt===ct.code?6:4);if(et==null||tt==null||nt==null||rt==null)throw new Error('multiaddr must have a valid format: "/{ip4, ip6, dns4, dns6, dnsaddr}/{address}/{tcp, udp}/{port}".');return{family:et,host:nt,transport:tt,port:rt}}protos(){return Mt(this,xr).map(([et])=>Object.assign({},getProtocol(et)))}protoCodes(){return Mt(this,xr).map(([et])=>et)}protoNames(){return Mt(this,xr).map(([et])=>getProtocol(et).name)}tuples(){return Mt(this,xr)}stringTuples(){return Mt(this,so)}encapsulate(et){return et=new Lr(et),new Lr(this.toString()+et.toString())}decapsulate(et){const tt=et.toString(),nt=this.toString(),rt=nt.lastIndexOf(tt);if(rt<0)throw new Error(`Address ${this.toString()} does not contain subaddress: ${et.toString()}`);return new Lr(nt.slice(0,rt))}decapsulateCode(et){const tt=this.tuples();for(let nt=tt.length-1;nt>=0;nt--)if(tt[nt][0]===et)return new Lr(tuplesToBytes(tt.slice(0,nt)));return this}getPeerId(){try{let et=[];this.stringTuples().forEach(([nt,rt])=>{nt===names.p2p.code&&et.push([nt,rt]),nt===names["p2p-circuit"].code&&(et=[])});const tt=et.pop();if((tt==null?void 0:tt[1])!=null){const nt=tt[1];return nt[0]==="Q"||nt[0]==="1"?toString$8(base58btc.decode(`z${nt}`),"base58btc"):toString$8(CID.parse(nt).multihash.bytes,"base58btc")}return null}catch{return null}}getPath(){return Mt(this,ao)}equals(et){return equals(this.bytes,et.bytes)}async resolve(et){const tt=this.protos().find(ot=>ot.resolvable);if(tt==null)return[this];const nt=resolvers$1.get(tt.name);if(nt==null)throw new NoAvailableResolverError(`no available resolver for ${tt.name}`);return(await nt(this,et)).map(ot=>multiaddr(ot))}nodeAddress(){const et=this.toOptions();if(et.transport!=="tcp"&&et.transport!=="udp")throw new Error(`multiaddr must have a valid format - no protocol with name: "${et.transport}". Must have a valid transport protocol: "{tcp, udp}"`);return{family:et.family,address:et.host,port:et.port}}isThinWaistAddress(et){const tt=(et??this).protos();return!(tt.length!==2||tt[0].code!==4&&tt[0].code!==41||tt[1].code!==6&&tt[1].code!==273)}[(Xs=symbol,inspect$1)](){return`Multiaddr(${Mt(this,Kr)})`}};Kr=new WeakMap,xr=new WeakMap,so=new WeakMap,ao=new WeakMap;let Multiaddr=Lr;const resolvers$1=new Map;function isMultiaddr(o){return!!(o!=null&&o[symbol])}function multiaddr(o){return new Multiaddr(o)}const E_CANCELED=new Error("request for lock canceled");var __awaiter$2=function(o,et,tt,nt){function rt(ot){return ot instanceof tt?ot:new tt(function(it){it(ot)})}return new(tt||(tt=Promise))(function(ot,it){function st(lt){try{ct(nt.next(lt))}catch(dt){it(dt)}}function at(lt){try{ct(nt.throw(lt))}catch(dt){it(dt)}}function ct(lt){lt.done?ot(lt.value):rt(lt.value).then(st,at)}ct((nt=nt.apply(o,et||[])).next())})};class Semaphore{constructor(et,tt=E_CANCELED){this._value=et,this._cancelError=tt,this._queue=[],this._weightedWaiters=[]}acquire(et=1,tt=0){if(et<=0)throw new Error(`invalid weight ${et}: must be positive`);return new Promise((nt,rt)=>{const ot={resolve:nt,reject:rt,weight:et,priority:tt},it=findIndexFromEnd(this._queue,st=>tt<=st.priority);it===-1&&et<=this._value?this._dispatchItem(ot):this._queue.splice(it+1,0,ot)})}runExclusive(et){return __awaiter$2(this,arguments,void 0,function*(tt,nt=1,rt=0){const[ot,it]=yield this.acquire(nt,rt);try{return yield tt(ot)}finally{it()}})}waitForUnlock(et=1,tt=0){if(et<=0)throw new Error(`invalid weight ${et}: must be positive`);return this._couldLockImmediately(et,tt)?Promise.resolve():new Promise(nt=>{this._weightedWaiters[et-1]||(this._weightedWaiters[et-1]=[]),insertSorted(this._weightedWaiters[et-1],{resolve:nt,priority:tt})})}isLocked(){return this._value<=0}getValue(){return this._value}setValue(et){this._value=et,this._dispatchQueue()}release(et=1){if(et<=0)throw new Error(`invalid weight ${et}: must be positive`);this._value+=et,this._dispatchQueue()}cancel(){this._queue.forEach(et=>et.reject(this._cancelError)),this._queue=[]}_dispatchQueue(){for(this._drainUnlockWaiters();this._queue.length>0&&this._queue[0].weight<=this._value;)this._dispatchItem(this._queue.shift()),this._drainUnlockWaiters()}_dispatchItem(et){const tt=this._value;this._value-=et.weight,et.resolve([tt,this._newReleaser(et.weight)])}_newReleaser(et){let tt=!1;return()=>{tt||(tt=!0,this.release(et))}}_drainUnlockWaiters(){if(this._queue.length===0)for(let et=this._value;et>0;et--){const tt=this._weightedWaiters[et-1];tt&&(tt.forEach(nt=>nt.resolve()),this._weightedWaiters[et-1]=[])}else{const et=this._queue[0].priority;for(let tt=this._value;tt>0;tt--){const nt=this._weightedWaiters[tt-1];if(!nt)continue;const rt=nt.findIndex(ot=>ot.priority<=et);(rt===-1?nt:nt.splice(0,rt)).forEach(ot=>ot.resolve())}}}_couldLockImmediately(et,tt){return(this._queue.length===0||this._queue[0].priorityet.priority<=nt.priority);o.splice(tt+1,0,et)}function findIndexFromEnd(o,et){for(let tt=o.length-1;tt>=0;tt--)if(et(o[tt]))return tt;return-1}var __awaiter$1=function(o,et,tt,nt){function rt(ot){return ot instanceof tt?ot:new tt(function(it){it(ot)})}return new(tt||(tt=Promise))(function(ot,it){function st(lt){try{ct(nt.next(lt))}catch(dt){it(dt)}}function at(lt){try{ct(nt.throw(lt))}catch(dt){it(dt)}}function ct(lt){lt.done?ot(lt.value):rt(lt.value).then(st,at)}ct((nt=nt.apply(o,et||[])).next())})};class Mutex{constructor(et){this._semaphore=new Semaphore(1,et)}acquire(){return __awaiter$1(this,arguments,void 0,function*(et=0){const[,tt]=yield this._semaphore.acquire(1,et);return tt})}runExclusive(et,tt=0){return this._semaphore.runExclusive(()=>et(),1,tt)}isLocked(){return this._semaphore.isLocked()}waitForUnlock(et=0){return this._semaphore.waitForUnlock(1,et)}release(){this._semaphore.isLocked()&&this._semaphore.release()}cancel(){return this._semaphore.cancel()}}class PeerManager{constructor(et,tt,nt){Ct(this,"connectionManager");Ct(this,"core");Ct(this,"log");Ct(this,"peers",new Map);Ct(this,"healthManager");Ct(this,"readMutex",new Mutex);Ct(this,"writeMutex",new Mutex);Ct(this,"writeLockHolder",null);this.connectionManager=et,this.core=tt,this.log=nt,this.healthManager=getHealthManager(),this.healthManager.updateProtocolHealth(this.core.multicodec,0)}getWriteLockHolder(){return this.writeLockHolder}getPeers(){return Array.from(this.peers.values())}async addPeer(et){return this.writeMutex.runExclusive(async()=>{this.writeLockHolder=`addPeer: ${et.id.toString()}`,await this.connectionManager.attemptDial(et.id),this.peers.set(et.id.toString(),et),this.log.info(`Added and dialed peer: ${et.id.toString()}`),this.healthManager.updateProtocolHealth(this.core.multicodec,this.peers.size),this.writeLockHolder=null})}async removePeer(et){return this.writeMutex.runExclusive(()=>{this.writeLockHolder=`removePeer: ${et.toString()}`,this.peers.delete(et.toString()),this.log.info(`Removed peer: ${et.toString()}`),this.healthManager.updateProtocolHealth(this.core.multicodec,this.peers.size),this.writeLockHolder=null})}async getPeerCount(){return this.readMutex.runExclusive(()=>this.peers.size)}async hasPeers(){return this.readMutex.runExclusive(()=>this.peers.size>0)}async removeExcessPeers(et){this.log.info(`Removing ${et} excess peer(s)`);const tt=Array.from(this.peers.values()).slice(0,et);for(const nt of tt)await this.removePeer(nt.id)}async findAndAddPeers(et){const tt=await this.findPeers(et);return tt.length===0?(this.log.warn("No additional peers found"),[]):this.addMultiplePeers(tt)}async findPeers(et){const tt=await this.core.getPeers();return this.readMutex.runExclusive(async()=>tt.filter(rt=>!this.peers.has(rt.id.toString())).slice(0,et))}async addMultiplePeers(et){const tt=[];for(const nt of et)await this.addPeer(nt),tt.push(nt);return tt}}const DEFAULT_NUM_PEERS_TO_USE=2,DEFAULT_MAINTAIN_PEERS_INTERVAL=3e4;class BaseProtocolSDK{constructor(et,tt,nt){Ct(this,"core");Ct(this,"connectionManager");Ct(this,"peerManager");Ct(this,"numPeersToUse");Ct(this,"maintainPeersIntervalId",null);Ct(this,"log");this.core=et,this.connectionManager=tt,this.log=new Logger$1(`sdk:${et.multicodec}`),this.numPeersToUse=(nt==null?void 0:nt.numPeersToUse)??DEFAULT_NUM_PEERS_TO_USE;const rt=(nt==null?void 0:nt.maintainPeersInterval)??DEFAULT_MAINTAIN_PEERS_INTERVAL;this.peerManager=new PeerManager(tt,et,this.log),this.log.info(`Initializing BaseProtocolSDK with numPeersToUse: ${this.numPeersToUse}, maintainPeersInterval: ${rt}ms`),this.startMaintainPeersInterval(rt)}get connectedPeers(){return this.peerManager.getPeers().slice(0,this.numPeersToUse)}async renewPeer(et){this.log.info(`Attempting to renew peer ${et}`);const tt=await this.peerManager.findPeers(1);if(tt.length===0){this.log.error("Failed to find a new peer to replace the disconnected one");return}return await this.peerManager.removePeer(et),await this.peerManager.addPeer(tt[0]),this.log.info(`Successfully renewed peer. New peer: ${tt[0].id}`),tt[0]}stopMaintainPeersInterval(){this.maintainPeersIntervalId?(clearInterval(this.maintainPeersIntervalId),this.maintainPeersIntervalId=null,this.log.info("Maintain peers interval stopped")):this.log.info("Maintain peers interval was not running")}async hasPeers(et={}){const{forceUseAllPeers:tt=!1,maxAttempts:nt=3}=et;this.log.info(`Checking for peers. forceUseAllPeers: ${tt}, maxAttempts: ${nt}`);for(let rt=0;rt0)return this.log.info(`At least one peer connected (${this.connectedPeers.length}), not forcing use of all peers`),!0;if(this.connectedPeers.length>=this.numPeersToUse)return this.log.info(`Required number of peers (${this.numPeersToUse}) reached`),!0;this.log.warn(`Found only ${this.connectedPeers.length}/${this.numPeersToUse} required peers. Retrying...`)}return this.log.error(`Failed to find required number of peers (${this.numPeersToUse}) after ${nt} attempts`),!1}async startMaintainPeersInterval(et){this.log.info(`Starting maintain peers interval with ${et}ms interval`);try{this.maintainPeersIntervalId=setInterval(()=>{this.log.info("Running scheduled peer maintenance"),this.maintainPeers().catch(tt=>{this.log.error("Error during scheduled peer maintenance:",tt)})},et),this.log.info("Maintain peers interval started successfully")}catch(tt){throw this.log.error("Error starting maintain peers interval:",tt),tt}}async maintainPeers(){try{const et=await this.peerManager.getPeerCount(),tt=this.numPeersToUse-et;if(this.log.info(`Current peer count: ${et}, target: ${this.numPeersToUse}`),tt===0){this.log.info("Peer count is at target, no maintenance required");return}tt>0?(this.log.info(`Attempting to add ${tt} peer(s)`),await this.peerManager.findAndAddPeers(tt)):(this.log.info(`Attempting to remove ${Math.abs(tt)} excess peer(s)`),await this.peerManager.removeExcessPeers(Math.abs(tt)));const nt=await this.peerManager.getPeerCount();this.log.info(`Peer maintenance completed. Initial count: ${et}, Final count: ${nt}`)}catch(et){this.log.error("Error during peer maintenance",{error:et})}}}const DEFAULT_KEEP_ALIVE=6e4,DEFAULT_LIGHT_PUSH_FILTER_CHECK=!1,DEFAULT_LIGHT_PUSH_FILTER_CHECK_INTERVAL=1e4,DEFAULT_SUBSCRIBE_OPTIONS={keepAlive:DEFAULT_KEEP_ALIVE,enableLightPushFilterCheck:DEFAULT_LIGHT_PUSH_FILTER_CHECK};function messageHash(o,et){const tt=utf8ToBytes$1(o),nt=utf8ToBytes$1(et.contentTopic),rt=tryConvertTimestampToBytes(et.timestamp),ot=concat$2([tt,et.payload,nt,et.meta,rt].filter(isDefined));return sha256$2(ot)}function tryConvertTimestampToBytes(o){if(!o)return;let et;return typeof o=="bigint"?et=o:et=BigInt(o.valueOf())*1000000n,numberToBytes(et)}function messageHashStr(o,et){const tt=messageHash(o,et);return bytesToHex$1(tt)}const log$h=new Logger$1("sdk:receiver:reliability_monitor"),DEFAULT_MAX_PINGS=3,MESSAGE_VERIFICATION_DELAY=5e3;class ReceiverReliabilityMonitor{constructor(et,tt,nt,rt,ot,it,st){Ct(this,"pubsubTopic");Ct(this,"getPeers");Ct(this,"renewPeer");Ct(this,"getContentTopics");Ct(this,"protocolSubscribe");Ct(this,"addLibp2pEventListener");Ct(this,"sendLightPushMessage");Ct(this,"receivedMessagesFormPeer",new Set);Ct(this,"receivedMessages",new Set);Ct(this,"scheduledVerification",new Map);Ct(this,"verifiedPeers",new Set);Ct(this,"peerFailures",new Map);Ct(this,"maxPingFailures",DEFAULT_MAX_PINGS);Ct(this,"peerRenewalLocks",new Set);this.pubsubTopic=et,this.getPeers=tt,this.renewPeer=nt,this.getContentTopics=rt,this.protocolSubscribe=ot,this.addLibp2pEventListener=it,this.sendLightPushMessage=st,this.addLibp2pEventListener("peer:disconnect",at=>{const ct=at.detail;this.getPeers().some(lt=>lt.id.equals(ct))&&this.renewAndSubscribePeer(ct)})}setMaxPingFailures(et){et!==void 0&&(this.maxPingFailures=et)}async handlePingResult(et,tt){if(tt!=null&&tt.success){this.peerFailures.delete(et.toString());return}const nt=(this.peerFailures.get(et.toString())||0)+1;if(this.peerFailures.set(et.toString(),nt),nt>=this.maxPingFailures)try{log$h.info(`Attempting to renew ${et.toString()} due to ping failures.`),await this.renewAndSubscribePeer(et),this.peerFailures.delete(et.toString())}catch(rt){log$h.error(`Failed to renew peer ${et.toString()}: ${rt}.`)}}notifyMessageReceived(et,tt){const nt=this.buildMessageHash(tt);return this.verifiedPeers.add(et),this.receivedMessagesFormPeer.add(`${et}-${nt}`),log$h.info(`notifyMessage received debug: ephemeral:${tt.ephemeral} ${bytesToUtf8(tt.payload)}`),log$h.info(`notifyMessage received: peer:${et} message:${nt}`),this.receivedMessages.has(nt)?!0:(this.receivedMessages.add(nt),!1)}notifyMessageSent(et,tt){const nt=et.toString(),rt=this.buildMessageHash(tt);if(log$h.info(`notifyMessage sent debug: ${bytesToUtf8(tt.payload)}`),this.scheduledVerification.has(nt)){log$h.warn(`notifyMessage sent: attempting to schedule verification for pending peer:${nt} message:${rt}`);return}const ot=setTimeout(async()=>{const it=this.verifiedPeers.has(nt),st=this.receivedMessagesFormPeer.has(`${nt}-${rt}`);if(it||st){log$h.info(`notifyMessage sent setTimeout: verified that peer pushes filter messages, peer:${nt} message:${rt}`);return}log$h.warn(`notifyMessage sent setTimeout: peer didn't return probe message, attempting renewAndSubscribe, peer:${nt} message:${rt}`),this.scheduledVerification.delete(nt),await this.renewAndSubscribePeer(et)},MESSAGE_VERIFICATION_DELAY);this.scheduledVerification.set(nt,ot)}shouldVerifyPeer(et){const tt=et.toString(),nt=this.verifiedPeers.has(tt),rt=this.scheduledVerification.has(tt);return!(nt||rt)}buildMessageHash(et){return messageHashStr(this.pubsubTopic,et)}async renewAndSubscribePeer(et){const tt=et.toString();try{if(this.peerRenewalLocks.has(tt)){log$h.info(`Peer ${tt} is already being renewed.`);return}this.peerRenewalLocks.add(tt);const nt=await this.renewPeer(et);if(!nt){log$h.warn(`Failed to renew peer ${tt}: No new peer found.`);return}return await this.protocolSubscribe(this.pubsubTopic,nt,this.getContentTopics()),await this.sendLightPushMessage(nt),this.peerFailures.delete(tt),nt}catch(nt){log$h.error(`Failed to renew peer ${tt}: ${nt}.`);return}finally{this.peerRenewalLocks.delete(tt)}}}const Nr=class Nr{static createReceiverMonitor(et,tt,nt,rt,ot,it,st){if(Nr.receiverMonitors.has(et))return Nr.receiverMonitors.get(et);const at=new ReceiverReliabilityMonitor(et,tt,nt,rt,ot,it,st);return Nr.receiverMonitors.set(et,at),at}constructor(){}static stop(et){this.receiverMonitors.delete(et)}static stopAll(){for(const[et,tt]of this.receiverMonitors)tt.setMaxPingFailures(void 0),this.receiverMonitors.delete(et)}};Ct(Nr,"receiverMonitors",new Map);let ReliabilityMonitorManager=Nr;const log$g=new Logger$1("sdk:filter:subscription_manager");class SubscriptionManager{constructor(et,tt,nt,rt,ot,it,st){Ct(this,"pubsubTopic");Ct(this,"protocol");Ct(this,"connectionManager");Ct(this,"getPeers");Ct(this,"renewPeer");Ct(this,"libp2p");Ct(this,"lightPush");Ct(this,"reliabilityMonitor");Ct(this,"keepAliveTimeout",DEFAULT_KEEP_ALIVE);Ct(this,"keepAliveInterval",null);Ct(this,"enableLightPushFilterCheck",DEFAULT_LIGHT_PUSH_FILTER_CHECK);Ct(this,"subscriptionCallbacks");this.pubsubTopic=et,this.protocol=tt,this.connectionManager=nt,this.getPeers=rt,this.renewPeer=ot,this.libp2p=it,this.lightPush=st,this.pubsubTopic=et,this.subscriptionCallbacks=new Map,this.reliabilityMonitor=ReliabilityMonitorManager.createReceiverMonitor(this.pubsubTopic,this.getPeers.bind(this),this.renewPeer.bind(this),()=>Array.from(this.subscriptionCallbacks.keys()),this.protocol.subscribe.bind(this.protocol),this.protocol.addLibp2pEventListener.bind(this.protocol),this.sendLightPushCheckMessage.bind(this))}async subscribe(et,tt,nt=DEFAULT_SUBSCRIBE_OPTIONS){this.reliabilityMonitor.setMaxPingFailures(nt.pingsBeforePeerRenewed),this.keepAliveTimeout=nt.keepAlive||DEFAULT_KEEP_ALIVE,this.enableLightPushFilterCheck=(nt==null?void 0:nt.enableLightPushFilterCheck)||DEFAULT_LIGHT_PUSH_FILTER_CHECK;const rt=Array.isArray(et)?et:[et];for(const lt of rt)if(lt.pubsubTopic!==this.pubsubTopic)return{failures:[{error:ProtocolError$1.TOPIC_DECODER_MISMATCH}],successes:[]};this.enableLightPushFilterCheck&&rt.push(createDecoder(this.buildLightPushContentTopic(),this.pubsubTopic));const ot=groupByContentTopic(rt),it=Array.from(ot.keys()),st=this.getPeers().map(async lt=>this.subscribeWithPeerVerification(lt,it)),at=await Promise.allSettled(st),ct=this.handleResult(at,"subscribe");return ot.forEach((lt,dt)=>{const ht={decoders:lt,callback:tt};dt!==this.buildLightPushContentTopic()&&this.subscriptionCallbacks.set(dt,ht)}),this.startSubscriptionsMaintenance(this.keepAliveTimeout),ct}async unsubscribe(et){const tt=this.getPeers().map(async ot=>{const it=await this.protocol.unsubscribe(this.pubsubTopic,ot,et);return et.forEach(st=>{this.subscriptionCallbacks.delete(st)}),it}),nt=await Promise.allSettled(tt),rt=this.handleResult(nt,"unsubscribe");return this.subscriptionCallbacks.size===0&&this.stopSubscriptionsMaintenance(),rt}async ping(et){log$g.info("Sending keep-alive ping");const nt=(et?[et]:this.getPeers().map(ot=>ot.id)).map(ot=>this.pingSpecificPeer(ot)),rt=await Promise.allSettled(nt);return this.handleResult(rt,"ping")}async unsubscribeAll(){const et=this.getPeers().map(async rt=>this.protocol.unsubscribeAll(this.pubsubTopic,rt)),tt=await Promise.allSettled(et);this.subscriptionCallbacks.clear();const nt=this.handleResult(tt,"unsubscribeAll");return this.stopSubscriptionsMaintenance(),nt}async processIncomingMessage(et,tt){if(this.reliabilityMonitor.notifyMessageReceived(tt,et)){log$g.info("Message already received, skipping");return}const{contentTopic:rt}=et,ot=this.subscriptionCallbacks.get(rt);if(!ot){log$g.error("No subscription callback available for ",rt);return}log$g.info("Processing message with content topic ",rt," on pubsub topic ",this.pubsubTopic),await pushMessage(ot,this.pubsubTopic,et)}async subscribeWithPeerVerification(et,tt){const nt=await this.protocol.subscribe(this.pubsubTopic,et,tt);return await this.sendLightPushCheckMessage(et),nt}handleResult(et,tt){const nt={failures:[],successes:[]};for(const rt of et)if(rt.status==="rejected")log$g.error(`Failed to resolve ${tt} promise successfully: `,rt.reason),nt.failures.push({error:ProtocolError$1.GENERIC_FAIL});else{const ot=rt.value;ot.failure?nt.failures.push(ot.failure):nt.successes.push(ot.success)}return nt}async pingSpecificPeer(et){var rt,ot;const tt=this.getPeers().find(it=>it.id.equals(et));if(!tt)return{success:null,failure:{peerId:et,error:ProtocolError$1.NO_PEER_AVAILABLE}};let nt;try{nt=await this.protocol.ping(tt)}catch{nt={success:null,failure:{peerId:et,error:ProtocolError$1.GENERIC_FAIL}}}return log$g.info(`Received result from filter ping peerId:${et.toString()} success:${(rt=nt.success)==null?void 0:rt.toString()} failure:${(ot=nt.failure)==null?void 0:ot.error}`),await this.reliabilityMonitor.handlePingResult(et,nt),nt}startSubscriptionsMaintenance(et){log$g.info("Starting subscriptions maintenance"),this.startKeepAlivePings(et),this.startConnectionListener()}stopSubscriptionsMaintenance(){log$g.info("Stopping subscriptions maintenance"),this.stopKeepAlivePings(),this.stopConnectionListener()}startConnectionListener(){this.connectionManager.addEventListener(EConnectionStateEvents.CONNECTION_STATUS,this.connectionListener.bind(this))}stopConnectionListener(){this.connectionManager.removeEventListener(EConnectionStateEvents.CONNECTION_STATUS,this.connectionListener.bind(this))}async connectionListener({detail:et}){if(!et){this.stopKeepAlivePings();return}try{await this.ping()}catch(tt){log$g.error(`networkStateListener failed to recover: ${tt}`)}this.startKeepAlivePings(this.keepAliveTimeout)}startKeepAlivePings(et){if(this.keepAliveInterval){log$g.info("Recurring pings already set up.");return}this.keepAliveInterval=setInterval(()=>{this.ping()},et)}stopKeepAlivePings(){if(!this.keepAliveInterval){log$g.info("Already stopped recurring pings.");return}log$g.info("Stopping recurring pings."),clearInterval(this.keepAliveInterval),this.keepAliveInterval=null}async sendLightPushCheckMessage(et){if(this.lightPush&&this.libp2p&&this.reliabilityMonitor.shouldVerifyPeer(et.id)){const tt=createEncoder({contentTopic:this.buildLightPushContentTopic(),pubsubTopic:this.pubsubTopic,ephemeral:!0}),nt={payload:new Uint8Array(1)},rt=await tt.toProtoObj(nt);setTimeout(async()=>{const ot=await this.lightPush.protocol.send(tt,nt,et);if(this.reliabilityMonitor.notifyMessageSent(et.id,rt),ot.failure){log$g.error(`failed to send lightPush ping message to peer:${et.id.toString()} ${ot.failure.error}`);return}},DEFAULT_LIGHT_PUSH_FILTER_CHECK_INTERVAL)}}buildLightPushContentTopic(){return`/js-waku-subscription-ping/1/${this.libp2p.peerId.toString()}/utf8`}}async function pushMessage(o,et,tt){const{decoders:nt,callback:rt}=o,{contentTopic:ot}=tt;if(!ot){log$g.warn("Message has no content topic, skipping");return}try{const it=nt.map(at=>at.fromProtoObj(et,tt).then(ct=>ct||Promise.reject("Decoding failed"))),st=await Promise.any(it);await rt(st)}catch(it){log$g.error("Error decoding message",it)}}const log$f=new Logger$1("sdk:filter");class Filter extends BaseProtocolSDK{constructor(tt,nt,rt,ot){super(new FilterCore(async(it,st,at)=>{const ct=this.getActiveSubscription(it);if(!ct){log$f.error(`No subscription locally registered for topic ${it}`);return}await ct.processIncomingMessage(st,at)},tt.configuredPubsubTopics,nt),tt,{numPeersToUse:ot==null?void 0:ot.numPeersToUse});Ct(this,"libp2p");Ct(this,"lightPush");Ct(this,"protocol");Ct(this,"activeSubscriptions",new Map);this.libp2p=nt,this.lightPush=rt,this.protocol=this.core,this.activeSubscriptions=new Map}async subscribe(tt,nt,rt,ot=DEFAULT_SUBSCRIBE_OPTIONS){const it=this.getUniquePubsubTopics(tt);if(it.length!==1)return{subscription:null,error:ProtocolError$1.INVALID_DECODER_TOPICS,results:null};const st=it[0],{subscription:at,error:ct}=await this.createSubscription(st,rt);if(ct)return{subscription:null,error:ct,results:null};const{failures:lt,successes:dt}=await at.subscribe(tt,nt,ot);return{subscription:at,error:null,results:{failures:lt,successes:dt}}}async createSubscription(tt,nt){var st;nt={autoRetry:!0,...nt};const rt=typeof tt=="string"?tt:(st=shardInfoToPubsubTopics(tt))==null?void 0:st[0];return ensurePubsubTopicIsConfigured(rt,this.protocol.pubsubTopics),await this.hasPeers(nt)?(log$f.info(`Creating filter subscription with ${this.connectedPeers.length} peers: `,this.connectedPeers.map(at=>at.id.toString())),{error:null,subscription:this.getActiveSubscription(rt)??this.setActiveSubscription(rt,new SubscriptionManager(rt,this.protocol,this.connectionManager,()=>this.connectedPeers,this.renewPeer.bind(this),this.libp2p,this.lightPush))}):{error:ProtocolError$1.NO_PEER_AVAILABLE,subscription:null}}async subscribeWithUnsubscribe(tt,nt,rt=DEFAULT_SUBSCRIBE_OPTIONS){const ot=this.getUniquePubsubTopics(tt);if(ot.length===0)throw Error("Failed to subscribe: no pubsubTopic found on decoders provided.");if(ot.length>1)throw Error("Failed to subscribe: all decoders should have the same pubsub topic. Use createSubscription to be more agile.");const{subscription:it,error:st}=await this.createSubscription(ot[0]);if(st)throw Error(`Failed to create subscription: ${st}`);await it.subscribe(tt,nt,rt);const at=Array.from(groupByContentTopic(Array.isArray(tt)?tt:[tt]).keys());return async()=>{await it.unsubscribe(at)}}toSubscriptionIterator(tt){return toAsyncIterator(this,tt)}getActiveSubscription(tt){return this.activeSubscriptions.get(tt)}setActiveSubscription(tt,nt){return this.activeSubscriptions.set(tt,nt),nt}getUniquePubsubTopics(tt){return Array.isArray(tt)?tt.length===0?[]:[...new Set(tt.map(rt=>rt.pubsubTopic))]:[tt.pubsubTopic]}}function wakuFilter(o,et,tt){return nt=>new Filter(o,nt,et,tt)}const log$e=new Logger$1("sdk:light-push"),DEFAULT_MAX_ATTEMPTS=3,DEFAULT_SEND_OPTIONS={autoRetry:!1,maxAttempts:DEFAULT_MAX_ATTEMPTS};class LightPush{constructor(et,tt,nt){Ct(this,"libp2p");Ct(this,"numPeersToUse",DEFAULT_NUM_PEERS_TO_USE);Ct(this,"protocol");this.libp2p=tt,this.numPeersToUse=(nt==null?void 0:nt.numPeersToUse)??DEFAULT_NUM_PEERS_TO_USE,this.protocol=new LightPushCore(et.configuredPubsubTopics,tt)}async send(et,tt,nt=DEFAULT_SEND_OPTIONS){const rt=[],ot=[],{pubsubTopic:it}=et;try{ensurePubsubTopicIsConfigured(it,this.protocol.pubsubTopics)}catch{return log$e.error("Failed to send waku light push: pubsub topic not configured"),{successes:rt,failures:[{error:ProtocolError$1.TOPIC_NOT_CONFIGURED}]}}const st=await this.getConnectedPeers();if(st.length===0)return{successes:rt,failures:[{error:ProtocolError$1.NO_PEER_AVAILABLE}]};const at=await Promise.allSettled(st.map(ct=>this.protocol.send(et,tt,ct)));for(const ct of at){if(ct.status!=="fulfilled"){log$e.error("Failed unexpectedly while sending:",ct.reason),ot.push({error:ProtocolError$1.GENERIC_FAIL});continue}const{failure:lt,success:dt}=ct.value;if(dt){rt.push(dt);continue}lt&&(ot.push(lt),nt!=null&&nt.autoRetry&&this.attemptRetries(ht=>this.protocol.send(et,tt,ht),nt.maxAttempts))}return getHealthManager().updateProtocolHealth(this.protocol.multicodec,rt.length),{successes:rt,failures:ot}}async attemptRetries(et,tt){var rt;tt=tt||DEFAULT_MAX_ATTEMPTS;const nt=await this.getConnectedPeers();if(nt.length===0){log$e.warn("Cannot retry with no connected peers.");return}for(let ot=0;ot{try{return await this.libp2p.peerStore.get(nt)}catch{return null}}))).filter(nt=>!!nt).filter(nt=>nt.protocols.includes(LightPushCodec)).slice(0,this.numPeersToUse)}}function wakuLightPush(o,et={}){return tt=>new LightPush(o,tt,et)}const DEFAULT_NUM_PEERS=1,log$d=new Logger$1("waku:store:sdk");class Store extends BaseProtocolSDK{constructor(tt,nt){super(new StoreCore(tt.configuredPubsubTopics,nt),tt,{numPeersToUse:DEFAULT_NUM_PEERS});Ct(this,"protocol");this.protocol=this.core}async*queryGenerator(tt,nt){const{pubsubTopic:rt,contentTopics:ot,decodersAsMap:it}=this.validateDecodersAndPubsubTopic(tt),st={pubsubTopic:rt,contentTopics:ot,includeData:!0,paginationForward:!0,...nt},at=(await this.protocol.getPeers({numPeers:this.numPeersToUse,maxBootstrapPeers:1}))[0];if(!at)throw log$d.error("No peers available to query"),new Error("No peers available to query");log$d.info(`Querying store with options: ${JSON.stringify(nt)}`);const ct=this.protocol.queryPerPage(st,it,at);for await(const lt of ct)yield lt}async queryWithOrderedCallback(tt,nt,rt){log$d.info("Querying store with ordered callback");for await(const ot of this.queryGenerator(tt,rt))if(await this.processMessages(ot,nt))break}async queryWithPromiseCallback(tt,nt,rt){log$d.info("Querying store with promise callback");let ot=!1;for await(const it of this.queryGenerator(tt,rt)){const st=it.map(async at=>{ot||(ot=!!await nt(at))});if(await Promise.all(st),ot)break}}async processMessages(tt,nt){let rt=!1;const it=(await Promise.all(tt)).filter(isDefined);return await Promise.all(it.map(async st=>{st&&!rt&&(rt=!!await nt(st))})),rt}createCursor(tt){return messageHash(tt.pubsubTopic,tt)}validateDecodersAndPubsubTopic(tt){if(tt.length===0)throw log$d.error("No decoders provided"),new Error("No decoders provided");const nt=Array.from(new Set(tt.map(st=>st.pubsubTopic)));if(nt.length>1)throw log$d.error("API does not support querying multiple pubsub topics at once"),new Error("API does not support querying multiple pubsub topics at once");const rt=nt[0];ensurePubsubTopicIsConfigured(rt,this.protocol.pubsubTopics);const ot=new Map;tt.forEach(st=>{if(ot.has(st.contentTopic))throw log$d.error("API does not support different decoder per content topic"),new Error("API does not support different decoder per content topic");ot.set(st.contentTopic,st)});const it=tt.filter(st=>st.pubsubTopic===rt).map(st=>st.contentTopic);if(it.length===0)throw log$d.error(`No decoders found for topic ${rt}`),new Error("No decoders found for topic "+rt);return{pubsubTopic:rt,contentTopics:it,decodersAsMap:ot}}}function wakuStore(o){return et=>new Store(o,et)}const log$c=new Logger$1("wait-for-remote-peer");async function waitForRemotePeer(o,et,tt){et=et!=null&&et.length?et:getEnabledProtocols(o);const nt=o.libp2p.getConnections();if(!o.isStarted())throw Error("Waku node is not started");for(const ot of et)switch(ot){case Protocols.Relay:if(!o.relay)throw Error("Cannot wait for Relay peer: protocol not mounted");break;case Protocols.LightPush:if(!o.lightPush)throw Error("Cannot wait for LightPush peer: protocol not mounted");break;case Protocols.Store:if(!o.store)throw Error("Cannot wait for Store peer: protocol not mounted");break;case Protocols.Filter:if(!o.filter)throw Error("Cannot wait for Filter peer: protocol not mounted");break}const rt=[waitForProtocols(o,et)];nt.length>0&&!et.includes(Protocols.Relay)&&rt.push(waitForMetadata(o,et)),tt?await rejectOnTimeout(Promise.any(rt),tt,"Timed out waiting for a remote peer."):await Promise.any(rt)}async function waitForProtocols(o,et){const tt=[];return o.relay&&et.includes(Protocols.Relay)&&tt.push(o.relay.waitForPeers()),o.store&&et.includes(Protocols.Store)&&tt.push(waitForConnectedPeer(StoreCodec,o.libp2p)),o.lightPush&&et.includes(Protocols.LightPush)&&tt.push(waitForConnectedPeer(LightPushCodec,o.libp2p)),o.filter&&et.includes(Protocols.Filter)&&tt.push(waitForConnectedPeer(FilterCodecs.SUBSCRIBE,o.libp2p)),Promise.all(tt)}async function waitForConnectedPeer(o,et){log$c.info(`Waiting for ${o} peer.`),await new Promise(tt=>{const nt=async rt=>{var ot,it;if((it=(ot=rt.detail)==null?void 0:ot.protocols)!=null&&it.includes(o)){const st=et.services.metadata;if(!st){et.removeEventListener("peer:identify",nt),tt();return}try{await st.confirmOrAttemptHandshake(rt.detail.peerId),et.removeEventListener("peer:identify",nt),tt()}catch(at){at.code==="ERR_CONNECTION_BEING_CLOSED"&&log$c.error("Connection closed. Some peers can be on different shard."),log$c.error(`Error waiting for metadata: ${at}`)}}};et.addEventListener("peer:identify",nt)})}async function waitForMetadata(o,et){const tt=o.libp2p.getPeers(),nt=o.libp2p.services.metadata,rt=mapProtocolsToCodecs(et);if(!tt.length||!nt){log$c.info(`Skipping waitForMetadata due to missing connections:${tt.length} or metadataService:${!!nt}`);return}for(const ot of tt)try{const it=await o.libp2p.peerStore.get(ot);if(it.protocols.some(at=>rt.has(at))&&!(await nt.confirmOrAttemptHandshake(ot)).error&&(it.protocols.forEach(lt=>{rt.has(lt)&&rt.set(lt,!0)}),Array.from(rt.values()).every(lt=>lt)))return}catch(it){it.code==="ERR_CONNECTION_BEING_CLOSED"&&log$c.error("Connection closed. Some peers can be on different shard."),log$c.error(`Error while iterating through peers: ${it}`);continue}}const awaitTimeout=(o,et)=>new Promise((tt,nt)=>setTimeout(()=>nt(Error(et)),o));async function rejectOnTimeout(o,et,tt){await Promise.race([o,awaitTimeout(et,tt)])}function getEnabledProtocols(o){const et=[];return o.relay&&et.push(Protocols.Relay),o.filter&&et.push(Protocols.Filter),o.store&&et.push(Protocols.Store),o.lightPush&&et.push(Protocols.LightPush),et}function mapProtocolsToCodecs(o){const et=new Map,tt={[Protocols.Filter]:FilterCodecs.SUBSCRIBE,[Protocols.LightPush]:LightPushCodec,[Protocols.Store]:StoreCodec};for(const nt of o)tt[nt]&&et.set(tt[nt],!1);return et}const DefaultPingKeepAliveValueSecs=5*60,DefaultRelayKeepAliveValueSecs=5*60,DefaultUserAgent="js-waku",DefaultPingMaxInboundStreams=10,log$b=new Logger$1("waku");class WakuNode{constructor(et,tt,nt,rt,ot){Ct(this,"pubsubTopics");Ct(this,"libp2p");Ct(this,"relay");Ct(this,"store");Ct(this,"filter");Ct(this,"lightPush");Ct(this,"connectionManager");Ct(this,"health");this.pubsubTopics=et,this.relay=ot,this.libp2p=nt,rt={filter:!1,lightpush:!1,store:!1,...rt};const it=tt.pingKeepAlive||DefaultPingKeepAliveValueSecs,st=this.relay?tt.relayKeepAlive||DefaultRelayKeepAliveValueSecs:0,at=this.libp2p.peerId.toString();if(this.connectionManager=ConnectionManager.create(at,nt,{pingKeepAlive:it,relayKeepAlive:st},this.pubsubTopics,this.relay),this.health=getHealthManager(),rt.store){const ct=wakuStore(this.connectionManager);this.store=ct(nt)}if(rt.lightpush){const ct=wakuLightPush(this.connectionManager,tt);this.lightPush=ct(nt)}if(rt.filter){const ct=wakuFilter(this.connectionManager,this.lightPush,tt);this.filter=ct(nt)}log$b.info("Waku node created",at,`relay: ${!!this.relay}, store: ${!!this.store}, light push: ${!!this.lightPush}, filter: ${!!this.filter}`)}get peerId(){return this.libp2p.peerId}get protocols(){return this.libp2p.getProtocols()}async dial(et,tt){const nt=tt??[],rt=this.mapToPeerIdOrMultiaddr(et);typeof tt>"u"&&(this.relay&&nt.push(Protocols.Relay),this.store&&nt.push(Protocols.Store),this.filter&&nt.push(Protocols.Filter),this.lightPush&&nt.push(Protocols.LightPush));const ot=[];return nt.includes(Protocols.Relay)&&(this.relay?this.relay.gossipSub.multicodecs.forEach(it=>ot.push(it)):log$b.error("Relay codec not included in dial codec: protocol not mounted locally")),nt.includes(Protocols.Store)&&(this.store?ot.push(this.store.protocol.multicodec):log$b.error("Store codec not included in dial codec: protocol not mounted locally")),nt.includes(Protocols.LightPush)&&(this.lightPush?ot.push(this.lightPush.protocol.multicodec):log$b.error("Light Push codec not included in dial codec: protocol not mounted locally")),nt.includes(Protocols.Filter)&&(this.filter?ot.push(this.filter.protocol.multicodec):log$b.error("Filter codec not included in dial codec: protocol not mounted locally")),log$b.info(`Dialing to ${rt.toString()} with protocols ${nt}`),this.libp2p.dialProtocol(rt,ot)}async start(){await this.libp2p.start()}async stop(){ReliabilityMonitorManager.stopAll(),this.connectionManager.stop(),await this.libp2p.stop()}async waitForPeers(et,tt){return waitForRemotePeer(this,et,tt)}isStarted(){return this.libp2p.status=="started"}isConnected(){return this.connectionManager.isConnected()}mapToPeerIdOrMultiaddr(et){return isPeerId$2(et)?et:multiaddr(et)}}var ls;let InvalidParametersError$3=(ls=class extends Error{constructor(et="Invalid parameters"){super(et),this.name="InvalidParametersError"}},Ct(ls,"name","InvalidParametersError"),ls);class InvalidPublicKeyError extends Error{constructor(et="Invalid public key"){super(et),this.name="InvalidPublicKeyError"}}Ct(InvalidPublicKeyError,"name","InvalidPublicKeyError");var us;let UnsupportedKeyTypeError$1=(us=class extends Error{constructor(et="Unsupported key type"){super(et),this.name="UnsupportedKeyTypeError"}},Ct(us,"name","UnsupportedKeyTypeError"),us);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const _0n$2=BigInt(0),_1n$3=BigInt(1),_2n$2=BigInt(2),_8n$2=BigInt(8),VERIFY_DEFAULT={zip215:!0};function validateOpts$1(o){const et=validateBasic(o);return validateObject(o,{hash:"function",a:"bigint",d:"bigint",randomBytes:"function"},{adjustScalarBytes:"function",domain:"function",uvRatio:"function",mapToCurve:"function"}),Object.freeze({...et})}function twistedEdwards(o){const et=validateOpts$1(o),{Fp:tt,n:nt,prehash:rt,hash:ot,randomBytes:it,nByteLength:st,h:at}=et,ct=_2n$2<{try{return{isValid:!0,value:tt.sqrt(Yt*tt.inv(Ht))}}catch{return{isValid:!1,value:_0n$2}}}),pt=et.adjustScalarBytes||(Yt=>Yt),mt=et.domain||((Yt,Ht,Ut)=>{if(abool("phflag",Ut),Ht.length||Ut)throw new Error("Contexts/pre-hash are not supported");return Yt});function ft(Yt,Ht){aInRange("coordinate "+Yt,Ht,_0n$2,ct)}function yt(Yt){if(!(Yt instanceof vt))throw new Error("ExtendedPoint expected")}const gt=memoized((Yt,Ht)=>{const{ex:Ut,ey:qt,ez:Lt}=Yt,Zt=Yt.is0();Ht==null&&(Ht=Zt?_8n$2:tt.inv(Lt));const Qt=lt(Ut*Ht),Nt=lt(qt*Ht),Gt=lt(Lt*Ht);if(Zt)return{x:_0n$2,y:_1n$3};if(Gt!==_1n$3)throw new Error("invZ was invalid");return{x:Qt,y:Nt}}),xt=memoized(Yt=>{const{a:Ht,d:Ut}=et;if(Yt.is0())throw new Error("bad point: ZERO");const{ex:qt,ey:Lt,ez:Zt,et:Qt}=Yt,Nt=lt(qt*qt),Gt=lt(Lt*Lt),nn=lt(Zt*Zt),Wt=lt(nn*nn),hn=lt(Nt*Ht),Xt=lt(nn*lt(hn+Gt)),Jt=lt(Wt+lt(Ut*lt(Nt*Gt)));if(Xt!==Jt)throw new Error("bad point: equation left != right (1)");const tn=lt(qt*Lt),_t=lt(Zt*Qt);if(tn!==_t)throw new Error("bad point: equation left != right (2)");return!0});class vt{constructor(Ht,Ut,qt,Lt){this.ex=Ht,this.ey=Ut,this.ez=qt,this.et=Lt,ft("x",Ht),ft("y",Ut),ft("z",qt),ft("t",Lt),Object.freeze(this)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static fromAffine(Ht){if(Ht instanceof vt)throw new Error("extended point not allowed");const{x:Ut,y:qt}=Ht||{};return ft("x",Ut),ft("y",qt),new vt(Ut,qt,_1n$3,lt(Ut*qt))}static normalizeZ(Ht){const Ut=tt.invertBatch(Ht.map(qt=>qt.ez));return Ht.map((qt,Lt)=>qt.toAffine(Ut[Lt])).map(vt.fromAffine)}static msm(Ht,Ut){return pippenger(vt,dt,Ht,Ut)}_setWindowSize(Ht){wt.setWindowSize(this,Ht)}assertValidity(){xt(this)}equals(Ht){yt(Ht);const{ex:Ut,ey:qt,ez:Lt}=this,{ex:Zt,ey:Qt,ez:Nt}=Ht,Gt=lt(Ut*Nt),nn=lt(Zt*Lt),Wt=lt(qt*Nt),hn=lt(Qt*Lt);return Gt===nn&&Wt===hn}is0(){return this.equals(vt.ZERO)}negate(){return new vt(lt(-this.ex),this.ey,this.ez,lt(-this.et))}double(){const{a:Ht}=et,{ex:Ut,ey:qt,ez:Lt}=this,Zt=lt(Ut*Ut),Qt=lt(qt*qt),Nt=lt(_2n$2*lt(Lt*Lt)),Gt=lt(Ht*Zt),nn=Ut+qt,Wt=lt(lt(nn*nn)-Zt-Qt),hn=Gt+Qt,Xt=hn-Nt,Jt=Gt-Qt,tn=lt(Wt*Xt),_t=lt(hn*Jt),Dt=lt(Wt*Jt),Vt=lt(Xt*hn);return new vt(tn,_t,Vt,Dt)}add(Ht){yt(Ht);const{a:Ut,d:qt}=et,{ex:Lt,ey:Zt,ez:Qt,et:Nt}=this,{ex:Gt,ey:nn,ez:Wt,et:hn}=Ht;if(Ut===BigInt(-1)){const mn=lt((Zt-Lt)*(nn+Gt)),wn=lt((Zt+Lt)*(nn-Gt)),Tn=lt(wn-mn);if(Tn===_0n$2)return this.double();const Pn=lt(Qt*_2n$2*hn),yn=lt(Nt*_2n$2*Wt),En=yn+Pn,on=wn+mn,Tt=yn-Pn,St=lt(En*Tn),At=lt(on*Tt),$t=lt(En*Tt),Kt=lt(Tn*on);return new vt(St,At,Kt,$t)}const Xt=lt(Lt*Gt),Jt=lt(Zt*nn),tn=lt(Nt*qt*hn),_t=lt(Qt*Wt),Dt=lt((Lt+Zt)*(Gt+nn)-Xt-Jt),Vt=_t-tn,en=_t+tn,an=lt(Jt-Ut*Xt),dn=lt(Dt*Vt),ln=lt(en*an),pn=lt(Dt*an),kn=lt(Vt*en);return new vt(dn,ln,kn,pn)}subtract(Ht){return this.add(Ht.negate())}wNAF(Ht){return wt.wNAFCached(this,Ht,vt.normalizeZ)}multiply(Ht){const Ut=Ht;aInRange("scalar",Ut,_1n$3,nt);const{p:qt,f:Lt}=this.wNAF(Ut);return vt.normalizeZ([qt,Lt])[0]}multiplyUnsafe(Ht){const Ut=Ht;return aInRange("scalar",Ut,_0n$2,nt),Ut===_0n$2?Et:this.equals(Et)||Ut===_1n$3?this:this.equals(bt)?this.wNAF(Ut).p:wt.unsafeLadder(this,Ut)}isSmallOrder(){return this.multiplyUnsafe(at).is0()}isTorsionFree(){return wt.unsafeLadder(this,nt).is0()}toAffine(Ht){return gt(this,Ht)}clearCofactor(){const{h:Ht}=et;return Ht===_1n$3?this:this.multiplyUnsafe(Ht)}static fromHex(Ht,Ut=!1){const{d:qt,a:Lt}=et,Zt=tt.BYTES;Ht=ensureBytes$1("pointHex",Ht,Zt),abool("zip215",Ut);const Qt=Ht.slice(),Nt=Ht[Zt-1];Qt[Zt-1]=Nt&-129;const Gt=bytesToNumberLE(Qt),nn=Ut?ct:tt.ORDER;aInRange("pointHex.y",Gt,_0n$2,nn);const Wt=lt(Gt*Gt),hn=lt(Wt-_1n$3),Xt=lt(qt*Wt-Lt);let{isValid:Jt,value:tn}=ht(hn,Xt);if(!Jt)throw new Error("Point.fromHex: invalid y coordinate");const _t=(tn&_1n$3)===_1n$3,Dt=(Nt&128)!==0;if(!Ut&&tn===_0n$2&&Dt)throw new Error("Point.fromHex: x=0 and x_0=1");return Dt!==_t&&(tn=lt(-tn)),vt.fromAffine({x:tn,y:Gt})}static fromPrivateKey(Ht){return Rt(Ht).point}toRawBytes(){const{x:Ht,y:Ut}=this.toAffine(),qt=numberToBytesLE(Ut,tt.BYTES);return qt[qt.length-1]|=Ht&_1n$3?128:0,qt}toHex(){return bytesToHex$2(this.toRawBytes())}}vt.BASE=new vt(et.Gx,et.Gy,_1n$3,lt(et.Gx*et.Gy)),vt.ZERO=new vt(_0n$2,_1n$3,_1n$3,_0n$2);const{BASE:bt,ZERO:Et}=vt,wt=wNAF(vt,st*8);function kt(Yt){return mod$1(Yt,nt)}function It(Yt){return kt(bytesToNumberLE(Yt))}function Rt(Yt){const Ht=st;Yt=ensureBytes$1("private key",Yt,Ht);const Ut=ensureBytes$1("hashed private key",ot(Yt),2*Ht),qt=pt(Ut.slice(0,Ht)),Lt=Ut.slice(Ht,2*Ht),Zt=It(qt),Qt=bt.multiply(Zt),Nt=Qt.toRawBytes();return{head:qt,prefix:Lt,scalar:Zt,point:Qt,pointBytes:Nt}}function Pt(Yt){return Rt(Yt).pointBytes}function jt(Yt=new Uint8Array,...Ht){const Ut=concatBytes$1(...Ht);return It(ot(mt(Ut,ensureBytes$1("context",Yt),!!rt)))}function Ot(Yt,Ht,Ut={}){Yt=ensureBytes$1("message",Yt),rt&&(Yt=rt(Yt));const{prefix:qt,scalar:Lt,pointBytes:Zt}=Rt(Ht),Qt=jt(Ut.context,qt,Yt),Nt=bt.multiply(Qt).toRawBytes(),Gt=jt(Ut.context,Nt,Zt,Yt),nn=kt(Qt+Gt*Lt);aInRange("signature.s",nn,_0n$2,nt);const Wt=concatBytes$1(Nt,numberToBytesLE(nn,tt.BYTES));return ensureBytes$1("result",Wt,st*2)}const Bt=VERIFY_DEFAULT;function zt(Yt,Ht,Ut,qt=Bt){const{context:Lt,zip215:Zt}=qt,Qt=tt.BYTES;Yt=ensureBytes$1("signature",Yt,2*Qt),Ht=ensureBytes$1("message",Ht),Zt!==void 0&&abool("zip215",Zt),rt&&(Ht=rt(Ht));const Nt=bytesToNumberLE(Yt.slice(Qt,2*Qt));let Gt,nn,Wt;try{Gt=vt.fromHex(Ut,Zt),nn=vt.fromHex(Yt.slice(0,Qt),Zt),Wt=bt.multiplyUnsafe(Nt)}catch{return!1}if(!Zt&&Gt.isSmallOrder())return!1;const hn=jt(Lt,nn.toRawBytes(),Gt.toRawBytes(),Ht);return nn.add(Gt.multiplyUnsafe(hn)).subtract(Wt).clearCofactor().equals(vt.ZERO)}return bt._setWindowSize(8),{CURVE:et,getPublicKey:Pt,sign:Ot,verify:zt,ExtendedPoint:vt,utils:{getExtendedPublicKey:Rt,randomPrivateKey:()=>it(tt.BYTES),precompute(Yt=8,Ht=vt.BASE){return Ht._setWindowSize(Yt),Ht.multiply(BigInt(3)),Ht}}}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const _0n$1=BigInt(0),_1n$2=BigInt(1);function validateOpts(o){return validateObject(o,{a:"bigint"},{montgomeryBits:"isSafeInteger",nByteLength:"isSafeInteger",adjustScalarBytes:"function",domain:"function",powPminus2:"function",Gu:"bigint"}),Object.freeze({...o})}function montgomery(o){const et=validateOpts(o),{P:tt}=et,nt=xt=>mod$1(xt,tt),rt=et.montgomeryBits,ot=Math.ceil(rt/8),it=et.nByteLength,st=et.adjustScalarBytes||(xt=>xt),at=et.powPminus2||(xt=>pow(xt,tt-BigInt(2),tt));function ct(xt,vt,bt){const Et=nt(xt*(vt-bt));return vt=nt(vt-Et),bt=nt(bt+Et),[vt,bt]}const lt=(et.a-BigInt(2))/BigInt(4);function dt(xt,vt){aInRange("u",xt,_0n$1,tt),aInRange("scalar",vt,_0n$1,tt);const bt=vt,Et=xt;let wt=_1n$2,kt=_0n$1,It=xt,Rt=_1n$2,Pt=_0n$1,jt;for(let Bt=BigInt(rt-1);Bt>=_0n$1;Bt--){const zt=bt>>Bt&_1n$2;Pt^=zt,jt=ct(Pt,wt,It),wt=jt[0],It=jt[1],jt=ct(Pt,kt,Rt),kt=jt[0],Rt=jt[1],Pt=zt;const Ft=wt+kt,Yt=nt(Ft*Ft),Ht=wt-kt,Ut=nt(Ht*Ht),qt=Yt-Ut,Lt=It+Rt,Zt=It-Rt,Qt=nt(Zt*Ft),Nt=nt(Lt*Ht),Gt=Qt+Nt,nn=Qt-Nt;It=nt(Gt*Gt),Rt=nt(Et*nt(nn*nn)),wt=nt(Yt*Ut),kt=nt(qt*(Yt+nt(lt*qt)))}jt=ct(Pt,wt,It),wt=jt[0],It=jt[1],jt=ct(Pt,kt,Rt),kt=jt[0],Rt=jt[1];const Ot=at(kt);return nt(wt*Ot)}function ht(xt){return numberToBytesLE(nt(xt),ot)}function pt(xt){const vt=ensureBytes$1("u coordinate",xt,ot);return it===32&&(vt[31]&=127),bytesToNumberLE(vt)}function mt(xt){const vt=ensureBytes$1("scalar",xt),bt=vt.length;if(bt!==ot&&bt!==it)throw new Error(`Expected ${ot} or ${it} bytes, got ${bt}`);return bytesToNumberLE(st(vt))}function ft(xt,vt){const bt=pt(vt),Et=mt(xt),wt=dt(bt,Et);if(wt===_0n$1)throw new Error("Invalid private or public key received");return ht(wt)}const yt=ht(et.Gu);function gt(xt){return ft(xt,yt)}return{scalarMult:ft,scalarMultBase:gt,getSharedSecret:(xt,vt)=>ft(xt,vt),getPublicKey:xt=>gt(xt),utils:{randomPrivateKey:()=>et.randomBytes(et.nByteLength)},GuBytes:yt}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const ED25519_P=BigInt("57896044618658097711785492504343953926634992332820282019728792003956564819949"),ED25519_SQRT_M1=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752");BigInt(0);const _1n$1=BigInt(1),_2n$1=BigInt(2),_3n$1=BigInt(3),_5n=BigInt(5),_8n$1=BigInt(8);function ed25519_pow_2_252_3(o){const et=BigInt(10),tt=BigInt(20),nt=BigInt(40),rt=BigInt(80),ot=ED25519_P,st=o*o%ot*o%ot,at=pow2$1(st,_2n$1,ot)*st%ot,ct=pow2$1(at,_1n$1,ot)*o%ot,lt=pow2$1(ct,_5n,ot)*ct%ot,dt=pow2$1(lt,et,ot)*lt%ot,ht=pow2$1(dt,tt,ot)*dt%ot,pt=pow2$1(ht,nt,ot)*ht%ot,mt=pow2$1(pt,rt,ot)*pt%ot,ft=pow2$1(mt,rt,ot)*pt%ot,yt=pow2$1(ft,et,ot)*lt%ot;return{pow_p_5_8:pow2$1(yt,_2n$1,ot)*o%ot,b2:st}}function adjustScalarBytes(o){return o[0]&=248,o[31]&=127,o[31]|=64,o}function uvRatio(o,et){const tt=ED25519_P,nt=mod$1(et*et*et,tt),rt=mod$1(nt*nt*et,tt),ot=ed25519_pow_2_252_3(o*rt).pow_p_5_8;let it=mod$1(o*nt*ot,tt);const st=mod$1(et*it*it,tt),at=it,ct=mod$1(it*ED25519_SQRT_M1,tt),lt=st===o,dt=st===mod$1(-o,tt),ht=st===mod$1(-o*ED25519_SQRT_M1,tt);return lt&&(it=at),(dt||ht)&&(it=ct),isNegativeLE(it,tt)&&(it=mod$1(-it,tt)),{isValid:lt||dt,value:it}}const Fp=Field$1(ED25519_P,void 0,!0),ed25519Defaults={a:BigInt(-1),d:BigInt("37095705934669439343138083508754565189542113879843219016388785533085940283555"),Fp,n:BigInt("7237005577332262213973186563042994240857116359379907606001950938285454250989"),h:_8n$1,Gx:BigInt("15112221349535400772501151409588531511454012693041857206046113283949847762202"),Gy:BigInt("46316835694926478169428394003475163141307993866256225615783033603165251855960"),hash:sha512,randomBytes:randomBytes$1,adjustScalarBytes,uvRatio},ed25519=twistedEdwards(ed25519Defaults),x25519=montgomery({P:ED25519_P,a:BigInt(486662),montgomeryBits:255,nByteLength:32,Gu:BigInt(9),powPminus2:o=>{const et=ED25519_P,{pow_p_5_8:tt,b2:nt}=ed25519_pow_2_252_3(o);return mod$1(pow2$1(tt,_3n$1,et)*nt,et)},adjustScalarBytes,randomBytes:randomBytes$1}),PUBLIC_KEY_BYTE_LENGTH=32,PRIVATE_KEY_BYTE_LENGTH=64,KEYS_BYTE_LENGTH=32;function generateKey(){const o=ed25519.utils.randomPrivateKey(),et=ed25519.getPublicKey(o);return{privateKey:concatKeys(o,et),publicKey:et}}function hashAndSign(o,et){const tt=o.subarray(0,KEYS_BYTE_LENGTH);return ed25519.sign(et instanceof Uint8Array?et:et.subarray(),tt)}function hashAndVerify$2(o,et,tt){return ed25519.verify(et,tt instanceof Uint8Array?tt:tt.subarray(),o)}function concatKeys(o,et){const tt=new Uint8Array(PRIVATE_KEY_BYTE_LENGTH);for(let nt=0;ntenumeration(__KeyTypeValues)})(KeyType||(KeyType={}));var PublicKey;(function(o){let et;o.codec=()=>(et==null&&(et=message$1((tt,nt,rt={})=>{rt.lengthDelimited!==!1&&nt.fork(),tt.Type!=null&&(nt.uint32(8),KeyType.codec().encode(tt.Type,nt)),tt.Data!=null&&(nt.uint32(18),nt.bytes(tt.Data)),rt.lengthDelimited!==!1&&nt.ldelim()},(tt,nt,rt={})=>{const ot={},it=nt==null?tt.len:tt.pos+nt;for(;tt.pos>>3){case 1:{ot.Type=KeyType.codec().decode(tt);break}case 2:{ot.Data=tt.bytes();break}default:{tt.skipType(st&7);break}}}return ot})),et),o.encode=tt=>encodeMessage(tt,o.codec()),o.decode=(tt,nt)=>decodeMessage(tt,o.codec(),nt)})(PublicKey||(PublicKey={}));var PrivateKey;(function(o){let et;o.codec=()=>(et==null&&(et=message$1((tt,nt,rt={})=>{rt.lengthDelimited!==!1&&nt.fork(),tt.Type!=null&&(nt.uint32(8),KeyType.codec().encode(tt.Type,nt)),tt.Data!=null&&(nt.uint32(18),nt.bytes(tt.Data)),rt.lengthDelimited!==!1&&nt.ldelim()},(tt,nt,rt={})=>{const ot={},it=nt==null?tt.len:tt.pos+nt;for(;tt.pos>>3){case 1:{ot.Type=KeyType.codec().decode(tt);break}case 2:{ot.Data=tt.bytes();break}default:{tt.skipType(st&7);break}}}return ot})),et),o.encode=tt=>encodeMessage(tt,o.codec()),o.decode=(tt,nt)=>decodeMessage(tt,o.codec(),nt)})(PrivateKey||(PrivateKey={}));/*! * MIT License * * Copyright (c) 2017-2022 Peculiar Ventures, LLC @@ -3934,7 +3934,7 @@ Vui lòng thử lại.`,injectionScreen_notconnected_h1:"Đăng nhập vào {{ C `).map(rt=>` ${rt}`).join(` `));const tt=this.idBlock.tagClass===3?`[${this.idBlock.tagNumber}]`:this.constructor.NAME;return et.length?`${tt} : ${et.join(` -`)}`:`${tt} :`}}_a$v=Constructed;typeStore.Constructed=_a$v;Constructed.NAME="CONSTRUCTED";class LocalEndOfContentValueBlock extends ValueBlock{fromBER(et,tt,nt){return tt}toBER(et){return EMPTY_BUFFER$1}}LocalEndOfContentValueBlock.override="EndOfContentValueBlock";var _a$u;class EndOfContent extends BaseBlock{constructor(et={}){super(et,LocalEndOfContentValueBlock),this.idBlock.tagClass=1,this.idBlock.tagNumber=0}}_a$u=EndOfContent;typeStore.EndOfContent=_a$u;EndOfContent.NAME=END_OF_CONTENT_NAME;var _a$t;class Null extends BaseBlock{constructor(et={}){super(et,ValueBlock),this.idBlock.tagClass=1,this.idBlock.tagNumber=5}fromBER(et,tt,nt){return this.lenBlock.length>0&&this.warnings.push("Non-zero length of value block for Null type"),this.idBlock.error.length||(this.blockLength+=this.idBlock.blockLength),this.lenBlock.error.length||(this.blockLength+=this.lenBlock.blockLength),this.blockLength+=nt,tt+nt>et.byteLength?(this.error="End of input reached before message was fully decoded (inconsistent offset and length values)",-1):tt+nt}toBER(et,tt){const nt=new ArrayBuffer(2);if(!et){const rt=new Uint8Array(nt);rt[0]=5,rt[1]=0}return tt&&tt.write(nt),nt}onAsciiEncoding(){return`${this.constructor.NAME}`}}_a$t=Null;typeStore.Null=_a$t;Null.NAME="NULL";class LocalBooleanValueBlock extends HexBlock(ValueBlock){constructor({value:et,...tt}={}){super(tt),tt.valueHex?this.valueHexView=BufferSourceConverter.toUint8Array(tt.valueHex):this.valueHexView=new Uint8Array(1),et&&(this.value=et)}get value(){for(const et of this.valueHexView)if(et>0)return!0;return!1}set value(et){this.valueHexView[0]=et?255:0}fromBER(et,tt,nt){const rt=BufferSourceConverter.toUint8Array(et);return checkBufferParams(this,rt,tt,nt)?(this.valueHexView=rt.subarray(tt,tt+nt),nt>1&&this.warnings.push("Boolean value encoded in more then 1 octet"),this.isHexOnly=!0,utilDecodeTC.call(this),this.blockLength=nt,tt+nt):-1}toBER(){return this.valueHexView.slice()}toJSON(){return{...super.toJSON(),value:this.value}}}LocalBooleanValueBlock.NAME="BooleanValueBlock";var _a$s;let Boolean$1=class extends BaseBlock{constructor(et={}){super(et,LocalBooleanValueBlock),this.idBlock.tagClass=1,this.idBlock.tagNumber=1}getValue(){return this.valueBlock.value}setValue(et){this.valueBlock.value=et}onAsciiEncoding(){return`${this.constructor.NAME} : ${this.getValue}`}};_a$s=Boolean$1;typeStore.Boolean=_a$s;Boolean$1.NAME="BOOLEAN";class LocalOctetStringValueBlock extends HexBlock(LocalConstructedValueBlock){constructor({isConstructed:et=!1,...tt}={}){super(tt),this.isConstructed=et}fromBER(et,tt,nt){let rt=0;if(this.isConstructed){if(this.isHexOnly=!1,rt=LocalConstructedValueBlock.prototype.fromBER.call(this,et,tt,nt),rt===-1)return rt;for(let ot=0;ot0&&ct.unusedBits>0)return this.error='Using of "unused bits" inside constructive BIT STRING allowed for least one only',-1;this.unusedBits=ct.unusedBits}return rt}const ot=BufferSourceConverter.toUint8Array(et);if(!checkBufferParams(this,ot,tt,nt))return-1;const it=ot.subarray(tt,tt+nt);if(this.unusedBits=it[0],this.unusedBits>7)return this.error="Unused bits for BitString must be in range 0-7",-1;if(!this.unusedBits){const st=it.subarray(1);try{if(st.byteLength){const at=localFromBER(st,0,st.byteLength);at.offset!==-1&&at.offset===nt-1&&(this.value=[at.result])}}catch{}}return this.valueHexView=it.subarray(1),this.blockLength=it.length,tt+nt}toBER(et,tt){if(this.isConstructed)return LocalConstructedValueBlock.prototype.toBER.call(this,et,tt);if(et)return new ArrayBuffer(this.valueHexView.byteLength+1);if(!this.valueHexView.byteLength)return EMPTY_BUFFER$1;const nt=new Uint8Array(this.valueHexView.length+1);return nt[0]=this.unusedBits,nt.set(this.valueHexView,1),nt.buffer}toJSON(){return{...super.toJSON(),unusedBits:this.unusedBits,isConstructed:this.isConstructed}}}LocalBitStringValueBlock.NAME="BitStringValueBlock";var _a$q;class BitString extends BaseBlock{constructor({idBlock:et={},lenBlock:tt={},...nt}={}){var rt,ot;(rt=nt.isConstructed)!==null&&rt!==void 0||(nt.isConstructed=!!(!((ot=nt.value)===null||ot===void 0)&&ot.length)),super({idBlock:{isConstructed:nt.isConstructed,...et},lenBlock:{...tt,isIndefiniteForm:!!nt.isIndefiniteForm},...nt},LocalBitStringValueBlock),this.idBlock.tagClass=1,this.idBlock.tagNumber=3}fromBER(et,tt,nt){return this.valueBlock.isConstructed=this.idBlock.isConstructed,this.valueBlock.isIndefiniteForm=this.lenBlock.isIndefiniteForm,super.fromBER(et,tt,nt)}onAsciiEncoding(){if(this.valueBlock.isConstructed||this.valueBlock.value&&this.valueBlock.value.length)return Constructed.prototype.onAsciiEncoding.call(this);{const et=[],tt=this.valueBlock.valueHexView;for(const rt of tt)et.push(rt.toString(2).padStart(8,"0"));const nt=et.join("");return`${this.constructor.NAME} : ${nt.substring(0,nt.length-this.valueBlock.unusedBits)}`}}}_a$q=BitString;typeStore.BitString=_a$q;BitString.NAME=BIT_STRING_NAME;var _a$p;function viewAdd(o,et){const tt=new Uint8Array([0]),nt=new Uint8Array(o),rt=new Uint8Array(et);let ot=nt.slice(0);const it=ot.length-1,st=rt.slice(0),at=st.length-1;let ct=0;const lt=at=0;ht--,dt++){switch(!0){case dt=ot.length:ot=utilConcatView(new Uint8Array([ct%10]),ot);break;default:ot[it-dt]=ct%10}}return tt[0]>0&&(ot=utilConcatView(tt,ot)),ot}function power2(o){if(o>=powers2.length)for(let et=powers2.length;et<=o;et++){const tt=new Uint8Array([0]);let nt=powers2[et-1].slice(0);for(let rt=nt.length-1;rt>=0;rt--){const ot=new Uint8Array([(nt[rt]<<1)+tt[0]]);tt[0]=ot[0]/10,nt[rt]=ot[0]%10}tt[0]>0&&(nt=utilConcatView(tt,nt)),powers2.push(nt)}return powers2[o]}function viewSub(o,et){let tt=0;const nt=new Uint8Array(o),rt=new Uint8Array(et),ot=nt.slice(0),it=ot.length-1,st=rt.slice(0),at=st.length-1;let ct,lt=0;for(let dt=at;dt>=0;dt--,lt++)switch(ct=ot[it-lt]-st[at-lt]-tt,!0){case ct<0:tt=1,ot[it-lt]=ct+10;break;default:tt=0,ot[it-lt]=ct}if(tt>0)for(let dt=it-at+1;dt>=0;dt--,lt++)if(ct=ot[it-lt]-tt,ct<0)tt=1,ot[it-lt]=ct+10;else{tt=0,ot[it-lt]=ct;break}return ot.slice()}class LocalIntegerValueBlock extends HexBlock(ValueBlock){constructor({value:et,...tt}={}){super(tt),this._valueDec=0,tt.valueHex&&this.setValueHex(),et!==void 0&&(this.valueDec=et)}setValueHex(){this.valueHexView.length>=4?(this.warnings.push("Too big Integer for decoding, hex only"),this.isHexOnly=!0,this._valueDec=0):(this.isHexOnly=!1,this.valueHexView.length>0&&(this._valueDec=utilDecodeTC.call(this)))}set valueDec(et){this._valueDec=et,this.isHexOnly=!1,this.valueHexView=new Uint8Array(utilEncodeTC(et))}get valueDec(){return this._valueDec}fromDER(et,tt,nt,rt=0){const ot=this.fromBER(et,tt,nt);if(ot===-1)return ot;const it=this.valueHexView;return it[0]===0&&it[1]&128?this.valueHexView=it.subarray(1):rt!==0&&it.length1&&(rt=it.length+1),this.valueHexView=it.subarray(rt-it.length)),ot}toDER(et=!1){const tt=this.valueHexView;switch(!0){case(tt[0]&128)!==0:{const nt=new Uint8Array(this.valueHexView.length+1);nt[0]=0,nt.set(tt,1),this.valueHexView=nt}break;case(tt[0]===0&&(tt[1]&128)===0):this.valueHexView=this.valueHexView.subarray(1);break}return this.toBER(et)}fromBER(et,tt,nt){const rt=super.fromBER(et,tt,nt);return rt===-1||this.setValueHex(),rt}toBER(et){return et?new ArrayBuffer(this.valueHexView.length):this.valueHexView.slice().buffer}toJSON(){return{...super.toJSON(),valueDec:this.valueDec}}toString(){const et=this.valueHexView.length*8-1;let tt=new Uint8Array(this.valueHexView.length*8/3),nt=0,rt;const ot=this.valueHexView;let it="",st=!1;for(let at=ot.byteLength-1;at>=0;at--){rt=ot[at];for(let ct=0;ct<8;ct++){if((rt&1)===1)switch(nt){case et:tt=viewSub(power2(nt),tt),it="-";break;default:tt=viewAdd(tt,power2(nt))}nt++,rt>>=1}}for(let at=0;at0;){const ot=new LocalSidValueBlock;if(rt=ot.fromBER(et,rt,nt),rt===-1)return this.blockLength=0,this.error=ot.error,rt;this.value.length===0&&(ot.isFirstSid=!0),this.blockLength+=ot.blockLength,nt-=ot.blockLength,this.value.push(ot)}return rt}toBER(et){const tt=[];for(let nt=0;ntNumber.MAX_SAFE_INTEGER){assertBigInt();const st=BigInt(rt);it.valueBigInt=st}else if(it.valueDec=parseInt(rt,10),isNaN(it.valueDec))return;this.value.length||(it.isFirstSid=!0,ot=!0),this.value.push(it)}while(nt!==-1)}toString(){let et="",tt=!1;for(let nt=0;nt0;){const ot=new LocalRelativeSidValueBlock;if(rt=ot.fromBER(et,rt,nt),rt===-1)return this.blockLength=0,this.error=ot.error,rt;this.blockLength+=ot.blockLength,nt-=ot.blockLength,this.value.push(ot)}return rt}toBER(et,tt){const nt=[];for(let rt=0;rt4)continue;const st=4-it.length;for(let at=it.length-1;at>=0;at--)nt[rt*4+at+st]=it[at]}this.valueBlock.value=et}}LocalUniversalStringValueBlock.NAME="UniversalStringValueBlock";var _a$g;class UniversalString extends LocalUniversalStringValueBlock{constructor({...et}={}){super(et),this.idBlock.tagClass=1,this.idBlock.tagNumber=28}}_a$g=UniversalString;typeStore.UniversalString=_a$g;UniversalString.NAME="UniversalString";var _a$f;class NumericString extends LocalSimpleStringBlock{constructor(et={}){super(et),this.idBlock.tagClass=1,this.idBlock.tagNumber=18}}_a$f=NumericString;typeStore.NumericString=_a$f;NumericString.NAME="NumericString";var _a$e;class PrintableString extends LocalSimpleStringBlock{constructor(et={}){super(et),this.idBlock.tagClass=1,this.idBlock.tagNumber=19}}_a$e=PrintableString;typeStore.PrintableString=_a$e;PrintableString.NAME="PrintableString";var _a$d;class TeletexString extends LocalSimpleStringBlock{constructor(et={}){super(et),this.idBlock.tagClass=1,this.idBlock.tagNumber=20}}_a$d=TeletexString;typeStore.TeletexString=_a$d;TeletexString.NAME="TeletexString";var _a$c;class VideotexString extends LocalSimpleStringBlock{constructor(et={}){super(et),this.idBlock.tagClass=1,this.idBlock.tagNumber=21}}_a$c=VideotexString;typeStore.VideotexString=_a$c;VideotexString.NAME="VideotexString";var _a$b;class IA5String extends LocalSimpleStringBlock{constructor(et={}){super(et),this.idBlock.tagClass=1,this.idBlock.tagNumber=22}}_a$b=IA5String;typeStore.IA5String=_a$b;IA5String.NAME="IA5String";var _a$a;class GraphicString extends LocalSimpleStringBlock{constructor(et={}){super(et),this.idBlock.tagClass=1,this.idBlock.tagNumber=25}}_a$a=GraphicString;typeStore.GraphicString=_a$a;GraphicString.NAME="GraphicString";var _a$9;class VisibleString extends LocalSimpleStringBlock{constructor(et={}){super(et),this.idBlock.tagClass=1,this.idBlock.tagNumber=26}}_a$9=VisibleString;typeStore.VisibleString=_a$9;VisibleString.NAME="VisibleString";var _a$8;class GeneralString extends LocalSimpleStringBlock{constructor(et={}){super(et),this.idBlock.tagClass=1,this.idBlock.tagNumber=27}}_a$8=GeneralString;typeStore.GeneralString=_a$8;GeneralString.NAME="GeneralString";var _a$7;class CharacterString extends LocalSimpleStringBlock{constructor(et={}){super(et),this.idBlock.tagClass=1,this.idBlock.tagNumber=29}}_a$7=CharacterString;typeStore.CharacterString=_a$7;CharacterString.NAME="CharacterString";var _a$6;class UTCTime extends VisibleString{constructor({value:et,valueDate:tt,...nt}={}){if(super(nt),this.year=0,this.month=0,this.day=0,this.hour=0,this.minute=0,this.second=0,et){this.fromString(et),this.valueBlock.valueHexView=new Uint8Array(et.length);for(let rt=0;rt=50?this.year=1900+rt:this.year=2e3+rt,this.month=parseInt(nt[2],10),this.day=parseInt(nt[3],10),this.hour=parseInt(nt[4],10),this.minute=parseInt(nt[5],10),this.second=parseInt(nt[6],10)}toString(et="iso"){if(et==="iso"){const tt=new Array(7);return tt[0]=padNumber(this.year<2e3?this.year-1900:this.year-2e3,2),tt[1]=padNumber(this.month,2),tt[2]=padNumber(this.day,2),tt[3]=padNumber(this.hour,2),tt[4]=padNumber(this.minute,2),tt[5]=padNumber(this.second,2),tt[6]="Z",tt.join("")}return super.toString(et)}onAsciiEncoding(){return`${this.constructor.NAME} : ${this.toDate().toISOString()}`}toJSON(){return{...super.toJSON(),year:this.year,month:this.month,day:this.day,hour:this.hour,minute:this.minute,second:this.second}}}_a$6=UTCTime;typeStore.UTCTime=_a$6;UTCTime.NAME="UTCTime";var _a$5;class GeneralizedTime extends UTCTime{constructor(et={}){var tt;super(et),(tt=this.millisecond)!==null&&tt!==void 0||(this.millisecond=0),this.idBlock.tagClass=1,this.idBlock.tagNumber=24}fromDate(et){super.fromDate(et),this.millisecond=et.getUTCMilliseconds()}toDate(){return new Date(Date.UTC(this.year,this.month-1,this.day,this.hour,this.minute,this.second,this.millisecond))}fromString(et){let tt=!1,nt="",rt="",ot=0,it,st=0,at=0;if(et[et.length-1]==="Z")nt=et.substring(0,et.length-1),tt=!0;else{const dt=new Number(et[et.length-1]);if(isNaN(dt.valueOf()))throw new Error("Wrong input string for conversion");nt=et}if(tt){if(nt.indexOf("+")!==-1)throw new Error("Wrong input string for conversion");if(nt.indexOf("-")!==-1)throw new Error("Wrong input string for conversion")}else{let dt=1,ht=nt.indexOf("+"),pt="";if(ht===-1&&(ht=nt.indexOf("-"),dt=-1),ht!==-1){if(pt=nt.substring(ht+1),nt=nt.substring(0,ht),pt.length!==2&&pt.length!==4)throw new Error("Wrong input string for conversion");let mt=parseInt(pt.substring(0,2),10);if(isNaN(mt.valueOf()))throw new Error("Wrong input string for conversion");if(st=dt*mt,pt.length===4){if(mt=parseInt(pt.substring(2,4),10),isNaN(mt.valueOf()))throw new Error("Wrong input string for conversion");at=dt*mt}}}let ct=nt.indexOf(".");if(ct===-1&&(ct=nt.indexOf(",")),ct!==-1){const dt=new Number(`0${nt.substring(ct)}`);if(isNaN(dt.valueOf()))throw new Error("Wrong input string for conversion");ot=dt.valueOf(),rt=nt.substring(0,ct)}else rt=nt;switch(!0){case rt.length===8:if(it=/(\d{4})(\d{2})(\d{2})/ig,ct!==-1)throw new Error("Wrong input string for conversion");break;case rt.length===10:if(it=/(\d{4})(\d{2})(\d{2})(\d{2})/ig,ct!==-1){let dt=60*ot;this.minute=Math.floor(dt),dt=60*(dt-this.minute),this.second=Math.floor(dt),dt=1e3*(dt-this.second),this.millisecond=Math.floor(dt)}break;case rt.length===12:if(it=/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})/ig,ct!==-1){let dt=60*ot;this.second=Math.floor(dt),dt=1e3*(dt-this.second),this.millisecond=Math.floor(dt)}break;case rt.length===14:if(it=/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/ig,ct!==-1){const dt=1e3*ot;this.millisecond=Math.floor(dt)}break;default:throw new Error("Wrong input string for conversion")}const lt=it.exec(rt);if(lt===null)throw new Error("Wrong input string for conversion");for(let dt=1;dt0&&(nt=`0${nt}`),et.push(nt)}),BigInt("0x"+et.join(""))}function pkixToRSAPublicKey(o){const et=pkixToJwk(o);if(rsaKeySize(et)>MAX_RSA_KEY_SIZE)throw new InvalidPublicKeyError("Key size is too large");const tt=sha256$2(PublicKey.encode({Type:KeyType.RSA,Data:o})),nt=create$3(SHA2_256_CODE,tt);return new RSAPublicKey(et,nt)}function isPromise$3(o){return o==null?!1:typeof o.then=="function"&&typeof o.catch=="function"&&typeof o.finally=="function"}function hashAndVerify(o,et,tt){const nt=sha256.digest(tt instanceof Uint8Array?tt:tt.subarray());if(isPromise$3(nt))return nt.then(({digest:rt})=>secp256k1.verify(et,rt,o)).catch(rt=>{throw new VerificationError(String(rt))});try{return secp256k1.verify(et,nt.digest,o)}catch(rt){throw new VerificationError(String(rt))}}class Secp256k1PublicKey{constructor(et){Ct(this,"type","secp256k1");Ct(this,"raw");Ct(this,"_key");this._key=validateSecp256k1PublicKey(et),this.raw=compressSecp256k1PublicKey(this._key)}toMultihash(){return identity.digest(publicKeyToProtobuf(this))}toCID(){return CID.createV1(114,this.toMultihash())}toString(){return base58btc.encode(this.toMultihash().bytes).substring(1)}equals(et){return et==null||!(et.raw instanceof Uint8Array)?!1:equals(this.raw,et.raw)}verify(et,tt){return hashAndVerify(this._key,tt,et)}}function unmarshalSecp256k1PublicKey(o){return new Secp256k1PublicKey(o)}function compressSecp256k1PublicKey(o){return secp256k1.ProjectivePoint.fromHex(o).toRawBytes(!0)}function validateSecp256k1PublicKey(o){try{return secp256k1.ProjectivePoint.fromHex(o),o}catch(et){throw new InvalidPublicKeyError(String(et))}}async function generateKeyPair(o,et){return generateEd25519KeyPair()}function publicKeyFromProtobuf(o){const{Type:et,Data:tt}=PublicKey.decode(o),nt=tt??new Uint8Array;switch(et){case KeyType.RSA:return pkixToRSAPublicKey(nt);case KeyType.Ed25519:return unmarshalEd25519PublicKey(nt);case KeyType.secp256k1:return unmarshalSecp256k1PublicKey(nt);default:throw new UnsupportedKeyTypeError$1}}function publicKeyFromRaw(o){return o.byteLength===32?unmarshalEd25519PublicKey(o):o.byteLength===33?unmarshalSecp256k1PublicKey(o):pkixToRSAPublicKey(o)}function publicKeyFromMultihash(o){const{Type:et,Data:tt}=PublicKey.decode(o.digest),nt=tt??new Uint8Array;switch(et){case KeyType.Ed25519:return unmarshalEd25519PublicKey(nt);case KeyType.secp256k1:return unmarshalSecp256k1PublicKey(nt);default:throw new UnsupportedKeyTypeError$1}}function publicKeyToProtobuf(o){return PublicKey.encode({Type:KeyType[o.type],Data:o.raw})}const peerIdSymbol$2=Symbol.for("@libp2p/peer-id");var ds;let InvalidParametersError$2=(ds=class extends Error{constructor(et="Invalid parameters"){super(et),this.name="InvalidParametersError"}},Ct(ds,"name","InvalidParametersError"),ds);class InvalidCIDError extends Error{constructor(et="Invalid CID"){super(et),this.name="InvalidCIDError"}}Ct(InvalidCIDError,"name","InvalidCIDError");class InvalidMultihashError extends Error{constructor(et="Invalid Multihash"){super(et),this.name="InvalidMultihashError"}}Ct(InvalidMultihashError,"name","InvalidMultihashError");class UnsupportedKeyTypeError extends Error{constructor(et="Unsupported key type"){super(et),this.name="UnsupportedKeyTypeError"}}Ct(UnsupportedKeyTypeError,"name","UnsupportedKeyTypeError");const inspect=Symbol.for("nodejs.util.inspect.custom"),LIBP2P_KEY_CODE$1=114;var Js;class PeerIdImpl{constructor(et){Ct(this,"type");Ct(this,"multihash");Ct(this,"publicKey");Ct(this,"string");Ct(this,Js,!0);this.type=et.type,this.multihash=et.multihash,Object.defineProperty(this,"string",{enumerable:!1,writable:!0})}get[Symbol.toStringTag](){return`PeerId(${this.toString()})`}toString(){return this.string==null&&(this.string=base58btc.encode(this.multihash.bytes).slice(1)),this.string}toMultihash(){return this.multihash}toCID(){return CID.createV1(LIBP2P_KEY_CODE$1,this.multihash)}toJSON(){return this.toString()}equals(et){var tt;if(et==null)return!1;if(et instanceof Uint8Array)return equals(this.multihash.bytes,et);if(typeof et=="string")return this.toString()===et;if(((tt=et==null?void 0:et.toMultihash())==null?void 0:tt.bytes)!=null)return equals(this.multihash.bytes,et.toMultihash().bytes);throw new Error("not valid Id")}[(Js=peerIdSymbol$2,inspect)](){return`PeerId(${this.toString()})`}}class RSAPeerId extends PeerIdImpl{constructor(tt){super({...tt,type:"RSA"});Ct(this,"type","RSA");Ct(this,"publicKey");this.publicKey=tt.publicKey}}class Ed25519PeerId extends PeerIdImpl{constructor(tt){super({...tt,type:"Ed25519"});Ct(this,"type","Ed25519");Ct(this,"publicKey");this.publicKey=tt.publicKey}}class Secp256k1PeerId extends PeerIdImpl{constructor(tt){super({...tt,type:"secp256k1"});Ct(this,"type","secp256k1");Ct(this,"publicKey");this.publicKey=tt.publicKey}}const TRANSPORT_IPFS_GATEWAY_HTTP_CODE$1=2336;var na,ga;class URLPeerId{constructor(et){Ct(this,"type","url");Ct(this,"multihash");Ct(this,"publicKey");Ct(this,"url");Ct(this,na,!0);this.url=et.toString(),this.multihash=identity.digest(fromString(this.url))}[(ga=inspect,na=peerIdSymbol$2,ga)](){return`PeerId(${this.url})`}toString(){return this.toCID().toString()}toMultihash(){return this.multihash}toCID(){return CID.createV1(TRANSPORT_IPFS_GATEWAY_HTTP_CODE$1,this.toMultihash())}toJSON(){return this.toString()}equals(et){return et==null?!1:(et instanceof Uint8Array&&(et=toString$8(et)),et.toString()===this.toString())}}const LIBP2P_KEY_CODE=114,TRANSPORT_IPFS_GATEWAY_HTTP_CODE=2336;function peerIdFromString$1(o,et){let tt;if(o.charAt(0)==="1"||o.charAt(0)==="Q")tt=decode$6(base58btc.decode(`z${o}`));else throw new InvalidParametersError$2('Please pass a multibase decoder for strings that do not start with "1" or "Q"');return peerIdFromMultihash(tt)}function peerIdFromPublicKey(o){if(o.type==="Ed25519")return new Ed25519PeerId({multihash:o.toCID().multihash,publicKey:o});if(o.type==="secp256k1")return new Secp256k1PeerId({multihash:o.toCID().multihash,publicKey:o});if(o.type==="RSA")return new RSAPeerId({multihash:o.toCID().multihash,publicKey:o});throw new UnsupportedKeyTypeError}function peerIdFromPrivateKey(o){return peerIdFromPublicKey(o.publicKey)}function peerIdFromMultihash(o){if(isSha256Multihash(o))return new RSAPeerId({multihash:o});if(isIdentityMultihash(o))try{const et=publicKeyFromMultihash(o);if(et.type==="Ed25519")return new Ed25519PeerId({multihash:o,publicKey:et});if(et.type==="secp256k1")return new Secp256k1PeerId({multihash:o,publicKey:et})}catch{const tt=toString$8(o.digest);return new URLPeerId(new URL(tt))}throw new InvalidMultihashError("Supplied PeerID Multihash is invalid")}function peerIdFromCID(o){if((o==null?void 0:o.multihash)==null||o.version==null||o.version===1&&o.code!==LIBP2P_KEY_CODE&&o.code!==TRANSPORT_IPFS_GATEWAY_HTTP_CODE)throw new InvalidCIDError("Supplied PeerID CID is invalid");if(o.code===TRANSPORT_IPFS_GATEWAY_HTTP_CODE){const et=toString$8(o.multihash.digest);return new URLPeerId(new URL(et))}return peerIdFromMultihash(o.multihash)}function isIdentityMultihash(o){return o.code===identity.code}function isSha256Multihash(o){return o.code===sha256.code}let AbortError$8=class extends Error{constructor(tt,nt,rt){super(tt??"The operation was aborted");Ct(this,"type");Ct(this,"code");this.type="aborted",this.name=rt??"AbortError",this.code=nt??"ABORT_ERR"}};async function raceSignal(o,et,tt){if(et==null)return o;if(et.aborted)return Promise.reject(new AbortError$8(tt==null?void 0:tt.errorMessage,tt==null?void 0:tt.errorCode,tt==null?void 0:tt.errorName));let nt;const rt=new AbortError$8(tt==null?void 0:tt.errorMessage,tt==null?void 0:tt.errorCode,tt==null?void 0:tt.errorName);try{return await Promise.race([o,new Promise((ot,it)=>{nt=()=>{it(rt)},et.addEventListener("abort",nt)})])}finally{nt!=null&&et.removeEventListener("abort",nt)}}class QueuelessPushable{constructor(){Ct(this,"readNext");Ct(this,"haveNext");Ct(this,"ended");Ct(this,"nextResult");this.ended=!1,this.readNext=pDefer(),this.haveNext=pDefer()}[Symbol.asyncIterator](){return this}async next(){if(this.nextResult==null&&await this.haveNext.promise,this.nextResult==null)throw new Error("HaveNext promise resolved but nextResult was undefined");const et=this.nextResult;return this.nextResult=void 0,this.readNext.resolve(),this.readNext=pDefer(),et}async throw(et){return this.ended=!0,et!=null&&(this.haveNext.promise.catch(()=>{}),this.haveNext.reject(et)),{done:!0,value:void 0}}async return(){const et={done:!0,value:void 0};return await this._push(void 0),et}async push(et,tt){await this._push(et,tt)}async end(et,tt){et!=null?await this.throw(et):await this._push(void 0,tt)}async _push(et,tt){if(et!=null&&this.ended)throw new Error("Cannot push value onto an ended pushable");for(;this.nextResult!=null;)await this.readNext.promise;et!=null?this.nextResult={done:!1,value:et}:(this.ended=!0,this.nextResult={done:!0,value:void 0}),this.haveNext.resolve(),this.haveNext=pDefer(),await raceSignal(this.readNext.promise,tt==null?void 0:tt.signal,tt)}}function queuelessPushable(){return new QueuelessPushable}class UnexpectedEOFError extends Error{constructor(){super(...arguments);Ct(this,"name","UnexpectedEOFError");Ct(this,"code","ERR_UNEXPECTED_EOF")}}class CodeError extends Error{constructor(tt,nt){super(tt);Ct(this,"code");this.code=nt}}let AbortError$7=class extends CodeError{constructor(tt){super(tt,"ABORT_ERR");Ct(this,"type");this.type="aborted",this.name="AbortError"}};function byteStream(o,et){const tt=queuelessPushable();o.sink(tt).catch(async it=>{await tt.end(it)}),o.sink=async it=>{for await(const st of it)await tt.push(st);await tt.end()};let nt=o.source;o.source[Symbol.iterator]!=null?nt=o.source[Symbol.iterator]():o.source[Symbol.asyncIterator]!=null&&(nt=o.source[Symbol.asyncIterator]());const rt=new Uint8ArrayList;return{read:async(it,st)=>{var lt,dt;(lt=st==null?void 0:st.signal)==null||lt.throwIfAborted();let at;const ct=new Promise((ht,pt)=>{var mt;at=()=>{pt(new AbortError$7("Read aborted"))},(mt=st==null?void 0:st.signal)==null||mt.addEventListener("abort",at)});try{if(it==null){const{done:pt,value:mt}=await Promise.race([nt.next(),ct]);return pt===!0?new Uint8ArrayList:mt}for(;rt.byteLength{var at;(at=st==null?void 0:st.signal)==null||at.throwIfAborted(),it instanceof Uint8Array?await tt.push(it,st):await tt.push(it.subarray(),st)},unwrap:()=>{if(rt.byteLength>0){const it=o.source;o.source=async function*(){(et==null?void 0:et.yieldBytes)===!1?yield rt:yield*rt,yield*it}()}return o}}}class InvalidMessageLengthError extends Error{constructor(){super(...arguments);Ct(this,"name","InvalidMessageLengthError");Ct(this,"code","ERR_INVALID_MSG_LENGTH")}}class InvalidDataLengthError extends Error{constructor(){super(...arguments);Ct(this,"name","InvalidDataLengthError");Ct(this,"code","ERR_MSG_DATA_TOO_LONG")}}class InvalidDataLengthLengthError extends Error{constructor(){super(...arguments);Ct(this,"name","InvalidDataLengthLengthError");Ct(this,"code","ERR_MSG_LENGTH_TOO_LONG")}}function lpStream(o,et={}){const tt=byteStream(o,et);et.maxDataLength!=null&&et.maxLengthLength==null&&(et.maxLengthLength=encodingLength$3(et.maxDataLength));const nt=(et==null?void 0:et.lengthDecoder)??decode$b,rt=(et==null?void 0:et.lengthEncoder)??encode$a;return{read:async it=>{let st=-1;const at=new Uint8ArrayList;for(;;){at.append(await tt.read(1,it));try{st=nt(at)}catch(ct){if(ct instanceof RangeError)continue;throw ct}if(st<0)throw new InvalidMessageLengthError("Invalid message length");if((et==null?void 0:et.maxLengthLength)!=null&&at.byteLength>et.maxLengthLength)throw new InvalidDataLengthLengthError("message length length too long");if(st>-1)break}if((et==null?void 0:et.maxDataLength)!=null&&st>et.maxDataLength)throw new InvalidDataLengthError("message length too long");return tt.read(st,it)},write:async(it,st)=>{await tt.write(new Uint8ArrayList(rt(it.byteLength),it),st)},writeV:async(it,st)=>{const at=new Uint8ArrayList(...it.flatMap(ct=>[rt(ct.byteLength),ct]));await tt.write(at,st)},unwrap:()=>tt.unwrap()}}function pair(){const o=pDefer();let et=!1;return{sink:async tt=>{if(et)throw new Error("already piped");et=!0,o.resolve(tt)},source:async function*(){yield*await o.promise}()}}function duplexPair(){const o=pair(),et=pair();return[{source:o.source,sink:et.sink},{source:et.source,sink:o.sink}]}var define_globalThis_process_env_default$2={};const NOISE_MSG_MAX_LENGTH_BYTES=65535,NOISE_MSG_MAX_LENGTH_BYTES_WITHOUT_TAG=NOISE_MSG_MAX_LENGTH_BYTES-16,DUMP_SESSION_KEYS=!!(define_globalThis_process_env_default$2!=null&&define_globalThis_process_env_default$2.DUMP_SESSION_KEYS);function number$2(o){if(!Number.isSafeInteger(o)||o<0)throw new Error(`positive integer expected, not ${o}`)}function bool(o){if(typeof o!="boolean")throw new Error(`boolean expected, not ${o}`)}function isBytes$1(o){return o instanceof Uint8Array||o!=null&&typeof o=="object"&&o.constructor.name==="Uint8Array"}function bytes(o,...et){if(!isBytes$1(o))throw new Error("Uint8Array expected");if(et.length>0&&!et.includes(o.length))throw new Error(`Uint8Array expected of length ${et}, not of length=${o.length}`)}function exists(o,et=!0){if(o.destroyed)throw new Error("Hash instance has been destroyed");if(et&&o.finished)throw new Error("Hash#digest() has already been called")}function output(o,et){bytes(o);const tt=et.outputLen;if(o.lengthnew Uint32Array(o.buffer,o.byteOffset,Math.floor(o.byteLength/4)),createView=o=>new DataView(o.buffer,o.byteOffset,o.byteLength),isLE=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;if(!isLE)throw new Error("Non little-endian hardware is not supported");function utf8ToBytes(o){if(typeof o!="string")throw new Error(`string expected, got ${typeof o}`);return new Uint8Array(new TextEncoder().encode(o))}function toBytes(o){if(typeof o=="string")o=utf8ToBytes(o);else if(isBytes$1(o))o=copyBytes(o);else throw new Error(`Uint8Array expected, got ${typeof o}`);return o}function checkOpts(o,et){if(et==null||typeof et!="object")throw new Error("options must be defined");return Object.assign(o,et)}function equalBytes(o,et){if(o.length!==et.length)return!1;let tt=0;for(let nt=0;nt(Object.assign(et,o),et);function setBigUint64(o,et,tt,nt){if(typeof o.setBigUint64=="function")return o.setBigUint64(et,tt,nt);const rt=BigInt(32),ot=BigInt(4294967295),it=Number(tt>>rt&ot),st=Number(tt&ot),at=4,ct=0;o.setUint32(et+at,it,nt),o.setUint32(et+ct,st,nt)}function copyBytes(o){return Uint8Array.from(o)}function clean(...o){for(let et=0;etUint8Array.from(o.split("").map(et=>et.charCodeAt(0))),sigma16=_utf8ToBytes("expand 16-byte k"),sigma32=_utf8ToBytes("expand 32-byte k"),sigma16_32=u32(sigma16),sigma32_32=u32(sigma32);sigma32_32.slice();function rotl(o,et){return o<>>32-et}function isAligned32(o){return o.byteOffset%4===0}const BLOCK_LEN=64,BLOCK_LEN32=16,MAX_COUNTER=2**32-1,U32_EMPTY=new Uint32Array;function runCipher(o,et,tt,nt,rt,ot,it,st){const at=rt.length,ct=new Uint8Array(BLOCK_LEN),lt=u32(ct),dt=isAligned32(rt)&&isAligned32(ot),ht=dt?u32(rt):U32_EMPTY,pt=dt?u32(ot):U32_EMPTY;for(let mt=0;mt=MAX_COUNTER)throw new Error("arx: counter overflow");const ft=Math.min(BLOCK_LEN,at-mt);if(dt&&ft===BLOCK_LEN){const yt=mt/4;if(mt%4!==0)throw new Error("arx: invalid block position");for(let gt=0,xt;gt{bytes(st),bytes(at),bytes(ct);const ht=ct.length;if(lt===void 0&&(lt=new Uint8Array(ht)),bytes(lt),number$2(dt),dt<0||dt>=MAX_COUNTER)throw new Error("arx: counter overflow");if(lt.lengtho[et++]&255|(o[et++]&255)<<8;class Poly1305{constructor(et){this.blockLen=16,this.outputLen=16,this.buffer=new Uint8Array(16),this.r=new Uint16Array(10),this.h=new Uint16Array(10),this.pad=new Uint16Array(8),this.pos=0,this.finished=!1,et=toBytes(et),bytes(et,32);const tt=u8to16(et,0),nt=u8to16(et,2),rt=u8to16(et,4),ot=u8to16(et,6),it=u8to16(et,8),st=u8to16(et,10),at=u8to16(et,12),ct=u8to16(et,14);this.r[0]=tt&8191,this.r[1]=(tt>>>13|nt<<3)&8191,this.r[2]=(nt>>>10|rt<<6)&7939,this.r[3]=(rt>>>7|ot<<9)&8191,this.r[4]=(ot>>>4|it<<12)&255,this.r[5]=it>>>1&8190,this.r[6]=(it>>>14|st<<2)&8191,this.r[7]=(st>>>11|at<<5)&8065,this.r[8]=(at>>>8|ct<<8)&8191,this.r[9]=ct>>>5&127;for(let lt=0;lt<8;lt++)this.pad[lt]=u8to16(et,16+2*lt)}process(et,tt,nt=!1){const rt=nt?0:2048,{h:ot,r:it}=this,st=it[0],at=it[1],ct=it[2],lt=it[3],dt=it[4],ht=it[5],pt=it[6],mt=it[7],ft=it[8],yt=it[9],gt=u8to16(et,tt+0),xt=u8to16(et,tt+2),vt=u8to16(et,tt+4),bt=u8to16(et,tt+6),Et=u8to16(et,tt+8),wt=u8to16(et,tt+10),kt=u8to16(et,tt+12),Tt=u8to16(et,tt+14);let Rt=ot[0]+(gt&8191),Pt=ot[1]+((gt>>>13|xt<<3)&8191),$t=ot[2]+((xt>>>10|vt<<6)&8191),Ot=ot[3]+((vt>>>7|bt<<9)&8191),Bt=ot[4]+((bt>>>4|Et<<12)&8191),zt=ot[5]+(Et>>>1&8191),Ft=ot[6]+((Et>>>14|wt<<2)&8191),Yt=ot[7]+((wt>>>11|kt<<5)&8191),Ht=ot[8]+((kt>>>8|Tt<<8)&8191),Ut=ot[9]+(Tt>>>5|rt),qt=0,Lt=qt+Rt*st+Pt*(5*yt)+$t*(5*ft)+Ot*(5*mt)+Bt*(5*pt);qt=Lt>>>13,Lt&=8191,Lt+=zt*(5*ht)+Ft*(5*dt)+Yt*(5*lt)+Ht*(5*ct)+Ut*(5*at),qt+=Lt>>>13,Lt&=8191;let Zt=qt+Rt*at+Pt*st+$t*(5*yt)+Ot*(5*ft)+Bt*(5*mt);qt=Zt>>>13,Zt&=8191,Zt+=zt*(5*pt)+Ft*(5*ht)+Yt*(5*dt)+Ht*(5*lt)+Ut*(5*ct),qt+=Zt>>>13,Zt&=8191;let Qt=qt+Rt*ct+Pt*at+$t*st+Ot*(5*yt)+Bt*(5*ft);qt=Qt>>>13,Qt&=8191,Qt+=zt*(5*mt)+Ft*(5*pt)+Yt*(5*ht)+Ht*(5*dt)+Ut*(5*lt),qt+=Qt>>>13,Qt&=8191;let Nt=qt+Rt*lt+Pt*ct+$t*at+Ot*st+Bt*(5*yt);qt=Nt>>>13,Nt&=8191,Nt+=zt*(5*ft)+Ft*(5*mt)+Yt*(5*pt)+Ht*(5*ht)+Ut*(5*dt),qt+=Nt>>>13,Nt&=8191;let Gt=qt+Rt*dt+Pt*lt+$t*ct+Ot*at+Bt*st;qt=Gt>>>13,Gt&=8191,Gt+=zt*(5*yt)+Ft*(5*ft)+Yt*(5*mt)+Ht*(5*pt)+Ut*(5*ht),qt+=Gt>>>13,Gt&=8191;let nn=qt+Rt*ht+Pt*dt+$t*lt+Ot*ct+Bt*at;qt=nn>>>13,nn&=8191,nn+=zt*st+Ft*(5*yt)+Yt*(5*ft)+Ht*(5*mt)+Ut*(5*pt),qt+=nn>>>13,nn&=8191;let Wt=qt+Rt*pt+Pt*ht+$t*dt+Ot*lt+Bt*ct;qt=Wt>>>13,Wt&=8191,Wt+=zt*at+Ft*st+Yt*(5*yt)+Ht*(5*ft)+Ut*(5*mt),qt+=Wt>>>13,Wt&=8191;let hn=qt+Rt*mt+Pt*pt+$t*ht+Ot*dt+Bt*lt;qt=hn>>>13,hn&=8191,hn+=zt*ct+Ft*at+Yt*st+Ht*(5*yt)+Ut*(5*ft),qt+=hn>>>13,hn&=8191;let Xt=qt+Rt*ft+Pt*mt+$t*pt+Ot*ht+Bt*dt;qt=Xt>>>13,Xt&=8191,Xt+=zt*lt+Ft*ct+Yt*at+Ht*st+Ut*(5*yt),qt+=Xt>>>13,Xt&=8191;let Jt=qt+Rt*yt+Pt*ft+$t*mt+Ot*pt+Bt*ht;qt=Jt>>>13,Jt&=8191,Jt+=zt*dt+Ft*lt+Yt*ct+Ht*at+Ut*st,qt+=Jt>>>13,Jt&=8191,qt=(qt<<2)+qt|0,qt=qt+Lt|0,Lt=qt&8191,qt=qt>>>13,Zt+=qt,ot[0]=Lt,ot[1]=Zt,ot[2]=Qt,ot[3]=Nt,ot[4]=Gt,ot[5]=nn,ot[6]=Wt,ot[7]=hn,ot[8]=Xt,ot[9]=Jt}finalize(){const{h:et,pad:tt}=this,nt=new Uint16Array(10);let rt=et[1]>>>13;et[1]&=8191;for(let st=2;st<10;st++)et[st]+=rt,rt=et[st]>>>13,et[st]&=8191;et[0]+=rt*5,rt=et[0]>>>13,et[0]&=8191,et[1]+=rt,rt=et[1]>>>13,et[1]&=8191,et[2]+=rt,nt[0]=et[0]+5,rt=nt[0]>>>13,nt[0]&=8191;for(let st=1;st<10;st++)nt[st]=et[st]+rt,rt=nt[st]>>>13,nt[st]&=8191;nt[9]-=8192;let ot=(rt^1)-1;for(let st=0;st<10;st++)nt[st]&=ot;ot=~ot;for(let st=0;st<10;st++)et[st]=et[st]&ot|nt[st];et[0]=(et[0]|et[1]<<13)&65535,et[1]=(et[1]>>>3|et[2]<<10)&65535,et[2]=(et[2]>>>6|et[3]<<7)&65535,et[3]=(et[3]>>>9|et[4]<<4)&65535,et[4]=(et[4]>>>12|et[5]<<1|et[6]<<14)&65535,et[5]=(et[6]>>>2|et[7]<<11)&65535,et[6]=(et[7]>>>5|et[8]<<8)&65535,et[7]=(et[8]>>>8|et[9]<<5)&65535;let it=et[0]+tt[0];et[0]=it&65535;for(let st=1;st<8;st++)it=(et[st]+tt[st]|0)+(it>>>16)|0,et[st]=it&65535;clean(nt)}update(et){exists(this);const{buffer:tt,blockLen:nt}=this;et=toBytes(et);const rt=et.length;for(let ot=0;ot>>0,et[ot++]=nt[it]>>>8;return et}digest(){const{buffer:et,outputLen:tt}=this;this.digestInto(et);const nt=et.slice(0,tt);return this.destroy(),nt}}function wrapConstructorWithKey(o){const et=(nt,rt)=>o(rt).update(toBytes(nt)).digest(),tt=o(new Uint8Array(32));return et.outputLen=tt.outputLen,et.blockLen=tt.blockLen,et.create=nt=>o(nt),et}const poly1305=wrapConstructorWithKey(o=>new Poly1305(o));function chachaCore(o,et,tt,nt,rt,ot=20){let it=o[0],st=o[1],at=o[2],ct=o[3],lt=et[0],dt=et[1],ht=et[2],pt=et[3],mt=et[4],ft=et[5],yt=et[6],gt=et[7],xt=rt,vt=tt[0],bt=tt[1],Et=tt[2],wt=it,kt=st,Tt=at,Rt=ct,Pt=lt,$t=dt,Ot=ht,Bt=pt,zt=mt,Ft=ft,Yt=yt,Ht=gt,Ut=xt,qt=vt,Lt=bt,Zt=Et;for(let Nt=0;Nt{o.update(et);const tt=et.length%16;tt&&o.update(ZEROS16.subarray(tt))},ZEROS32=new Uint8Array(32);function computeTag(o,et,tt,nt,rt){const ot=o(et,tt,ZEROS32),it=poly1305.create(ot);rt&&updatePadded(it,rt),updatePadded(it,nt);const st=new Uint8Array(16),at=createView(st);setBigUint64(at,0,BigInt(rt?rt.length:0),!0),setBigUint64(at,8,BigInt(nt.length),!0),it.update(st);const ct=it.digest();return clean(ot,st),ct}const _poly1305_aead=o=>(et,tt,nt)=>(bytes(et,32),bytes(tt),{encrypt(ot,it){const st=ot.length,at=st+16;it?bytes(it,at):it=new Uint8Array(at),o(et,tt,ot,it,1);const ct=computeTag(o,et,tt,it.subarray(0,-16),nt);return it.set(ct,st),clean(ct),it},decrypt(ot,it){const st=ot.length,at=st-16;if(st<16)throw new Error("encrypted data must be at least 16 bytes");it?bytes(it,at):it=new Uint8Array(at);const ct=ot.subarray(0,-16),lt=ot.subarray(-16),dt=computeTag(o,et,tt,ct,nt);if(!equalBytes(lt,dt))throw new Error("invalid tag");return o(et,tt,ct,it,1),clean(dt),it}}),chacha20poly1305=wrapCipher({blockSize:64,nonceLength:12,tagLength:16},_poly1305_aead(chacha20));function extract(o,et,tt){return hash$1(o),tt===void 0&&(tt=new Uint8Array(o.outputLen)),hmac(o,toBytes$2(tt),toBytes$2(et))}const HKDF_COUNTER=new Uint8Array([0]),EMPTY_BUFFER=new Uint8Array;function expand(o,et,tt,nt=32){if(hash$1(o),number$4(nt),nt>255*o.outputLen)throw new Error("Length should be <= 255*HashLen");const rt=Math.ceil(nt/o.outputLen);tt===void 0&&(tt=EMPTY_BUFFER);const ot=new Uint8Array(rt*o.outputLen),it=hmac.create(o,et),st=it._cloneInto(),at=new Uint8Array(it.outputLen);for(let ct=0;cto.generateX25519SharedKey(et.privateKey,tt).subarray(0,32),encrypt:o.chaCha20Poly1305Encrypt,decrypt:o.chaCha20Poly1305Decrypt,hash:o.hashSHA256,hkdf:o.getHKDF}}const uint16BEEncode=o=>{const et=allocUnsafe(2);return et[0]=o>>8,et[1]=o,et};uint16BEEncode.bytes=2;const uint16BEDecode=o=>{if(o.length<2)throw RangeError("Could not decode int16BE");if(o instanceof Uint8Array){let et=0;return et+=o[0]<<8,et+=o[1],et}return o.getUint16(0)};uint16BEDecode.bytes=2;function registerMetrics(o){return{xxHandshakeSuccesses:o.registerCounter("libp2p_noise_xxhandshake_successes_total",{help:"Total count of noise xxHandshakes successes_"}),xxHandshakeErrors:o.registerCounter("libp2p_noise_xxhandshake_error_total",{help:"Total count of noise xxHandshakes errors"}),encryptedPackets:o.registerCounter("libp2p_noise_encrypted_packets_total",{help:"Total count of noise encrypted packets successfully"}),decryptedPackets:o.registerCounter("libp2p_noise_decrypted_packets_total",{help:"Total count of noise decrypted packets"}),decryptErrors:o.registerCounter("libp2p_noise_decrypt_errors_total",{help:"Total count of noise decrypt errors"})}}function logLocalStaticKeys(o,et){!et.enabled||!DUMP_SESSION_KEYS||(o?(et(`LOCAL_STATIC_PUBLIC_KEY ${toString$8(o.publicKey,"hex")}`),et(`LOCAL_STATIC_PRIVATE_KEY ${toString$8(o.privateKey,"hex")}`)):et("Missing local static keys."))}function logLocalEphemeralKeys(o,et){!et.enabled||!DUMP_SESSION_KEYS||(o?(et(`LOCAL_PUBLIC_EPHEMERAL_KEY ${toString$8(o.publicKey,"hex")}`),et(`LOCAL_PRIVATE_EPHEMERAL_KEY ${toString$8(o.privateKey,"hex")}`)):et("Missing local ephemeral keys."))}function logRemoteStaticKey(o,et){!et.enabled||!DUMP_SESSION_KEYS||et(o?`REMOTE_STATIC_PUBLIC_KEY ${toString$8(o.subarray(),"hex")}`:"Missing remote static public key.")}function logRemoteEphemeralKey(o,et){!et.enabled||!DUMP_SESSION_KEYS||et(o?`REMOTE_EPHEMERAL_PUBLIC_KEY ${toString$8(o.subarray(),"hex")}`:"Missing remote ephemeral keys.")}function logCipherState(o,et,tt){!tt.enabled||!DUMP_SESSION_KEYS||(tt(`CIPHER_STATE_1 ${o.n.getUint64()} ${o.k&&toString$8(o.k,"hex")}`),tt(`CIPHER_STATE_2 ${et.n.getUint64()} ${et.k&&toString$8(et.k,"hex")}`))}const rs=class rs extends Error{constructor(tt="Invalid crypto exchange"){super(tt);Ct(this,"code");this.code=rs.code}};Ct(rs,"code","ERR_INVALID_CRYPTO_EXCHANGE");let InvalidCryptoExchangeError=rs;const MIN_NONCE=0,MAX_NONCE=4294967295,ERR_MAX_NONCE="Cipherstate has reached maximum n, a new handshake must be performed";class Nonce{constructor(et=MIN_NONCE){Ct(this,"n");Ct(this,"bytes");Ct(this,"view");this.n=et,this.bytes=alloc$2(12),this.view=new DataView(this.bytes.buffer,this.bytes.byteOffset,this.bytes.byteLength),this.view.setUint32(4,et,!0)}increment(){this.n++,this.view.setUint32(4,this.n,!0)}getBytes(){return this.bytes}getUint64(){return this.n}assertValue(){if(this.n>MAX_NONCE)throw new Error(ERR_MAX_NONCE)}}const ZEROLEN=alloc$2(0);class CipherState{constructor(et,tt=void 0,nt=0){Ct(this,"k");Ct(this,"n");Ct(this,"crypto");this.crypto=et,this.k=tt,this.n=new Nonce(nt)}hasKey(){return!!this.k}encryptWithAd(et,tt){if(!this.hasKey())return tt;this.n.assertValue();const nt=this.crypto.encrypt(tt,this.n.getBytes(),et,this.k);return this.n.increment(),nt}decryptWithAd(et,tt,nt){if(!this.hasKey())return tt;this.n.assertValue();const rt=this.crypto.decrypt(tt,this.n.getBytes(),et,this.k,nt);return this.n.increment(),rt}}class SymmetricState{constructor(et,tt){Ct(this,"cs");Ct(this,"ck");Ct(this,"h");Ct(this,"crypto");this.crypto=et;const nt=fromString(tt,"utf-8");this.h=hashProtocolName(et,nt),this.ck=this.h,this.cs=new CipherState(et)}mixKey(et){const[tt,nt]=this.crypto.hkdf(this.ck,et);this.ck=tt,this.cs=new CipherState(this.crypto,nt)}mixHash(et){this.h=this.crypto.hash(new Uint8ArrayList(this.h,et))}encryptAndHash(et){const tt=this.cs.encryptWithAd(this.h,et);return this.mixHash(tt),tt}decryptAndHash(et){const tt=this.cs.decryptWithAd(this.h,et);return this.mixHash(et),tt}split(){const[et,tt]=this.crypto.hkdf(this.ck,ZEROLEN);return[new CipherState(this.crypto,et),new CipherState(this.crypto,tt)]}}class AbstractHandshakeState{constructor(et){Ct(this,"ss");Ct(this,"s");Ct(this,"e");Ct(this,"rs");Ct(this,"re");Ct(this,"initiator");Ct(this,"crypto");const{crypto:tt,protocolName:nt,prologue:rt,initiator:ot,s:it,e:st,rs:at,re:ct}=et;this.crypto=tt,this.ss=new SymmetricState(tt,nt),this.ss.mixHash(rt),this.initiator=ot,this.s=it,this.e=st,this.rs=at,this.re=ct}writeE(){if(this.e)throw new Error("ephemeral keypair is already set");const et=this.crypto.generateKeypair();return this.ss.mixHash(et.publicKey),this.e=et,et.publicKey}writeS(){if(!this.s)throw new Error("static keypair is not set");return this.ss.encryptAndHash(this.s.publicKey)}writeEE(){if(!this.e)throw new Error("ephemeral keypair is not set");if(!this.re)throw new Error("remote ephemeral public key is not set");this.ss.mixKey(this.crypto.dh(this.e,this.re))}writeES(){if(this.initiator){if(!this.e)throw new Error("ephemeral keypair is not set");if(!this.rs)throw new Error("remote static public key is not set");this.ss.mixKey(this.crypto.dh(this.e,this.rs))}else{if(!this.s)throw new Error("static keypair is not set");if(!this.re)throw new Error("remote ephemeral public key is not set");this.ss.mixKey(this.crypto.dh(this.s,this.re))}}writeSE(){if(this.initiator){if(!this.s)throw new Error("static keypair is not set");if(!this.re)throw new Error("remote ephemeral public key is not set");this.ss.mixKey(this.crypto.dh(this.s,this.re))}else{if(!this.e)throw new Error("ephemeral keypair is not set");if(!this.rs)throw new Error("remote static public key is not set");this.ss.mixKey(this.crypto.dh(this.e,this.rs))}}readE(et,tt=0){if(this.re)throw new Error("remote ephemeral public key is already set");if(et.byteLength(et==null&&(et=message$1((tt,nt,rt={})=>{if(rt.lengthDelimited!==!1&&nt.fork(),tt.webtransportCerthashes!=null)for(const ot of tt.webtransportCerthashes)nt.uint32(10),nt.bytes(ot);rt.lengthDelimited!==!1&&nt.ldelim()},(tt,nt)=>{const rt={webtransportCerthashes:[]},ot=nt==null?tt.len:tt.pos+nt;for(;tt.pos>>3){case 1:{rt.webtransportCerthashes.push(tt.bytes());break}default:{tt.skipType(it&7);break}}}return rt})),et),o.encode=tt=>encodeMessage(tt,o.codec()),o.decode=tt=>decodeMessage(tt,o.codec())})(NoiseExtensions||(NoiseExtensions={}));var NoiseHandshakePayload;(function(o){let et;o.codec=()=>(et==null&&(et=message$1((tt,nt,rt={})=>{rt.lengthDelimited!==!1&&nt.fork(),tt.identityKey!=null&&tt.identityKey.byteLength>0&&(nt.uint32(10),nt.bytes(tt.identityKey)),tt.identitySig!=null&&tt.identitySig.byteLength>0&&(nt.uint32(18),nt.bytes(tt.identitySig)),tt.extensions!=null&&(nt.uint32(34),NoiseExtensions.codec().encode(tt.extensions,nt)),rt.lengthDelimited!==!1&&nt.ldelim()},(tt,nt)=>{const rt={identityKey:alloc$2(0),identitySig:alloc$2(0)},ot=nt==null?tt.len:tt.pos+nt;for(;tt.pos>>3){case 1:{rt.identityKey=tt.bytes();break}case 2:{rt.identitySig=tt.bytes();break}case 4:{rt.extensions=NoiseExtensions.codec().decode(tt,tt.uint32());break}default:{tt.skipType(it&7);break}}}return rt})),et),o.encode=tt=>encodeMessage(tt,o.codec()),o.decode=tt=>decodeMessage(tt,o.codec())})(NoiseHandshakePayload||(NoiseHandshakePayload={}));async function createHandshakePayload(o,et,tt){const nt=await o.sign(getSignaturePayload(et));return NoiseHandshakePayload.encode({identityKey:publicKeyToProtobuf(o.publicKey),identitySig:nt,extensions:tt})}async function decodeHandshakePayload(o,et,tt){try{const nt=NoiseHandshakePayload.decode(o),rt=publicKeyFromProtobuf(nt.identityKey);if((tt==null?void 0:tt.equals(rt))===!1)throw new Error(`Payload identity key ${rt} does not match expected remote identity key ${tt}`);if(!et)throw new Error("Remote static does not exist");const ot=getSignaturePayload(et);if(!await rt.verify(ot,nt.identitySig))throw new Error("Invalid payload signature");return nt}catch(nt){throw new UnexpectedPeerError(nt.message)}}function getSignaturePayload(o){const et=fromString("noise-libp2p-static-key:");return o instanceof Uint8Array?concat$1([et,o],et.length+o.length):(o.prepend(et),o)}async function performHandshakeInitiator(o,et){const{log:tt,connection:nt,crypto:rt,privateKey:ot,prologue:it,s:st,remoteIdentityKey:at,extensions:ct}=o,lt=await createHandshakePayload(ot,st.publicKey,ct),dt=new XXHandshakeState({crypto:rt,protocolName:"Noise_XX_25519_ChaChaPoly_SHA256",initiator:!0,prologue:it,s:st});logLocalStaticKeys(dt.s,tt),tt.trace("Stage 0 - Initiator starting to send first message."),await nt.write(dt.writeMessageA(ZEROLEN),et),tt.trace("Stage 0 - Initiator finished sending first message."),logLocalEphemeralKeys(dt.e,tt),tt.trace("Stage 1 - Initiator waiting to receive first message from responder...");const ht=dt.readMessageB(await nt.read(et));tt.trace("Stage 1 - Initiator received the message."),logRemoteEphemeralKey(dt.re,tt),logRemoteStaticKey(dt.rs,tt),tt.trace("Initiator going to check remote's signature...");const pt=await decodeHandshakePayload(ht,dt.rs,at);tt.trace("All good with the signature!"),tt.trace("Stage 2 - Initiator sending third handshake message."),await nt.write(dt.writeMessageC(lt),et),tt.trace("Stage 2 - Initiator sent message with signed payload.");const[mt,ft]=dt.ss.split();return logCipherState(mt,ft,tt),{payload:pt,encrypt:yt=>mt.encryptWithAd(ZEROLEN,yt),decrypt:(yt,gt)=>ft.decryptWithAd(ZEROLEN,yt,gt)}}async function performHandshakeResponder(o,et){const{log:tt,connection:nt,crypto:rt,privateKey:ot,prologue:it,s:st,remoteIdentityKey:at,extensions:ct}=o,lt=await createHandshakePayload(ot,st.publicKey,ct),dt=new XXHandshakeState({crypto:rt,protocolName:"Noise_XX_25519_ChaChaPoly_SHA256",initiator:!1,prologue:it,s:st});logLocalStaticKeys(dt.s,tt),tt.trace("Stage 0 - Responder waiting to receive first message."),dt.readMessageA(await nt.read(et)),tt.trace("Stage 0 - Responder received first message."),logRemoteEphemeralKey(dt.re,tt),tt.trace("Stage 1 - Responder sending out first message with signed payload and static key."),await nt.write(dt.writeMessageB(lt),et),tt.trace("Stage 1 - Responder sent the second handshake message with signed payload."),logLocalEphemeralKeys(dt.e,tt),tt.trace("Stage 2 - Responder waiting for third handshake message...");const ht=dt.readMessageC(await nt.read(et));tt.trace("Stage 2 - Responder received the message, finished handshake.");const pt=await decodeHandshakePayload(ht,dt.rs,at),[mt,ft]=dt.ss.split();return logCipherState(mt,ft,tt),{payload:pt,encrypt:yt=>ft.encryptWithAd(ZEROLEN,yt),decrypt:(yt,gt)=>mt.decryptWithAd(ZEROLEN,yt,gt)}}const CHACHA_TAG_LENGTH=16;function encryptStream(o,et){return async function*(tt){for await(const nt of tt)for(let rt=0;rtnt.length&&(ot=nt.length);let it;nt instanceof Uint8Array?it=o.encrypt(nt.subarray(rt,ot)):it=o.encrypt(nt.sublist(rt,ot)),et==null||et.encryptedPackets.increment(),yield new Uint8ArrayList(uint16BEEncode(it.byteLength),it)}}}function decryptStream(o,et){return async function*(tt){for await(const nt of tt)for(let rt=0;rtnt.length&&(ot=nt.length),ot-CHACHA_TAG_LENGTHdecode$5(it,{lengthDecoder:uint16BEDecode}),decryptStream(tt,this.metrics),nt),rt}}function noise(o={}){return et=>new Noise(et,o)}const peerDiscoverySymbol$1=Symbol.for("@libp2p/peer-discovery");function setMaxListeners$7(){}const setMaxListeners$6=(o,...et)=>{try{[...et]}catch{}};var Yn,$a;let TypedEventEmitter$2=($a=class extends EventTarget{constructor(){super();fn(this,Yn,new Map);setMaxListeners$6(1/0,this)}listenerCount(tt){const nt=Mt(this,Yn).get(tt);return nt==null?0:nt.length}addEventListener(tt,nt,rt){super.addEventListener(tt,nt,rt);let ot=Mt(this,Yn).get(tt);ot==null&&(ot=[],Mt(this,Yn).set(tt,ot)),ot.push({callback:nt,once:(rt!==!0&&rt!==!1&&(rt==null?void 0:rt.once))??!1})}removeEventListener(tt,nt,rt){super.removeEventListener(tt.toString(),nt??null,rt);let ot=Mt(this,Yn).get(tt);ot!=null&&(ot=ot.filter(({callback:it})=>it!==nt),Mt(this,Yn).set(tt,ot))}dispatchEvent(tt){const nt=super.dispatchEvent(tt);let rt=Mt(this,Yn).get(tt.type);return rt==null||(rt=rt.filter(({once:ot})=>!ot),Mt(this,Yn).set(tt.type,rt)),nt}safeDispatchEvent(tt,nt={}){return this.dispatchEvent(new CustomEvent(tt,nt))}},Yn=new WeakMap,$a);const serviceCapabilities$4=Symbol.for("@libp2p/service-capabilities"),DNS4=base("dns4"),DNS6=base("dns6"),DNSADDR=base("dnsaddr"),DNS$1=or$1(base("dns"),DNSADDR,DNS4,DNS6),IP=or$1(base("ip4"),base("ip6")),TCP$1=or$1(and$1(IP,base("tcp")),and$1(DNS$1,base("tcp"))),UDP=and$1(IP,base("udp")),UTP=and$1(UDP,base("utp")),QUIC=and$1(UDP,base("quic")),QUICV1=and$1(UDP,base("quic-v1")),_WebSockets$1=or$1(and$1(TCP$1,base("ws")),and$1(DNS$1,base("ws"))),WebSockets$2=or$1(and$1(_WebSockets$1,base("p2p")),_WebSockets$1),_WebSocketsSecure$1=or$1(and$1(TCP$1,base("wss")),and$1(DNS$1,base("wss")),and$1(TCP$1,base("tls"),base("ws")),and$1(DNS$1,base("tls"),base("ws"))),WebSocketsSecure$1=or$1(and$1(_WebSocketsSecure$1,base("p2p")),_WebSocketsSecure$1),HTTP=or$1(and$1(TCP$1,base("http")),and$1(IP,base("http")),and$1(DNS$1,base("http"))),HTTPS=or$1(and$1(TCP$1,base("https")),and$1(IP,base("https")),and$1(DNS$1,base("https"))),_WebRTCDirect$1=and$1(UDP,base("webrtc-direct"),base("certhash")),WebRTCDirect$1=or$1(and$1(_WebRTCDirect$1,base("p2p")),_WebRTCDirect$1),_WebTransport$1=and$1(QUICV1,base("webtransport"),base("certhash"),base("certhash")),WebTransport$1=or$1(and$1(_WebTransport$1,base("p2p")),_WebTransport$1),P2PWebRTCStar=or$1(and$1(WebSockets$2,base("p2p-webrtc-star"),base("p2p")),and$1(WebSocketsSecure$1,base("p2p-webrtc-star"),base("p2p")),and$1(WebSockets$2,base("p2p-webrtc-star")),and$1(WebSocketsSecure$1,base("p2p-webrtc-star"))),P2PWebRTCDirect=or$1(and$1(HTTP,base("p2p-webrtc-direct"),base("p2p")),and$1(HTTPS,base("p2p-webrtc-direct"),base("p2p")),and$1(HTTP,base("p2p-webrtc-direct")),and$1(HTTPS,base("p2p-webrtc-direct"))),Reliable=or$1(_WebSockets$1,_WebSocketsSecure$1,HTTP,HTTPS,P2PWebRTCStar,P2PWebRTCDirect,TCP$1,UTP,QUIC,DNS$1,WebRTCDirect$1,WebTransport$1),_P2P$1=or$1(and$1(Reliable,base("p2p")),P2PWebRTCStar,P2PWebRTCDirect,WebRTCDirect$1,WebTransport$1,base("p2p")),_Circuit$1=or$1(and$1(_P2P$1,base("p2p-circuit"),_P2P$1),and$1(_P2P$1,base("p2p-circuit")),and$1(base("p2p-circuit"),_P2P$1),and$1(Reliable,base("p2p-circuit")),and$1(base("p2p-circuit"),Reliable),base("p2p-circuit")),CircuitRecursive=()=>or$1(and$1(_Circuit$1,CircuitRecursive),_Circuit$1),Circuit$1=CircuitRecursive(),P2P=or$1(and$1(Circuit$1,_P2P$1,Circuit$1),and$1(_P2P$1,Circuit$1),and$1(Circuit$1,_P2P$1),Circuit$1,_P2P$1);function makeMatchesFunction(o){function et(tt){let nt;try{nt=multiaddr(tt)}catch{return!1}const rt=o(nt.protoNames());return rt===null?!1:rt===!0||rt===!1?rt:rt.length===0}return et}function and$1(...o){function et(tt){if(tt.length(nt=typeof rt=="function"?rt().partialMatch(tt):rt.partialMatch(tt),Array.isArray(nt)&&(tt=nt),nt===null)),nt}return{toString:function(){return"{ "+o.join(" ")+" }"},input:o,matches:makeMatchesFunction(et),partialMatch:et}}function or$1(...o){function et(nt){let rt=null;return o.some(ot=>{const it=typeof ot=="function"?ot().partialMatch(nt):ot.partialMatch(nt);return it!=null?(rt=it,!0):!1}),rt}return{toString:function(){return"{ "+o.join(" ")+" }"},input:o,matches:makeMatchesFunction(et),partialMatch:et}}function base(o){const et=o;function tt(rt){let ot;try{ot=multiaddr(rt)}catch{return!1}const it=ot.protoNames();return it.length===1&&it[0]===et}function nt(rt){return rt.length===0?null:rt[0]===et?rt.slice(1):null}return{toString:function(){return et},matches:tt,partialMatch:nt}}const DEFAULT_BOOTSTRAP_TAG_NAME$1="bootstrap",DEFAULT_BOOTSTRAP_TAG_VALUE$1=50,DEFAULT_BOOTSTRAP_DISCOVERY_TIMEOUT=1e3;var _c,yl,xl,El;class Bootstrap extends(El=TypedEventEmitter$2,xl=peerDiscoverySymbol$1,yl=Symbol.toStringTag,_c=serviceCapabilities$4,El){constructor(tt,nt={list:[]}){if(nt.list==null||nt.list.length===0)throw new Error("Bootstrap requires a list of peer addresses");super();Ct(this,"log");Ct(this,"timer");Ct(this,"list");Ct(this,"timeout");Ct(this,"components");Ct(this,"_init");Ct(this,xl,this);Ct(this,yl,"@libp2p/bootstrap");Ct(this,_c,["@libp2p/peer-discovery"]);this.components=tt,this.log=tt.logger.forComponent("libp2p:bootstrap"),this.timeout=nt.timeout??DEFAULT_BOOTSTRAP_DISCOVERY_TIMEOUT,this.list=[];for(const rt of nt.list){if(!P2P.matches(rt)){this.log.error("Invalid multiaddr");continue}const ot=multiaddr(rt),it=ot.getPeerId();if(it==null){this.log.error("Invalid bootstrap multiaddr without peer id");continue}const st={id:peerIdFromString$1(it),multiaddrs:[ot]};this.list.push(st)}this._init=nt}isStarted(){return!!this.timer}start(){this.isStarted()||(this.log("Starting bootstrap node discovery, discovering peers after %s ms",this.timeout),this.timer=setTimeout(()=>{this._discoverBootstrapPeers().catch(tt=>{this.log.error(tt)})},this.timeout))}async _discoverBootstrapPeers(){if(this.timer!=null)for(const tt of this.list){if(await this.components.peerStore.merge(tt.id,{tags:{[this._init.tagName??DEFAULT_BOOTSTRAP_TAG_NAME$1]:{value:this._init.tagValue??DEFAULT_BOOTSTRAP_TAG_VALUE$1,ttl:this._init.tagTTL}},multiaddrs:tt.multiaddrs}),this.timer==null)return;this.safeDispatchEvent("peer",{detail:tt}),this.components.connectionManager.openConnection(tt.id).catch(nt=>{this.log.error("could not dial bootstrap peer %p",tt.id,nt)})}}stop(){this.timer!=null&&clearTimeout(this.timer),this.timer=void 0}}Ct(Bootstrap,"tag","bootstrap");function bootstrap(o){return et=>new Bootstrap(et,o)}var hs;let UnsupportedProtocolError$1=(hs=class extends Error{constructor(et="Unsupported protocol error"){super(et),this.name="UnsupportedProtocolError"}},Ct(hs,"name","UnsupportedProtocolError"),hs);var ps;let InvalidMessageError$2=(ps=class extends Error{constructor(et="Invalid message"){super(et),this.name="InvalidMessageError"}},Ct(ps,"name","InvalidMessageError"),ps);function setMaxListeners$5(){}const setMaxListeners$4=(o,...et)=>{try{[...et]}catch{}},serviceCapabilities$3=Symbol.for("@libp2p/service-capabilities");var Envelope;(function(o){let et;o.codec=()=>(et==null&&(et=message$1((tt,nt,rt={})=>{rt.lengthDelimited!==!1&&nt.fork(),tt.publicKey!=null&&tt.publicKey.byteLength>0&&(nt.uint32(10),nt.bytes(tt.publicKey)),tt.payloadType!=null&&tt.payloadType.byteLength>0&&(nt.uint32(18),nt.bytes(tt.payloadType)),tt.payload!=null&&tt.payload.byteLength>0&&(nt.uint32(26),nt.bytes(tt.payload)),tt.signature!=null&&tt.signature.byteLength>0&&(nt.uint32(42),nt.bytes(tt.signature)),rt.lengthDelimited!==!1&&nt.ldelim()},(tt,nt,rt={})=>{const ot={publicKey:alloc$2(0),payloadType:alloc$2(0),payload:alloc$2(0),signature:alloc$2(0)},it=nt==null?tt.len:tt.pos+nt;for(;tt.pos>>3){case 1:{ot.publicKey=tt.bytes();break}case 2:{ot.payloadType=tt.bytes();break}case 3:{ot.payload=tt.bytes();break}case 5:{ot.signature=tt.bytes();break}default:{tt.skipType(st&7);break}}}return ot})),et),o.encode=tt=>encodeMessage(tt,o.codec()),o.decode=(tt,nt)=>decodeMessage(tt,o.codec(),nt)})(Envelope||(Envelope={}));class InvalidSignatureError extends Error{constructor(et="Invalid signature"){super(et),this.name="InvalidSignatureError"}}const cr=class cr{constructor(et){Ct(this,"publicKey");Ct(this,"payloadType");Ct(this,"payload");Ct(this,"signature");Ct(this,"marshaled");const{publicKey:tt,payloadType:nt,payload:rt,signature:ot}=et;this.publicKey=tt,this.payloadType=nt,this.payload=rt,this.signature=ot}marshal(){return this.marshaled==null&&(this.marshaled=Envelope.encode({publicKey:publicKeyToProtobuf(this.publicKey),payloadType:this.payloadType,payload:this.payload.subarray(),signature:this.signature})),this.marshaled}equals(et){return equals(this.marshal(),et.marshal())}async validate(et){const tt=formatSignaturePayload(et,this.payloadType,this.payload);return this.publicKey.verify(tt.subarray(),this.signature)}};Ct(cr,"createFromProtobuf",async et=>{const tt=Envelope.decode(et),nt=publicKeyFromProtobuf(tt.publicKey);return new cr({publicKey:nt,payloadType:tt.payloadType,payload:tt.payload,signature:tt.signature})}),Ct(cr,"seal",async(et,tt)=>{if(tt==null)throw new Error("Missing private key");const nt=et.domain,rt=et.codec,ot=et.marshal(),it=formatSignaturePayload(nt,rt,ot),st=await tt.sign(it.subarray());return new cr({publicKey:tt.publicKey,payloadType:rt,payload:ot,signature:st})}),Ct(cr,"openAndCertify",async(et,tt)=>{const nt=await cr.createFromProtobuf(et);if(!await nt.validate(tt))throw new InvalidSignatureError("Envelope signature is not valid for the given domain");return nt});let RecordEnvelope=cr;const formatSignaturePayload=(o,et,tt)=>{const nt=fromString(o),rt=encode$a(nt.byteLength),ot=encode$a(et.length),it=encode$a(tt.length);return new Uint8ArrayList(rt,nt,ot,et,it,tt)};function arrayEquals(o,et){const tt=(nt,rt)=>nt.toString().localeCompare(rt.toString());return o.length!==et.length?!1:(et.sort(tt),o.sort(tt).every((nt,rt)=>et[rt].equals(nt)))}const ENVELOPE_DOMAIN_PEER_RECORD="libp2p-peer-record",ENVELOPE_PAYLOAD_TYPE_PEER_RECORD=Uint8Array.from([3,1]);var PeerRecord$1;(function(o){(function(tt){let nt;tt.codec=()=>(nt==null&&(nt=message$1((rt,ot,it={})=>{it.lengthDelimited!==!1&&ot.fork(),rt.multiaddr!=null&&rt.multiaddr.byteLength>0&&(ot.uint32(10),ot.bytes(rt.multiaddr)),it.lengthDelimited!==!1&&ot.ldelim()},(rt,ot,it={})=>{const st={multiaddr:alloc$2(0)},at=ot==null?rt.len:rt.pos+ot;for(;rt.pos>>3){case 1:{st.multiaddr=rt.bytes();break}default:{rt.skipType(ct&7);break}}}return st})),nt),tt.encode=rt=>encodeMessage(rt,tt.codec()),tt.decode=(rt,ot)=>decodeMessage(rt,tt.codec(),ot)})(o.AddressInfo||(o.AddressInfo={}));let et;o.codec=()=>(et==null&&(et=message$1((tt,nt,rt={})=>{if(rt.lengthDelimited!==!1&&nt.fork(),tt.peerId!=null&&tt.peerId.byteLength>0&&(nt.uint32(10),nt.bytes(tt.peerId)),tt.seq!=null&&tt.seq!==0n&&(nt.uint32(16),nt.uint64(tt.seq)),tt.addresses!=null)for(const ot of tt.addresses)nt.uint32(26),o.AddressInfo.codec().encode(ot,nt);rt.lengthDelimited!==!1&&nt.ldelim()},(tt,nt,rt={})=>{var st,at;const ot={peerId:alloc$2(0),seq:0n,addresses:[]},it=nt==null?tt.len:tt.pos+nt;for(;tt.pos>>3){case 1:{ot.peerId=tt.bytes();break}case 2:{ot.seq=tt.uint64();break}case 3:{if(((st=rt.limits)==null?void 0:st.addresses)!=null&&ot.addresses.length===rt.limits.addresses)throw new MaxLengthError('Decode error - map field "addresses" had too many elements');ot.addresses.push(o.AddressInfo.codec().decode(tt,tt.uint32(),{limits:(at=rt.limits)==null?void 0:at.addresses$}));break}default:{tt.skipType(ct&7);break}}}return ot})),et),o.encode=tt=>encodeMessage(tt,o.codec()),o.decode=(tt,nt)=>decodeMessage(tt,o.codec(),nt)})(PeerRecord$1||(PeerRecord$1={}));const nr=class nr{constructor(et){Ct(this,"peerId");Ct(this,"multiaddrs");Ct(this,"seqNumber");Ct(this,"domain",nr.DOMAIN);Ct(this,"codec",nr.CODEC);Ct(this,"marshaled");const{peerId:tt,multiaddrs:nt,seqNumber:rt}=et;this.peerId=tt,this.multiaddrs=nt??[],this.seqNumber=rt??BigInt(Date.now())}marshal(){return this.marshaled==null&&(this.marshaled=PeerRecord$1.encode({peerId:this.peerId.toMultihash().bytes,seq:BigInt(this.seqNumber),addresses:this.multiaddrs.map(et=>({multiaddr:et.bytes}))})),this.marshaled}equals(et){return!(!(et instanceof nr)||!this.peerId.equals(et.peerId)||this.seqNumber!==et.seqNumber||!arrayEquals(this.multiaddrs,et.multiaddrs))}};Ct(nr,"createFromProtobuf",et=>{const tt=PeerRecord$1.decode(et),nt=peerIdFromMultihash(decode$6(tt.peerId)),rt=(tt.addresses??[]).map(it=>multiaddr(it.multiaddr)),ot=tt.seq;return new nr({peerId:nt,multiaddrs:rt,seqNumber:ot})}),Ct(nr,"DOMAIN",ENVELOPE_DOMAIN_PEER_RECORD),Ct(nr,"CODEC",ENVELOPE_PAYLOAD_TYPE_PEER_RECORD);let PeerRecord=nr;function isAsyncIterable$4(o){return o[Symbol.asyncIterator]!=null}function drain(o){if(isAsyncIterable$4(o))return(async()=>{for await(const et of o);})();for(const et of o);}const CustomEvent$1=globalThis.CustomEvent??Event;async function*parallel(o,et={}){let tt=et.concurrency??1/0;tt<1&&(tt=1/0);const nt=et.ordered==null?!1:et.ordered,rt=new EventTarget,ot=[];let it=pDefer(),st=pDefer(),at=!1,ct,lt=!1;rt.addEventListener("task-complete",()=>{st.resolve()}),Promise.resolve().then(async()=>{try{for await(const mt of o){if(ot.length===tt&&(it=pDefer(),await it.promise),lt)break;const ft={done:!1};ot.push(ft),mt().then(yt=>{ft.done=!0,ft.ok=!0,ft.value=yt,rt.dispatchEvent(new CustomEvent$1("task-complete"))},yt=>{ft.done=!0,ft.err=yt,rt.dispatchEvent(new CustomEvent$1("task-complete"))})}at=!0,rt.dispatchEvent(new CustomEvent$1("task-complete"))}catch(mt){ct=mt,rt.dispatchEvent(new CustomEvent$1("task-complete"))}});function dt(){var mt;return nt?(mt=ot[0])==null?void 0:mt.done:!!ot.find(ft=>ft.done)}function*ht(){for(;ot.length>0&&ot[0].done;){const mt=ot[0];if(ot.shift(),mt.ok)yield mt.value;else throw lt=!0,it.resolve(),mt.err;it.resolve()}}function*pt(){for(;dt();)for(let mt=0;mt{const it=await tt.read(ot);return rt.decode(it)},write:async(rt,ot,it)=>{await tt.write(ot.encode(rt),it)},writeV:async(rt,ot,it)=>{await tt.writeV(rt.map(st=>ot.encode(st)),it)},pb:rt=>({read:async ot=>nt.read(rt,ot),write:async(ot,it)=>nt.write(ot,rt,it),writeV:async(ot,it)=>nt.writeV(ot,rt,it),unwrap:()=>nt}),unwrap:()=>tt.unwrap()};return nt}const IDENTIFY_PROTOCOL_VERSION="0.1.0",MULTICODEC_IDENTIFY_PROTOCOL_NAME="id",MULTICODEC_IDENTIFY_PROTOCOL_VERSION="1.0.0",MAX_IDENTIFY_MESSAGE_SIZE=1024*8,MAX_PUSH_CONCURRENCY=32;var Identify$1;(function(o){let et;o.codec=()=>(et==null&&(et=message$1((tt,nt,rt={})=>{if(rt.lengthDelimited!==!1&&nt.fork(),tt.protocolVersion!=null&&(nt.uint32(42),nt.string(tt.protocolVersion)),tt.agentVersion!=null&&(nt.uint32(50),nt.string(tt.agentVersion)),tt.publicKey!=null&&(nt.uint32(10),nt.bytes(tt.publicKey)),tt.listenAddrs!=null)for(const ot of tt.listenAddrs)nt.uint32(18),nt.bytes(ot);if(tt.observedAddr!=null&&(nt.uint32(34),nt.bytes(tt.observedAddr)),tt.protocols!=null)for(const ot of tt.protocols)nt.uint32(26),nt.string(ot);tt.signedPeerRecord!=null&&(nt.uint32(66),nt.bytes(tt.signedPeerRecord)),rt.lengthDelimited!==!1&&nt.ldelim()},(tt,nt,rt={})=>{var st,at;const ot={listenAddrs:[],protocols:[]},it=nt==null?tt.len:tt.pos+nt;for(;tt.pos>>3){case 5:{ot.protocolVersion=tt.string();break}case 6:{ot.agentVersion=tt.string();break}case 1:{ot.publicKey=tt.bytes();break}case 2:{if(((st=rt.limits)==null?void 0:st.listenAddrs)!=null&&ot.listenAddrs.length===rt.limits.listenAddrs)throw new MaxLengthError('Decode error - map field "listenAddrs" had too many elements');ot.listenAddrs.push(tt.bytes());break}case 4:{ot.observedAddr=tt.bytes();break}case 3:{if(((at=rt.limits)==null?void 0:at.protocols)!=null&&ot.protocols.length===rt.limits.protocols)throw new MaxLengthError('Decode error - map field "protocols" had too many elements');ot.protocols.push(tt.string());break}case 8:{ot.signedPeerRecord=tt.bytes();break}default:{tt.skipType(ct&7);break}}}return ot})),et),o.encode=tt=>encodeMessage(tt,o.codec()),o.decode=(tt,nt)=>decodeMessage(tt,o.codec(),nt)})(Identify$1||(Identify$1={}));var define_process_default={env:{NODE_ENV:'"production"',VITE_WALLETCONNECT_PROJECT_ID:'"1d93edc21291f98e3bed6ff7617ff539"'},nextTick:"setImmediate",platform:'"browser"',version:'"v16.0.0"',browser:!0};function isElectron$1(){return!!(typeof window<"u"&&typeof window.process=="object"&&window.process.type==="renderer"||typeof define_process_default<"u"&&typeof define_process_default.versions=="object"&&define_process_default.versions.electron||typeof navigator=="object"&&typeof navigator.userAgent=="string"&&navigator.userAgent.indexOf("Electron")>=0)}var isElectron_1=isElectron$1;const detectElectron=getDefaultExportFromCjs(isElectron_1),isEnvWithDom=typeof window=="object"&&typeof document=="object"&&document.nodeType===9,isElectron=detectElectron(),isBrowser=isEnvWithDom&&!isElectron,isElectronMain=isElectron&&!isEnvWithDom,isElectronRenderer=isElectron&&isEnvWithDom,isNode=typeof globalThis.process<"u"&&typeof globalThis.process.release<"u"&&globalThis.process.release.name==="node"&&!isElectron,isWebWorker=typeof importScripts=="function"&&typeof self<"u"&&typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope,isReactNative=typeof navigator<"u"&&navigator.product==="ReactNative",defaultValues={protocolPrefix:"ipfs",timeout:5e3,maxInboundStreams:1,maxOutboundStreams:1,maxObservedAddresses:10,maxMessageSize:MAX_IDENTIFY_MESSAGE_SIZE,runOnConnectionOpen:!0,runOnSelfUpdate:!0,runOnLimitedConnection:!0,concurrency:MAX_PUSH_CONCURRENCY};function getCleanMultiaddr(o){if(o!=null&&o.length>0)try{return multiaddr(o)}catch{}}function getAgentVersion(o,et){return et!=null||(et=`${o.name}/${o.version}`,isNode||isElectronMain?et+=` UserAgent=${globalThis.process.version}`:(isBrowser||isWebWorker||isElectronRenderer||isReactNative)&&(et+=` UserAgent=${globalThis.navigator.userAgent}`)),et}async function consumeIdentifyMessage(o,et,tt,nt,rt){if(tt("received identify from %p",nt.remotePeer),rt==null)throw new InvalidMessageError$2("message was null or undefined");const ot={};if(rt.listenAddrs.length>0&&(ot.addresses=rt.listenAddrs.map(at=>({isCertified:!1,multiaddr:multiaddr(at)}))),rt.protocols.length>0&&(ot.protocols=rt.protocols),rt.publicKey!=null){const at=publicKeyFromProtobuf(rt.publicKey);if(!peerIdFromPublicKey(at).equals(nt.remotePeer))throw new InvalidMessageError$2("public key did not match remote PeerId");ot.publicKey=at}let it;if(rt.signedPeerRecord!=null){tt.trace("received signedPeerRecord from %p",nt.remotePeer);let at=rt.signedPeerRecord;const ct=await RecordEnvelope.openAndCertify(at,PeerRecord.DOMAIN);let lt=PeerRecord.createFromProtobuf(ct.payload);const dt=peerIdFromCID(ct.publicKey.toCID());if(!lt.peerId.equals(dt))throw new InvalidMessageError$2("signing key does not match PeerId in the PeerRecord");if(!nt.remotePeer.equals(lt.peerId))throw new InvalidMessageError$2("signing key does not match remote PeerId");let ht;try{ht=await o.get(lt.peerId)}catch(pt){if(pt.name!=="NotFoundError")throw pt}if(ht!=null&&(ot.metadata=ht.metadata,ht.peerRecordEnvelope!=null)){const pt=await RecordEnvelope.createFromProtobuf(ht.peerRecordEnvelope),mt=PeerRecord.createFromProtobuf(pt.payload);mt.seqNumber>=lt.seqNumber&&(tt("sequence number was lower or equal to existing sequence number - stored: %d received: %d",mt.seqNumber,lt.seqNumber),lt=mt,at=ht.peerRecordEnvelope)}ot.peerRecordEnvelope=at,ot.addresses=lt.multiaddrs.map(pt=>({isCertified:!0,multiaddr:pt})),it={seq:lt.seqNumber,addresses:lt.multiaddrs}}else tt("%p did not send a signed peer record",nt.remotePeer);if(tt.trace("patching %p with",nt.remotePeer,ot),await o.patch(nt.remotePeer,ot),rt.agentVersion!=null||rt.protocolVersion!=null){const at={};rt.agentVersion!=null&&(at.AgentVersion=fromString(rt.agentVersion)),rt.protocolVersion!=null&&(at.ProtocolVersion=fromString(rt.protocolVersion)),tt.trace("merging %p metadata",nt.remotePeer,at),await o.merge(nt.remotePeer,{metadata:at})}const st={peerId:nt.remotePeer,protocolVersion:rt.protocolVersion,agentVersion:rt.agentVersion,publicKey:rt.publicKey,listenAddrs:rt.listenAddrs.map(at=>multiaddr(at)),observedAddr:rt.observedAddr==null?void 0:multiaddr(rt.observedAddr),protocols:rt.protocols,signedPeerRecord:it,connection:nt};return et.safeDispatchEvent("peer:identify",{detail:st}),st}class AbstractIdentify{constructor(et,tt){Ct(this,"host");Ct(this,"protocol");Ct(this,"started");Ct(this,"timeout");Ct(this,"peerId");Ct(this,"privateKey");Ct(this,"peerStore");Ct(this,"registrar");Ct(this,"addressManager");Ct(this,"maxInboundStreams");Ct(this,"maxOutboundStreams");Ct(this,"maxMessageSize");Ct(this,"maxObservedAddresses");Ct(this,"events");Ct(this,"runOnLimitedConnection");Ct(this,"log");this.protocol=tt.protocol,this.started=!1,this.peerId=et.peerId,this.privateKey=et.privateKey,this.peerStore=et.peerStore,this.registrar=et.registrar,this.addressManager=et.addressManager,this.events=et.events,this.log=tt.log,this.timeout=tt.timeout??defaultValues.timeout,this.maxInboundStreams=tt.maxInboundStreams??defaultValues.maxInboundStreams,this.maxOutboundStreams=tt.maxOutboundStreams??defaultValues.maxOutboundStreams,this.maxMessageSize=tt.maxMessageSize??defaultValues.maxMessageSize,this.maxObservedAddresses=tt.maxObservedAddresses??defaultValues.maxObservedAddresses,this.runOnLimitedConnection=tt.runOnLimitedConnection??defaultValues.runOnLimitedConnection,this.host={protocolVersion:`${tt.protocolPrefix??defaultValues.protocolPrefix}/${IDENTIFY_PROTOCOL_VERSION}`,agentVersion:getAgentVersion(et.nodeInfo,tt.agentVersion)}}isStarted(){return this.started}async start(){this.started||(await this.peerStore.merge(this.peerId,{metadata:{AgentVersion:fromString(this.host.agentVersion),ProtocolVersion:fromString(this.host.protocolVersion)}}),await this.registrar.handle(this.protocol,et=>{this.handleProtocol(et).catch(tt=>{this.log.error(tt)})},{maxInboundStreams:this.maxInboundStreams,maxOutboundStreams:this.maxOutboundStreams,runOnLimitedConnection:this.runOnLimitedConnection}),this.started=!0)}async stop(){await this.registrar.unhandle(this.protocol),this.started=!1}}var Netmask_1;(function(){var o,et,tt,nt,rt,ot,it,st;st=function(at){var ct,lt,dt,ht;return ct=(at&255<<24)>>>24,lt=(at&255<<16)>>>16,dt=(at&65280)>>>8,ht=at&255,[ct,lt,dt,ht].join(".")},it=function(at){var ct,lt,dt,ht,pt,mt;for(ct=[],dt=ht=0;ht<=3&&at.length!==0;dt=++ht){if(dt>0){if(at[0]!==".")throw new Error("Invalid IP");at=at.substring(1)}mt=et(at),pt=mt[0],lt=mt[1],at=at.substring(lt),ct.push(pt)}if(at.length!==0)throw new Error("Invalid IP");switch(ct.length){case 1:if(ct[0]>4294967295)throw new Error("Invalid IP");return ct[0]>>>0;case 2:if(ct[0]>255||ct[1]>16777215)throw new Error("Invalid IP");return(ct[0]<<24|ct[1])>>>0;case 3:if(ct[0]>255||ct[1]>255||ct[2]>65535)throw new Error("Invalid IP");return(ct[0]<<24|ct[1]<<16|ct[2])>>>0;case 4:if(ct[0]>255||ct[1]>255||ct[2]>255||ct[3]>255)throw new Error("Invalid IP");return(ct[0]<<24|ct[1]<<16|ct[2]<<8|ct[3])>>>0;default:throw new Error("Invalid IP")}},tt=function(at){return at.charCodeAt(0)},nt=tt("0"),ot=tt("a"),rt=tt("A"),et=function(at){var ct,lt,dt,ht,pt;for(ht=0,ct=10,lt="9",dt=0,at.length>1&&at[dt]==="0"&&(at[dt+1]==="x"||at[dt+1]==="X"?(dt+=2,ct=16):"0"<=at[dt+1]&&at[dt+1]<="9"&&(dt++,ct=8,lt="7")),pt=dt;dt>>0;else if(ct===16)if("a"<=at[dt]&&at[dt]<="f")ht=ht*ct+(10+tt(at[dt])-ot)>>>0;else if("A"<=at[dt]&&at[dt]<="F")ht=ht*ct+(10+tt(at[dt])-rt)>>>0;else break;else break;if(ht>4294967295)throw new Error("too large");dt++}if(dt===pt)throw new Error("empty octet");return[ht,dt]},o=function(){function at(ct,lt){var dt,ht,pt;if(typeof ct!="string")throw new Error("Missing `net' parameter");if(lt||(pt=ct.split("/",2),ct=pt[0],lt=pt[1]),lt||(lt=32),typeof lt=="string"&<.indexOf(".")>-1){try{this.maskLong=it(lt)}catch{throw new Error("Invalid mask: "+lt)}for(dt=ht=32;ht>=0;dt=--ht)if(this.maskLong===4294967295<<32-dt>>>0){this.bitmask=dt;break}}else if(lt||lt===0)this.bitmask=parseInt(lt,10),this.maskLong=0,this.bitmask>0&&(this.maskLong=4294967295<<32-this.bitmask>>>0);else throw new Error("Invalid mask: empty");try{this.netLong=(it(ct)&this.maskLong)>>>0}catch{throw new Error("Invalid net address: "+ct)}if(!(this.bitmask<=32))throw new Error("Invalid mask for ip4: "+lt);this.size=Math.pow(2,32-this.bitmask),this.base=st(this.netLong),this.mask=st(this.maskLong),this.hostmask=st(~this.maskLong),this.first=this.bitmask<=30?st(this.netLong+1):this.base,this.last=this.bitmask<=30?st(this.netLong+this.size-2):st(this.netLong+this.size-1),this.broadcast=this.bitmask<=30?st(this.netLong+this.size-1):void 0}return at.prototype.contains=function(ct){return typeof ct=="string"&&(ct.indexOf("/")>0||ct.split(".").length!==4)&&(ct=new at(ct)),ct instanceof at?this.contains(ct.base)&&this.contains(ct.broadcast||ct.last):(it(ct)&this.maskLong)>>>0===(this.netLong&this.maskLong)>>>0},at.prototype.next=function(ct){return ct==null&&(ct=1),new at(st(this.netLong+this.size*ct),this.mask)},at.prototype.forEach=function(ct){var lt,dt,ht;for(ht=it(this.first),dt=it(this.last),lt=0;ht<=dt;)ct(st(ht),ht,lt),lt++,ht++},at.prototype.toString=function(){return this.base+"/"+this.bitmask},at}(),Netmask_1=o}).call(commonjsGlobal);const PRIVATE_IP_RANGES=["0.0.0.0/8","10.0.0.0/8","100.64.0.0/10","127.0.0.0/8","169.254.0.0/16","172.16.0.0/12","192.0.0.0/24","192.0.0.0/29","192.0.0.8/32","192.0.0.9/32","192.0.0.10/32","192.0.0.170/32","192.0.0.171/32","192.0.2.0/24","192.31.196.0/24","192.52.193.0/24","192.88.99.0/24","192.168.0.0/16","192.175.48.0/24","198.18.0.0/15","198.51.100.0/24","203.0.113.0/24","240.0.0.0/4","255.255.255.255/32"],NETMASK_RANGES=PRIVATE_IP_RANGES.map(o=>new Netmask_1(o));function ipv4Check(o){for(const et of NETMASK_RANGES)if(et.contains(o))return!0;return!1}function isIpv4MappedIpv6(o){return/^::ffff:([0-9a-fA-F]{1,4}):([0-9a-fA-F]{1,4})$/.test(o)}function ipv4MappedIpv6Check(o){const et=o.split(":");if(et.length<2)return!1;const tt=et[et.length-1].padStart(4,"0"),nt=et[et.length-2].padStart(4,"0"),rt=`${parseInt(nt.substring(0,2),16)}.${parseInt(nt.substring(2),16)}.${parseInt(tt.substring(0,2),16)}.${parseInt(tt.substring(2),16)}`;return ipv4Check(rt)}function isIpv4EmbeddedIpv6(o){return/^::ffff:([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})$/.test(o)}function ipv4EmbeddedIpv6Check(o){const et=o.split(":"),tt=et[et.length-1];return ipv4Check(tt)}function ipv6Check(o){return/^::$/.test(o)||/^::1$/.test(o)||/^64:ff9b::([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})$/.test(o)||/^100::([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4})$/.test(o)||/^2001::([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4})$/.test(o)||/^2001:2[0-9a-fA-F]:([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4})$/.test(o)||/^2001:db8:([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4})$/.test(o)||/^2002:([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4})$/.test(o)||/^f[c-d]([0-9a-fA-F]{2,2}):/i.test(o)||/^fe[8-9a-bA-B][0-9a-fA-F]:/i.test(o)||/^ff([0-9a-fA-F]{2,2}):/i.test(o)}function isPrivateIp(o){return isIPv4(o)?ipv4Check(o):isIpv4MappedIpv6(o)?ipv4MappedIpv6Check(o):isIpv4EmbeddedIpv6(o)?ipv4EmbeddedIpv6Check(o):isIPv6(o)?ipv6Check(o):void 0}const toParts=o=>o.toString().split("/").slice(1),func=o=>({match:et=>et.length<1?!1:o(et[0])?et.slice(1):!1,pattern:"fn"}),literal=o=>({match:et=>func(tt=>tt===o).match(et),pattern:o}),string$3=()=>({match:o=>func(et=>typeof et=="string").match(o),pattern:"{string}"}),number$1=()=>({match:o=>func(et=>!isNaN(parseInt(et))).match(o),pattern:"{number}"}),peerId=()=>({match:o=>{if(o.length<2||o[0]!=="p2p"&&o[0]!=="ipfs")return!1;if(o[1].startsWith("Q")||o[1].startsWith("1"))try{base58btc.decode(`z${o[1]}`)}catch{return!1}else return!1;return o.slice(2)},pattern:"/p2p/{peerid}"}),certhash=()=>({match:o=>{if(o.length<2||o[0]!=="certhash")return!1;try{base64url.decode(o[1])}catch{return!1}return o.slice(2)},pattern:"/certhash/{certhash}"}),optional=o=>({match:et=>{const tt=o.match(et);return tt===!1?et:tt},pattern:`optional(${o.pattern})`}),or=(...o)=>({match:et=>{let tt;for(const nt of o){const rt=nt.match(et);rt!==!1&&(tt==null||rt.lengthet.pattern).join(", ")})`}),and=(...o)=>({match:et=>{for(const tt of o){const nt=tt.match(et);if(nt===!1)return!1;et=nt}return et},pattern:`and(${o.map(et=>et.pattern).join(", ")})`});function fmt(...o){function et(rt){let ot=toParts(rt);for(const it of o){const st=it.match(ot);if(st===!1)return!1;ot=st}return ot}function tt(rt){return et(rt)!==!1}function nt(rt){const ot=et(rt);return ot===!1?!1:ot.length===0}return{matchers:o,matches:tt,exactMatch:nt}}const _DNS4=and(literal("dns4"),string$3()),_DNS6=and(literal("dns6"),string$3()),_DNSADDR=and(literal("dnsaddr"),string$3()),_DNS=and(literal("dns"),string$3());fmt(_DNS4,optional(peerId()));fmt(_DNS6,optional(peerId()));fmt(_DNSADDR,optional(peerId()));fmt(or(_DNS,_DNSADDR,_DNS4,_DNS6),optional(peerId()));const _IP4=and(literal("ip4"),func(isIPv4)),_IP6=and(literal("ip6"),func(isIPv6)),_IP=or(_IP4,_IP6),_IP_OR_DOMAIN=or(_IP,_DNS,_DNS4,_DNS6,_DNSADDR),IP_OR_DOMAIN=fmt(or(_IP,and(or(_DNS,_DNSADDR,_DNS4,_DNS6),optional(peerId())))),_TCP=and(_IP_OR_DOMAIN,literal("tcp"),number$1()),_UDP=and(_IP_OR_DOMAIN,literal("udp"),number$1()),TCP=fmt(and(_TCP,optional(peerId()))),_QUIC=and(_UDP,literal("quic")),_QUICV1=and(_UDP,literal("quic-v1")),QUIC_V0_OR_V1=or(_QUIC,_QUICV1),_WEB=or(_IP_OR_DOMAIN,_TCP,_UDP,_QUIC,_QUICV1),_WebSockets=or(and(_WEB,literal("ws"),optional(peerId()))),WebSockets$1=fmt(_WebSockets),_WebSocketsSecure=or(and(_WEB,literal("wss"),optional(peerId())),and(_WEB,literal("tls"),optional(and(literal("sni"),string$3())),literal("ws"),optional(peerId()))),WebSocketsSecure=fmt(_WebSocketsSecure),_WebRTCDirect=and(_UDP,literal("webrtc-direct"),optional(certhash()),optional(certhash()),optional(peerId())),WebRTCDirect=fmt(_WebRTCDirect),_WebTransport=and(_QUICV1,literal("webtransport"),optional(certhash()),optional(certhash()),optional(peerId())),WebTransport=fmt(_WebTransport),_P2P=or(_WebSockets,_WebSocketsSecure,and(_TCP,optional(peerId())),and(QUIC_V0_OR_V1,optional(peerId())),and(_IP_OR_DOMAIN,optional(peerId())),_WebRTCDirect,_WebTransport,peerId()),_Circuit=and(_P2P,literal("p2p-circuit"),peerId()),Circuit=fmt(_Circuit),_WebRTC=or(and(_P2P,literal("p2p-circuit"),literal("webrtc"),optional(peerId())),and(_P2P,literal("webrtc"),optional(peerId())),and(literal("webrtc"),optional(peerId()))),WebRTC=fmt(_WebRTC);or(and(_IP_OR_DOMAIN,literal("tcp"),number$1(),literal("http"),optional(peerId())),and(_IP_OR_DOMAIN,literal("http"),optional(peerId())));or(and(_IP_OR_DOMAIN,literal("tcp"),or(and(literal("443"),literal("http")),and(number$1(),literal("https"))),optional(peerId())),and(_IP_OR_DOMAIN,literal("tls"),literal("http"),optional(peerId())),and(_IP_OR_DOMAIN,literal("https"),optional(peerId())));or(and(literal("memory"),string$3(),optional(peerId())));var wl,Cl;class Identify extends(Cl=AbstractIdentify,wl=serviceCapabilities$3,Cl){constructor(tt,nt={}){super(tt,{...nt,protocol:`/${nt.protocolPrefix??defaultValues.protocolPrefix}/${MULTICODEC_IDENTIFY_PROTOCOL_NAME}/${MULTICODEC_IDENTIFY_PROTOCOL_VERSION}`,log:tt.logger.forComponent("libp2p:identify")});Ct(this,wl,["@libp2p/identify"]);(nt.runOnConnectionOpen??defaultValues.runOnConnectionOpen)&&tt.events.addEventListener("connection:open",rt=>{const ot=rt.detail;this.identify(ot).catch(it=>{it.name!==UnsupportedProtocolError$1.name&&this.log.error("error during identify trigged by connection:open",it)})})}async _identify(tt,nt={}){let rt;if(nt.signal==null){const ot=AbortSignal.timeout(this.timeout);setMaxListeners$4(1/0,ot),nt={...nt,signal:ot}}try{rt=await tt.newStream(this.protocol,{...nt,runOnLimitedConnection:this.runOnLimitedConnection});const it=await pbStream(rt,{maxDataLength:this.maxMessageSize}).pb(Identify$1).read(nt);return await rt.close(nt),it}catch(ot){throw rt==null||rt.abort(ot),ot}}async identify(tt,nt={}){const rt=await this._identify(tt,nt),{publicKey:ot,protocols:it,observedAddr:st}=rt;if(ot==null)throw new InvalidMessageError$2("public key was missing from identify message");const at=publicKeyFromProtobuf(ot),ct=peerIdFromCID(at.toCID());if(!tt.remotePeer.equals(ct))throw new InvalidMessageError$2("identified peer does not match the expected peer");if(this.peerId.equals(ct))throw new InvalidMessageError$2("identified peer is our own peer id?");const lt=getCleanMultiaddr(st);return this.log("identify completed for peer %p and protocols %o",ct,it),lt!=null&&(this.log("our observed address was %a",lt),isPrivateIp(lt==null?void 0:lt.nodeAddress().address)===!0?this.log("our observed address was private"):this.addressManager.getObservedAddrs().length<(this.maxObservedAddresses??1/0)&&(this.log("storing our observed address"),this.addressManager.addObservedAddr(lt))),consumeIdentifyMessage(this.peerStore,this.events,this.log,tt,rt)}async handleProtocol(tt){const{connection:nt,stream:rt}=tt,ot=AbortSignal.timeout(this.timeout);setMaxListeners$4(1/0,ot);try{const it=await this.peerStore.get(this.peerId),st=this.addressManager.getAddresses().map(dt=>dt.decapsulateCode(getProtocol("p2p").code));let at=it.peerRecordEnvelope;if(st.length>0&&at==null){const dt=new PeerRecord({peerId:this.peerId,multiaddrs:st});at=(await RecordEnvelope.seal(dt,this.privateKey)).marshal().subarray()}let ct=nt.remoteAddr.bytes;IP_OR_DOMAIN.matches(nt.remoteAddr)||(ct=void 0),await pbStream(rt).pb(Identify$1).write({protocolVersion:this.host.protocolVersion,agentVersion:this.host.agentVersion,publicKey:publicKeyToProtobuf(this.privateKey.publicKey),listenAddrs:st.map(dt=>dt.bytes),signedPeerRecord:at,observedAddr:ct,protocols:it.protocols},{signal:ot}),await rt.close({signal:ot})}catch(it){this.log.error("could not respond to identify request",it),rt.abort(it)}}}function identify(o={}){return et=>new Identify(et,o)}class MuxerClosedError extends Error{constructor(et="The muxer is closed"){super(et),this.name="MuxerClosedError"}}Ct(MuxerClosedError,"name","MuxerClosedError");var gs;let InvalidMessageError$1=(gs=class extends Error{constructor(et="Invalid message"){super(et),this.name="InvalidMessageError"}},Ct(gs,"name","InvalidMessageError"),gs);var ys;let TooManyOutboundProtocolStreamsError$1=(ys=class extends Error{constructor(et="Too many outbound protocol streams"){super(et),this.name="TooManyOutboundProtocolStreamsError"}},Ct(ys,"name","TooManyOutboundProtocolStreamsError"),ys);const serviceCapabilities$2=Symbol.for("@libp2p/service-capabilities");function getIterator(o){if(o!=null){if(typeof o[Symbol.iterator]=="function")return o[Symbol.iterator]();if(typeof o[Symbol.asyncIterator]=="function")return o[Symbol.asyncIterator]();if(typeof o.next=="function")return o}throw new Error("argument is not an iterator or iterable")}function isPromise$2(o){return o==null?!1:typeof o.then=="function"&&typeof o.catch=="function"&&typeof o.finally=="function"}function closeSource(o,et){var nt,rt;const tt=(rt=(nt=getIterator(o)).return)==null?void 0:rt.call(nt);isPromise$2(tt)&&tt.catch(ot=>{et.error("could not cause iterator to return",ot)})}const createAbortError=()=>{const o=new Error("Delay aborted");return o.name="AbortError",o},clearMethods=new WeakMap;function createDelay({clearTimeout:o,setTimeout:et}={}){return(tt,{value:nt,signal:rt}={})=>{if(rt!=null&&rt.aborted)return Promise.reject(createAbortError());let ot,it,st;const at=o??clearTimeout,ct=()=>{at(ot),st(createAbortError())},lt=()=>{rt&&rt.removeEventListener("abort",ct)},dt=new Promise((ht,pt)=>{it=()=>{lt(),ht(nt)},st=pt,ot=(et??setTimeout)(it,tt)});return rt&&rt.addEventListener("abort",ct,{once:!0}),clearMethods.set(dt,()=>{at(ot),ot=null,it()}),dt}}const delay=createDelay();class RateLimitError extends Error{constructor(tt="Rate limit exceeded",nt){super(tt);Ct(this,"remainingPoints");Ct(this,"msBeforeNext");Ct(this,"consumedPoints");Ct(this,"isFirstInDuration");this.name="RateLimitError",this.remainingPoints=nt.remainingPoints,this.msBeforeNext=nt.msBeforeNext,this.consumedPoints=nt.consumedPoints,this.isFirstInDuration=nt.isFirstInDuration}}class QueueFullError extends Error{constructor(et="The queue was full"){super(et),this.name="QueueFullError"}}Ct(QueueFullError,"name","QueueFullError");class RateLimiter{constructor(et={}){Ct(this,"memoryStorage");Ct(this,"points");Ct(this,"duration");Ct(this,"blockDuration");Ct(this,"execEvenly");Ct(this,"execEvenlyMinDelayMs");Ct(this,"keyPrefix");this.points=et.points??4,this.duration=et.duration??1,this.blockDuration=et.blockDuration??0,this.execEvenly=et.execEvenly??!1,this.execEvenlyMinDelayMs=et.execEvenlyMinDelayMs??this.duration*1e3/this.points,this.keyPrefix=et.keyPrefix??"rlflx",this.memoryStorage=new MemoryStorage}async consume(et,tt=1,nt={}){const rt=this.getKey(et),ot=this._getKeySecDuration(nt);let it=this.memoryStorage.incrby(rt,tt,ot);if(it.remainingPoints=Math.max(this.points-it.consumedPoints,0),it.consumedPoints>this.points)throw this.blockDuration>0&&it.consumedPoints<=this.points+tt&&(it=this.memoryStorage.set(rt,it.consumedPoints,this.blockDuration)),new RateLimitError("Rate limit exceeded",it);if(this.execEvenly&&it.msBeforeNext>0&&!it.isFirstInDuration){let st=Math.ceil(it.msBeforeNext/(it.remainingPoints+2));st=0?nt:this.duration)*1e3;return this.memoryStorage.set(this.getKey(et),tt,nt),{remainingPoints:0,msBeforeNext:rt===0?-1:rt,consumedPoints:tt,isFirstInDuration:!1}}get(et){const tt=this.memoryStorage.get(this.getKey(et));return tt!=null&&(tt.remainingPoints=Math.max(this.points-tt.consumedPoints,0)),tt}delete(et){this.memoryStorage.delete(this.getKey(et))}_getKeySecDuration(et){return(et==null?void 0:et.customDuration)!=null&&et.customDuration>=0?et.customDuration:this.duration}getKey(et){return this.keyPrefix.length>0?`${this.keyPrefix}:${et}`:et}parseKey(et){return et.substring(this.keyPrefix.length)}}class MemoryStorage{constructor(){Ct(this,"storage");this.storage=new Map}incrby(et,tt,nt){const rt=this.storage.get(et);if(rt!=null){const ot=rt.expiresAt!=null?rt.expiresAt.getTime()-new Date().getTime():-1;return rt.expiresAt==null||ot>0?(rt.value+=tt,{remainingPoints:0,msBeforeNext:ot,consumedPoints:rt.value,isFirstInDuration:!1}):this.set(et,tt,nt)}return this.set(et,tt,nt)}set(et,tt,nt){const rt=nt*1e3,ot=this.storage.get(et);ot!=null&&clearTimeout(ot.timeoutId);const it={value:tt,expiresAt:rt>0?new Date(Date.now()+rt):void 0};return this.storage.set(et,it),rt>0&&(it.timeoutId=setTimeout(()=>{this.storage.delete(et)},rt),it.timeoutId.unref!=null&&it.timeoutId.unref()),{remainingPoints:0,msBeforeNext:rt===0?-1:rt,consumedPoints:it.value,isFirstInDuration:!0}}get(et){const tt=this.storage.get(et);if(tt!=null)return{remainingPoints:0,msBeforeNext:tt.expiresAt!=null?tt.expiresAt.getTime()-new Date().getTime():-1,consumedPoints:tt.value,isFirstInDuration:!1}}delete(et){const tt=this.storage.get(et);return tt!=null?(tt.timeoutId!=null&&clearTimeout(tt.timeoutId),this.storage.delete(et),!0):!1}}var MessageTypes;(function(o){o[o.NEW_STREAM=0]="NEW_STREAM",o[o.MESSAGE_RECEIVER=1]="MESSAGE_RECEIVER",o[o.MESSAGE_INITIATOR=2]="MESSAGE_INITIATOR",o[o.CLOSE_RECEIVER=3]="CLOSE_RECEIVER",o[o.CLOSE_INITIATOR=4]="CLOSE_INITIATOR",o[o.RESET_RECEIVER=5]="RESET_RECEIVER",o[o.RESET_INITIATOR=6]="RESET_INITIATOR"})(MessageTypes||(MessageTypes={}));const MessageTypeNames=Object.freeze({0:"NEW_STREAM",1:"MESSAGE_RECEIVER",2:"MESSAGE_INITIATOR",3:"CLOSE_RECEIVER",4:"CLOSE_INITIATOR",5:"RESET_RECEIVER",6:"RESET_INITIATOR"}),InitiatorMessageTypes=Object.freeze({NEW_STREAM:MessageTypes.NEW_STREAM,MESSAGE:MessageTypes.MESSAGE_INITIATOR,CLOSE:MessageTypes.CLOSE_INITIATOR,RESET:MessageTypes.RESET_INITIATOR}),ReceiverMessageTypes=Object.freeze({MESSAGE:MessageTypes.MESSAGE_RECEIVER,CLOSE:MessageTypes.CLOSE_RECEIVER,RESET:MessageTypes.RESET_RECEIVER}),MAX_MSG_SIZE=1<<20,MAX_MSG_QUEUE_SIZE=4<<20;class Decoder{constructor(et=MAX_MSG_SIZE,tt=MAX_MSG_QUEUE_SIZE){Ct(this,"_buffer");Ct(this,"_headerInfo");Ct(this,"_maxMessageSize");Ct(this,"_maxUnprocessedMessageQueueSize");this._buffer=new Uint8ArrayList,this._headerInfo=null,this._maxMessageSize=et,this._maxUnprocessedMessageQueueSize=tt}write(et){if(et==null||et.length===0)return[];if(this._buffer.append(et),this._buffer.byteLength>this._maxUnprocessedMessageQueueSize)throw new InvalidMessageError$1("Unprocessed message queue size too large!");const tt=[];for(;this._buffer.length!==0;){if(this._headerInfo==null)try{this._headerInfo=this._decodeHeader(this._buffer)}catch(ct){if(ct.name==="InvalidMessageError")throw ct;break}const{id:nt,type:rt,length:ot,offset:it}=this._headerInfo;if(this._buffer.length-itthis._maxMessageSize)throw new InvalidMessageError$1("Message size too large");return{id:tt>>3,type:it,offset:nt+ot,length:rt}}}const MSB=128,REST=127;function readVarInt(o,et=0){let tt=0,nt=0,rt=et,ot;const it=o.length;do{if(rt>=it||nt>49)throw et=0,new RangeError("Could not decode varint");ot=o.get(rt++),tt+=nt<28?(ot&REST)<=MSB);return et=rt-et,{value:tt,offset:et}}const POOL_SIZE=10*1024;class Encoder{constructor(){Ct(this,"_pool");Ct(this,"_poolOffset");this._pool=allocUnsafe(POOL_SIZE),this._poolOffset=0}write(et,tt){const nt=this._pool;let rt=this._poolOffset;encode$a(et.id<<3|et.type,nt,rt),rt+=encodingLength$3(et.id<<3|et.type),(et.type===MessageTypes.NEW_STREAM||et.type===MessageTypes.MESSAGE_INITIATOR||et.type===MessageTypes.MESSAGE_RECEIVER)&&et.data!=null?(encode$a(et.data.length,nt,rt),rt+=encodingLength$3(et.data.length)):(encode$a(0,nt,rt),rt+=encodingLength$3(0));const ot=nt.subarray(this._poolOffset,rt);POOL_SIZE-rt<100?(this._pool=allocUnsafe(POOL_SIZE),this._poolOffset=0):this._poolOffset=rt,tt.append(ot),(et.type===MessageTypes.NEW_STREAM||et.type===MessageTypes.MESSAGE_INITIATOR||et.type===MessageTypes.MESSAGE_RECEIVER)&&et.data!=null&&tt.append(et.data)}}const encoder$1=new Encoder;async function*encode$4(o){for await(const et of o){const tt=new Uint8ArrayList;encoder$1.write(et,tt),yield tt}}class StreamInputBufferError extends Error{constructor(et="Stream input buffer error"){super(et),this.name="StreamInputBufferError"}}var xs;let AbortError$6=(xs=class extends Error{constructor(et="The operation was aborted"){super(et),this.name="AbortError"}},Ct(xs,"name","AbortError"),xs);class StreamResetError extends Error{constructor(et="The stream has been reset"){super(et),this.name="StreamResetError"}}Ct(StreamResetError,"name","StreamResetError");class StreamStateError extends Error{constructor(et="The stream is in an invalid state"){super(et),this.name="StreamStateError"}}Ct(StreamStateError,"name","StreamStateError");function setMaxListeners$3(){}const setMaxListeners$2=(o,...et)=>{try{[...et]}catch{}};var Zn,Sl;let TypedEventEmitter$1=(Sl=class extends EventTarget{constructor(){super();fn(this,Zn,new Map);setMaxListeners$2(1/0,this)}listenerCount(tt){const nt=Mt(this,Zn).get(tt);return nt==null?0:nt.length}addEventListener(tt,nt,rt){super.addEventListener(tt,nt,rt);let ot=Mt(this,Zn).get(tt);ot==null&&(ot=[],Mt(this,Zn).set(tt,ot)),ot.push({callback:nt,once:(rt!==!0&&rt!==!1&&(rt==null?void 0:rt.once))??!1})}removeEventListener(tt,nt,rt){super.removeEventListener(tt.toString(),nt??null,rt);let ot=Mt(this,Zn).get(tt);ot!=null&&(ot=ot.filter(({callback:it})=>it!==nt),Mt(this,Zn).set(tt,ot))}dispatchEvent(tt){const nt=super.dispatchEvent(tt);let rt=Mt(this,Zn).get(tt.type);return rt==null||(rt=rt.filter(({once:ot})=>!ot),Mt(this,Zn).set(tt.type,rt)),nt}safeDispatchEvent(tt,nt={}){return this.dispatchEvent(new CustomEvent(tt,nt))}},Zn=new WeakMap,Sl);const DEFAULT_SEND_CLOSE_WRITE_TIMEOUT=5e3;function isPromise$1(o){return o==null?!1:typeof o.then=="function"&&typeof o.catch=="function"&&typeof o.finally=="function"}class AbstractStream{constructor(et){Ct(this,"id");Ct(this,"direction");Ct(this,"timeline");Ct(this,"protocol");Ct(this,"metadata");Ct(this,"source");Ct(this,"status");Ct(this,"readStatus");Ct(this,"writeStatus");Ct(this,"log");Ct(this,"sinkController");Ct(this,"sinkEnd");Ct(this,"closed");Ct(this,"endErr");Ct(this,"streamSource");Ct(this,"onEnd");Ct(this,"onCloseRead");Ct(this,"onCloseWrite");Ct(this,"onReset");Ct(this,"onAbort");Ct(this,"sendCloseWriteTimeout");Ct(this,"sendingData");this.sinkController=new AbortController,this.sinkEnd=pDefer(),this.closed=pDefer(),this.log=et.log,this.status="open",this.readStatus="ready",this.writeStatus="ready",this.id=et.id,this.metadata=et.metadata??{},this.direction=et.direction,this.timeline={open:Date.now()},this.sendCloseWriteTimeout=et.sendCloseWriteTimeout??DEFAULT_SEND_CLOSE_WRITE_TIMEOUT,this.onEnd=et.onEnd,this.onCloseRead=et==null?void 0:et.onCloseRead,this.onCloseWrite=et==null?void 0:et.onCloseWrite,this.onReset=et==null?void 0:et.onReset,this.onAbort=et==null?void 0:et.onAbort,this.source=this.streamSource=pushable({onEnd:tt=>{tt!=null?this.log.trace("source ended with error",tt):this.log.trace("source ended"),this.onSourceEnd(tt)}}),this.sink=this.sink.bind(this)}async sink(et){if(this.writeStatus!=="ready")throw new StreamStateError(`writable end state is "${this.writeStatus}" not "ready"`);try{this.writeStatus="writing";const tt={signal:this.sinkController.signal};if(this.direction==="outbound"){const rt=this.sendNewStream(tt);isPromise$1(rt)&&await rt}const nt=()=>{closeSource(et,this.log)};try{this.sinkController.signal.addEventListener("abort",nt),this.log.trace("sink reading from source");for await(let rt of et){rt=rt instanceof Uint8Array?new Uint8ArrayList(rt):rt;const ot=this.sendData(rt,tt);isPromise$1(ot)&&(this.sendingData=pDefer(),await ot,this.sendingData.resolve(),this.sendingData=void 0)}}finally{this.sinkController.signal.removeEventListener("abort",nt)}this.log.trace('sink finished reading from source, write status is "%s"',this.writeStatus),this.writeStatus==="writing"&&(this.writeStatus="closing",this.log.trace("send close write to remote"),await this.sendCloseWrite({signal:AbortSignal.timeout(this.sendCloseWriteTimeout)}),this.writeStatus="closed"),this.onSinkEnd()}catch(tt){throw this.log.trace("sink ended with error, calling abort with error",tt),this.abort(tt),tt}finally{this.log.trace("resolve sink end"),this.sinkEnd.resolve()}}onSourceEnd(et){var tt;this.timeline.closeRead==null&&(this.timeline.closeRead=Date.now(),this.readStatus="closed",et!=null&&this.endErr==null&&(this.endErr=et),(tt=this.onCloseRead)==null||tt.call(this),this.timeline.closeWrite!=null?(this.log.trace("source and sink ended"),this.timeline.close=Date.now(),this.status!=="aborted"&&this.status!=="reset"&&(this.status="closed"),this.onEnd!=null&&this.onEnd(this.endErr),this.closed.resolve()):this.log.trace("source ended, waiting for sink to end"))}onSinkEnd(et){var tt;this.timeline.closeWrite==null&&(this.timeline.closeWrite=Date.now(),this.writeStatus="closed",et!=null&&this.endErr==null&&(this.endErr=et),(tt=this.onCloseWrite)==null||tt.call(this),this.timeline.closeRead!=null?(this.log.trace("sink and source ended"),this.timeline.close=Date.now(),this.status!=="aborted"&&this.status!=="reset"&&(this.status="closed"),this.onEnd!=null&&this.onEnd(this.endErr),this.closed.resolve()):this.log.trace("sink ended, waiting for source to end"))}async close(et){this.log.trace("closing gracefully"),this.status="closing",await raceSignal(Promise.all([this.closeWrite(et),this.closeRead(et),this.closed.promise]),et==null?void 0:et.signal),this.status="closed",this.log.trace("closed gracefully")}async closeRead(et={}){if(this.readStatus==="closing"||this.readStatus==="closed")return;this.log.trace('closing readable end of stream with starting read status "%s"',this.readStatus);const tt=this.readStatus;this.readStatus="closing",this.status!=="reset"&&this.status!=="aborted"&&this.timeline.closeRead==null&&(this.log.trace("send close read to remote"),await this.sendCloseRead(et)),tt==="ready"&&(this.log.trace("ending internal source queue with %d queued bytes",this.streamSource.readableLength),this.streamSource.end()),this.log.trace("closed readable end of stream")}async closeWrite(et={}){this.writeStatus==="closing"||this.writeStatus==="closed"||(this.log.trace('closing writable end of stream with starting write status "%s"',this.writeStatus),this.writeStatus==="ready"&&(this.log.trace("sink was never sunk, sink an empty array"),await raceSignal(this.sink([]),et.signal)),this.writeStatus==="writing"&&(this.sendingData!=null&&await raceSignal(this.sendingData.promise,et.signal),this.log.trace("aborting source passed to .sink"),this.sinkController.abort(),await raceSignal(this.sinkEnd.promise,et.signal)),this.writeStatus="closed",this.log.trace("closed writable end of stream"))}abort(et){var nt;if(this.status==="closed"||this.status==="aborted"||this.status==="reset")return;this.log("abort with error",et),this.log("try to send reset to remote");const tt=this.sendReset();isPromise$1(tt)&&tt.catch(rt=>{this.log.error("error sending reset message",rt)}),this.status="aborted",this.timeline.abort=Date.now(),this._closeSinkAndSource(et),(nt=this.onAbort)==null||nt.call(this,et)}reset(){var tt;if(this.status==="closed"||this.status==="aborted"||this.status==="reset")return;const et=new StreamResetError("stream reset");this.status="reset",this.timeline.reset=Date.now(),this._closeSinkAndSource(et),(tt=this.onReset)==null||tt.call(this)}_closeSinkAndSource(et){this._closeSink(et),this._closeSource(et)}_closeSink(et){this.writeStatus==="writing"&&(this.log.trace("end sink source"),this.sinkController.abort()),this.onSinkEnd(et)}_closeSource(et){this.readStatus!=="closing"&&this.readStatus!=="closed"&&(this.log.trace("ending source with %d bytes to be read by consumer",this.streamSource.readableLength),this.readStatus="closing",this.streamSource.end(et))}remoteCloseWrite(){if(this.readStatus==="closing"||this.readStatus==="closed"){this.log("received remote close write but local source is already closed");return}this.log.trace("remote close write"),this._closeSource()}remoteCloseRead(){if(this.writeStatus==="closing"||this.writeStatus==="closed"){this.log("received remote close read but local sink is already closed");return}this.log.trace("remote close read"),this._closeSink()}destroy(){if(this.status==="closed"||this.status==="aborted"||this.status==="reset"){this.log("received destroy but we are already closed");return}this.log.trace("stream destroyed"),this._closeSinkAndSource()}sourcePush(et){this.streamSource.push(et)}sourceReadableLength(){return this.streamSource.readableLength}}class MplexStream extends AbstractStream{constructor(tt){super(tt);Ct(this,"name");Ct(this,"streamId");Ct(this,"send");Ct(this,"types");Ct(this,"maxDataSize");this.types=tt.direction==="outbound"?InitiatorMessageTypes:ReceiverMessageTypes,this.send=tt.send,this.name=tt.name,this.streamId=tt.streamId,this.maxDataSize=tt.maxDataSize}async sendNewStream(){await this.send({id:this.streamId,type:InitiatorMessageTypes.NEW_STREAM,data:new Uint8ArrayList(fromString(this.name))})}async sendData(tt){for(tt=tt.sublist();tt.byteLength>0;){const nt=Math.min(tt.byteLength,this.maxDataSize);await this.send({id:this.streamId,type:this.types.MESSAGE,data:tt.sublist(0,nt)}),tt.consume(nt)}}async sendReset(){await this.send({id:this.streamId,type:this.types.RESET})}async sendCloseWrite(){await this.send({id:this.streamId,type:this.types.CLOSE})}async sendCloseRead(){}}function createStream(o){const{id:et,name:tt,send:nt,onEnd:rt,type:ot="initiator",maxMsgSize:it=MAX_MSG_SIZE}=o;return new MplexStream({id:ot==="initiator"?`i${et}`:`r${et}`,streamId:et,name:`${tt??et}`,direction:ot==="initiator"?"outbound":"inbound",maxDataSize:it,onEnd:rt,send:nt,log:o.logger.forComponent(`libp2p:mplex:stream:${ot}:${et}`)})}const MAX_STREAMS_INBOUND_STREAMS_PER_CONNECTION=1024,MAX_STREAMS_OUTBOUND_STREAMS_PER_CONNECTION=1024,MAX_STREAM_BUFFER_SIZE=1024*1024*4,DISCONNECT_THRESHOLD=5,CLOSE_TIMEOUT$2=500;function printMessage(o){const et={...o,type:`${MessageTypeNames[o.type]} (${o.type})`};return o.type===MessageTypes.NEW_STREAM&&(et.data=toString$8(o.data instanceof Uint8Array?o.data:o.data.subarray())),(o.type===MessageTypes.MESSAGE_INITIATOR||o.type===MessageTypes.MESSAGE_RECEIVER)&&(et.data=toString$8(o.data instanceof Uint8Array?o.data:o.data.subarray(),"base16")),et}class MplexStreamMuxer{constructor(et,tt){Ct(this,"protocol","/mplex/6.7.0");Ct(this,"sink");Ct(this,"source");Ct(this,"log");Ct(this,"_streamId");Ct(this,"_streams");Ct(this,"_init");Ct(this,"_source");Ct(this,"closeController");Ct(this,"rateLimiter");Ct(this,"closeTimeout");Ct(this,"logger");tt=tt??{},this.log=et.logger.forComponent("libp2p:mplex"),this.logger=et.logger,this._streamId=0,this._streams={initiators:new Map,receivers:new Map},this._init=tt,this.closeTimeout=tt.closeTimeout??CLOSE_TIMEOUT$2,this.sink=this._createSink(),this._source=pushable({objectMode:!0,onEnd:()=>{for(const nt of this._streams.initiators.values())nt.destroy();for(const nt of this._streams.receivers.values())nt.destroy()}}),this.source=pipe(this._source,nt=>encode$4(nt)),this.closeController=new AbortController,this.rateLimiter=new RateLimiter({points:tt.disconnectThreshold??DISCONNECT_THRESHOLD,duration:1})}get streams(){const et=[];for(const tt of this._streams.initiators.values())et.push(tt);for(const tt of this._streams.receivers.values())et.push(tt);return et}newStream(et){if(this.closeController.signal.aborted)throw new MuxerClosedError("Muxer already closed");const tt=this._streamId++;et=et==null?tt.toString():et.toString();const nt=this._streams.initiators;return this._newStream({id:tt,name:et,type:"initiator",registry:nt})}async close(et){if(this.closeController.signal.aborted)return;const tt=(et==null?void 0:et.signal)??AbortSignal.timeout(this.closeTimeout);try{await Promise.all(this.streams.map(async nt=>nt.close({signal:tt}))),this._source.end(),await this._source.onEmpty({signal:tt}),this.closeController.abort()}catch(nt){this.abort(nt)}}abort(et){this.closeController.signal.aborted||(this.streams.forEach(tt=>{tt.abort(et)}),this.closeController.abort(et))}_newReceiverStream(et){const{id:tt,name:nt}=et,rt=this._streams.receivers;return this._newStream({id:tt,name:nt,type:"receiver",registry:rt})}_newStream(et){const{id:tt,name:nt,type:rt,registry:ot}=et;if(this.log("new %s stream %s",rt,tt),rt==="initiator"&&this._streams.initiators.size===(this._init.maxOutboundStreams??MAX_STREAMS_OUTBOUND_STREAMS_PER_CONNECTION))throw new TooManyOutboundProtocolStreamsError$1("Too many outbound streams open");if(ot.has(tt))throw new Error(`${rt} stream ${tt} already exists!`);const at=createStream({id:tt,name:nt,send:async ct=>{this.log.enabled&&this.log.trace("%s stream %s send",rt,tt,printMessage(ct)),this._source.push(ct)},type:rt,onEnd:()=>{this.log("%s stream with id %s and protocol %s ended",rt,tt,at.protocol),ot.delete(tt),this._init.onStreamEnd!=null&&this._init.onStreamEnd(at)},maxMsgSize:this._init.maxMsgSize,logger:this.logger});return ot.set(tt,at),at}_createSink(){return async tt=>{const nt=()=>{closeSource(tt,this.log)};this.closeController.signal.addEventListener("abort",nt);try{const rt=new Decoder(this._init.maxMsgSize,this._init.maxUnprocessedMessageQueueSize);for await(const ot of tt)for(const it of rt.write(ot))await this._handleIncoming(it);this._source.end()}catch(rt){this.log("error in sink",rt),this._source.end(rt)}finally{this.closeController.signal.removeEventListener("abort",nt)}}}async _handleIncoming(et){const{id:tt,type:nt}=et;if(this.log.enabled&&this.log.trace("incoming message",printMessage(et)),et.type===MessageTypes.NEW_STREAM){if(this._streams.receivers.size===(this._init.maxInboundStreams??MAX_STREAMS_INBOUND_STREAMS_PER_CONNECTION)){this.log("too many inbound streams open"),this._source.push({id:tt,type:MessageTypes.RESET_RECEIVER});try{await this.rateLimiter.consume("new-stream",1)}catch{this.log("rate limit hit when opening too many new streams over the inbound stream limit - closing remote connection"),this.abort(new Error("Too many open streams"));return}return}const st=this._newReceiverStream({id:tt,name:toString$8(et.data instanceof Uint8Array?et.data:et.data.subarray())});this._init.onIncomingStream!=null&&this._init.onIncomingStream(st);return}const ot=((nt&1)===1?this._streams.initiators:this._streams.receivers).get(tt);if(ot==null){this.log("missing stream %s for message type %s",tt,MessageTypeNames[nt]);try{await this.rateLimiter.consume("missing-stream",1)}catch{this.log("rate limit hit when receiving messages for streams that do not exist - closing remote connection"),this.abort(new Error("Too many messages for missing streams"));return}return}const it=this._init.maxStreamBufferSize??MAX_STREAM_BUFFER_SIZE;try{switch(nt){case MessageTypes.MESSAGE_INITIATOR:case MessageTypes.MESSAGE_RECEIVER:if(ot.sourceReadableLength()>it)throw this._source.push({id:et.id,type:nt===MessageTypes.MESSAGE_INITIATOR?MessageTypes.RESET_RECEIVER:MessageTypes.RESET_INITIATOR}),new StreamInputBufferError("Input buffer full - increase Mplex maxBufferSize to accommodate slow consumers");ot.sourcePush(et.data);break;case MessageTypes.CLOSE_INITIATOR:case MessageTypes.CLOSE_RECEIVER:ot.remoteCloseWrite();break;case MessageTypes.RESET_INITIATOR:case MessageTypes.RESET_RECEIVER:ot.reset();break;default:this.log("unknown message type %s",nt)}}catch(st){this.log.error("error while processing message",st),ot.abort(st)}}}var Al,Rl;Rl=Symbol.toStringTag,Al=serviceCapabilities$2;class Mplex{constructor(et,tt={}){Ct(this,"protocol","/mplex/6.7.0");Ct(this,"_init");Ct(this,"components");Ct(this,Rl,"@libp2p/mplex");Ct(this,Al,["@libp2p/stream-multiplexing"]);this.components=et,this._init=tt}createStreamMuxer(et={}){return new MplexStreamMuxer(this.components,{...et,...this._init})}}function mplex(o={}){return et=>new Mplex(et,o)}function isAsyncIterable$3(o){return o[Symbol.asyncIterator]!=null}function first(o){if(isAsyncIterable$3(o))return(async()=>{for await(const et of o)return et})();for(const et of o)return et}const PING_LENGTH$1=32,PROTOCOL_VERSION$1="1.0.0",PROTOCOL_NAME$1="ping",PROTOCOL_PREFIX$1="ipfs",TIMEOUT=1e4,MAX_INBOUND_STREAMS=2,MAX_OUTBOUND_STREAMS=1;var _l;_l=Symbol.toStringTag;class PingService{constructor(et,tt={}){Ct(this,"protocol");Ct(this,"components");Ct(this,"started");Ct(this,"timeout");Ct(this,"maxInboundStreams");Ct(this,"maxOutboundStreams");Ct(this,"runOnLimitedConnection");Ct(this,"log");Ct(this,_l,"@libp2p/ping");this.components=et,this.log=et.logger.forComponent("libp2p:ping"),this.started=!1,this.protocol=`/${tt.protocolPrefix??PROTOCOL_PREFIX$1}/${PROTOCOL_NAME$1}/${PROTOCOL_VERSION$1}`,this.timeout=tt.timeout??TIMEOUT,this.maxInboundStreams=tt.maxInboundStreams??MAX_INBOUND_STREAMS,this.maxOutboundStreams=tt.maxOutboundStreams??MAX_OUTBOUND_STREAMS,this.runOnLimitedConnection=tt.runOnLimitedConnection??!0,this.handleMessage=this.handleMessage.bind(this)}async start(){await this.components.registrar.handle(this.protocol,this.handleMessage,{maxInboundStreams:this.maxInboundStreams,maxOutboundStreams:this.maxOutboundStreams,runOnLimitedConnection:this.runOnLimitedConnection}),this.started=!0}async stop(){await this.components.registrar.unhandle(this.protocol),this.started=!1}isStarted(){return this.started}handleMessage(et){this.log("incoming ping from %p",et.connection.remotePeer);const{stream:tt}=et,nt=Date.now();AbortSignal.timeout(this.timeout).addEventListener("abort",()=>{tt==null||tt.abort(new TimeoutError$3("ping timeout"))}),pipe(tt,async function*(ot){let it=0;for await(const st of ot){if(it+=st.byteLength,it>PING_LENGTH$1){tt==null||tt.abort(new InvalidMessageError$3("Too much data received"));return}yield st}},tt).catch(ot=>{this.log.error("incoming ping from %p failed with error",et.connection.remotePeer,ot),tt==null||tt.abort(ot)}).finally(()=>{const ot=Date.now()-nt;this.log("incoming ping from %p complete in %dms",et.connection.remotePeer,ot)})}async ping(et,tt={}){var at,ct;this.log("pinging %p",et);const nt=Date.now(),rt=randomBytes(PING_LENGTH$1),ot=await this.components.connectionManager.openConnection(et,tt);let it,st=()=>{};if(tt.signal==null){const lt=AbortSignal.timeout(this.timeout);tt={...tt,signal:lt}}try{it=await ot.newStream(this.protocol,{...tt,runOnLimitedConnection:this.runOnLimitedConnection}),st=()=>{it==null||it.abort(new AbortError$9)},(at=tt.signal)==null||at.addEventListener("abort",st,{once:!0});const lt=await pipe([rt],it,async ht=>first(ht)),dt=Date.now()-nt;if(lt==null)throw new ProtocolError(`Did not receive a ping ack after ${dt}ms`);if(!equals(rt,lt.subarray()))throw new ProtocolError(`Received wrong ping ack after ${dt}ms`);return this.log("ping %p complete in %dms",ot.remotePeer,dt),dt}catch(lt){throw this.log.error("error while pinging %p",ot.remotePeer,lt),it==null||it.abort(lt),lt}finally{(ct=tt.signal)==null||ct.removeEventListener("abort",st),it!=null&&await it.close()}}}function ping(o={}){return et=>new PingService(et,o)}const transportSymbol=Symbol.for("@libp2p/transport");var FaultTolerance$1;(function(o){o[o.FATAL_ALL=0]="FATAL_ALL",o[o.NO_FATAL=1]="NO_FATAL"})(FaultTolerance$1||(FaultTolerance$1={}));var vs;let AbortError$5=(vs=class extends Error{constructor(et="The operation was aborted"){super(et),this.name="AbortError"}},Ct(vs,"name","AbortError"),vs);class ConnectionFailedError extends Error{constructor(et="Connection failed"){super(et),this.name="ConnectionFailedError"}}Ct(ConnectionFailedError,"name","ConnectionFailedError");const serviceCapabilities$1=Symbol.for("@libp2p/service-capabilities"),ASSUME_HTTP_CODES=[getProtocol("tcp").code,getProtocol("dns").code,getProtocol("dnsaddr").code,getProtocol("dns4").code,getProtocol("dns6").code];function extractSNI(o){var et;return(et=extractTuple("sni",o))==null?void 0:et[1]}function extractPort(o){var tt;const et=(tt=extractTuple("tcp",o))==null?void 0:tt[1];return et==null?"":`:${et}`}function extractTuple(o,et){let tt;try{tt=getProtocol(o).code}catch{return}for(const[nt,rt]of et)if(nt===tt&&rt!=null)return[nt,rt]}function hasTLS(o){return o.some(([et,tt])=>et===getProtocol("tls").code)}function interpretNext(o,et,tt){const nt=interpreters[getProtocol(o).name];if(nt==null)throw new Error(`Can't interpret protocol ${getProtocol(o).name}`);const rt=nt(et,tt);return o===getProtocol("ip6").code?`[${rt}]`:rt}const interpreters={ip4:(o,et)=>o,ip6:(o,et)=>et.length===0?o:`[${o}]`,tcp:(o,et)=>{const tt=et.pop();if(tt==null)throw new Error("Unexpected end of multiaddr");return`tcp://${interpretNext(tt[0],tt[1]??"",et)}:${o}`},udp:(o,et)=>{const tt=et.pop();if(tt==null)throw new Error("Unexpected end of multiaddr");return`udp://${interpretNext(tt[0],tt[1]??"",et)}:${o}`},dnsaddr:(o,et)=>o,dns4:(o,et)=>o,dns6:(o,et)=>o,dns:(o,et)=>o,ipfs:(o,et)=>{const tt=et.pop();if(tt==null)throw new Error("Unexpected end of multiaddr");return`${interpretNext(tt[0],tt[1]??"",et)}/ipfs/${o}`},p2p:(o,et)=>{const tt=et.pop();if(tt==null)throw new Error("Unexpected end of multiaddr");return`${interpretNext(tt[0],tt[1]??"",et)}/p2p/${o}`},http:(o,et)=>{const tt=hasTLS(et),nt=extractSNI(et),rt=extractPort(et);if(tt&&nt!=null)return`https://${nt}${rt}`;const ot=tt?"https://":"http://",it=et.pop();if(it==null)throw new Error("Unexpected end of multiaddr");let st=interpretNext(it[0],it[1]??"",et);return st=st.replace("tcp://",""),`${ot}${st}`},"http-path":(o,et)=>{const tt=et.pop();if(tt==null)throw new Error("Unexpected end of multiaddr");const nt=interpretNext(tt[0],tt[1]??"",et),rt=decodeURIComponent(o);return`${nt}/${rt}`},tls:(o,et)=>{const tt=et.pop();if(tt==null)throw new Error("Unexpected end of multiaddr");return interpretNext(tt[0],tt[1]??"",et)},sni:(o,et)=>{const tt=et.pop();if(tt==null)throw new Error("Unexpected end of multiaddr");return interpretNext(tt[0],tt[1]??"",et)},https:(o,et)=>{const tt=et.pop();if(tt==null)throw new Error("Unexpected end of multiaddr");let nt=interpretNext(tt[0],tt[1]??"",et);return nt=nt.replace("tcp://",""),`https://${nt}`},ws:(o,et)=>{const tt=hasTLS(et),nt=extractSNI(et),rt=extractPort(et);if(tt&&nt!=null)return`wss://${nt}${rt}`;const ot=tt?"wss://":"ws://",it=et.pop();if(it==null)throw new Error("Unexpected end of multiaddr");let st=interpretNext(it[0],it[1]??"",et);return st=st.replace("tcp://",""),`${ot}${st}`},wss:(o,et)=>{const tt=et.pop();if(tt==null)throw new Error("Unexpected end of multiaddr");let nt=interpretNext(tt[0],tt[1]??"",et);return nt=nt.replace("tcp://",""),`wss://${nt}`},"p2p-websocket-star":(o,et)=>{const tt=et.pop();if(tt==null)throw new Error("Unexpected end of multiaddr");return`${interpretNext(tt[0],tt[1]??"",et)}/p2p-websocket-star`},"p2p-webrtc-star":(o,et)=>{const tt=et.pop();if(tt==null)throw new Error("Unexpected end of multiaddr");return`${interpretNext(tt[0],tt[1]??"",et)}/p2p-webrtc-star`},"p2p-webrtc-direct":(o,et)=>{const tt=et.pop();if(tt==null)throw new Error("Unexpected end of multiaddr");return`${interpretNext(tt[0],tt[1]??"",et)}/p2p-webrtc-direct`}};function multiaddrToUri(o,et){const nt=multiaddr(o).stringTuples(),rt=nt.pop();if(rt==null)throw new Error("Unexpected end of multiaddr");const ot=getProtocol(rt[0]),it=interpreters[ot.name];if(it==null)throw new Error(`No interpreter found for ${ot.name}`);let st=it(rt[1]??"",nt);return ASSUME_HTTP_CODES.includes(rt[0])&&(st=st.replace(/^.*:\/\//,""),rt[1]==="443"?st=`https://${st}`:st=`http://${st}`),(st.startsWith("http://")||st.startsWith("https://")||st.startsWith("ws://")||st.startsWith("wss://"))&&(st=new URL(st).toString(),st.endsWith("/")&&(st=st.substring(0,st.length-1))),st}const ready=async o=>{if(o.readyState>=2)throw new Error("socket closed");o.readyState!==1&&await new Promise((et,tt)=>{function nt(){o.removeEventListener("open",rt),o.removeEventListener("error",ot)}function rt(){nt(),et()}function ot(it){nt(),tt(it.error??new Error(`connect ECONNREFUSED ${o.url}`))}o.addEventListener("open",rt),o.addEventListener("error",ot)})},sink=(o,et)=>(et=et??{},et.closeOnEnd=et.closeOnEnd!==!1,async nt=>{for await(const rt of nt){try{await ready(o)}catch(ot){if(ot.message==="socket closed")break;throw ot}if(o.readyState===o.CLOSING||o.readyState===o.CLOSED)break;o.send(rt)}et.closeOnEnd!=null&&o.readyState<=1&&await new Promise((rt,ot)=>{o.addEventListener("close",it=>{if(it.wasClean||it.code===1006)rt();else{const st=Object.assign(new Error("ws error"),{event:it});ot(st)}}),setTimeout(()=>{o.close()})})});var dom={},eventIterator={};Object.defineProperty(eventIterator,"__esModule",{value:!0});class EventQueue{constructor(){this.pullQueue=[],this.pushQueue=[],this.eventHandlers={},this.isPaused=!1,this.isStopped=!1}push(et){if(this.isStopped)return;const tt={value:et,done:!1};if(this.pullQueue.length){const nt=this.pullQueue.shift();nt&&nt.resolve(tt)}else this.pushQueue.push(Promise.resolve(tt)),this.highWaterMark!==void 0&&this.pushQueue.length>=this.highWaterMark&&!this.isPaused&&(this.isPaused=!0,this.eventHandlers.highWater?this.eventHandlers.highWater():console&&console.warn(`EventIterator queue reached ${this.pushQueue.length} items`))}stop(){if(!this.isStopped){this.isStopped=!0,this.remove();for(const et of this.pullQueue)et.resolve({value:void 0,done:!0});this.pullQueue.length=0}}fail(et){if(!this.isStopped)if(this.isStopped=!0,this.remove(),this.pullQueue.length){for(const tt of this.pullQueue)tt.reject(et);this.pullQueue.length=0}else{const tt=Promise.reject(et);tt.catch(()=>{}),this.pushQueue.push(tt)}}remove(){Promise.resolve().then(()=>{this.removeCallback&&this.removeCallback()})}[Symbol.asyncIterator](){return{next:et=>{const tt=this.pushQueue.shift();return tt?(this.lowWaterMark!==void 0&&this.pushQueue.length<=this.lowWaterMark&&this.isPaused&&(this.isPaused=!1,this.eventHandlers.lowWater&&this.eventHandlers.lowWater()),tt):this.isStopped?Promise.resolve({value:void 0,done:!0}):new Promise((nt,rt)=>{this.pullQueue.push({resolve:nt,reject:rt})})},return:()=>(this.isStopped=!0,this.pushQueue.length=0,this.remove(),Promise.resolve({value:void 0,done:!0}))}}}let EventIterator$1=class{constructor(et,{highWaterMark:tt=100,lowWaterMark:nt=1}={}){const rt=new EventQueue;rt.highWaterMark=tt,rt.lowWaterMark=nt,rt.removeCallback=et({push:ot=>rt.push(ot),stop:()=>rt.stop(),fail:ot=>rt.fail(ot),on:(ot,it)=>{rt.eventHandlers[ot]=it}})||(()=>{}),this[Symbol.asyncIterator]=()=>rt[Symbol.asyncIterator](),Object.freeze(this)}};eventIterator.EventIterator=EventIterator$1;eventIterator.default=EventIterator$1;Object.defineProperty(dom,"__esModule",{value:!0});const event_iterator_1=eventIterator;var EventIterator=dom.EventIterator=event_iterator_1.EventIterator;function subscribe(o,et,tt){return new event_iterator_1.EventIterator(({push:nt})=>(this.addEventListener(o,nt,et),()=>this.removeEventListener(o,nt,et)),tt)}dom.subscribe=subscribe;dom.default=event_iterator_1.EventIterator;function isArrayBuffer(o){var et;return o instanceof ArrayBuffer||((et=o==null?void 0:o.constructor)==null?void 0:et.name)==="ArrayBuffer"&&typeof(o==null?void 0:o.byteLength)=="number"}const source=o=>{o.binaryType="arraybuffer";const et=async()=>{await new Promise((ot,it)=>{if(nt){ot();return}if(rt!=null){it(rt);return}const st=lt=>{o.removeEventListener("open",at),o.removeEventListener("error",ct),lt()},at=()=>{st(ot)},ct=lt=>{st(()=>{it(lt.error??new Error(`connect ECONNREFUSED ${o.url}`))})};o.addEventListener("open",at),o.addEventListener("error",ct)})},tt=async function*(){const ot=new EventIterator(({push:it,stop:st,fail:at})=>{const ct=dt=>{let ht=null;typeof dt.data=="string"&&(ht=fromString(dt.data)),isArrayBuffer(dt.data)&&(ht=new Uint8Array(dt.data)),dt.data instanceof Uint8Array&&(ht=dt.data),ht!=null&&it(ht)},lt=dt=>{at(dt.error??new Error("Socket error"))};return o.addEventListener("message",ct),o.addEventListener("error",lt),o.addEventListener("close",st),()=>{o.removeEventListener("message",ct),o.removeEventListener("error",lt),o.removeEventListener("close",st)}},{highWaterMark:1/0});await et();for await(const it of ot)yield isArrayBuffer(it)?new Uint8Array(it):it}();let nt=o.readyState===1,rt;return o.addEventListener("open",()=>{nt=!0,rt=null}),o.addEventListener("close",()=>{nt=!1,rt=null}),o.addEventListener("error",ot=>{nt||(rt=ot.error??new Error(`connect ECONNREFUSED ${o.url}`))}),Object.assign(tt,{connected:et})},duplex=(o,et)=>{et=et??{};const tt=source(o);let nt=et.remoteAddress,rt=et.remotePort;if(o.url!=null)try{const it=new URL(o.url);nt=it.hostname,rt=parseInt(it.port,10)}catch{}if(nt==null||rt==null)throw new Error("Remote connection did not have address and/or port");return{sink:sink(o,et),source:tt,connected:async()=>{await tt.connected()},close:async()=>{(o.readyState===o.CONNECTING||o.readyState===o.OPEN)&&await new Promise(it=>{o.addEventListener("close",()=>{it()}),o.close()})},destroy:()=>{o.terminate!=null?o.terminate():o.close()},remoteAddress:nt,remotePort:rt,socket:o}},WebSocket$1=WebSocket,map={"http:":"ws:","https:":"wss:"},defaultProtocol="ws:",wsurl=(o,et)=>{if(o.startsWith("//")&&(o=`${(et==null?void 0:et.protocol)??defaultProtocol}${o}`),o.startsWith("/")&&et!=null){const nt=et.protocol??defaultProtocol,rt=et.host,ot=et.port!=null&&(rt==null?void 0:rt.endsWith(`:${et.port}`))!==!0?`:${et.port}`:"";o=`${nt}//${rt}${ot}${o}`}const tt=new URL(o);for(const[nt,rt]of Object.entries(map))tt.protocol===nt&&(tt.protocol=rt);return tt};function connect(o,et){const tt=typeof window>"u"?void 0:window.location;et=et??{};const nt=wsurl(o,tt),rt=new WebSocket$1(nt.toString(),et.websocket);return duplex(rt,et)}class CustomProgressEvent extends Event{constructor(tt,nt){super(tt);Ct(this,"type");Ct(this,"detail");this.type=tt,this.detail=nt}}function all$1(o){return o.filter(et=>WebSocketsSecure.exactMatch(et)||WebSockets$1.exactMatch(et))}function wss(o){return o.filter(et=>WebSocketsSecure.exactMatch(et))}function createListener(){throw new Error("WebSocket Servers can not be created in the browser!")}const CLOSE_TIMEOUT$1=500;function socketToMaConn(o,et,tt){const nt=tt.logger.forComponent("libp2p:websockets:maconn"),rt=tt.metrics,ot=tt.metricPrefix??"",it={log:nt,async sink(st){try{await o.sink(async function*(){for await(const at of st)at instanceof Uint8Array?yield at:yield at.subarray()}())}catch(at){at.type!=="aborted"&&nt.error(at)}},source:o.source,remoteAddr:et,timeline:{open:Date.now()},async close(st={}){var lt,dt;const at=Date.now();if(st.signal==null){const ht=AbortSignal.timeout(CLOSE_TIMEOUT$1);st={...st,signal:ht}}const ct=()=>{const{host:ht,port:pt}=it.remoteAddr.toOptions();nt("timeout closing stream to %s:%s after %dms, destroying it manually",ht,pt,Date.now()-at),this.abort(new AbortError$5("Socket close timeout"))};(lt=st.signal)==null||lt.addEventListener("abort",ct);try{await o.close()}catch(ht){nt.error("error closing WebSocket gracefully",ht),this.abort(ht)}finally{(dt=st.signal)==null||dt.removeEventListener("abort",ct),it.timeline.close=Date.now()}},abort(st){const{host:at,port:ct}=it.remoteAddr.toOptions();nt("timeout closing stream to %s:%s due to error",at,ct,st),o.destroy(),it.timeline.close=Date.now(),rt==null||rt.increment({[`${ot}error`]:!0})}};return o.socket.addEventListener("close",()=>{rt==null||rt.increment({[`${ot}close`]:!0}),it.timeline.close==null&&(it.timeline.close=Date.now())},{once:!0}),it}var Tl,Il,Pl;Pl=transportSymbol,Il=Symbol.toStringTag,Tl=serviceCapabilities$1;class WebSockets{constructor(et,tt){Ct(this,"log");Ct(this,"init");Ct(this,"logger");Ct(this,"metrics");Ct(this,"components");Ct(this,Pl,!0);Ct(this,Il,"@libp2p/websockets");Ct(this,Tl,["@libp2p/transport"]);this.log=et.logger.forComponent("libp2p:websockets"),this.logger=et.logger,this.components=et,this.init=tt,et.metrics!=null&&(this.metrics={dialerEvents:et.metrics.registerCounterGroup("libp2p_websockets_dialer_events_total",{label:"event",help:"Total count of WebSockets dialer events by type"})})}async dial(et,tt){var it;this.log("dialing %s",et),tt=tt??{};const nt=await this._connect(et,tt),rt=socketToMaConn(nt,et,{logger:this.logger,metrics:(it=this.metrics)==null?void 0:it.dialerEvents});this.log("new outbound connection %s",rt.remoteAddr);const ot=await tt.upgrader.upgradeOutbound(rt,tt);return this.log("outbound connection %s upgraded",rt.remoteAddr),ot}async _connect(et,tt){var it,st,at,ct,lt;(it=tt==null?void 0:tt.signal)==null||it.throwIfAborted();const nt=et.toOptions();this.log("dialing %s:%s",nt.host,nt.port);const rt=pDefer(),ot=connect(multiaddrToUri(et),this.init);ot.socket.addEventListener("error",()=>{var ht;const dt=new ConnectionFailedError(`Could not connect to ${et.toString()}`);this.log.error("connection error:",dt),(ht=this.metrics)==null||ht.dialerEvents.increment({error:!0}),rt.reject(dt)});try{(st=tt.onProgress)==null||st.call(tt,new CustomProgressEvent("websockets:open-connection")),await raceSignal(Promise.race([ot.connected(),rt.promise]),tt.signal)}catch(dt){throw((at=tt.signal)==null?void 0:at.aborted)===!0&&((ct=this.metrics)==null||ct.dialerEvents.increment({abort:!0})),ot.close().catch(ht=>{this.log.error("error closing raw socket",ht)}),dt}return this.log("connected %s",et),(lt=this.metrics)==null||lt.dialerEvents.increment({connect:!0}),ot}createListener(et){return createListener({logger:this.logger,metrics:this.components.metrics},{...this.init,...et})}listenFilter(et){var tt,nt;return et=Array.isArray(et)?et:[et],((tt=this.init)==null?void 0:tt.filter)!=null?(nt=this.init)==null?void 0:nt.filter(et):isBrowser||isWebWorker?wss(et):all$1(et)}dialFilter(et){return this.listenFilter(et)}}function webSockets(o={}){return et=>new WebSockets(et,o)}const connectionSymbol=Symbol.for("@libp2p/connection"),contentRoutingSymbol=Symbol.for("@libp2p/content-routing"),peerDiscoverySymbol=Symbol.for("@libp2p/peer-discovery"),peerIdSymbol$1=Symbol.for("@libp2p/peer-id");function isPeerId$1(o){return!!(o!=null&&o[peerIdSymbol$1])}const peerRoutingSymbol=Symbol.for("@libp2p/peer-routing"),KEEP_ALIVE="keep-alive";var FaultTolerance;(function(o){o[o.FATAL_ALL=0]="FATAL_ALL",o[o.NO_FATAL=1]="NO_FATAL"})(FaultTolerance||(FaultTolerance={}));var bs;let AbortError$4=(bs=class extends Error{constructor(et="The operation was aborted"){super(et),this.name="AbortError"}},Ct(bs,"name","AbortError"),bs);var Es;let InvalidParametersError$1=(Es=class extends Error{constructor(et="Invalid parameters"){super(et),this.name="InvalidParametersError"}},Ct(Es,"name","InvalidParametersError"),Es);class ConnectionClosingError extends Error{constructor(et="The connection is closing"){super(et),this.name="ConnectionClosingError"}}Ct(ConnectionClosingError,"name","ConnectionClosingError");class ConnectionClosedError extends Error{constructor(et="The connection is closed"){super(et),this.name="ConnectionClosedError"}}Ct(ConnectionClosedError,"name","ConnectionClosedError");var ws;let NotFoundError$1=(ws=class extends Error{constructor(et="Not found"){super(et),this.name="NotFoundError"}},Ct(ws,"name","NotFoundError"),ws);class InvalidPeerIdError extends Error{constructor(et="Invalid PeerID"){super(et),this.name="InvalidPeerIdError"}}Ct(InvalidPeerIdError,"name","InvalidPeerIdError");class InvalidMultiaddrError extends Error{constructor(et="Invalid multiaddr"){super(et),this.name="InvalidMultiaddrError"}}Ct(InvalidMultiaddrError,"name","InvalidMultiaddrError");var Cs;let TimeoutError$2=(Cs=class extends Error{constructor(et="Timed out"){super(et),this.name="TimeoutError"}},Ct(Cs,"name","TimeoutError"),Cs);class NotStartedError extends Error{constructor(et="Not started"){super(et),this.name="NotStartedError"}}Ct(NotStartedError,"name","NotStartedError");class DialError extends Error{constructor(et="Dial error"){super(et),this.name="DialError"}}Ct(DialError,"name","DialError");class LimitedConnectionError extends Error{constructor(et="Limited connection"){super(et),this.name="LimitedConnectionError"}}Ct(LimitedConnectionError,"name","LimitedConnectionError");class TooManyInboundProtocolStreamsError extends Error{constructor(et="Too many inbound protocol streams"){super(et),this.name="TooManyInboundProtocolStreamsError"}}Ct(TooManyInboundProtocolStreamsError,"name","TooManyInboundProtocolStreamsError");class TooManyOutboundProtocolStreamsError extends Error{constructor(et="Too many outbound protocol streams"){super(et),this.name="TooManyOutboundProtocolStreamsError"}}Ct(TooManyOutboundProtocolStreamsError,"name","TooManyOutboundProtocolStreamsError");function setMaxListeners$1(){}const setMaxListeners=(o,...et)=>{try{[...et]}catch{}};var Xn;class TypedEventEmitter extends EventTarget{constructor(){super();fn(this,Xn,new Map);setMaxListeners(1/0,this)}listenerCount(tt){const nt=Mt(this,Xn).get(tt);return nt==null?0:nt.length}addEventListener(tt,nt,rt){super.addEventListener(tt,nt,rt);let ot=Mt(this,Xn).get(tt);ot==null&&(ot=[],Mt(this,Xn).set(tt,ot)),ot.push({callback:nt,once:(rt!==!0&&rt!==!1&&(rt==null?void 0:rt.once))??!1})}removeEventListener(tt,nt,rt){super.removeEventListener(tt.toString(),nt??null,rt);let ot=Mt(this,Xn).get(tt);ot!=null&&(ot=ot.filter(({callback:it})=>it!==nt),Mt(this,Xn).set(tt,ot))}dispatchEvent(tt){const nt=super.dispatchEvent(tt);let rt=Mt(this,Xn).get(tt.type);return rt==null||(rt=rt.filter(({once:ot})=>!ot),Mt(this,Xn).set(tt.type,rt)),nt}safeDispatchEvent(tt,nt={}){return this.dispatchEvent(new CustomEvent(tt,nt))}}Xn=new WeakMap;function isStartable(o){return o!=null&&typeof o.start=="function"&&typeof o.stop=="function"}async function start(...o){const et=[];for(const tt of o)isStartable(tt)&&et.push(tt);await Promise.all(et.map(async tt=>{tt.beforeStart!=null&&await tt.beforeStart()})),await Promise.all(et.map(async tt=>{await tt.start()})),await Promise.all(et.map(async tt=>{tt.afterStart!=null&&await tt.afterStart()}))}async function stop(...o){const et=[];for(const tt of o)isStartable(tt)&&et.push(tt);await Promise.all(et.map(async tt=>{tt.beforeStop!=null&&await tt.beforeStop()})),await Promise.all(et.map(async tt=>{await tt.stop()})),await Promise.all(et.map(async tt=>{tt.afterStop!=null&&await tt.afterStop()}))}const serviceCapabilities=Symbol.for("@libp2p/service-capabilities"),serviceDependencies=Symbol.for("@libp2p/service-dependencies");let TimeoutError$1=class extends Error{constructor(et){super(et),this.name="TimeoutError"}},AbortError$3=class extends Error{constructor(et){super(),this.name="AbortError",this.message=et}};const getDOMException=o=>globalThis.DOMException===void 0?new AbortError$3(o):new DOMException(o),getAbortedReason=o=>{const et=o.reason===void 0?getDOMException("This operation was aborted."):o.reason;return et instanceof Error?et:getDOMException(et)};function pTimeout(o,et){const{milliseconds:tt,fallback:nt,message:rt,customTimers:ot={setTimeout,clearTimeout}}=et;let it;const at=new Promise((ct,lt)=>{if(typeof tt!="number"||Math.sign(tt)!==1)throw new TypeError(`Expected \`milliseconds\` to be a positive number, got \`${tt}\``);if(et.signal){const{signal:ht}=et;ht.aborted&<(getAbortedReason(ht));const pt=()=>{lt(getAbortedReason(ht))};ht.addEventListener("abort",pt,{once:!0}),o.finally(()=>{ht.removeEventListener("abort",pt)})}if(tt===Number.POSITIVE_INFINITY){o.then(ct,lt);return}const dt=new TimeoutError$1;it=ot.setTimeout.call(void 0,()=>{if(nt){try{ct(nt())}catch(ht){lt(ht)}return}typeof o.cancel=="function"&&o.cancel(),rt===!1?ct():rt instanceof Error?lt(rt):(dt.message=rt??`Promise timed out after ${tt} milliseconds`,lt(dt))},tt),(async()=>{try{ct(await o)}catch(ht){lt(ht)}})()}).finally(()=>{at.clear()});return at.clear=()=>{ot.clearTimeout.call(void 0,it),it=void 0},at}function lowerBound(o,et,tt){let nt=0,rt=o.length;for(;rt>0;){const ot=Math.trunc(rt/2);let it=nt+ot;tt(o[it],et)<=0?(nt=++it,rt-=ot+1):rt=ot}return nt}var Jn,Ll;let PriorityQueue$1=(Ll=class{constructor(){fn(this,Jn,[])}enqueue(et,tt){tt={priority:0,...tt};const nt={priority:tt.priority,run:et};if(this.size&&Mt(this,Jn)[this.size-1].priority>=tt.priority){Mt(this,Jn).push(nt);return}const rt=lowerBound(Mt(this,Jn),nt,(ot,it)=>it.priority-ot.priority);Mt(this,Jn).splice(rt,0,nt)}dequeue(){const et=Mt(this,Jn).shift();return et==null?void 0:et.run}filter(et){return Mt(this,Jn).filter(tt=>tt.priority===et.priority).map(tt=>tt.run)}get size(){return Mt(this,Jn).length}},Jn=new WeakMap,Ll);var Qr,Yr,vr,co,Zr,lo,zn,Xr,Dn,uo,Vn,Jr,ir,ho,_n,Yl,Zl,Xl,Jl,eu,Xo,js,Os,Jo,tu,_i;class PQueue extends EventEmitter$1{constructor(tt){var nt,rt;super();fn(this,_n);fn(this,Qr);fn(this,Yr);fn(this,vr,0);fn(this,co);fn(this,Zr);fn(this,lo,0);fn(this,zn);fn(this,Xr);fn(this,Dn);fn(this,uo);fn(this,Vn,0);fn(this,Jr);fn(this,ir);fn(this,ho);Ct(this,"timeout");if(tt={carryoverConcurrencyCount:!1,intervalCap:Number.POSITIVE_INFINITY,interval:0,concurrency:Number.POSITIVE_INFINITY,autoStart:!0,queueClass:PriorityQueue$1,...tt},!(typeof tt.intervalCap=="number"&&tt.intervalCap>=1))throw new TypeError(`Expected \`intervalCap\` to be a number from 1 and up, got \`${((nt=tt.intervalCap)==null?void 0:nt.toString())??""}\` (${typeof tt.intervalCap})`);if(tt.interval===void 0||!(Number.isFinite(tt.interval)&&tt.interval>=0))throw new TypeError(`Expected \`interval\` to be a finite number >= 0, got \`${((rt=tt.interval)==null?void 0:rt.toString())??""}\` (${typeof tt.interval})`);un(this,Qr,tt.carryoverConcurrencyCount),un(this,Yr,tt.intervalCap===Number.POSITIVE_INFINITY||tt.interval===0),un(this,co,tt.intervalCap),un(this,Zr,tt.interval),un(this,Dn,new tt.queueClass),un(this,uo,tt.queueClass),this.concurrency=tt.concurrency,this.timeout=tt.timeout,un(this,ho,tt.throwOnTimeout===!0),un(this,ir,tt.autoStart===!1)}get concurrency(){return Mt(this,Jr)}set concurrency(tt){if(!(typeof tt=="number"&&tt>=1))throw new TypeError(`Expected \`concurrency\` to be a number from 1 and up, got \`${tt}\` (${typeof tt})`);un(this,Jr,tt),gn(this,_n,Jo).call(this)}async add(tt,nt={}){return nt={timeout:this.timeout,throwOnTimeout:Mt(this,ho),...nt},new Promise((rt,ot)=>{Mt(this,Dn).enqueue(async()=>{var it;br(this,Vn)._++,br(this,vr)._++;try{(it=nt.signal)==null||it.throwIfAborted();let st=tt({signal:nt.signal});nt.timeout&&(st=pTimeout(Promise.resolve(st),{milliseconds:nt.timeout})),nt.signal&&(st=Promise.race([st,gn(this,_n,tu).call(this,nt.signal)]));const at=await st;rt(at),this.emit("completed",at)}catch(st){if(st instanceof TimeoutError$1&&!nt.throwOnTimeout){rt();return}ot(st),this.emit("error",st)}finally{gn(this,_n,Xl).call(this)}},nt),this.emit("add"),gn(this,_n,Xo).call(this)})}async addAll(tt,nt){return Promise.all(tt.map(async rt=>this.add(rt,nt)))}start(){return Mt(this,ir)?(un(this,ir,!1),gn(this,_n,Jo).call(this),this):this}pause(){un(this,ir,!0)}clear(){un(this,Dn,new(Mt(this,uo)))}async onEmpty(){Mt(this,Dn).size!==0&&await gn(this,_n,_i).call(this,"empty")}async onSizeLessThan(tt){Mt(this,Dn).sizeMt(this,Dn).size{gn(this,_n,Jl).call(this)},nt)),!0}return!1},Xo=function(){if(Mt(this,Dn).size===0)return Mt(this,zn)&&clearInterval(Mt(this,zn)),un(this,zn,void 0),this.emit("empty"),Mt(this,Vn)===0&&this.emit("idle"),!1;if(!Mt(this,ir)){const tt=!Mt(this,_n,eu);if(Mt(this,_n,Yl)&&Mt(this,_n,Zl)){const nt=Mt(this,Dn).dequeue();return nt?(this.emit("active"),nt(),tt&&gn(this,_n,js).call(this),!0):!1}}return!1},js=function(){Mt(this,Yr)||Mt(this,zn)!==void 0||(un(this,zn,setInterval(()=>{gn(this,_n,Os).call(this)},Mt(this,Zr))),un(this,lo,Date.now()+Mt(this,Zr)))},Os=function(){Mt(this,vr)===0&&Mt(this,Vn)===0&&Mt(this,zn)&&(clearInterval(Mt(this,zn)),un(this,zn,void 0)),un(this,vr,Mt(this,Qr)?Mt(this,Vn):0),gn(this,_n,Jo).call(this)},Jo=function(){for(;gn(this,_n,Xo).call(this););},tu=async function(tt){return new Promise((nt,rt)=>{tt.addEventListener("abort",()=>{rt(tt.reason)},{once:!0})})},_i=async function(tt,nt){return new Promise(rt=>{const ot=()=>{nt&&!nt()||(this.off(tt,ot),rt())};this.on(tt,ot)})};function getTypes(o){const et=[RecordType.A];return o==null?et:Array.isArray(o)?o.length===0?et:o:[o]}const DEFAULT_TTL=60;function toDNSResponse(o){return{Status:o.Status??0,TC:o.TC??o.flag_tc??!1,RD:o.RD??o.flag_rd??!1,RA:o.RA??o.flag_ra??!1,AD:o.AD??o.flag_ad??!1,CD:o.CD??o.flag_cd??!1,Question:(o.Question??o.questions??[]).map(et=>({name:et.name,type:RecordType[et.type]})),Answer:(o.Answer??o.answers??[]).map(et=>({name:et.name,type:RecordType[et.type],TTL:et.TTL??et.ttl??DEFAULT_TTL,data:et.data instanceof Uint8Array?toString$8(et.data):et.data}))}}const DEFAULT_QUERY_CONCURRENCY=4;function dnsJsonOverHttps(o,et={}){const tt=new PQueue({concurrency:et.queryConcurrency??DEFAULT_QUERY_CONCURRENCY});return async(nt,rt={})=>{var st;const ot=new URLSearchParams;ot.set("name",nt),getTypes(rt.types).forEach(at=>{ot.append("type",RecordType[at])}),(st=rt.onProgress)==null||st.call(rt,new CustomProgressEvent("dns:query",{detail:nt}));const it=await tt.add(async()=>{var lt;const at=await fetch(`${o}?${ot}`,{headers:{accept:"application/dns-json"},signal:rt==null?void 0:rt.signal});if(at.status!==200)throw new Error(`Unexpected HTTP status: ${at.status} - ${at.statusText}`);const ct=toDNSResponse(await at.json());return(lt=rt.onProgress)==null||lt.call(rt,new CustomProgressEvent("dns:response",{detail:ct})),ct},{signal:rt.signal});if(it==null)throw new Error("No DNS response received");return it}}function defaultResolver(){return[dnsJsonOverHttps("https://cloudflare-dns.com/dns-query"),dnsJsonOverHttps("https://dns.google/resolve")]}var hashlru=function(o){if(!o)throw Error("hashlru must have a max value, of type number, greater than 0");var et=0,tt=Object.create(null),nt=Object.create(null);function rt(ot,it){tt[ot]=it,et++,et>=o&&(et=0,nt=tt,tt=Object.create(null))}return{has:function(ot){return tt[ot]!==void 0||nt[ot]!==void 0},remove:function(ot){tt[ot]!==void 0&&(tt[ot]=void 0),nt[ot]!==void 0&&(nt[ot]=void 0)},get:function(ot){var it=tt[ot];if(it!==void 0)return it;if((it=nt[ot])!==void 0)return rt(ot,it),it},set:function(ot,it){tt[ot]!==void 0?tt[ot]=it:rt(ot,it)},clear:function(){tt=Object.create(null),nt=Object.create(null)}}};const hashlru$1=getDefaultExportFromCjs(hashlru);class CachedAnswers{constructor(et){Ct(this,"lru");this.lru=hashlru$1(et)}get(et,tt){let nt=!0;const rt=[];for(const ot of tt){const it=this.getAnswers(et,ot);if(it.length===0){nt=!1;break}rt.push(...it)}if(nt)return toDNSResponse({answers:rt})}getAnswers(et,tt){const nt=`${et.toLowerCase()}-${tt}`,rt=this.lru.get(nt);if(rt!=null){const ot=rt.filter(it=>it.expires>Date.now()).map(({expires:it,value:st})=>({...st,TTL:Math.round((it-Date.now())/1e3),type:RecordType[st.type]}));return ot.length===0&&this.lru.remove(nt),ot}return[]}add(et,tt){const nt=`${et.toLowerCase()}-${tt.type}`,rt=this.lru.get(nt)??[];rt.push({expires:Date.now()+(tt.TTL??DEFAULT_TTL)*1e3,value:tt}),this.lru.set(nt,rt)}remove(et,tt){const nt=`${et.toLowerCase()}-${tt}`;this.lru.remove(nt)}clear(){this.lru.clear()}}function cache(o){return new CachedAnswers(o)}const DEFAULT_ANSWER_CACHE_SIZE=1e3;class DNS{constructor(et){Ct(this,"resolvers");Ct(this,"cache");this.resolvers={},this.cache=cache(et.cacheSize??DEFAULT_ANSWER_CACHE_SIZE),Object.entries(et.resolvers??{}).forEach(([tt,nt])=>{Array.isArray(nt)||(nt=[nt]),tt.endsWith(".")||(tt=`${tt}.`),this.resolvers[tt]=nt}),this.resolvers["."]==null&&(this.resolvers["."]=defaultResolver())}async query(et,tt={}){var at,ct,lt;const nt=getTypes(tt.types),rt=tt.cached!==!1?this.cache.get(et,nt):void 0;if(rt!=null)return(at=tt.onProgress)==null||at.call(tt,new CustomProgressEvent("dns:cache",{detail:rt})),rt;const ot=`${et.split(".").pop()}.`,it=(this.resolvers[ot]??this.resolvers["."]).sort(()=>Math.random()>.5?-1:1),st=[];for(const dt of it){if(((ct=tt.signal)==null?void 0:ct.aborted)===!0)break;try{const ht=await dt(et,{...tt,types:nt});for(const pt of ht.Answer)this.cache.add(et,pt);return ht}catch(ht){st.push(ht),(lt=tt.onProgress)==null||lt.call(tt,new CustomProgressEvent("dns:error",{detail:ht}))}}throw st.length===1?st[0]:new AggregateError(st,`DNS lookup of ${et} ${nt} failed`)}}var RecordType;(function(o){o[o.A=1]="A",o[o.CNAME=5]="CNAME",o[o.TXT=16]="TXT",o[o.AAAA=28]="AAAA"})(RecordType||(RecordType={}));function dns(o={}){return new DNS(o)}const MAX_RECURSIVE_DEPTH=32,{code:dnsaddrCode}=getProtocol("dnsaddr");class RecursionLimitError extends Error{constructor(et="Max recursive depth reached"){super(et),this.name="RecursionLimitError"}}const dnsaddrResolver=async function(et,tt={}){const nt=tt.maxRecursiveDepth??MAX_RECURSIVE_DEPTH;if(nt===0)throw new RecursionLimitError("Max recursive depth reached");const[,rt]=et.stringTuples().find(([ct])=>ct===dnsaddrCode)??[],it=await((tt==null?void 0:tt.dns)??dns()).query(`_dnsaddr.${rt}`,{signal:tt==null?void 0:tt.signal,types:[RecordType.TXT]}),st=et.getPeerId(),at=[];for(const ct of it.Answer){const lt=ct.data.replace(/["']/g,"").trim().split("=")[1];if(lt==null||st!=null&&!lt.includes(st))continue;const dt=multiaddr(lt);if(lt.startsWith("/dnsaddr")){const ht=await dt.resolve({...tt,maxRecursiveDepth:nt-1});at.push(...ht.map(pt=>pt.toString()))}else at.push(dt.toString())}return at};var isPlainObj=o=>{if(Object.prototype.toString.call(o)!=="[object Object]")return!1;const et=Object.getPrototypeOf(o);return et===null||et===Object.prototype};const isOptionObject=isPlainObj,{hasOwnProperty:hasOwnProperty$1}=Object.prototype,{propertyIsEnumerable}=Object,defineProperty$1=(o,et,tt)=>Object.defineProperty(o,et,{value:tt,writable:!0,enumerable:!0,configurable:!0}),globalThis$1=commonjsGlobal,defaultMergeOptions={concatArrays:!1,ignoreUndefined:!1},getEnumerableOwnPropertyKeys=o=>{const et=[];for(const tt in o)hasOwnProperty$1.call(o,tt)&&et.push(tt);if(Object.getOwnPropertySymbols){const tt=Object.getOwnPropertySymbols(o);for(const nt of tt)propertyIsEnumerable.call(o,nt)&&et.push(nt)}return et};function clone(o){return Array.isArray(o)?cloneArray(o):isOptionObject(o)?cloneOptionObject(o):o}function cloneArray(o){const et=o.slice(0,0);return getEnumerableOwnPropertyKeys(o).forEach(tt=>{defineProperty$1(et,tt,clone(o[tt]))}),et}function cloneOptionObject(o){const et=Object.getPrototypeOf(o)===null?Object.create(null):{};return getEnumerableOwnPropertyKeys(o).forEach(tt=>{defineProperty$1(et,tt,clone(o[tt]))}),et}const mergeKeys=(o,et,tt,nt)=>(tt.forEach(rt=>{typeof et[rt]>"u"&&nt.ignoreUndefined||(rt in o&&o[rt]!==Object.getPrototypeOf(o)?defineProperty$1(o,rt,merge$1(o[rt],et[rt],nt)):defineProperty$1(o,rt,clone(et[rt])))}),o),concatArrays=(o,et,tt)=>{let nt=o.slice(0,0),rt=0;return[o,et].forEach(ot=>{const it=[];for(let st=0;st!it.includes(st)),tt)}),nt};function merge$1(o,et,tt){return tt.concatArrays&&Array.isArray(o)&&Array.isArray(et)?concatArrays(o,et,tt):!isOptionObject(et)||!isOptionObject(o)?clone(et):mergeKeys(o,et,getEnumerableOwnPropertyKeys(et),tt)}var mergeOptions=function(...o){const et=merge$1(clone(defaultMergeOptions),this!==globalThis$1&&this||{},defaultMergeOptions);let tt={_:{}};for(const nt of o)if(nt!==void 0){if(!isOptionObject(nt))throw new TypeError("`"+nt+"` is not an Option Object");tt=merge$1(tt,{_:nt},et)}return tt._};const mergeOptions$1=getDefaultExportFromCjs(mergeOptions);var define_globalThis_process_env_default$1={};const DefaultConfig={addresses:{listen:[],announce:[],noAnnounce:[],announceFilter:o=>o},connectionManager:{resolvers:{dnsaddr:dnsaddrResolver}},transportManager:{faultTolerance:FaultTolerance.FATAL_ALL}};async function validateConfig(o){const et=mergeOptions$1(DefaultConfig,o);if(et.connectionProtector===null&&(define_globalThis_process_env_default$1==null?void 0:define_globalThis_process_env_default$1.LIBP2P_FORCE_PNET)!=null)throw new InvalidParametersError$1("Private network is enforced, but no protector was provided");return et}const s=1e3,m=s*60,h=m*60,d=h*24,w=d*7,y=d*365.25;function ms(o,et){try{if(typeof o=="string"&&o.length>0)return parse$3(o);if(typeof o=="number"&&isFinite(o))return et!=null&&et.long?fmtLong(o):fmtShort(o);throw new Error("Value is not a string or number.")}catch(tt){const nt=isError$1(tt)?`${tt.message}. value=${JSON.stringify(o)}`:"An unknown error has occured.";throw new Error(nt)}}function parse$3(o){if(o=String(o),o.length>100)throw new Error("Value exceeds the maximum length of 100 characters.");const et=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(o);if(!et)return NaN;const tt=parseFloat(et[1]),nt=(et[2]||"ms").toLowerCase();switch(nt){case"years":case"year":case"yrs":case"yr":case"y":return tt*y;case"weeks":case"week":case"w":return tt*w;case"days":case"day":case"d":return tt*d;case"hours":case"hour":case"hrs":case"hr":case"h":return tt*h;case"minutes":case"minute":case"mins":case"min":case"m":return tt*m;case"seconds":case"second":case"secs":case"sec":case"s":return tt*s;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return tt;default:throw new Error(`The unit ${nt} was matched, but no matching case exists.`)}}function fmtShort(o){const et=Math.abs(o);return et>=d?`${Math.round(o/d)}d`:et>=h?`${Math.round(o/h)}h`:et>=m?`${Math.round(o/m)}m`:et>=s?`${Math.round(o/s)}s`:`${o}ms`}function fmtLong(o){const et=Math.abs(o);return et>=d?plural(o,et,d,"day"):et>=h?plural(o,et,h,"hour"):et>=m?plural(o,et,m,"minute"):et>=s?plural(o,et,s,"second"):`${o} ms`}function plural(o,et,tt,nt){const rt=et>=tt*1.5;return`${Math.round(o/tt)} ${nt}${rt?"s":""}`}function isError$1(o){return typeof o=="object"&&o!==null&&"message"in o}function setup(o){tt.debug=tt,tt.default=tt,tt.coerce=at,tt.disable=ot,tt.enable=rt,tt.enabled=it,tt.humanize=ms,tt.destroy=ct,Object.keys(o).forEach(lt=>{tt[lt]=o[lt]}),tt.names=[],tt.skips=[],tt.formatters={};function et(lt){let dt=0;for(let ht=0;ht{if(wt==="%%")return"%";bt++;const Tt=tt.formatters[kt];if(typeof Tt=="function"){const Rt=yt[bt];wt=Tt.call(gt,Rt),yt.splice(bt,1),bt--}return wt}),tt.formatArgs.call(gt,yt),(gt.log||tt.log).apply(gt,yt)}return ft.namespace=lt,ft.useColors=tt.useColors(),ft.color=tt.selectColor(lt),ft.extend=nt,ft.destroy=tt.destroy,Object.defineProperty(ft,"enabled",{enumerable:!0,configurable:!1,get:()=>ht!==null?ht:(pt!==tt.namespaces&&(pt=tt.namespaces,mt=tt.enabled(lt)),mt),set:yt=>{ht=yt}}),typeof tt.init=="function"&&tt.init(ft),ft}function nt(lt,dt){const ht=tt(this.namespace+(typeof dt>"u"?":":dt)+lt);return ht.log=this.log,ht}function rt(lt){tt.save(lt),tt.namespaces=lt,tt.names=[],tt.skips=[];let dt;const ht=(typeof lt=="string"?lt:"").split(/[\s,]+/),pt=ht.length;for(dt=0;dt"-"+dt)].join(",");return tt.enable(""),lt}function it(lt){if(lt[lt.length-1]==="*")return!0;let dt,ht;for(dt=0,ht=tt.skips.length;dt=31||typeof navigator<"u"&&((rt=navigator.userAgent)==null?void 0:rt.toLowerCase().match(/applewebkit\/(\d+)/))}function formatArgs(o){if(o[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+o[0]+(this.useColors?"%c ":" ")+"+"+ms(this.diff),!this.useColors)return;const et="color: "+this.color;o.splice(1,0,et,"color: inherit");let tt=0,nt=0;o[0].replace(/%[a-zA-Z%]/g,rt=>{rt!=="%%"&&(tt++,rt==="%c"&&(nt=tt))}),o.splice(nt,0,et)}const log$a=console.debug??console.log??(()=>{});function save(o){try{o?storage==null||storage.setItem("debug",o):storage==null||storage.removeItem("debug")}catch{}}function load$1(){let o;try{o=storage==null?void 0:storage.getItem("debug")}catch{}return!o&&typeof globalThis.process<"u"&&"env"in globalThis.process&&(o=define_globalThis_process_env_default.DEBUG),o}function localstorage(){try{return localStorage}catch{}}function setupFormatters(o){o.j=function(et){try{return JSON.stringify(et)}catch(tt){return"[UnexpectedJSONParseError]: "+tt.message}}}const weald=setup({formatArgs,save,load:load$1,useColors,setupFormatters,colors,storage,log:log$a});weald.formatters.b=o=>o==null?"undefined":base58btc.baseEncode(o);weald.formatters.t=o=>o==null?"undefined":base32$2.baseEncode(o);weald.formatters.m=o=>o==null?"undefined":base64$2.baseEncode(o);weald.formatters.p=o=>o==null?"undefined":o.toString();weald.formatters.c=o=>o==null?"undefined":o.toString();weald.formatters.k=o=>o==null?"undefined":o.toString();weald.formatters.a=o=>o==null?"undefined":o.toString();weald.formatters.e=o=>o==null?"undefined":notEmpty(o.stack)??notEmpty(o.message)??o.toString();function createDisabledLogger(o){const et=()=>{};return et.enabled=!1,et.color="",et.diff=0,et.log=()=>{},et.namespace=o,et.destroy=()=>!0,et.extend=()=>et,et}function defaultLogger(){return{forComponent(o){return logger$2(o)}}}function logger$2(o){let et=createDisabledLogger(`${o}:trace`);return weald.enabled(`${o}:trace`)&&weald.names.map(tt=>tt.toString()).find(tt=>tt.includes(":trace"))!=null&&(et=weald(`${o}:trace`)),Object.assign(weald(o),{error:weald(`${o}:error`),trace:et})}function notEmpty(o){if(o!=null&&(o=o.trim(),o.length!==0))return o}function mapIterable(o,et){const tt={[Symbol.iterator]:()=>tt,next:()=>{const nt=o.next(),rt=nt.value;return nt.done===!0||rt==null?{done:!0,value:void 0}:{done:!1,value:et(rt)}}};return tt}function peerIdFromString(o){const et=decode$6(base58btc.decode(`z${o}`));return peerIdFromMultihash(et)}class PeerMap{constructor(et){Ct(this,"map");if(this.map=new Map,et!=null)for(const[tt,nt]of et.entries())this.map.set(tt.toString(),{key:tt,value:nt})}[Symbol.iterator](){return this.entries()}clear(){this.map.clear()}delete(et){return this.map.delete(et.toString())}entries(){return mapIterable(this.map.entries(),et=>[et[1].key,et[1].value])}forEach(et){this.map.forEach((tt,nt)=>{et(tt.value,tt.key,this)})}get(et){var tt;return(tt=this.map.get(et.toString()))==null?void 0:tt.value}has(et){return this.map.has(et.toString())}set(et,tt){this.map.set(et.toString(),{key:et,value:tt})}keys(){return mapIterable(this.map.values(),et=>et.key)}values(){return mapIterable(this.map.values(),et=>et.value)}get size(){return this.map.size}}class PeerSet{constructor(et){Ct(this,"set");if(this.set=new Set,et!=null)for(const tt of et)this.set.add(tt.toString())}get size(){return this.set.size}[Symbol.iterator](){return this.values()}add(et){this.set.add(et.toString())}clear(){this.set.clear()}delete(et){this.set.delete(et.toString())}entries(){return mapIterable(this.set.entries(),et=>{const tt=peerIdFromString(et[0]);return[tt,tt]})}forEach(et){this.set.forEach(tt=>{const nt=peerIdFromString(tt);et(nt,nt,this)})}has(et){return this.set.has(et.toString())}values(){return mapIterable(this.set.values(),et=>peerIdFromString(et))}intersection(et){const tt=new PeerSet;for(const nt of et)this.has(nt)&&tt.add(nt);return tt}difference(et){const tt=new PeerSet;for(const nt of this)et.has(nt)||tt.add(nt);return tt}union(et){const tt=new PeerSet;for(const nt of et)tt.add(nt);for(const nt of this)tt.add(nt);return tt}}var murmurHash3js={exports:{}};(function(o,et){(function(tt,nt){var rt={version:"3.0.0",x86:{},x64:{},inputValidation:!0};function ot(ft){if(!Array.isArray(ft)&&!ArrayBuffer.isView(ft))return!1;for(var yt=0;yt255)return!1;return!0}function it(ft,yt){return(ft&65535)*yt+(((ft>>>16)*yt&65535)<<16)}function st(ft,yt){return ft<>>32-yt}function at(ft){return ft^=ft>>>16,ft=it(ft,2246822507),ft^=ft>>>13,ft=it(ft,3266489909),ft^=ft>>>16,ft}function ct(ft,yt){ft=[ft[0]>>>16,ft[0]&65535,ft[1]>>>16,ft[1]&65535],yt=[yt[0]>>>16,yt[0]&65535,yt[1]>>>16,yt[1]&65535];var gt=[0,0,0,0];return gt[3]+=ft[3]+yt[3],gt[2]+=gt[3]>>>16,gt[3]&=65535,gt[2]+=ft[2]+yt[2],gt[1]+=gt[2]>>>16,gt[2]&=65535,gt[1]+=ft[1]+yt[1],gt[0]+=gt[1]>>>16,gt[1]&=65535,gt[0]+=ft[0]+yt[0],gt[0]&=65535,[gt[0]<<16|gt[1],gt[2]<<16|gt[3]]}function lt(ft,yt){ft=[ft[0]>>>16,ft[0]&65535,ft[1]>>>16,ft[1]&65535],yt=[yt[0]>>>16,yt[0]&65535,yt[1]>>>16,yt[1]&65535];var gt=[0,0,0,0];return gt[3]+=ft[3]*yt[3],gt[2]+=gt[3]>>>16,gt[3]&=65535,gt[2]+=ft[2]*yt[3],gt[1]+=gt[2]>>>16,gt[2]&=65535,gt[2]+=ft[3]*yt[2],gt[1]+=gt[2]>>>16,gt[2]&=65535,gt[1]+=ft[1]*yt[3],gt[0]+=gt[1]>>>16,gt[1]&=65535,gt[1]+=ft[2]*yt[2],gt[0]+=gt[1]>>>16,gt[1]&=65535,gt[1]+=ft[3]*yt[1],gt[0]+=gt[1]>>>16,gt[1]&=65535,gt[0]+=ft[0]*yt[3]+ft[1]*yt[2]+ft[2]*yt[1]+ft[3]*yt[0],gt[0]&=65535,[gt[0]<<16|gt[1],gt[2]<<16|gt[3]]}function dt(ft,yt){return yt%=64,yt===32?[ft[1],ft[0]]:yt<32?[ft[0]<>>32-yt,ft[1]<>>32-yt]:(yt-=32,[ft[1]<>>32-yt,ft[0]<>>32-yt])}function ht(ft,yt){return yt%=64,yt===0?ft:yt<32?[ft[0]<>>32-yt,ft[1]<>>1]),ft=lt(ft,[4283543511,3981806797]),ft=pt(ft,[0,ft[0]>>>1]),ft=lt(ft,[3301882366,444984403]),ft=pt(ft,[0,ft[0]>>>1]),ft}rt.x86.hash32=function(ft,yt){if(rt.inputValidation&&!ot(ft))return nt;yt=yt||0;for(var gt=ft.length%4,xt=ft.length-gt,vt=yt,bt=0,Et=3432918353,wt=461845907,kt=0;kt>>0},rt.x86.hash128=function(ft,yt){if(rt.inputValidation&&!ot(ft))return nt;yt=yt||0;for(var gt=ft.length%16,xt=ft.length-gt,vt=yt,bt=yt,Et=yt,wt=yt,kt=0,Tt=0,Rt=0,Pt=0,$t=597399067,Ot=2869860233,Bt=951274213,zt=2716044179,Ft=0;Ft>>0).toString(16)).slice(-8)+("00000000"+(bt>>>0).toString(16)).slice(-8)+("00000000"+(Et>>>0).toString(16)).slice(-8)+("00000000"+(wt>>>0).toString(16)).slice(-8)},rt.x64.hash128=function(ft,yt){if(rt.inputValidation&&!ot(ft))return nt;yt=yt||0;for(var gt=ft.length%16,xt=ft.length-gt,vt=[0,yt],bt=[0,yt],Et=[0,0],wt=[0,0],kt=[2277735313,289559509],Tt=[1291169091,658871167],Rt=0;Rt>>0).toString(16)).slice(-8)+("00000000"+(vt[1]>>>0).toString(16)).slice(-8)+("00000000"+(bt[0]>>>0).toString(16)).slice(-8)+("00000000"+(bt[1]>>>0).toString(16)).slice(-8)},o.exports&&(et=o.exports=rt),et.murmurHash3=rt})()})(murmurHash3js,murmurHash3js.exports);const MAX_FINGERPRINT_SIZE=64;class Fingerprint{constructor(et,tt,nt,rt=2){Ct(this,"fp");Ct(this,"h");Ct(this,"seed");if(rt>MAX_FINGERPRINT_SIZE)throw new TypeError("Invalid Fingerprint Size");const ot=tt.hashV(et,nt),it=alloc$2(rt);for(let st=0;stet.equals(tt))}add(et){if(!(et instanceof Fingerprint))throw new TypeError("Invalid Fingerprint");for(let tt=0;ttet.equals(nt));return tt>-1?(this.contents[tt]=null,!0):!1}}const FNV_PRIMES={32:16777619n,64:1099511628211n,128:309485009821345068724781371n,256:374144419156711147060143317175368453031918731002211n,512:35835915874844867368919076489095108449946327955754392558399825615420669938882575126094039892345713852759n,1024:5016456510113118655434598811035278955030765345404790744303017523831112055108147451509157692220295382716162651878526895249385292291816524375083746691371804094271873160484737966720260389217684476157468082573n},FNV_OFFSETS={32:2166136261n,64:14695981039346656037n,128:144066263297769815596495629667062367629n,256:100029257958052580907070968620625704837092796014241193945225284501741471925557n,512:9659303129496669498009435400716310466090418745672637896108374329434462657994582932197716438449813051892206539805784495328239340083876191928701583869517785n,1024:14197795064947621068722070641403218320880622795441933960878474914617582723252296732303717722150864096521202355549365628174669108571814760471015076148029755969804077320157692458563003215304957150157403644460363550505412711285966361610267868082893823963790439336411086884584107735010676915n},cachedEncoder=new globalThis.TextEncoder;function fnv1aUint8Array(o,et){const tt=FNV_PRIMES[et];let nt=FNV_OFFSETS[et];for(let rt=0;rt0;){const it=cachedEncoder.encodeInto(ot,tt);ot=ot.slice(it.read);for(let st=0;stNumber(fnv1a$1(o,{size:32})),hashV:(o,et)=>numberToBuffer(fnv1a.hash(o,et))};function numberToBuffer(o){let et=o.toString(16);return et.length%2===1&&(et=`0${et}`),fromString(et,"base16")}const maxCuckooCount=500;class CuckooFilter{constructor(et){Ct(this,"bucketSize");Ct(this,"filterSize");Ct(this,"fingerprintSize");Ct(this,"buckets");Ct(this,"count");Ct(this,"hash");Ct(this,"seed");this.filterSize=et.filterSize,this.bucketSize=et.bucketSize??4,this.fingerprintSize=et.fingerprintSize??2,this.count=0,this.buckets=[],this.hash=et.hash??fnv1a,this.seed=et.seed??getRandomInt(0,Math.pow(2,10))}add(et){typeof et=="string"&&(et=fromString(et));const tt=new Fingerprint(et,this.hash,this.seed,this.fingerprintSize),nt=this.hash.hash(et,this.seed)%this.filterSize,rt=(nt^tt.hash())%this.filterSize;if(this.buckets[nt]==null&&(this.buckets[nt]=new Bucket(this.bucketSize)),this.buckets[rt]==null&&(this.buckets[rt]=new Bucket(this.bucketSize)),this.buckets[nt].add(tt)||this.buckets[rt].add(tt))return this.count++,!0;const ot=[nt,rt];let it=ot[getRandomInt(0,ot.length-1)];this.buckets[it]==null&&(this.buckets[it]=new Bucket(this.bucketSize));for(let st=0;st.002?2:o>1e-5?4:8}function optimize(o,et=.001){const tt=calculateBucketSize(et),nt=MAX_LOAD[tt],rt=Math.round(o/nt),ot=Math.min(Math.ceil(Math.log2(1/et)+Math.log2(2*tt)),MAX_FINGERPRINT_SIZE);return{filterSize:rt,bucketSize:tt,fingerprintSize:ot}}class ScalableCuckooFilter{constructor(et){Ct(this,"filterSize");Ct(this,"bucketSize");Ct(this,"fingerprintSize");Ct(this,"scale");Ct(this,"filterSeries");Ct(this,"hash");Ct(this,"seed");this.bucketSize=et.bucketSize??4,this.filterSize=et.filterSize??(1<<18)/this.bucketSize,this.fingerprintSize=et.fingerprintSize??2,this.scale=et.scale??2,this.hash=et.hash??fnv1a,this.seed=et.seed??getRandomInt(0,Math.pow(2,10)),this.filterSeries=[new CuckooFilter({filterSize:this.filterSize,bucketSize:this.bucketSize,fingerprintSize:this.fingerprintSize,hash:this.hash,seed:this.seed})]}add(et){if(typeof et=="string"&&(et=fromString(et)),this.has(et))return!0;let tt=this.filterSeries.find(nt=>nt.reliable);if(tt==null){const nt=this.filterSize*Math.pow(this.scale,this.filterSeries.length);tt=new CuckooFilter({filterSize:nt,bucketSize:this.bucketSize,fingerprintSize:this.fingerprintSize,hash:this.hash,seed:this.seed}),this.filterSeries.push(tt)}return tt.add(et)}has(et){typeof et=="string"&&(et=fromString(et));for(let tt=0;ttet+tt.count,0)}}function createScalableCuckooFilter(o,et=.001,tt){return new ScalableCuckooFilter({...optimize(o,et)})}const peerIdSymbol=Symbol.for("@libp2p/peer-id");function isPeerId(o){return!!(o!=null&&o[peerIdSymbol])}class InvalidParametersError extends Error{constructor(et="Invalid parameters"){super(et),this.name="InvalidParametersError"}}Ct(InvalidParametersError,"name","InvalidParametersError");const events={},observable=o=>{o.addEventListener("message",et=>{observable.dispatchEvent("message",o,et)}),o.port!=null&&o.port.addEventListener("message",et=>{observable.dispatchEvent("message",o,et)})};observable.addEventListener=(o,et)=>{events[o]==null&&(events[o]=[]),events[o].push(et)};observable.removeEventListener=(o,et)=>{events[o]!=null&&(events[o]=events[o].filter(tt=>tt===et))};observable.dispatchEvent=function(o,et,tt){events[o]!=null&&events[o].forEach(nt=>nt(et,tt))};const WORKER_REQUEST_READ_LOCK="lock:worker:request-read",WORKER_RELEASE_READ_LOCK="lock:worker:release-read",MASTER_GRANT_READ_LOCK="lock:master:grant-read",WORKER_REQUEST_WRITE_LOCK="lock:worker:request-write",WORKER_RELEASE_WRITE_LOCK="lock:worker:release-write",MASTER_GRANT_WRITE_LOCK="lock:master:grant-write",nanoid=(o=21)=>Math.random().toString().substring(2),handleWorkerLockRequest=(o,et,tt,nt,rt)=>(ot,it)=>{if(it.data.type!==tt)return;const st={type:it.data.type,name:it.data.name,identifier:it.data.identifier};o.dispatchEvent(new MessageEvent(et,{data:{name:st.name,handler:async()=>{ot.postMessage({type:rt,name:st.name,identifier:st.identifier}),await new Promise(at=>{const ct=lt=>{if((lt==null?void 0:lt.data)==null)return;const dt={type:lt.data.type,name:lt.data.name,identifier:lt.data.identifier};dt.type===nt&&dt.identifier===st.identifier&&(ot.removeEventListener("message",ct),at())};ot.addEventListener("message",ct)})}}}))},makeWorkerLockRequest=(o,et,tt,nt)=>async()=>{const rt=nanoid();return globalThis.postMessage({type:et,identifier:rt,name:o}),new Promise(ot=>{const it=st=>{if((st==null?void 0:st.data)==null)return;const at={type:st.data.type,identifier:st.data.identifier};at.type===tt&&at.identifier===rt&&(globalThis.removeEventListener("message",it),ot(()=>{globalThis.postMessage({type:nt,identifier:rt,name:o})}))};globalThis.addEventListener("message",it)})},defaultOptions$4={singleProcess:!1},impl=o=>{if(o=Object.assign({},defaultOptions$4,o),!!globalThis.document||o.singleProcess){const tt=new EventTarget;return observable.addEventListener("message",handleWorkerLockRequest(tt,"requestReadLock",WORKER_REQUEST_READ_LOCK,WORKER_RELEASE_READ_LOCK,MASTER_GRANT_READ_LOCK)),observable.addEventListener("message",handleWorkerLockRequest(tt,"requestWriteLock",WORKER_REQUEST_WRITE_LOCK,WORKER_RELEASE_WRITE_LOCK,MASTER_GRANT_WRITE_LOCK)),tt}return{isWorker:!0,readLock:tt=>makeWorkerLockRequest(tt,WORKER_REQUEST_READ_LOCK,MASTER_GRANT_READ_LOCK,WORKER_RELEASE_READ_LOCK),writeLock:tt=>makeWorkerLockRequest(tt,WORKER_REQUEST_WRITE_LOCK,MASTER_GRANT_WRITE_LOCK,WORKER_RELEASE_WRITE_LOCK)}},mutexes={};let implementation;async function createReleaseable(o,et){let tt;const nt=new Promise(rt=>{tt=rt});return o.add(async()=>pTimeout((async()=>{await new Promise(rt=>{tt(()=>{rt()})})})(),{milliseconds:et.timeout})),nt}const createMutex=(o,et)=>{if(implementation.isWorker===!0)return{readLock:implementation.readLock(o,et),writeLock:implementation.writeLock(o,et)};const tt=new PQueue({concurrency:1});let nt;return{async readLock(){if(nt!=null)return createReleaseable(nt,et);nt=new PQueue({concurrency:et.concurrency,autoStart:!1});const rt=nt,ot=createReleaseable(nt,et);return tt.add(async()=>{rt.start(),await rt.onIdle().then(()=>{nt===rt&&(nt=null)})}),ot},async writeLock(){return nt=null,createReleaseable(tt,et)}}},defaultOptions$3={name:"lock",concurrency:1/0,timeout:846e5,singleProcess:!1};function createMortice(o){const et=Object.assign({},defaultOptions$3,o);return implementation==null&&(implementation=impl(et),implementation.isWorker!==!0&&(implementation.addEventListener("requestReadLock",tt=>{mutexes[tt.data.name]!=null&&mutexes[tt.data.name].readLock().then(async nt=>tt.data.handler().finally(()=>{nt()}))}),implementation.addEventListener("requestWriteLock",async tt=>{mutexes[tt.data.name]!=null&&mutexes[tt.data.name].writeLock().then(async nt=>tt.data.handler().finally(()=>{nt()}))}))),mutexes[et.name]==null&&(mutexes[et.name]=createMutex(et.name,et)),mutexes[et.name]}var Peer;(function(o){(function(tt){let nt;tt.codec=()=>(nt==null&&(nt=message$1((rt,ot,it={})=>{it.lengthDelimited!==!1&&ot.fork(),rt.key!=null&&rt.key!==""&&(ot.uint32(10),ot.string(rt.key)),rt.value!=null&&rt.value.byteLength>0&&(ot.uint32(18),ot.bytes(rt.value)),it.lengthDelimited!==!1&&ot.ldelim()},(rt,ot,it={})=>{const st={key:"",value:alloc$2(0)},at=ot==null?rt.len:rt.pos+ot;for(;rt.pos>>3){case 1:{st.key=rt.string();break}case 2:{st.value=rt.bytes();break}default:{rt.skipType(ct&7);break}}}return st})),nt),tt.encode=rt=>encodeMessage(rt,tt.codec()),tt.decode=(rt,ot)=>decodeMessage(rt,tt.codec(),ot)})(o.Peer$metadataEntry||(o.Peer$metadataEntry={})),function(tt){let nt;tt.codec=()=>(nt==null&&(nt=message$1((rt,ot,it={})=>{it.lengthDelimited!==!1&&ot.fork(),rt.key!=null&&rt.key!==""&&(ot.uint32(10),ot.string(rt.key)),rt.value!=null&&(ot.uint32(18),Tag.codec().encode(rt.value,ot)),it.lengthDelimited!==!1&&ot.ldelim()},(rt,ot,it={})=>{var ct;const st={key:""},at=ot==null?rt.len:rt.pos+ot;for(;rt.pos>>3){case 1:{st.key=rt.string();break}case 2:{st.value=Tag.codec().decode(rt,rt.uint32(),{limits:(ct=it.limits)==null?void 0:ct.value});break}default:{rt.skipType(lt&7);break}}}return st})),nt),tt.encode=rt=>encodeMessage(rt,tt.codec()),tt.decode=(rt,ot)=>decodeMessage(rt,tt.codec(),ot)}(o.Peer$tagsEntry||(o.Peer$tagsEntry={}));let et;o.codec=()=>(et==null&&(et=message$1((tt,nt,rt={})=>{if(rt.lengthDelimited!==!1&&nt.fork(),tt.addresses!=null)for(const ot of tt.addresses)nt.uint32(10),Address.codec().encode(ot,nt);if(tt.protocols!=null)for(const ot of tt.protocols)nt.uint32(18),nt.string(ot);if(tt.publicKey!=null&&(nt.uint32(34),nt.bytes(tt.publicKey)),tt.peerRecordEnvelope!=null&&(nt.uint32(42),nt.bytes(tt.peerRecordEnvelope)),tt.metadata!=null&&tt.metadata.size!==0)for(const[ot,it]of tt.metadata.entries())nt.uint32(50),o.Peer$metadataEntry.codec().encode({key:ot,value:it},nt);if(tt.tags!=null&&tt.tags.size!==0)for(const[ot,it]of tt.tags.entries())nt.uint32(58),o.Peer$tagsEntry.codec().encode({key:ot,value:it},nt);rt.lengthDelimited!==!1&&nt.ldelim()},(tt,nt,rt={})=>{var st,at,ct,lt,dt,ht;const ot={addresses:[],protocols:[],metadata:new Map,tags:new Map},it=nt==null?tt.len:tt.pos+nt;for(;tt.pos>>3){case 1:{if(((st=rt.limits)==null?void 0:st.addresses)!=null&&ot.addresses.length===rt.limits.addresses)throw new MaxLengthError('Decode error - map field "addresses" had too many elements');ot.addresses.push(Address.codec().decode(tt,tt.uint32(),{limits:(at=rt.limits)==null?void 0:at.addresses$}));break}case 2:{if(((ct=rt.limits)==null?void 0:ct.protocols)!=null&&ot.protocols.length===rt.limits.protocols)throw new MaxLengthError('Decode error - map field "protocols" had too many elements');ot.protocols.push(tt.string());break}case 4:{ot.publicKey=tt.bytes();break}case 5:{ot.peerRecordEnvelope=tt.bytes();break}case 6:{if(((lt=rt.limits)==null?void 0:lt.metadata)!=null&&ot.metadata.size===rt.limits.metadata)throw new MaxSizeError('Decode error - map field "metadata" had too many elements');const mt=o.Peer$metadataEntry.codec().decode(tt,tt.uint32());ot.metadata.set(mt.key,mt.value);break}case 7:{if(((dt=rt.limits)==null?void 0:dt.tags)!=null&&ot.tags.size===rt.limits.tags)throw new MaxSizeError('Decode error - map field "tags" had too many elements');const mt=o.Peer$tagsEntry.codec().decode(tt,tt.uint32(),{limits:{value:(ht=rt.limits)==null?void 0:ht.tags$value}});ot.tags.set(mt.key,mt.value);break}default:{tt.skipType(pt&7);break}}}return ot})),et),o.encode=tt=>encodeMessage(tt,o.codec()),o.decode=(tt,nt)=>decodeMessage(tt,o.codec(),nt)})(Peer||(Peer={}));var Address;(function(o){let et;o.codec=()=>(et==null&&(et=message$1((tt,nt,rt={})=>{rt.lengthDelimited!==!1&&nt.fork(),tt.multiaddr!=null&&tt.multiaddr.byteLength>0&&(nt.uint32(10),nt.bytes(tt.multiaddr)),tt.isCertified!=null&&(nt.uint32(16),nt.bool(tt.isCertified)),rt.lengthDelimited!==!1&&nt.ldelim()},(tt,nt,rt={})=>{const ot={multiaddr:alloc$2(0)},it=nt==null?tt.len:tt.pos+nt;for(;tt.pos>>3){case 1:{ot.multiaddr=tt.bytes();break}case 2:{ot.isCertified=tt.bool();break}default:{tt.skipType(st&7);break}}}return ot})),et),o.encode=tt=>encodeMessage(tt,o.codec()),o.decode=(tt,nt)=>decodeMessage(tt,o.codec(),nt)})(Address||(Address={}));var Tag;(function(o){let et;o.codec=()=>(et==null&&(et=message$1((tt,nt,rt={})=>{rt.lengthDelimited!==!1&&nt.fork(),tt.value!=null&&tt.value!==0&&(nt.uint32(8),nt.uint32(tt.value)),tt.expiry!=null&&(nt.uint32(16),nt.uint64(tt.expiry)),rt.lengthDelimited!==!1&&nt.ldelim()},(tt,nt,rt={})=>{const ot={value:0},it=nt==null?tt.len:tt.pos+nt;for(;tt.pos>>3){case 1:{ot.value=tt.uint32();break}case 2:{ot.expiry=tt.uint64();break}default:{tt.skipType(st&7);break}}}return ot})),et),o.encode=tt=>encodeMessage(tt,o.codec()),o.decode=(tt,nt)=>decodeMessage(tt,o.codec(),nt)})(Tag||(Tag={}));function bytesToPeer(o,et){const tt=Peer.decode(et);if(tt.publicKey!=null&&o.publicKey==null){const ot=publicKeyFromProtobuf(tt.publicKey);o=peerIdFromPublicKey(ot)}const nt=new Map,rt=BigInt(Date.now());for(const[ot,it]of tt.tags.entries())it.expiry!=null&&it.expiry({multiaddr:multiaddr(ot),isCertified:it??!1})),metadata:tt.metadata,peerRecordEnvelope:tt.peerRecordEnvelope??void 0,tags:nt}}const pathSepS="/",pathSepB=new TextEncoder().encode(pathSepS),pathSep=pathSepB[0];class Key{constructor(et,tt){Ct(this,"_buf");if(typeof et=="string")this._buf=fromString(et);else if(et instanceof Uint8Array)this._buf=et;else throw new Error("Invalid key, should be String of Uint8Array");if(tt==null&&(tt=!0),tt&&this.clean(),this._buf.byteLength===0||this._buf[0]!==pathSep)throw new Error("Invalid key")}toString(et="utf8"){return toString$8(this._buf,et)}uint8Array(){return this._buf}get[Symbol.toStringTag](){return`Key(${this.toString()})`}static withNamespaces(et){return new Key(et.join(pathSepS))}static random(){return new Key(Math.random().toString().substring(2))}static asKey(et){return et instanceof Uint8Array||typeof et=="string"?new Key(et):typeof et.uint8Array=="function"?new Key(et.uint8Array()):null}clean(){if((this._buf==null||this._buf.byteLength===0)&&(this._buf=pathSepB),this._buf[0]!==pathSep){const et=new Uint8Array(this._buf.byteLength+1);et.fill(pathSep,0,1),et.set(this._buf,1),this._buf=et}for(;this._buf.byteLength>1&&this._buf[this._buf.byteLength-1]===pathSep;)this._buf=this._buf.subarray(0,-1)}less(et){const tt=this.list(),nt=et.list();for(let rt=0;rtit)return!1}return tt.lengthtt.namespaces()))])}}function namespaceType(o){const et=o.split(":");return et.length<2?"":et.slice(0,-1).join(":")}function namespaceValue(o){const et=o.split(":");return et[et.length-1]}function flatten(o){return[].concat(...o)}const NAMESPACE_COMMON="/peers/";function peerIdToDatastoreKey(o){if(!isPeerId(o)||o.type==null)throw new InvalidParametersError("Invalid PeerId");const et=o.toCID().toString();return new Key(`${NAMESPACE_COMMON}${et}`)}async function dedupeFilterAndSortAddresses(o,et,tt){const nt=new Map;for(const rt of tt){if(rt==null)continue;if(rt.multiaddr instanceof Uint8Array&&(rt.multiaddr=multiaddr(rt.multiaddr)),!isMultiaddr(rt.multiaddr))throw new InvalidParametersError("Multiaddr was invalid");if(!await et(o,rt.multiaddr))continue;const ot=rt.isCertified??!1,it=rt.multiaddr.toString(),st=nt.get(it);st!=null?rt.isCertified=st.isCertified||ot:nt.set(it,{multiaddr:rt.multiaddr,isCertified:ot})}return[...nt.values()].sort((rt,ot)=>rt.multiaddr.toString().localeCompare(ot.multiaddr.toString())).map(({isCertified:rt,multiaddr:ot})=>({isCertified:rt,multiaddr:ot.bytes}))}async function toPeerPB(o,et,tt,nt){if(et==null)throw new InvalidParametersError("Invalid PeerData");if(et.publicKey!=null&&o.publicKey!=null&&!et.publicKey.equals(o.publicKey))throw new InvalidParametersError("publicKey bytes do not match peer id publicKey bytes");const rt=nt.existingPeer;if(rt!=null&&!o.equals(rt.id))throw new InvalidParametersError("peer id did not match existing peer id");let ot=(rt==null?void 0:rt.addresses)??[],it=new Set((rt==null?void 0:rt.protocols)??[]),st=(rt==null?void 0:rt.metadata)??new Map,at=(rt==null?void 0:rt.tags)??new Map,ct=rt==null?void 0:rt.peerRecordEnvelope;if(tt==="patch"){if((et.multiaddrs!=null||et.addresses!=null)&&(ot=[],et.multiaddrs!=null&&ot.push(...et.multiaddrs.map(ht=>({isCertified:!1,multiaddr:ht}))),et.addresses!=null&&ot.push(...et.addresses)),et.protocols!=null&&(it=new Set(et.protocols)),et.metadata!=null){const ht=et.metadata instanceof Map?[...et.metadata.entries()]:Object.entries(et.metadata);st=createSortedMap(ht,{validate:validateMetadata})}if(et.tags!=null){const ht=et.tags instanceof Map?[...et.tags.entries()]:Object.entries(et.tags);at=createSortedMap(ht,{validate:validateTag,map:mapTag})}et.peerRecordEnvelope!=null&&(ct=et.peerRecordEnvelope)}if(tt==="merge"){if(et.multiaddrs!=null&&ot.push(...et.multiaddrs.map(ht=>({isCertified:!1,multiaddr:ht}))),et.addresses!=null&&ot.push(...et.addresses),et.protocols!=null&&(it=new Set([...it,...et.protocols])),et.metadata!=null){const ht=et.metadata instanceof Map?[...et.metadata.entries()]:Object.entries(et.metadata);for(const[pt,mt]of ht)mt==null?st.delete(pt):st.set(pt,mt);st=createSortedMap([...st.entries()],{validate:validateMetadata})}if(et.tags!=null){const ht=et.tags instanceof Map?[...et.tags.entries()]:Object.entries(et.tags),pt=new Map(at);for(const[mt,ft]of ht)ft==null?pt.delete(mt):pt.set(mt,ft);at=createSortedMap([...pt.entries()],{validate:validateTag,map:mapTag})}et.peerRecordEnvelope!=null&&(ct=et.peerRecordEnvelope)}let lt;(rt==null?void 0:rt.id.publicKey)!=null?lt=publicKeyToProtobuf(rt.id.publicKey):et.publicKey!=null?lt=publicKeyToProtobuf(et.publicKey):o.publicKey!=null&&(lt=publicKeyToProtobuf(o.publicKey));const dt={addresses:await dedupeFilterAndSortAddresses(o,nt.addressFilter??(async()=>!0),ot),protocols:[...it.values()].sort((ht,pt)=>ht.localeCompare(pt)),metadata:st,tags:at,publicKey:lt,peerRecordEnvelope:ct};return o.type!=="RSA"&&delete dt.publicKey,dt}function createSortedMap(o,et){var nt;const tt=new Map;for(const[rt,ot]of o)ot!=null&&et.validate(rt,ot);for(const[rt,ot]of o.sort(([it],[st])=>it.localeCompare(st)))ot!=null&&tt.set(rt,((nt=et.map)==null?void 0:nt.call(et,rt,ot))??ot);return tt}function validateMetadata(o,et){if(typeof o!="string")throw new InvalidParametersError("Metadata key must be a string");if(!(et instanceof Uint8Array))throw new InvalidParametersError("Metadata value must be a Uint8Array")}function validateTag(o,et){if(typeof o!="string")throw new InvalidParametersError("Tag name must be a string");if(et.value!=null){if(parseInt(`${et.value}`,10)!==et.value)throw new InvalidParametersError("Tag value must be an integer");if(et.value<0||et.value>100)throw new InvalidParametersError("Tag value must be between 0-100")}if(et.ttl!=null){if(parseInt(`${et.ttl}`,10)!==et.ttl)throw new InvalidParametersError("Tag ttl must be an integer");if(et.ttl<0)throw new InvalidParametersError("Tag ttl must be between greater than 0")}}function mapTag(o,et){let tt;return et.expiry!=null&&(tt=et.expiry),et.ttl!=null&&(tt=BigInt(Date.now()+Number(et.ttl))),{value:et.value??0,expiry:tt}}function decodePeer(o,et){const tt=o.toString().split("/")[2],nt=CID.parse(tt,base32$2),rt=peerIdFromCID(nt);return bytesToPeer(rt,et)}function mapQuery(o){return o==null?{}:{prefix:NAMESPACE_COMMON,filters:(o.filters??[]).map(et=>({key:tt,value:nt})=>et(decodePeer(tt,nt))),orders:(o.orders??[]).map(et=>(tt,nt)=>et(decodePeer(tt.key,tt.value),decodePeer(nt.key,nt.value)))}}var er,es,ts;class PersistentStore{constructor(et,tt={}){fn(this,er);Ct(this,"peerId");Ct(this,"datastore");Ct(this,"lock");Ct(this,"addressFilter");this.peerId=et.peerId,this.datastore=et.datastore,this.addressFilter=tt.addressFilter,this.lock=createMortice({name:"peer-store",singleProcess:!0})}async has(et){return this.datastore.has(peerIdToDatastoreKey(et))}async delete(et){if(this.peerId.equals(et))throw new InvalidParametersError("Cannot delete self peer");await this.datastore.delete(peerIdToDatastoreKey(et))}async load(et){const tt=await this.datastore.get(peerIdToDatastoreKey(et));return bytesToPeer(et,tt)}async save(et,tt){const{existingBuf:nt,existingPeer:rt}=await gn(this,er,es).call(this,et),ot=await toPeerPB(et,tt,"patch",{addressFilter:this.addressFilter});return gn(this,er,ts).call(this,et,ot,nt,rt)}async patch(et,tt){const{existingBuf:nt,existingPeer:rt}=await gn(this,er,es).call(this,et),ot=await toPeerPB(et,tt,"patch",{addressFilter:this.addressFilter,existingPeer:rt});return gn(this,er,ts).call(this,et,ot,nt,rt)}async merge(et,tt){const{existingBuf:nt,existingPeer:rt}=await gn(this,er,es).call(this,et),ot=await toPeerPB(et,tt,"merge",{addressFilter:this.addressFilter,existingPeer:rt});return gn(this,er,ts).call(this,et,ot,nt,rt)}async*all(et){for await(const{key:tt,value:nt}of this.datastore.query(mapQuery(et??{}))){const rt=decodePeer(tt,nt);rt.id.equals(this.peerId)||(yield rt)}}}er=new WeakSet,es=async function(et){try{const tt=await this.datastore.get(peerIdToDatastoreKey(et)),nt=bytesToPeer(et,tt);return{existingBuf:tt,existingPeer:nt}}catch(tt){if(tt.name!=="NotFoundError")throw tt}return{}},ts=async function(et,tt,nt,rt){const ot=Peer.encode(tt);return nt!=null&&equals(ot,nt)?{peer:bytesToPeer(et,ot),previous:rt,updated:!1}:(await this.datastore.put(peerIdToDatastoreKey(et),ot),{peer:bytesToPeer(et,ot),previous:rt,updated:!0})};var Nl,eo,ns;Nl=Symbol.toStringTag;class PersistentPeerStore{constructor(et,tt={}){fn(this,eo);Ct(this,"store");Ct(this,"events");Ct(this,"peerId");Ct(this,"log");Ct(this,Nl,"@libp2p/peer-store");this.log=et.logger.forComponent("libp2p:peer-store"),this.events=et.events,this.peerId=et.peerId,this.store=new PersistentStore(et,tt)}async forEach(et,tt){this.log.trace("forEach await read lock");const nt=await this.store.lock.readLock();this.log.trace("forEach got read lock");try{for await(const rt of this.store.all(tt))et(rt)}finally{this.log.trace("forEach release read lock"),nt()}}async all(et){this.log.trace("all await read lock");const tt=await this.store.lock.readLock();this.log.trace("all got read lock");try{return await all$2(this.store.all(et))}finally{this.log.trace("all release read lock"),tt()}}async delete(et){this.log.trace("delete await write lock");const tt=await this.store.lock.writeLock();this.log.trace("delete got write lock");try{await this.store.delete(et)}finally{this.log.trace("delete release write lock"),tt()}}async has(et){this.log.trace("has await read lock");const tt=await this.store.lock.readLock();this.log.trace("has got read lock");try{return await this.store.has(et)}finally{this.log.trace("has release read lock"),tt()}}async get(et){this.log.trace("get await read lock");const tt=await this.store.lock.readLock();this.log.trace("get got read lock");try{return await this.store.load(et)}finally{this.log.trace("get release read lock"),tt()}}async save(et,tt){this.log.trace("save await write lock");const nt=await this.store.lock.writeLock();this.log.trace("save got write lock");try{const rt=await this.store.save(et,tt);return gn(this,eo,ns).call(this,et,rt),rt.peer}finally{this.log.trace("save release write lock"),nt()}}async patch(et,tt){this.log.trace("patch await write lock");const nt=await this.store.lock.writeLock();this.log.trace("patch got write lock");try{const rt=await this.store.patch(et,tt);return gn(this,eo,ns).call(this,et,rt),rt.peer}finally{this.log.trace("patch release write lock"),nt()}}async merge(et,tt){this.log.trace("merge await write lock");const nt=await this.store.lock.writeLock();this.log.trace("merge got write lock");try{const rt=await this.store.merge(et,tt);return gn(this,eo,ns).call(this,et,rt),rt.peer}finally{this.log.trace("merge release write lock"),nt()}}async consumePeerRecord(et,tt){const nt=await RecordEnvelope.openAndCertify(et,PeerRecord.DOMAIN),rt=peerIdFromCID(nt.publicKey.toCID());if((tt==null?void 0:tt.equals(rt))===!1)return this.log("envelope peer id was not the expected peer id - expected: %p received: %p",tt,rt),!1;const ot=PeerRecord.createFromProtobuf(nt.payload);let it;try{it=await this.get(rt)}catch(st){if(st.name!=="NotFoundError")throw st}if((it==null?void 0:it.peerRecordEnvelope)!=null){const st=await RecordEnvelope.createFromProtobuf(it.peerRecordEnvelope),at=PeerRecord.createFromProtobuf(st.payload);if(at.seqNumber>=ot.seqNumber)return this.log("sequence number was lower or equal to existing sequence number - stored: %d received: %d",at.seqNumber,ot.seqNumber),!1}return await this.patch(ot.peerId,{peerRecordEnvelope:et,addresses:ot.multiaddrs.map(st=>({isCertified:!0,multiaddr:st}))}),!0}}eo=new WeakSet,ns=function(et,tt){tt.updated&&(this.peerId.equals(et)?this.events.safeDispatchEvent("self:peer:update",{detail:tt}):this.events.safeDispatchEvent("peer:update",{detail:tt}))};function persistentPeerStore(o,et={}){return new PersistentPeerStore(o,et)}const $r=class $r extends Error{constructor(tt="Not Found"){super(tt);Ct(this,"name",$r.name);Ct(this,"code",$r.code)}};Ct($r,"name","NotFoundError"),Ct($r,"code","ERR_NOT_FOUND");let NotFoundError=$r;function peekable(o){const[et,tt]=o[Symbol.asyncIterator]!=null?[o[Symbol.asyncIterator](),Symbol.asyncIterator]:[o[Symbol.iterator](),Symbol.iterator],nt=[];return{peek:()=>et.next(),push:rt=>{nt.push(rt)},next:()=>nt.length>0?{done:!1,value:nt.shift()}:et.next(),[tt](){return this}}}function isAsyncIterable$2(o){return o[Symbol.asyncIterator]!=null}function filter(o,et){let tt=0;if(isAsyncIterable$2(o))return async function*(){for await(const at of o)await et(at,tt++)&&(yield at)}();const nt=peekable(o),{value:rt,done:ot}=nt.next();if(ot===!0)return function*(){}();const it=et(rt,tt++);if(typeof it.then=="function")return async function*(){await it&&(yield rt);for await(const at of nt)await et(at,tt++)&&(yield at)}();const st=et;return function*(){it===!0&&(yield rt);for(const at of nt)st(at,tt++)&&(yield at)}()}function isAsyncIterable$1(o){return o[Symbol.asyncIterator]!=null}function sort(o,et){return isAsyncIterable$1(o)?async function*(){yield*(await all$2(o)).sort(et)}():function*(){yield*all$2(o).sort(et)}()}function isAsyncIterable(o){return o[Symbol.asyncIterator]!=null}function take(o,et){return isAsyncIterable(o)?async function*(){let tt=0;if(!(et<1)){for await(const nt of o)if(yield nt,tt++,tt===et)return}}():function*(){let tt=0;if(!(et<1)){for(const nt of o)if(yield nt,tt++,tt===et)return}}()}class BaseDatastore{put(et,tt,nt){return Promise.reject(new Error(".put is not implemented"))}get(et,tt){return Promise.reject(new Error(".get is not implemented"))}has(et,tt){return Promise.reject(new Error(".has is not implemented"))}delete(et,tt){return Promise.reject(new Error(".delete is not implemented"))}async*putMany(et,tt={}){for await(const{key:nt,value:rt}of et)await this.put(nt,rt,tt),yield nt}async*getMany(et,tt={}){for await(const nt of et)yield{key:nt,value:await this.get(nt,tt)}}async*deleteMany(et,tt={}){for await(const nt of et)await this.delete(nt,tt),yield nt}batch(){let et=[],tt=[];return{put(nt,rt){et.push({key:nt,value:rt})},delete(nt){tt.push(nt)},commit:async nt=>{await drain(this.putMany(et,nt)),et=[],await drain(this.deleteMany(tt,nt)),tt=[]}}}async*_all(et,tt){throw new Error("._all is not implemented")}async*_allKeys(et,tt){throw new Error("._allKeys is not implemented")}query(et,tt){let nt=this._all(et,tt);if(et.prefix!=null){const rt=et.prefix;nt=filter(nt,ot=>ot.key.toString().startsWith(rt))}if(Array.isArray(et.filters)&&(nt=et.filters.reduce((rt,ot)=>filter(rt,ot),nt)),Array.isArray(et.orders)&&(nt=et.orders.reduce((rt,ot)=>sort(rt,ot),nt)),et.offset!=null){let rt=0;const ot=et.offset;nt=filter(nt,()=>rt++>=ot)}return et.limit!=null&&(nt=take(nt,et.limit)),nt}queryKeys(et,tt){let nt=this._allKeys(et,tt);if(et.prefix!=null){const rt=et.prefix;nt=filter(nt,ot=>ot.toString().startsWith(rt))}if(Array.isArray(et.filters)&&(nt=et.filters.reduce((rt,ot)=>filter(rt,ot),nt)),Array.isArray(et.orders)&&(nt=et.orders.reduce((rt,ot)=>sort(rt,ot),nt)),et.offset!=null){const rt=et.offset;let ot=0;nt=filter(nt,()=>ot++>=rt)}return et.limit!=null&&(nt=take(nt,et.limit)),nt}}class MemoryDatastore extends BaseDatastore{constructor(){super();Ct(this,"data");this.data=new Map}put(tt,nt){return this.data.set(tt.toString(),nt),tt}get(tt){const nt=this.data.get(tt.toString());if(nt==null)throw new NotFoundError;return nt}has(tt){return this.data.has(tt.toString())}delete(tt){this.data.delete(tt.toString())}*_all(){for(const[tt,nt]of this.data.entries())yield{key:new Key(tt),value:nt}}*_allKeys(){for(const tt of this.data.keys())yield new Key(tt)}}function debounce(o,et){let tt;return function(){const nt=function(){tt=void 0,o()};clearTimeout(tt),tt=setTimeout(nt,et)}}const defaultAddressFilter=o=>o;function stripPeerId(o,et){const tt=o.getPeerId();return tt!=null&&peerIdFromString$1(tt).equals(et)&&(o=o.decapsulate(multiaddr(`/p2p/${et.toString()}`))),o}var $l;$l=Symbol.toStringTag;class DefaultAddressManager{constructor(et,tt={}){Ct(this,"log");Ct(this,"components");Ct(this,"listen");Ct(this,"announce");Ct(this,"observed");Ct(this,"announceFilter");Ct(this,$l,"@libp2p/address-manager");const{listen:nt=[],announce:rt=[]}=tt;this.components=et,this.log=et.logger.forComponent("libp2p:address-manager"),this.listen=nt.map(ot=>ot.toString()),this.announce=new Set(rt.map(ot=>ot.toString())),this.observed=new Map,this.announceFilter=tt.announceFilter??defaultAddressFilter,this._updatePeerStoreAddresses=debounce(this._updatePeerStoreAddresses.bind(this),1e3),et.events.addEventListener("transport:listening",()=>{this._updatePeerStoreAddresses()}),et.events.addEventListener("transport:close",()=>{this._updatePeerStoreAddresses()})}_updatePeerStoreAddresses(){const et=this.getAnnounceAddrs().concat(this.components.transportManager.getAddrs()).concat([...this.observed.entries()].filter(([tt,nt])=>nt.confident).map(([tt])=>multiaddr(tt))).map(tt=>tt.getPeerId()===this.components.peerId.toString()?tt.decapsulate(`/p2p/${this.components.peerId.toString()}`):tt);this.components.peerStore.patch(this.components.peerId,{multiaddrs:et}).catch(tt=>{this.log.error("error updating addresses",tt)})}getListenAddrs(){return Array.from(this.listen).map(et=>multiaddr(et))}getAnnounceAddrs(){return Array.from(this.announce).map(et=>multiaddr(et))}getObservedAddrs(){return Array.from(this.observed).map(([et])=>multiaddr(et))}addObservedAddr(et){et=stripPeerId(et,this.components.peerId);const tt=et.toString();this.observed.has(tt)||this.observed.set(tt,{confident:!1})}confirmObservedAddr(et){et=stripPeerId(et,this.components.peerId);const tt=et.toString(),rt=(this.observed.get(tt)??{confident:!1}).confident;this.observed.set(tt,{confident:!0}),rt||this._updatePeerStoreAddresses()}removeObservedAddr(et){et=stripPeerId(et,this.components.peerId);const tt=et.toString();this.observed.delete(tt)}getAddresses(){let et=this.getAnnounceAddrs().map(nt=>nt.toString());et.length===0&&(et=this.components.transportManager.getAddrs().map(nt=>nt.toString())),et=et.concat(Array.from(this.observed).filter(([nt,rt])=>rt.confident).map(([nt])=>nt));const tt=new Set(et);return this.announceFilter(Array.from(tt).map(nt=>multiaddr(nt))).map(nt=>{var rt;return((rt=nt.protos().pop())==null?void 0:rt.path)===!0||nt.getPeerId()===this.components.peerId.toString()?nt:nt.encapsulate(`/p2p/${this.components.peerId.toString()}`)})}}var messages;(function(o){o.NOT_STARTED_YET="The libp2p node is not started yet",o.NOT_FOUND="Not found"})(messages||(messages={}));class MissingServiceError extends Error{constructor(et="Missing service"){super(et),this.name="MissingServiceError"}}class UnmetServiceDependenciesError extends Error{constructor(et="Unmet service dependencies"){super(et),this.name="UnmetServiceDependenciesError"}}class NoContentRoutersError extends Error{constructor(et="No content routers available"){super(et),this.name="NoContentRoutersError"}}class NoPeerRoutersError extends Error{constructor(et="No peer routers available"){super(et),this.name="NoPeerRoutersError"}}class QueriedForSelfError extends Error{constructor(et="Should not try to find self"){super(et),this.name="QueriedForSelfError"}}class UnhandledProtocolError extends Error{constructor(et="Unhandled protocol error"){super(et),this.name="UnhandledProtocolError"}}class DuplicateProtocolHandlerError extends Error{constructor(et="Duplicate protocol handler error"){super(et),this.name="DuplicateProtocolHandlerError"}}class DialDeniedError extends Error{constructor(et="Dial denied error"){super(et),this.name="DialDeniedError"}}class NoValidAddressesError extends Error{constructor(et="No valid addresses"){super(et),this.name="NoValidAddressesError"}}class ConnectionInterceptedError extends Error{constructor(et="Connection intercepted"){super(et),this.name="ConnectionInterceptedError"}}class ConnectionDeniedError extends Error{constructor(et="Connection denied"){super(et),this.name="ConnectionDeniedError"}}class MuxerUnavailableError extends Error{constructor(et="Stream is not multiplexed"){super(et),this.name="MuxerUnavailableError"}}class EncryptionFailedError extends Error{constructor(et="Encryption failed"){super(et),this.name="EncryptionFailedError"}}class TransportUnavailableError extends Error{constructor(et="Transport unavailable"){super(et),this.name="TransportUnavailableError"}}class DefaultComponents{constructor(et={}){Ct(this,"components",{});Ct(this,"_started",!1);this.components={};for(const[tt,nt]of Object.entries(et))this.components[tt]=nt;this.components.logger==null&&(this.components.logger=defaultLogger())}isStarted(){return this._started}async _invokeStartableMethod(et){await Promise.all(Object.values(this.components).filter(tt=>isStartable(tt)).map(async tt=>{var nt;await((nt=tt[et])==null?void 0:nt.call(tt))}))}async beforeStart(){await this._invokeStartableMethod("beforeStart")}async start(){await this._invokeStartableMethod("start"),this._started=!0}async afterStart(){await this._invokeStartableMethod("afterStart")}async beforeStop(){await this._invokeStartableMethod("beforeStop")}async stop(){await this._invokeStartableMethod("stop"),this._started=!1}async afterStop(){await this._invokeStartableMethod("afterStop")}}const OPTIONAL_SERVICES=["metrics","connectionProtector","dns"],NON_SERVICE_PROPERTIES=["components","isStarted","beforeStart","start","afterStart","beforeStop","stop","afterStop","then","_invokeStartableMethod"];function defaultComponents(o={}){const et=new DefaultComponents(o);return new Proxy(et,{get(nt,rt,ot){if(typeof rt=="string"&&!NON_SERVICE_PROPERTIES.includes(rt)){const it=et.components[rt];if(it==null&&!OPTIONAL_SERVICES.includes(rt))throw new MissingServiceError(`${rt} not set`);return it}return Reflect.get(nt,rt,ot)},set(nt,rt,ot){return typeof rt=="string"?et.components[rt]=ot:Reflect.set(nt,rt,ot),!0}})}function checkServiceDependencies(o){const et={};for(const tt of Object.values(o.components))for(const nt of getServiceCapabilities(tt))et[nt]=!0;for(const tt of Object.values(o.components))for(const nt of getServiceDependencies(tt))if(et[nt]!==!0)throw new UnmetServiceDependenciesError(`Service "${getServiceName(tt)}" required capability "${nt}" but it was not provided by any component, you may need to add additional configuration when creating your node.`)}function getServiceCapabilities(o){return Array.isArray(o==null?void 0:o[serviceCapabilities])?o[serviceCapabilities]:[]}function getServiceDependencies(o){return Array.isArray(o==null?void 0:o[serviceDependencies])?o[serviceDependencies]:[]}function getServiceName(o){return(o==null?void 0:o[Symbol.toStringTag])??(o==null?void 0:o.toString())??"unknown"}function connectionGater(o={}){return{denyDialPeer:async()=>!1,denyDialMultiaddr:async et=>{const tt=et.stringTuples();return tt[0][0]===4||tt[0][0]===41?!!isPrivateIp(`${tt[0][1]}`):!1},denyInboundConnection:async()=>!1,denyOutboundConnection:async()=>!1,denyInboundEncryptedConnection:async()=>!1,denyOutboundEncryptedConnection:async()=>!1,denyInboundUpgradedConnection:async()=>!1,denyOutboundUpgradedConnection:async()=>!1,filterMultiaddrForPeer:async()=>!0,...o}}function getPeerAddress(o){if(isPeerId$1(o))return{peerId:o,multiaddrs:[]};Array.isArray(o)||(o=[o]);let et;if(o.length>0){const tt=o[0].getPeerId();et=tt==null?void 0:peerIdFromString$1(tt),o.forEach(nt=>{if(!isMultiaddr(nt))throw new InvalidMultiaddrError("Invalid multiaddr");const rt=nt.getPeerId();if(rt==null){if(et!=null)throw new InvalidParametersError$1("Multiaddrs must all have the same peer id or have no peer id")}else{const ot=peerIdFromString$1(rt);if((et==null?void 0:et.equals(ot))!==!0)throw new InvalidParametersError$1("Multiaddrs must all have the same peer id or have no peer id")}})}return{peerId:et,multiaddrs:o}}const DEFAULT_CLOSABLE_PROTOCOLS=["/ipfs/id/1.0.0","/ipfs/id/push/1.0.0","/libp2p/autonat/1.0.0","/libp2p/dcutr"];async function safelyCloseConnectionIfUnused(o,et){var rt;const tt=((rt=o==null?void 0:o.streams)==null?void 0:rt.map(ot=>ot.protocol))??[],nt=(et==null?void 0:et.closableProtocols)??DEFAULT_CLOSABLE_PROTOCOLS;if(!(tt.filter(ot=>ot!=null&&!nt.includes(ot)).length>0))try{await(o==null?void 0:o.close(et))}catch(ot){o==null||o.abort(ot)}}const DIAL_TIMEOUT=5e3,UPGRADE_TIMEOUT=3e3,PROTOCOL_NEGOTIATION_TIMEOUT=2e3,MAX_PEER_ADDRS_TO_DIAL=25,INBOUND_CONNECTION_THRESHOLD=5,MAX_INCOMING_PENDING_CONNECTIONS=10,MAX_PARALLEL_RECONNECTS=5,LAST_DIAL_FAILURE_KEY="last-dial-failure",LAST_DIAL_SUCCESS_KEY="last-dial-success",MAX_DIAL_QUEUE_LENGTH=500,MAX_CONNECTIONS=100,MAX_PARALLEL_DIALS=50,defaultOptions$2={maxConnections:MAX_CONNECTIONS,allow:[]};class ConnectionPruner{constructor(et,tt={}){Ct(this,"maxConnections");Ct(this,"connectionManager");Ct(this,"peerStore");Ct(this,"allow");Ct(this,"events");Ct(this,"log");this.maxConnections=tt.maxConnections??defaultOptions$2.maxConnections,this.allow=tt.allow??defaultOptions$2.allow,this.connectionManager=et.connectionManager,this.peerStore=et.peerStore,this.events=et.events,this.log=et.logger.forComponent("libp2p:connection-manager:connection-pruner"),this.maybePruneConnections=this.maybePruneConnections.bind(this)}start(){this.events.addEventListener("connection:open",this.maybePruneConnections)}stop(){this.events.removeEventListener("connection:open",this.maybePruneConnections)}maybePruneConnections(){this._maybePruneConnections().catch(et=>{this.log.error("error while pruning connections %e",et)})}async _maybePruneConnections(){const et=this.connectionManager.getConnections(),tt=et.length;if(this.log("checking max connections limit %d/%d",tt,this.maxConnections),tt<=this.maxConnections)return;const nt=new PeerMap;for(const st of et){const at=st.remotePeer;if(!nt.has(at)){nt.set(at,0);try{const ct=await this.peerStore.get(at);nt.set(at,[...ct.tags.values()].reduce((lt,dt)=>lt+dt.value,0))}catch(ct){ct.name!=="NotFoundError"&&this.log.error("error loading peer tags",ct)}}}const rt=this.sortConnections(et,nt),ot=Math.max(tt-this.maxConnections,0),it=[];for(const st of rt)if(this.log("too many connections open - closing a connection to %p",st.remotePeer),this.allow.some(ct=>st.remoteAddr.toString().startsWith(ct.toString()))||it.push(st),it.length===ot)break;await Promise.all(it.map(async st=>{await safelyCloseConnectionIfUnused(st,{signal:AbortSignal.timeout(1e3)})})),this.events.safeDispatchEvent("connection:prune",{detail:it})}sortConnections(et,tt){return et.sort((nt,rt)=>{const ot=nt.timeline.open,it=rt.timeline.open;return otit?-1:0}).sort((nt,rt)=>nt.direction==="outbound"&&rt.direction==="inbound"?1:nt.direction==="inbound"&&rt.direction==="outbound"?-1:0).sort((nt,rt)=>nt.streams.length>rt.streams.length?1:nt.streams.length{const ot=tt.get(nt.remotePeer)??0,it=tt.get(rt.remotePeer)??0;return ot>it?1:ot{function st(){tt==null||tt.removeEventListener("abort",lt),o.removeEventListener(et,at),(nt==null?void 0:nt.errorEvent)!=null&&o.removeEventListener(nt.errorEvent,ct)}const at=dt=>{var ht;try{if(((ht=nt==null?void 0:nt.filter)==null?void 0:ht.call(nt,dt))===!1)return}catch(pt){st(),it(pt);return}st(),ot(dt)},ct=dt=>{st(),it(dt.detail)},lt=()=>{st(),it(rt)};tt==null||tt.addEventListener("abort",lt),o.addEventListener(et,at),(nt==null?void 0:nt.errorEvent)!=null&&o.addEventListener(nt.errorEvent,ct)})}class JobRecipient{constructor(et){Ct(this,"deferred");Ct(this,"signal");var tt;this.signal=et,this.deferred=pDefer(),this.onAbort=this.onAbort.bind(this),(tt=this.signal)==null||tt.addEventListener("abort",this.onAbort)}onAbort(){var et;this.deferred.reject(((et=this.signal)==null?void 0:et.reason)??new AbortError$6)}cleanup(){var et;(et=this.signal)==null||et.removeEventListener("abort",this.onAbort)}}function randomId(){return`${parseInt(String(Math.random()*1e9),10).toString()}${Date.now()}`}class Job{constructor(et,tt){Ct(this,"id");Ct(this,"fn");Ct(this,"options");Ct(this,"recipients");Ct(this,"status");Ct(this,"timeline");Ct(this,"controller");this.id=randomId(),this.status="queued",this.fn=et,this.options=tt,this.recipients=[],this.timeline={created:Date.now()},this.controller=new AbortController,setMaxListeners$2(1/0,this.controller.signal),this.onAbort=this.onAbort.bind(this)}abort(et){this.controller.abort(et)}onAbort(){this.recipients.reduce((tt,nt)=>{var rt;return tt&&((rt=nt.signal)==null?void 0:rt.aborted)===!0},!0)&&(this.controller.abort(new AbortError$6),this.cleanup())}async join(et={}){var nt;const tt=new JobRecipient(et.signal);return this.recipients.push(tt),(nt=et.signal)==null||nt.addEventListener("abort",this.onAbort),tt.deferred.promise}async run(){this.status="running",this.timeline.started=Date.now();try{this.controller.signal.throwIfAborted();const et=await raceSignal(this.fn({...this.options??{},signal:this.controller.signal}),this.controller.signal);this.recipients.forEach(tt=>{tt.deferred.resolve(et)}),this.status="complete"}catch(et){this.recipients.forEach(tt=>{tt.deferred.reject(et)}),this.status="errored"}finally{this.timeline.finished=Date.now(),this.cleanup()}}cleanup(){this.recipients.forEach(et=>{var tt;et.cleanup(),(tt=et.signal)==null||tt.removeEventListener("abort",this.onAbort)})}}class Queue extends TypedEventEmitter$1{constructor(tt={}){var nt;super();Ct(this,"concurrency");Ct(this,"maxSize");Ct(this,"queue");Ct(this,"pending");Ct(this,"sort");this.concurrency=tt.concurrency??Number.POSITIVE_INFINITY,this.maxSize=tt.maxSize??Number.POSITIVE_INFINITY,this.pending=0,tt.metricName!=null&&((nt=tt.metrics)==null||nt.registerMetricGroup(tt.metricName,{calculate:()=>({size:this.queue.length,running:this.pending,queued:this.queue.length-this.pending})})),this.sort=tt.sort,this.queue=[]}tryToStartAnother(){if(this.size===0)return queueMicrotask(()=>{this.safeDispatchEvent("empty")}),this.running===0&&queueMicrotask(()=>{this.safeDispatchEvent("idle")}),!1;if(this.pending{for(let nt=0;nt(this.safeDispatchEvent("completed",{detail:it}),this.safeDispatchEvent("success",{detail:{job:rt,result:it}}),it)).catch(it=>{if(rt.status==="queued"){for(let st=0;st{tt.abort(new AbortError$6)}),this.clear()}async onEmpty(tt){this.size!==0&&await raceEvent(this,"empty",tt==null?void 0:tt.signal)}async onSizeLessThan(tt,nt){this.sizethis.size{ht!=null?this.abort():this.clear(),nt.end(ht)},ot=ht=>{ht.detail!=null&&nt.push(ht.detail)},it=ht=>{rt(ht.detail)},st=()=>{rt()},at=()=>{rt(new AbortError$6("Queue aborted"))};this.addEventListener("completed",ot),this.addEventListener("error",it),this.addEventListener("idle",st),(lt=tt==null?void 0:tt.signal)==null||lt.addEventListener("abort",at);try{yield*nt}finally{this.removeEventListener("completed",ot),this.removeEventListener("error",it),this.removeEventListener("idle",st),(dt=tt==null?void 0:tt.signal)==null||dt.removeEventListener("abort",at),rt()}}}class PriorityQueue extends Queue{constructor(et={}){super({...et,sort:(tt,nt)=>tt.options.priority>nt.options.priority?-1:tt.options.priorityrt.toString())),nt}const defaultOptions$1={maxParallelDials:MAX_PARALLEL_DIALS,maxDialQueueLength:MAX_DIAL_QUEUE_LENGTH,maxPeerAddrsToDial:MAX_PEER_ADDRS_TO_DIAL,dialTimeout:DIAL_TIMEOUT,resolvers:{dnsaddr:dnsaddrResolver}};class DialQueue{constructor(et,tt={}){Ct(this,"queue");Ct(this,"components");Ct(this,"addressSorter");Ct(this,"maxPeerAddrsToDial");Ct(this,"maxDialQueueLength");Ct(this,"dialTimeout");Ct(this,"shutDownController");Ct(this,"connections");Ct(this,"log");this.addressSorter=tt.addressSorter,this.maxPeerAddrsToDial=tt.maxPeerAddrsToDial??defaultOptions$1.maxPeerAddrsToDial,this.maxDialQueueLength=tt.maxDialQueueLength??defaultOptions$1.maxDialQueueLength,this.dialTimeout=tt.dialTimeout??defaultOptions$1.dialTimeout,this.connections=tt.connections??new PeerMap,this.log=et.logger.forComponent("libp2p:connection-manager:dial-queue"),this.components=et,this.shutDownController=new AbortController,setMaxListeners(1/0,this.shutDownController.signal);for(const[nt,rt]of Object.entries(tt.resolvers??{}))resolvers$1.set(nt,rt);this.queue=new PriorityQueue({concurrency:tt.maxParallelDials??defaultOptions$1.maxParallelDials,metricName:"libp2p_dial_queue",metrics:et.metrics}),this.queue.addEventListener("error",nt=>{nt.detail.name!==AbortError$4.name&&this.log.error("error in dial queue - %e",nt.detail)})}start(){this.shutDownController=new AbortController,setMaxListeners(1/0,this.shutDownController.signal)}stop(){this.shutDownController.abort(),this.queue.abort()}async dial(et,tt={}){var st,at,ct;const{peerId:nt,multiaddrs:rt}=getPeerAddress(et),ot=Array.from(this.connections.values()).flat().find(lt=>tt.force===!0?!1:lt.remotePeer.equals(nt)?!0:rt.find(dt=>dt.equals(lt.remoteAddr)));if((ot==null?void 0:ot.status)==="open")return this.log("already connected to %a",ot.remoteAddr),(st=tt.onProgress)==null||st.call(tt,new CustomProgressEvent("dial-queue:already-connected")),ot;const it=this.queue.queue.find(lt=>{if((nt==null?void 0:nt.equals(lt.options.peerId))===!0)return!0;const dt=lt.options.multiaddrs;if(dt==null)return!1;for(const ht of rt)if(dt.has(ht.toString()))return!0;return!1});if(it!=null){this.log("joining existing dial target for %p",nt);for(const lt of rt)it.options.multiaddrs.add(lt.toString());return(at=tt.onProgress)==null||at.call(tt,new CustomProgressEvent("dial-queue:already-in-dial-queue")),it.join(tt)}if(this.queue.size>=this.maxDialQueueLength)throw new DialError("Dial queue is full");return this.log("creating dial target for %p",nt,rt.map(lt=>lt.toString())),(ct=tt.onProgress)==null||ct.call(tt,new CustomProgressEvent("dial-queue:add-to-dial-queue")),this.queue.add(async lt=>{var pt,mt;(pt=lt==null?void 0:lt.onProgress)==null||pt.call(lt,new CustomProgressEvent("dial-queue:start-dial"));const dt=this.createDialAbortController(lt==null?void 0:lt.signal);let ht;try{ht=await this.calculateMultiaddrs(nt,lt==null?void 0:lt.multiaddrs,{...lt,signal:dt}),(mt=lt==null?void 0:lt.onProgress)==null||mt.call(lt,new CustomProgressEvent("dial-queue:calculated-addresses",ht)),ht.map(({multiaddr:ft})=>ft.toString()).forEach(ft=>{lt==null||lt.multiaddrs.add(ft)})}catch(ft){throw dt.clear(),ft}try{let ft=0;const yt=[];for(const gt of ht){if(ft===this.maxPeerAddrsToDial)throw this.log("dialed maxPeerAddrsToDial (%d) addresses for %p, not trying any others",ft,nt),new DialError("Peer had more than maxPeerAddrsToDial");ft++;try{const xt=await this.components.transportManager.dial(gt.multiaddr,{...lt,signal:dt});this.log("dial to %a succeeded",gt.multiaddr);try{await this.components.peerStore.merge(xt.remotePeer,{multiaddrs:[xt.remoteAddr],metadata:{[LAST_DIAL_SUCCESS_KEY]:fromString(Date.now().toString())}})}catch(vt){this.log.error("could not update last dial failure key for %p",nt,vt)}return xt}catch(xt){if(this.log.error("dial failed to %a",gt.multiaddr,xt),nt!=null)try{await this.components.peerStore.merge(nt,{metadata:{[LAST_DIAL_FAILURE_KEY]:fromString(Date.now().toString())}})}catch(vt){this.log.error("could not update last dial failure key for %p",nt,vt)}if(dt.aborted)throw new TimeoutError$2(xt.message);yt.push(xt)}}throw yt.length===1?yt[0]:new AggregateError(yt,"All multiaddr dials failed")}finally{dt.clear()}},{peerId:nt,priority:tt.priority??DEFAULT_DIAL_PRIORITY,multiaddrs:new Set(rt.map(lt=>lt.toString())),signal:tt.signal,onProgress:tt.onProgress})}createDialAbortController(et){const tt=anySignal([AbortSignal.timeout(this.dialTimeout),this.shutDownController.signal,et]);return setMaxListeners(1/0,tt),tt}async calculateMultiaddrs(et,tt=new Set,nt={}){var dt,ht;const rt=[...tt].map(pt=>({multiaddr:multiaddr(pt),isCertified:!1}));if(et!=null){if(this.components.peerId.equals(et))throw new DialError("Tried to dial self");if(await((ht=(dt=this.components.connectionGater).denyDialPeer)==null?void 0:ht.call(dt,et))===!0)throw new DialDeniedError("The dial request is blocked by gater.allowDialPeer");if(rt.length===0){this.log("loading multiaddrs for %p",et);try{const pt=await this.components.peerStore.get(et);rt.push(...pt.addresses),this.log("loaded multiaddrs for %p",et,rt.map(({multiaddr:mt})=>mt.toString()))}catch(pt){if(pt.name!=="NotFoundError")throw pt}}if(rt.length===0){this.log("looking up multiaddrs for %p in the peer routing",et);try{const pt=await this.components.peerRouting.findPeer(et);this.log("found multiaddrs for %p in the peer routing",et,rt.map(({multiaddr:mt})=>mt.toString())),rt.push(...pt.multiaddrs.map(mt=>({multiaddr:mt,isCertified:!1})))}catch(pt){pt.name!=="NoPeerRoutersError"&&this.log.error("looking up multiaddrs for %p in the peer routing failed",et,pt)}}}let ot=(await Promise.all(rt.map(async pt=>{const mt=await resolveMultiaddrs(pt.multiaddr,{dns:this.components.dns,...nt,log:this.log});return mt.length===1&&mt[0].equals(pt.multiaddr)?pt:mt.map(ft=>({multiaddr:ft,isCertified:!1}))}))).flat();if(et!=null){const pt=`/p2p/${et.toString()}`;ot=ot.map(mt=>{const ft=mt.multiaddr.protos().pop();return(ft==null?void 0:ft.path)===!0?mt:mt.multiaddr.getPeerId()==null?{multiaddr:mt.multiaddr.encapsulate(pt),isCertified:mt.isCertified}:mt})}const it=ot.filter(pt=>{if(this.components.transportManager.dialTransportForMultiaddr(pt.multiaddr)==null)return!1;const mt=pt.multiaddr.getPeerId();return et!=null&&mt!=null?et.equals(mt):!0}),st=new Map;for(const pt of it){const mt=pt.multiaddr.toString(),ft=st.get(mt);if(ft!=null){ft.isCertified=ft.isCertified||pt.isCertified||!1;continue}st.set(mt,pt)}const at=[...st.values()];if(at.length===0)throw new NoValidAddressesError("The dial request has no valid addresses");const ct=[];for(const pt of at)this.components.connectionGater.denyDialMultiaddr!=null&&await this.components.connectionGater.denyDialMultiaddr(pt.multiaddr)||ct.push(pt);const lt=this.addressSorter==null?defaultAddressSorter(ct):ct.sort(this.addressSorter);if(lt.length===0)throw new DialDeniedError("The connection gater denied all addresses in the dial request");return this.log.trace("addresses for %p before filtering",et??"unknown peer",ot.map(({multiaddr:pt})=>pt.toString())),this.log.trace("addresses for %p after filtering",et??"unknown peer",lt.map(({multiaddr:pt})=>pt.toString())),lt}async isDialable(et,tt={}){Array.isArray(et)||(et=[et]);try{const nt=await this.calculateMultiaddrs(void 0,new Set(et.map(rt=>rt.toString())),tt);return tt.runOnLimitedConnection===!1?nt.find(rt=>!Circuit.matches(rt.multiaddr))!=null:!0}catch(nt){this.log.trace("error calculating if multiaddr(s) were dialable",nt)}return!1}}class PeerQueue extends Queue{has(et){return this.find(et)!=null}find(et){return this.queue.find(tt=>et.equals(tt.options.peerId))}}var retry$2={};function RetryOperation(o,et){typeof et=="boolean"&&(et={forever:et}),this._originalTimeouts=JSON.parse(JSON.stringify(o)),this._timeouts=o,this._options=et||{},this._maxRetryTime=et&&et.maxRetryTime||1/0,this._fn=null,this._errors=[],this._attempts=1,this._operationTimeout=null,this._operationTimeoutCb=null,this._timeout=null,this._operationStart=null,this._timer=null,this._options.forever&&(this._cachedTimeouts=this._timeouts.slice(0))}var retry_operation=RetryOperation;RetryOperation.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts.slice(0)};RetryOperation.prototype.stop=function(){this._timeout&&clearTimeout(this._timeout),this._timer&&clearTimeout(this._timer),this._timeouts=[],this._cachedTimeouts=null};RetryOperation.prototype.retry=function(o){if(this._timeout&&clearTimeout(this._timeout),!o)return!1;var et=new Date().getTime();if(o&&et-this._operationStart>=this._maxRetryTime)return this._errors.push(o),this._errors.unshift(new Error("RetryOperation timeout occurred")),!1;this._errors.push(o);var tt=this._timeouts.shift();if(tt===void 0)if(this._cachedTimeouts)this._errors.splice(0,this._errors.length-1),tt=this._cachedTimeouts.slice(-1);else return!1;var nt=this;return this._timer=setTimeout(function(){nt._attempts++,nt._operationTimeoutCb&&(nt._timeout=setTimeout(function(){nt._operationTimeoutCb(nt._attempts)},nt._operationTimeout),nt._options.unref&&nt._timeout.unref()),nt._fn(nt._attempts)},tt),this._options.unref&&this._timer.unref(),!0};RetryOperation.prototype.attempt=function(o,et){this._fn=o,et&&(et.timeout&&(this._operationTimeout=et.timeout),et.cb&&(this._operationTimeoutCb=et.cb));var tt=this;this._operationTimeoutCb&&(this._timeout=setTimeout(function(){tt._operationTimeoutCb()},tt._operationTimeout)),this._operationStart=new Date().getTime(),this._fn(this._attempts)};RetryOperation.prototype.try=function(o){console.log("Using RetryOperation.try() is deprecated"),this.attempt(o)};RetryOperation.prototype.start=function(o){console.log("Using RetryOperation.start() is deprecated"),this.attempt(o)};RetryOperation.prototype.start=RetryOperation.prototype.try;RetryOperation.prototype.errors=function(){return this._errors};RetryOperation.prototype.attempts=function(){return this._attempts};RetryOperation.prototype.mainError=function(){if(this._errors.length===0)return null;for(var o={},et=null,tt=0,nt=0;nt=tt&&(et=rt,tt=it)}return et};(function(o){var et=retry_operation;o.operation=function(tt){var nt=o.timeouts(tt);return new et(nt,{forever:tt&&(tt.forever||tt.retries===1/0),unref:tt&&tt.unref,maxRetryTime:tt&&tt.maxRetryTime})},o.timeouts=function(tt){if(tt instanceof Array)return[].concat(tt);var nt={retries:10,factor:2,minTimeout:1*1e3,maxTimeout:1/0,randomize:!1};for(var rt in tt)nt[rt]=tt[rt];if(nt.minTimeout>nt.maxTimeout)throw new Error("minTimeout is greater than maxTimeout");for(var ot=[],it=0;itobjectToString.call(o)==="[object Error]",errorMessages=new Set(["network error","Failed to fetch","NetworkError when attempting to fetch resource.","The Internet connection appears to be offline.","Load failed","Network request failed","fetch failed","terminated"]);function isNetworkError(o){return o&&isError(o)&&o.name==="TypeError"&&typeof o.message=="string"?o.message==="Load failed"?o.stack===void 0:errorMessages.has(o.message):!1}let AbortError$1=class extends Error{constructor(et){super(),et instanceof Error?(this.originalError=et,{message:et}=et):(this.originalError=new Error(et),this.originalError.stack=this.stack),this.name="AbortError",this.message=et}};const decorateErrorWithCounts=(o,et,tt)=>{const nt=tt.retries-(et-1);return o.attemptNumber=et,o.retriesLeft=nt,o};async function pRetry(o,et){return new Promise((tt,nt)=>{et={onFailedAttempt(){},retries:10,shouldRetry:()=>!0,...et};const rt=retry$1.operation(et),ot=()=>{var st;rt.stop(),nt((st=et.signal)==null?void 0:st.reason)};et.signal&&!et.signal.aborted&&et.signal.addEventListener("abort",ot,{once:!0});const it=()=>{var st;(st=et.signal)==null||st.removeEventListener("abort",ot),rt.stop()};rt.attempt(async st=>{try{const at=await o(st);it(),tt(at)}catch(at){try{if(!(at instanceof Error))throw new TypeError(`Non-error was thrown: "${at}". You should only throw errors.`);if(at instanceof AbortError$1)throw at.originalError;if(at instanceof TypeError&&!isNetworkError(at))throw at;if(decorateErrorWithCounts(at,st,et),await et.shouldRetry(at)||(rt.stop(),nt(at)),await et.onFailedAttempt(at),!rt.retry(at))throw rt.mainError()}catch(ct){decorateErrorWithCounts(ct,st,et),it(),nt(ct)}}})})}class ReconnectQueue{constructor(et,tt={}){Ct(this,"log");Ct(this,"queue");Ct(this,"started");Ct(this,"peerStore");Ct(this,"retries");Ct(this,"retryInterval");Ct(this,"backoffFactor");Ct(this,"connectionManager");Ct(this,"events");this.log=et.logger.forComponent("libp2p:reconnect-queue"),this.peerStore=et.peerStore,this.connectionManager=et.connectionManager,this.queue=new PeerQueue({concurrency:tt.maxParallelReconnects??MAX_PARALLEL_RECONNECTS,metricName:"libp2p_reconnect_queue",metrics:et.metrics}),this.started=!1,this.retries=tt.retries??5,this.backoffFactor=tt.backoffFactor,this.retryInterval=tt.retryInterval,this.events=et.events,et.events.addEventListener("peer:disconnect",nt=>{this.maybeReconnect(nt.detail).catch(rt=>{this.log.error("failed to maybe reconnect to %p - %e",nt.detail,rt)})})}async maybeReconnect(et){if(!this.started)return;const tt=await this.peerStore.get(et);hasKeepAliveTag(tt)&&(this.queue.has(et)||this.queue.add(async nt=>{await pRetry(async rt=>{if(this.started)try{await this.connectionManager.openConnection(et,{signal:nt==null?void 0:nt.signal})}catch(ot){throw this.log("reconnecting to %p attempt %d of %d failed - %e",et,rt,this.retries,ot),ot}},{signal:nt==null?void 0:nt.signal,retries:this.retries,factor:this.backoffFactor,minTimeout:this.retryInterval})},{peerId:et}).catch(async nt=>{this.log.error("failed to reconnect to %p - %e",et,nt);const rt={};[...tt.tags.keys()].forEach(ot=>{ot.startsWith(KEEP_ALIVE)&&(rt[ot]=void 0)}),await this.peerStore.merge(et,{tags:rt}),this.events.safeDispatchEvent("peer:reconnect-failure",{detail:et})}).catch(async nt=>{this.log.error("failed to remove keep-alive tag from %p - %e",et,nt)}))}start(){this.started=!0}async afterStart(){Promise.resolve().then(async()=>{const et=await this.peerStore.all({filters:[tt=>hasKeepAliveTag(tt)]});await Promise.all(et.map(async tt=>{await this.connectionManager.openConnection(tt.id).catch(nt=>{this.log.error(nt)})}))}).catch(et=>{this.log.error(et)})}stop(){this.started=!1,this.queue.abort()}}function hasKeepAliveTag(o){for(const et of o.tags.keys())if(et.startsWith(KEEP_ALIVE))return!0;return!1}const DEFAULT_DIAL_PRIORITY=50,defaultOptions={maxConnections:MAX_CONNECTIONS,inboundConnectionThreshold:INBOUND_CONNECTION_THRESHOLD,maxIncomingPendingConnections:MAX_INCOMING_PENDING_CONNECTIONS};var Ol;Ol=Symbol.toStringTag;class DefaultConnectionManager{constructor(et,tt={}){Ct(this,"started");Ct(this,"connections");Ct(this,"allow");Ct(this,"deny");Ct(this,"maxIncomingPendingConnections");Ct(this,"incomingPendingConnections");Ct(this,"outboundPendingConnections");Ct(this,"maxConnections");Ct(this,"dialQueue");Ct(this,"reconnectQueue");Ct(this,"connectionPruner");Ct(this,"inboundConnectionRateLimiter");Ct(this,"peerStore");Ct(this,"metrics");Ct(this,"events");Ct(this,"log");Ct(this,"peerId");Ct(this,Ol,"@libp2p/connection-manager");if(this.maxConnections=tt.maxConnections??defaultOptions.maxConnections,this.maxConnections<1)throw new InvalidParametersError$1("Connection Manager maxConnections must be greater than 0");this.connections=new PeerMap,this.started=!1,this.peerId=et.peerId,this.peerStore=et.peerStore,this.metrics=et.metrics,this.events=et.events,this.log=et.logger.forComponent("libp2p:connection-manager"),this.onConnect=this.onConnect.bind(this),this.onDisconnect=this.onDisconnect.bind(this),this.allow=(tt.allow??[]).map(nt=>multiaddr(nt)),this.deny=(tt.deny??[]).map(nt=>multiaddr(nt)),this.incomingPendingConnections=0,this.maxIncomingPendingConnections=tt.maxIncomingPendingConnections??defaultOptions.maxIncomingPendingConnections,this.outboundPendingConnections=0,this.inboundConnectionRateLimiter=new RateLimiter({points:tt.inboundConnectionThreshold??defaultOptions.inboundConnectionThreshold,duration:1}),this.connectionPruner=new ConnectionPruner({connectionManager:this,peerStore:et.peerStore,events:et.events,logger:et.logger},{maxConnections:this.maxConnections,allow:this.allow}),this.dialQueue=new DialQueue(et,{addressSorter:tt.addressSorter,maxParallelDials:tt.maxParallelDials??MAX_PARALLEL_DIALS,maxDialQueueLength:tt.maxDialQueueLength??MAX_DIAL_QUEUE_LENGTH,maxPeerAddrsToDial:tt.maxPeerAddrsToDial??MAX_PEER_ADDRS_TO_DIAL,dialTimeout:tt.dialTimeout??DIAL_TIMEOUT,resolvers:tt.resolvers??{dnsaddr:dnsaddrResolver},connections:this.connections}),this.reconnectQueue=new ReconnectQueue({events:et.events,peerStore:et.peerStore,logger:et.logger,connectionManager:this},{retries:tt.reconnectRetries,retryInterval:tt.reconnectRetryInterval,backoffFactor:tt.reconnectBackoffFactor,maxParallelReconnects:tt.maxParallelReconnects})}async start(){var et,tt,nt;(et=this.metrics)==null||et.registerMetricGroup("libp2p_connection_manager_connections",{calculate:()=>{const rt={inbound:0,"inbound pending":this.incomingPendingConnections,outbound:0,"outbound pending":this.outboundPendingConnections};for(const ot of this.connections.values())for(const it of ot)rt[it.direction]++;return rt}}),(tt=this.metrics)==null||tt.registerMetricGroup("libp2p_protocol_streams_total",{label:"protocol",calculate:()=>{const rt={};for(const ot of this.connections.values())for(const it of ot)for(const st of it.streams){const at=`${st.direction} ${st.protocol??"unnegotiated"}`;rt[at]=(rt[at]??0)+1}return rt}}),(nt=this.metrics)==null||nt.registerMetricGroup("libp2p_connection_manager_protocol_streams_per_connection_90th_percentile",{label:"protocol",calculate:()=>{const rt={};for(const it of this.connections.values())for(const st of it){const at={};for(const ct of st.streams){const lt=`${ct.direction} ${ct.protocol??"unnegotiated"}`;at[lt]=(at[lt]??0)+1}for(const[ct,lt]of Object.entries(at))rt[ct]=rt[ct]??[],rt[ct].push(lt)}const ot={};for(let[it,st]of Object.entries(rt)){st=st.sort((ct,lt)=>ct-lt);const at=Math.floor(st.length*.9);ot[it]=st[at]}return ot}}),this.events.addEventListener("connection:open",this.onConnect),this.events.addEventListener("connection:close",this.onDisconnect),await start(this.dialQueue,this.reconnectQueue,this.connectionPruner),this.started=!0,this.log("started")}async stop(){this.events.removeEventListener("connection:open",this.onConnect),this.events.removeEventListener("connection:close",this.onDisconnect),await stop(this.reconnectQueue,this.dialQueue,this.connectionPruner);const et=[];for(const tt of this.connections.values())for(const nt of tt)et.push((async()=>{try{await nt.close()}catch(rt){this.log.error(rt)}})());this.log("closing %d connections",et.length),await Promise.all(et),this.connections.clear(),this.log("stopped")}onConnect(et){this._onConnect(et).catch(tt=>{this.log.error(tt)})}async _onConnect(et){const{detail:tt}=et;if(!this.started){await tt.close();return}if(tt.status!=="open")return;const nt=tt.remotePeer,rt=!this.connections.has(nt),ot=this.connections.get(nt)??[];ot.push(tt),this.connections.set(nt,ot),nt.publicKey!=null&&nt.type==="RSA"&&await this.peerStore.patch(nt,{publicKey:nt.publicKey}),rt&&this.events.safeDispatchEvent("peer:connect",{detail:tt.remotePeer})}onDisconnect(et){const{detail:tt}=et,nt=tt.remotePeer,ot=(this.connections.get(nt)??[]).filter(it=>it.id!==tt.id);this.connections.set(nt,ot),ot.length===0&&(this.log("onDisconnect remove all connections for peer %p",nt),this.connections.delete(nt),this.events.safeDispatchEvent("peer:disconnect",{detail:tt.remotePeer}))}getConnections(et){if(et!=null)return this.connections.get(et)??[];let tt=[];for(const nt of this.connections.values())tt=tt.concat(nt);return tt}getConnectionsMap(){return this.connections}async openConnection(et,tt={}){var nt,rt;if(!this.started)throw new NotStartedError("Not started");this.outboundPendingConnections++;try{(nt=tt.signal)==null||nt.throwIfAborted();const{peerId:ot}=getPeerAddress(et);if(this.peerId.equals(ot))throw new InvalidPeerIdError("Can not dial self");if(ot!=null&&tt.force!==!0){this.log("dial %p",ot);const ct=this.getConnections(ot).find(lt=>lt.limits==null);if(ct!=null)return this.log("had an existing non-limited connection to %p",ot),(rt=tt.onProgress)==null||rt.call(tt,new CustomProgressEvent("dial-queue:already-connected")),ct}const it=await this.dialQueue.dial(et,{...tt,priority:tt.priority??DEFAULT_DIAL_PRIORITY});if(it.status!=="open")throw new ConnectionClosedError("Remote closed connection during opening");let st=this.connections.get(it.remotePeer);st==null&&(st=[],this.connections.set(it.remotePeer,st));let at=!1;for(const ct of st)if(ct.id===it.id&&(at=!0),tt.force!==!0&&ct.id!==it.id&&ct.remoteAddr.equals(it.remoteAddr))return it.abort(new InvalidMultiaddrError("Duplicate multiaddr connection")),ct;return at||st.push(it),it}finally{this.outboundPendingConnections--}}async closeConnections(et,tt={}){const nt=this.connections.get(et)??[];await Promise.all(nt.map(async rt=>{try{await rt.close(tt)}catch(ot){rt.abort(ot)}}))}async acceptIncomingConnection(et){if(this.deny.some(rt=>et.remoteAddr.toString().startsWith(rt.toString())))return this.log("connection from %a refused - connection remote address was in deny list",et.remoteAddr),!1;if(this.allow.some(rt=>et.remoteAddr.toString().startsWith(rt.toString())))return this.incomingPendingConnections++,!0;if(this.incomingPendingConnections===this.maxIncomingPendingConnections)return this.log("connection from %a refused - incomingPendingConnections exceeded by host",et.remoteAddr),!1;if(et.remoteAddr.isThinWaistAddress()){const rt=et.remoteAddr.nodeAddress().address;try{await this.inboundConnectionRateLimiter.consume(rt,1)}catch{return this.log("connection from %a refused - inboundConnectionThreshold exceeded by host %s",et.remoteAddr,rt),!1}}return this.getConnections().length({id:tt.id,status:et[tt.status],peerId:tt.options.peerId,multiaddrs:[...tt.options.multiaddrs].map(nt=>multiaddr(nt))}))}async isDialable(et,tt={}){return this.dialQueue.isDialable(et,tt)}}class MovingAverage{constructor(et){Ct(this,"movingAverage");Ct(this,"variance");Ct(this,"deviation");Ct(this,"forecast");Ct(this,"timespan");Ct(this,"previousTime");this.timespan=et,this.movingAverage=0,this.variance=0,this.deviation=0,this.forecast=0}alpha(et,tt){return 1-Math.exp(-(et-tt)/this.timespan)}push(et,tt=Date.now()){if(this.previousTime!=null){const nt=this.alpha(tt,this.previousTime),rt=et-this.movingAverage,ot=nt*rt;this.movingAverage=nt*et+(1-nt)*this.movingAverage,this.variance=(1-nt)*(this.variance+rt*ot),this.deviation=Math.sqrt(this.variance),this.forecast=this.movingAverage+nt*rt}else this.movingAverage=et;this.previousTime=tt}}const DEFAULT_TIMEOUT_MULTIPLIER=1.2,DEFAULT_FAILURE_MULTIPLIER=2,DEFAULT_MIN_TIMEOUT=2e3;class AdaptiveTimeout{constructor(et={}){Ct(this,"success");Ct(this,"failure");Ct(this,"next");Ct(this,"metric");Ct(this,"timeoutMultiplier");Ct(this,"failureMultiplier");Ct(this,"minTimeout");var tt;this.success=new MovingAverage(et.interval??5e3),this.failure=new MovingAverage(et.interval??5e3),this.next=new MovingAverage(et.interval??5e3),this.failureMultiplier=et.failureMultiplier??DEFAULT_FAILURE_MULTIPLIER,this.timeoutMultiplier=et.timeoutMultiplier??DEFAULT_TIMEOUT_MULTIPLIER,this.minTimeout=et.minTimeout??DEFAULT_MIN_TIMEOUT,et.metricName!=null&&(this.metric=(tt=et.metrics)==null?void 0:tt.registerMetricGroup(et.metricName))}getTimeoutSignal(et={}){const tt=Math.max(Math.round(this.next.movingAverage*(et.timeoutFactor??this.timeoutMultiplier)),this.minTimeout),nt=AbortSignal.timeout(tt),rt=anySignal([et.signal,nt]);return setMaxListeners$2(1/0,rt,nt),rt.start=Date.now(),rt.timeout=tt,rt}cleanUp(et){var nt,rt;const tt=Date.now()-et.start;et.aborted?(this.failure.push(tt),this.next.push(tt*this.failureMultiplier),(nt=this.metric)==null||nt.update({failureMovingAverage:this.failure.movingAverage,failureDeviation:this.failure.deviation,failureForecast:this.failure.forecast,failureVariance:this.failure.variance,failure:tt})):(this.success.push(tt),this.next.push(tt),(rt=this.metric)==null||rt.update({successMovingAverage:this.success.movingAverage,successDeviation:this.success.deviation,successForecast:this.success.forecast,successVariance:this.success.variance,success:tt}))}}const DEFAULT_PING_INTERVAL_MS=1e4,PROTOCOL_VERSION="1.0.0",PROTOCOL_NAME="ping",PROTOCOL_PREFIX="ipfs",PING_LENGTH=32,DEFAULT_ABORT_CONNECTION_ON_PING_FAILURE=!0;var Ml,Bl;Bl=Symbol.toStringTag,Ml=serviceCapabilities;class ConnectionMonitor{constructor(et,tt={}){Ct(this,"protocol");Ct(this,"components");Ct(this,"log");Ct(this,"heartbeatInterval");Ct(this,"pingIntervalMs");Ct(this,"abortController");Ct(this,"timeout");Ct(this,"abortConnectionOnPingFailure");Ct(this,Bl,"@libp2p/connection-monitor");Ct(this,Ml,["@libp2p/connection-monitor"]);this.components=et,this.protocol=`/${tt.protocolPrefix??PROTOCOL_PREFIX}/${PROTOCOL_NAME}/${PROTOCOL_VERSION}`,this.log=et.logger.forComponent("libp2p:connection-monitor"),this.pingIntervalMs=tt.pingInterval??DEFAULT_PING_INTERVAL_MS,this.abortConnectionOnPingFailure=tt.abortConnectionOnPingFailure??DEFAULT_ABORT_CONNECTION_ON_PING_FAILURE,this.timeout=new AdaptiveTimeout({...tt.pingTimeout??{},metrics:et.metrics,metricName:"libp2p_connection_monitor_ping_time_milliseconds"})}start(){this.abortController=new AbortController,setMaxListeners(1/0,this.abortController.signal),this.heartbeatInterval=setInterval(()=>{this.components.connectionManager.getConnections().forEach(et=>{Promise.resolve().then(async()=>{var nt;let tt=Date.now();try{const rt=this.timeout.getTimeoutSignal({signal:(nt=this.abortController)==null?void 0:nt.signal}),ot=await et.newStream(this.protocol,{signal:rt,runOnLimitedConnection:!0}),it=byteStream(ot);tt=Date.now(),await Promise.all([it.write(randomBytes(PING_LENGTH),{signal:rt}),it.read(PING_LENGTH,{signal:rt})]),et.rtt=Date.now()-tt,await it.unwrap().close({signal:rt})}catch(rt){if(rt.name!=="UnsupportedProtocolError")throw rt;et.rtt=(Date.now()-tt)/2}}).catch(tt=>{this.log.error("error during heartbeat",tt),this.abortConnectionOnPingFailure?(this.log.error("aborting connection due to ping failure"),et.abort(tt)):this.log("connection ping failed, but not aborting due to abortConnectionOnPingFailure flag")})})},this.pingIntervalMs)}stop(){var et;(et=this.abortController)==null||et.abort(),this.heartbeatInterval!=null&&clearInterval(this.heartbeatInterval)}}var Dl;Dl=Symbol.toStringTag;class CompoundContentRouting{constructor(et,tt){Ct(this,"routers");Ct(this,"started");Ct(this,"components");Ct(this,Dl,"@libp2p/content-routing");this.routers=tt.routers??[],this.started=!1,this.components=et}isStarted(){return this.started}async start(){this.started=!0}async stop(){this.started=!1}async*findProviders(et,tt={}){if(this.routers.length===0)throw new NoContentRoutersError("No content routers available");const nt=this,rt=new PeerSet;for await(const ot of merge$2(...nt.routers.map(it=>it.findProviders(et,tt))))ot!=null&&(ot.multiaddrs.length>0&&await this.components.peerStore.merge(ot.id,{multiaddrs:ot.multiaddrs}),!rt.has(ot.id)&&(rt.add(ot.id),yield ot))}async provide(et,tt={}){if(this.routers.length===0)throw new NoContentRoutersError("No content routers available");await Promise.all(this.routers.map(async nt=>{await nt.provide(et,tt)}))}async put(et,tt,nt){if(!this.isStarted())throw new NotStartedError;await Promise.all(this.routers.map(async rt=>{await rt.put(et,tt,nt)}))}async get(et,tt){if(!this.isStarted())throw new NotStartedError;return Promise.any(this.routers.map(async nt=>nt.get(et,tt)))}}var Fl;Fl=Symbol.toStringTag;class DefaultPeerRouting{constructor(et,tt={}){Ct(this,"log");Ct(this,"peerId");Ct(this,"peerStore");Ct(this,"routers");Ct(this,Fl,"@libp2p/peer-routing");this.log=et.logger.forComponent("libp2p:peer-routing"),this.peerId=et.peerId,this.peerStore=et.peerStore,this.routers=tt.routers??[]}async findPeer(et,tt){if(this.routers.length===0)throw new NoPeerRoutersError("No peer routers available");if(et.toString()===this.peerId.toString())throw new QueriedForSelfError("Should not try to find self");const nt=this,rt=merge$2(...this.routers.map(ot=>async function*(){try{yield await ot.findPeer(et,tt)}catch(it){nt.log.error(it)}}()));for await(const ot of rt)if(ot!=null)return ot.multiaddrs.length>0&&await this.peerStore.merge(ot.id,{multiaddrs:ot.multiaddrs}),ot;throw new NotFoundError$1}async*getClosestPeers(et,tt={}){if(this.routers.length===0)throw new NoPeerRoutersError("No peer routers available");const nt=this,rt=createScalableCuckooFilter(1024);for await(const ot of parallel(async function*(){const it=merge$2(...nt.routers.map(st=>st.getClosestPeers(et,tt)));for await(let st of it)yield async()=>{if(st.multiaddrs.length===0)try{st=await nt.findPeer(st.id,{...tt,useCache:!1})}catch(at){nt.log.error("could not find peer multiaddrs",at);return}return st}}()))ot!=null&&(ot.multiaddrs.length>0&&await this.peerStore.merge(ot.id,{multiaddrs:ot.multiaddrs}),!rt.has(ot.id.toMultihash().bytes)&&(rt.add(ot.id.toMultihash().bytes),yield ot))}}var Ul,zl;class RandomWalk extends(zl=TypedEventEmitter,Ul=Symbol.toStringTag,zl){constructor(tt){super();Ct(this,"peerRouting");Ct(this,"log");Ct(this,"walking");Ct(this,"walkers");Ct(this,"shutdownController");Ct(this,"walkController");Ct(this,"needNext");Ct(this,Ul,"@libp2p/random-walk");this.log=tt.logger.forComponent("libp2p:random-walk"),this.peerRouting=tt.peerRouting,this.walkers=0,this.walking=!1,this.shutdownController=new AbortController,setMaxListeners(1/0,this.shutdownController.signal)}start(){this.shutdownController=new AbortController,setMaxListeners(1/0,this.shutdownController.signal)}stop(){this.shutdownController.abort()}async*walk(tt){var rt,ot;this.walking||this.startWalk(),this.walkers++;const nt=anySignal([this.shutdownController.signal,tt==null?void 0:tt.signal]);setMaxListeners(1/0,nt);try{for(;;)(rt=this.needNext)==null||rt.resolve(),this.needNext=pDefer(),yield(await raceEvent(this,"walk:peer",nt,{errorEvent:"walk:error"})).detail}finally{nt.clear(),this.walkers--,this.walkers===0&&((ot=this.walkController)==null||ot.abort(),this.walkController=void 0)}}startWalk(){this.walking=!0,this.walkController=new AbortController,setMaxListeners(1/0,this.walkController.signal);const tt=anySignal([this.walkController.signal,this.shutdownController.signal]);setMaxListeners(1/0,tt);const nt=Date.now();let rt=0;Promise.resolve().then(async()=>{for(this.log("start walk");this.walkers>0;)try{const ot=randomBytes(32);let it=Date.now();for await(const st of this.peerRouting.getClosestPeers(ot,{signal:tt}))tt.aborted&&this.log("aborting walk"),tt.throwIfAborted(),this.log("found peer %p after %dms for %d walkers",st.id,Date.now()-it,this.walkers),rt++,this.safeDispatchEvent("walk:peer",{detail:st}),this.walkers===1&&this.needNext!=null&&(this.log("wait for need next"),await raceSignal(this.needNext.promise,tt)),it=Date.now();this.log("walk iteration for %b and %d walkers finished, found %d peers",ot,this.walkers,rt)}catch(ot){this.log.error("randomwalk errored",ot),this.safeDispatchEvent("walk:error",{detail:ot})}this.log("no walkers left, ended walk")}).catch(ot=>{this.log.error("randomwalk errored",ot)}).finally(()=>{this.log("finished walk, found %d peers after %dms",rt,Date.now()-nt),this.walking=!1})}}const DEFAULT_MAX_INBOUND_STREAMS=32,DEFAULT_MAX_OUTBOUND_STREAMS=64;var Vl;Vl=Symbol.toStringTag;class DefaultRegistrar{constructor(et){Ct(this,"log");Ct(this,"topologies");Ct(this,"handlers");Ct(this,"components");Ct(this,Vl,"@libp2p/registrar");this.log=et.logger.forComponent("libp2p:registrar"),this.topologies=new Map,this.handlers=new Map,this.components=et,this._onDisconnect=this._onDisconnect.bind(this),this._onPeerUpdate=this._onPeerUpdate.bind(this),this._onPeerIdentify=this._onPeerIdentify.bind(this),this.components.events.addEventListener("peer:disconnect",this._onDisconnect),this.components.events.addEventListener("peer:update",this._onPeerUpdate),this.components.events.addEventListener("peer:identify",this._onPeerIdentify)}getProtocols(){return Array.from(new Set([...this.handlers.keys()])).sort()}getHandler(et){const tt=this.handlers.get(et);if(tt==null)throw new UnhandledProtocolError(`No handler registered for protocol ${et}`);return tt}getTopologies(et){const tt=this.topologies.get(et);return tt==null?[]:[...tt.values()]}async handle(et,tt,nt){if(this.handlers.has(et))throw new DuplicateProtocolHandlerError(`Handler already registered for protocol ${et}`);const rt=mergeOptions$1.bind({ignoreUndefined:!0})({maxInboundStreams:DEFAULT_MAX_INBOUND_STREAMS,maxOutboundStreams:DEFAULT_MAX_OUTBOUND_STREAMS},nt);this.handlers.set(et,{handler:tt,options:rt}),await this.components.peerStore.merge(this.components.peerId,{protocols:[et]})}async unhandle(et){(Array.isArray(et)?et:[et]).forEach(nt=>{this.handlers.delete(nt)}),await this.components.peerStore.patch(this.components.peerId,{protocols:this.getProtocols()})}async register(et,tt){if(tt==null)throw new InvalidParametersError$1("invalid topology");const nt=`${(Math.random()*1e9).toString(36)}${Date.now()}`;let rt=this.topologies.get(et);return rt==null&&(rt=new Map,this.topologies.set(et,rt)),rt.set(nt,tt),nt}unregister(et){for(const[tt,nt]of this.topologies.entries())nt.has(et)&&(nt.delete(et),nt.size===0&&this.topologies.delete(tt))}_onDisconnect(et){const tt=et.detail;this.components.peerStore.get(tt).then(nt=>{var rt,ot,it;for(const st of nt.protocols){const at=this.topologies.get(st);if(at!=null)for(const ct of at.values())((rt=ct.filter)==null?void 0:rt.has(tt))!==!1&&((ot=ct.filter)==null||ot.remove(tt),(it=ct.onDisconnect)==null||it.call(ct,tt))}}).catch(nt=>{nt.name!=="NotFoundError"&&this.log.error("could not inform topologies of disconnecting peer %p",tt,nt)})}_onPeerUpdate(et){var ot,it,st;const{peer:tt,previous:nt}=et.detail,rt=((nt==null?void 0:nt.protocols)??[]).filter(at=>!tt.protocols.includes(at));for(const at of rt){const ct=this.topologies.get(at);if(ct!=null)for(const lt of ct.values())((ot=lt.filter)==null?void 0:ot.has(tt.id))!==!1&&((it=lt.filter)==null||it.remove(tt.id),(st=lt.onDisconnect)==null||st.call(lt,tt.id))}}_onPeerIdentify(et){var ot,it,st;const tt=et.detail.protocols,nt=et.detail.connection,rt=et.detail.peerId;for(const at of tt){const ct=this.topologies.get(at);if(ct!=null)for(const lt of ct.values())nt.limits!=null&<.notifyOnLimitedConnection!==!0||((ot=lt.filter)==null?void 0:ot.has(rt))!==!0&&((it=lt.filter)==null||it.add(rt),(st=lt.onConnect)==null||st.call(lt,rt,nt))}}}class TrackedMap extends Map{constructor(tt){super();Ct(this,"metric");const{name:nt,metrics:rt}=tt;this.metric=rt.registerMetric(nt),this.updateComponentMetric()}set(tt,nt){return super.set(tt,nt),this.updateComponentMetric(),this}delete(tt){const nt=super.delete(tt);return this.updateComponentMetric(),nt}clear(){super.clear(),this.updateComponentMetric()}updateComponentMetric(){this.metric.update(this.size)}}function trackedMap(o){const{name:et,metrics:tt}=o;let nt;return tt!=null?nt=new TrackedMap({name:et,metrics:tt}):nt=new Map,nt}var Hl;Hl=Symbol.toStringTag;class DefaultTransportManager{constructor(et,tt={}){Ct(this,"log");Ct(this,"components");Ct(this,"transports");Ct(this,"listeners");Ct(this,"faultTolerance");Ct(this,"started");Ct(this,Hl,"@libp2p/transport-manager");this.log=et.logger.forComponent("libp2p:transports"),this.components=et,this.started=!1,this.transports=new Map,this.listeners=trackedMap({name:"libp2p_transport_manager_listeners",metrics:this.components.metrics}),this.faultTolerance=tt.faultTolerance??FaultTolerance.FATAL_ALL}add(et){const tt=et[Symbol.toStringTag];if(tt==null)throw new InvalidParametersError$1("Transport must have a valid tag");if(this.transports.has(tt))throw new InvalidParametersError$1(`There is already a transport with the tag ${tt}`);this.log("adding transport %s",tt),this.transports.set(tt,et),this.listeners.has(tt)||this.listeners.set(tt,[])}isStarted(){return this.started}start(){this.started=!0}async afterStart(){const et=this.components.addressManager.getListenAddrs();await this.listen(et)}async stop(){const et=[];for(const[tt,nt]of this.listeners)for(this.log("closing listeners for %s",tt);nt.length>0;){const rt=nt.pop();rt!=null&&et.push(rt.close())}await Promise.all(et),this.log("all listeners closed");for(const tt of this.listeners.keys())this.listeners.set(tt,[]);this.started=!1}async dial(et,tt){var rt;const nt=this.dialTransportForMultiaddr(et);if(nt==null)throw new TransportUnavailableError(`No transport available for address ${String(et)}`);return(rt=tt==null?void 0:tt.onProgress)==null||rt.call(tt,new CustomProgressEvent("transport-manager:selected-transport",nt[Symbol.toStringTag])),nt.dial(et,{...tt,upgrader:this.components.upgrader})}getAddrs(){let et=[];for(const tt of this.listeners.values())for(const nt of tt)et=[...et,...nt.getAddrs()];return et}getTransports(){return Array.of(...this.transports.values())}getListeners(){return Array.of(...this.listeners.values()).flat()}dialTransportForMultiaddr(et){for(const tt of this.transports.values())if(tt.dialFilter([et]).length>0)return tt}listenTransportForMultiaddr(et){for(const tt of this.transports.values())if(tt.listenFilter([et]).length>0)return tt}async listen(et){if(!this.isStarted())throw new NotStartedError("Not started");if(et==null||et.length===0){this.log("no addresses were provided for listening, this node is dial only");return}const tt=[];for(const[nt,rt]of this.transports.entries()){const ot=rt.listenFilter(et),it=[];for(const ct of ot){this.log("creating listener for %s on %a",nt,ct);const lt=rt.createListener({upgrader:this.components.upgrader});let dt=this.listeners.get(nt)??[];dt==null&&(dt=[],this.listeners.set(nt,dt)),dt.push(lt),lt.addEventListener("listening",()=>{this.components.events.safeDispatchEvent("transport:listening",{detail:lt})}),lt.addEventListener("close",()=>{const ht=dt.findIndex(pt=>pt===lt);dt.splice(ht,1),this.components.events.safeDispatchEvent("transport:close",{detail:lt})}),it.push(lt.listen(ct))}if(it.length===0){tt.push(nt);continue}if((await Promise.allSettled(it)).find(ct=>ct.status==="fulfilled")==null&&this.faultTolerance!==FaultTolerance.NO_FATAL)throw new NoValidAddressesError(`Transport (${nt}) could not listen on any available address`)}if(tt.length===this.transports.size){const nt=`no valid addresses were provided for transports [${tt.join(", ")}]`;if(this.faultTolerance===FaultTolerance.FATAL_ALL)throw new NoValidAddressesError(nt);this.log(`libp2p in dial mode only: ${nt}`)}}async remove(et){const tt=this.listeners.get(et)??[];this.log.trace("removing transport %s",et);const nt=[];for(this.log.trace("closing listeners for %s",et);tt.length>0;){const rt=tt.pop();rt!=null&&nt.push(rt.close())}await Promise.all(nt),this.transports.delete(et),this.listeners.delete(et)}async removeAll(){const et=[];for(const tt of this.transports.keys())et.push(this.remove(tt));await Promise.all(et)}}const PROTOCOL_ID="/multistream/1.0.0",MAX_PROTOCOL_LENGTH=1024;class UnsupportedProtocolError extends Error{constructor(et="Unsupported protocol error"){super(et),this.name="UnsupportedProtocolError"}}Ct(UnsupportedProtocolError,"name","UnsupportedProtocolError");class InvalidMessageError extends Error{constructor(et="Invalid message"){super(et),this.name="InvalidMessageError"}}Ct(InvalidMessageError,"name","InvalidMessageError");const NewLine=fromString(` +`)}`:`${tt} :`}}_a$v=Constructed;typeStore.Constructed=_a$v;Constructed.NAME="CONSTRUCTED";class LocalEndOfContentValueBlock extends ValueBlock{fromBER(et,tt,nt){return tt}toBER(et){return EMPTY_BUFFER$1}}LocalEndOfContentValueBlock.override="EndOfContentValueBlock";var _a$u;class EndOfContent extends BaseBlock{constructor(et={}){super(et,LocalEndOfContentValueBlock),this.idBlock.tagClass=1,this.idBlock.tagNumber=0}}_a$u=EndOfContent;typeStore.EndOfContent=_a$u;EndOfContent.NAME=END_OF_CONTENT_NAME;var _a$t;class Null extends BaseBlock{constructor(et={}){super(et,ValueBlock),this.idBlock.tagClass=1,this.idBlock.tagNumber=5}fromBER(et,tt,nt){return this.lenBlock.length>0&&this.warnings.push("Non-zero length of value block for Null type"),this.idBlock.error.length||(this.blockLength+=this.idBlock.blockLength),this.lenBlock.error.length||(this.blockLength+=this.lenBlock.blockLength),this.blockLength+=nt,tt+nt>et.byteLength?(this.error="End of input reached before message was fully decoded (inconsistent offset and length values)",-1):tt+nt}toBER(et,tt){const nt=new ArrayBuffer(2);if(!et){const rt=new Uint8Array(nt);rt[0]=5,rt[1]=0}return tt&&tt.write(nt),nt}onAsciiEncoding(){return`${this.constructor.NAME}`}}_a$t=Null;typeStore.Null=_a$t;Null.NAME="NULL";class LocalBooleanValueBlock extends HexBlock(ValueBlock){constructor({value:et,...tt}={}){super(tt),tt.valueHex?this.valueHexView=BufferSourceConverter.toUint8Array(tt.valueHex):this.valueHexView=new Uint8Array(1),et&&(this.value=et)}get value(){for(const et of this.valueHexView)if(et>0)return!0;return!1}set value(et){this.valueHexView[0]=et?255:0}fromBER(et,tt,nt){const rt=BufferSourceConverter.toUint8Array(et);return checkBufferParams(this,rt,tt,nt)?(this.valueHexView=rt.subarray(tt,tt+nt),nt>1&&this.warnings.push("Boolean value encoded in more then 1 octet"),this.isHexOnly=!0,utilDecodeTC.call(this),this.blockLength=nt,tt+nt):-1}toBER(){return this.valueHexView.slice()}toJSON(){return{...super.toJSON(),value:this.value}}}LocalBooleanValueBlock.NAME="BooleanValueBlock";var _a$s;let Boolean$1=class extends BaseBlock{constructor(et={}){super(et,LocalBooleanValueBlock),this.idBlock.tagClass=1,this.idBlock.tagNumber=1}getValue(){return this.valueBlock.value}setValue(et){this.valueBlock.value=et}onAsciiEncoding(){return`${this.constructor.NAME} : ${this.getValue}`}};_a$s=Boolean$1;typeStore.Boolean=_a$s;Boolean$1.NAME="BOOLEAN";class LocalOctetStringValueBlock extends HexBlock(LocalConstructedValueBlock){constructor({isConstructed:et=!1,...tt}={}){super(tt),this.isConstructed=et}fromBER(et,tt,nt){let rt=0;if(this.isConstructed){if(this.isHexOnly=!1,rt=LocalConstructedValueBlock.prototype.fromBER.call(this,et,tt,nt),rt===-1)return rt;for(let ot=0;ot0&&ct.unusedBits>0)return this.error='Using of "unused bits" inside constructive BIT STRING allowed for least one only',-1;this.unusedBits=ct.unusedBits}return rt}const ot=BufferSourceConverter.toUint8Array(et);if(!checkBufferParams(this,ot,tt,nt))return-1;const it=ot.subarray(tt,tt+nt);if(this.unusedBits=it[0],this.unusedBits>7)return this.error="Unused bits for BitString must be in range 0-7",-1;if(!this.unusedBits){const st=it.subarray(1);try{if(st.byteLength){const at=localFromBER(st,0,st.byteLength);at.offset!==-1&&at.offset===nt-1&&(this.value=[at.result])}}catch{}}return this.valueHexView=it.subarray(1),this.blockLength=it.length,tt+nt}toBER(et,tt){if(this.isConstructed)return LocalConstructedValueBlock.prototype.toBER.call(this,et,tt);if(et)return new ArrayBuffer(this.valueHexView.byteLength+1);if(!this.valueHexView.byteLength)return EMPTY_BUFFER$1;const nt=new Uint8Array(this.valueHexView.length+1);return nt[0]=this.unusedBits,nt.set(this.valueHexView,1),nt.buffer}toJSON(){return{...super.toJSON(),unusedBits:this.unusedBits,isConstructed:this.isConstructed}}}LocalBitStringValueBlock.NAME="BitStringValueBlock";var _a$q;class BitString extends BaseBlock{constructor({idBlock:et={},lenBlock:tt={},...nt}={}){var rt,ot;(rt=nt.isConstructed)!==null&&rt!==void 0||(nt.isConstructed=!!(!((ot=nt.value)===null||ot===void 0)&&ot.length)),super({idBlock:{isConstructed:nt.isConstructed,...et},lenBlock:{...tt,isIndefiniteForm:!!nt.isIndefiniteForm},...nt},LocalBitStringValueBlock),this.idBlock.tagClass=1,this.idBlock.tagNumber=3}fromBER(et,tt,nt){return this.valueBlock.isConstructed=this.idBlock.isConstructed,this.valueBlock.isIndefiniteForm=this.lenBlock.isIndefiniteForm,super.fromBER(et,tt,nt)}onAsciiEncoding(){if(this.valueBlock.isConstructed||this.valueBlock.value&&this.valueBlock.value.length)return Constructed.prototype.onAsciiEncoding.call(this);{const et=[],tt=this.valueBlock.valueHexView;for(const rt of tt)et.push(rt.toString(2).padStart(8,"0"));const nt=et.join("");return`${this.constructor.NAME} : ${nt.substring(0,nt.length-this.valueBlock.unusedBits)}`}}}_a$q=BitString;typeStore.BitString=_a$q;BitString.NAME=BIT_STRING_NAME;var _a$p;function viewAdd(o,et){const tt=new Uint8Array([0]),nt=new Uint8Array(o),rt=new Uint8Array(et);let ot=nt.slice(0);const it=ot.length-1,st=rt.slice(0),at=st.length-1;let ct=0;const lt=at=0;ht--,dt++){switch(!0){case dt=ot.length:ot=utilConcatView(new Uint8Array([ct%10]),ot);break;default:ot[it-dt]=ct%10}}return tt[0]>0&&(ot=utilConcatView(tt,ot)),ot}function power2(o){if(o>=powers2.length)for(let et=powers2.length;et<=o;et++){const tt=new Uint8Array([0]);let nt=powers2[et-1].slice(0);for(let rt=nt.length-1;rt>=0;rt--){const ot=new Uint8Array([(nt[rt]<<1)+tt[0]]);tt[0]=ot[0]/10,nt[rt]=ot[0]%10}tt[0]>0&&(nt=utilConcatView(tt,nt)),powers2.push(nt)}return powers2[o]}function viewSub(o,et){let tt=0;const nt=new Uint8Array(o),rt=new Uint8Array(et),ot=nt.slice(0),it=ot.length-1,st=rt.slice(0),at=st.length-1;let ct,lt=0;for(let dt=at;dt>=0;dt--,lt++)switch(ct=ot[it-lt]-st[at-lt]-tt,!0){case ct<0:tt=1,ot[it-lt]=ct+10;break;default:tt=0,ot[it-lt]=ct}if(tt>0)for(let dt=it-at+1;dt>=0;dt--,lt++)if(ct=ot[it-lt]-tt,ct<0)tt=1,ot[it-lt]=ct+10;else{tt=0,ot[it-lt]=ct;break}return ot.slice()}class LocalIntegerValueBlock extends HexBlock(ValueBlock){constructor({value:et,...tt}={}){super(tt),this._valueDec=0,tt.valueHex&&this.setValueHex(),et!==void 0&&(this.valueDec=et)}setValueHex(){this.valueHexView.length>=4?(this.warnings.push("Too big Integer for decoding, hex only"),this.isHexOnly=!0,this._valueDec=0):(this.isHexOnly=!1,this.valueHexView.length>0&&(this._valueDec=utilDecodeTC.call(this)))}set valueDec(et){this._valueDec=et,this.isHexOnly=!1,this.valueHexView=new Uint8Array(utilEncodeTC(et))}get valueDec(){return this._valueDec}fromDER(et,tt,nt,rt=0){const ot=this.fromBER(et,tt,nt);if(ot===-1)return ot;const it=this.valueHexView;return it[0]===0&&it[1]&128?this.valueHexView=it.subarray(1):rt!==0&&it.length1&&(rt=it.length+1),this.valueHexView=it.subarray(rt-it.length)),ot}toDER(et=!1){const tt=this.valueHexView;switch(!0){case(tt[0]&128)!==0:{const nt=new Uint8Array(this.valueHexView.length+1);nt[0]=0,nt.set(tt,1),this.valueHexView=nt}break;case(tt[0]===0&&(tt[1]&128)===0):this.valueHexView=this.valueHexView.subarray(1);break}return this.toBER(et)}fromBER(et,tt,nt){const rt=super.fromBER(et,tt,nt);return rt===-1||this.setValueHex(),rt}toBER(et){return et?new ArrayBuffer(this.valueHexView.length):this.valueHexView.slice().buffer}toJSON(){return{...super.toJSON(),valueDec:this.valueDec}}toString(){const et=this.valueHexView.length*8-1;let tt=new Uint8Array(this.valueHexView.length*8/3),nt=0,rt;const ot=this.valueHexView;let it="",st=!1;for(let at=ot.byteLength-1;at>=0;at--){rt=ot[at];for(let ct=0;ct<8;ct++){if((rt&1)===1)switch(nt){case et:tt=viewSub(power2(nt),tt),it="-";break;default:tt=viewAdd(tt,power2(nt))}nt++,rt>>=1}}for(let at=0;at0;){const ot=new LocalSidValueBlock;if(rt=ot.fromBER(et,rt,nt),rt===-1)return this.blockLength=0,this.error=ot.error,rt;this.value.length===0&&(ot.isFirstSid=!0),this.blockLength+=ot.blockLength,nt-=ot.blockLength,this.value.push(ot)}return rt}toBER(et){const tt=[];for(let nt=0;ntNumber.MAX_SAFE_INTEGER){assertBigInt();const st=BigInt(rt);it.valueBigInt=st}else if(it.valueDec=parseInt(rt,10),isNaN(it.valueDec))return;this.value.length||(it.isFirstSid=!0,ot=!0),this.value.push(it)}while(nt!==-1)}toString(){let et="",tt=!1;for(let nt=0;nt0;){const ot=new LocalRelativeSidValueBlock;if(rt=ot.fromBER(et,rt,nt),rt===-1)return this.blockLength=0,this.error=ot.error,rt;this.blockLength+=ot.blockLength,nt-=ot.blockLength,this.value.push(ot)}return rt}toBER(et,tt){const nt=[];for(let rt=0;rt4)continue;const st=4-it.length;for(let at=it.length-1;at>=0;at--)nt[rt*4+at+st]=it[at]}this.valueBlock.value=et}}LocalUniversalStringValueBlock.NAME="UniversalStringValueBlock";var _a$g;class UniversalString extends LocalUniversalStringValueBlock{constructor({...et}={}){super(et),this.idBlock.tagClass=1,this.idBlock.tagNumber=28}}_a$g=UniversalString;typeStore.UniversalString=_a$g;UniversalString.NAME="UniversalString";var _a$f;class NumericString extends LocalSimpleStringBlock{constructor(et={}){super(et),this.idBlock.tagClass=1,this.idBlock.tagNumber=18}}_a$f=NumericString;typeStore.NumericString=_a$f;NumericString.NAME="NumericString";var _a$e;class PrintableString extends LocalSimpleStringBlock{constructor(et={}){super(et),this.idBlock.tagClass=1,this.idBlock.tagNumber=19}}_a$e=PrintableString;typeStore.PrintableString=_a$e;PrintableString.NAME="PrintableString";var _a$d;class TeletexString extends LocalSimpleStringBlock{constructor(et={}){super(et),this.idBlock.tagClass=1,this.idBlock.tagNumber=20}}_a$d=TeletexString;typeStore.TeletexString=_a$d;TeletexString.NAME="TeletexString";var _a$c;class VideotexString extends LocalSimpleStringBlock{constructor(et={}){super(et),this.idBlock.tagClass=1,this.idBlock.tagNumber=21}}_a$c=VideotexString;typeStore.VideotexString=_a$c;VideotexString.NAME="VideotexString";var _a$b;class IA5String extends LocalSimpleStringBlock{constructor(et={}){super(et),this.idBlock.tagClass=1,this.idBlock.tagNumber=22}}_a$b=IA5String;typeStore.IA5String=_a$b;IA5String.NAME="IA5String";var _a$a;class GraphicString extends LocalSimpleStringBlock{constructor(et={}){super(et),this.idBlock.tagClass=1,this.idBlock.tagNumber=25}}_a$a=GraphicString;typeStore.GraphicString=_a$a;GraphicString.NAME="GraphicString";var _a$9;class VisibleString extends LocalSimpleStringBlock{constructor(et={}){super(et),this.idBlock.tagClass=1,this.idBlock.tagNumber=26}}_a$9=VisibleString;typeStore.VisibleString=_a$9;VisibleString.NAME="VisibleString";var _a$8;class GeneralString extends LocalSimpleStringBlock{constructor(et={}){super(et),this.idBlock.tagClass=1,this.idBlock.tagNumber=27}}_a$8=GeneralString;typeStore.GeneralString=_a$8;GeneralString.NAME="GeneralString";var _a$7;class CharacterString extends LocalSimpleStringBlock{constructor(et={}){super(et),this.idBlock.tagClass=1,this.idBlock.tagNumber=29}}_a$7=CharacterString;typeStore.CharacterString=_a$7;CharacterString.NAME="CharacterString";var _a$6;class UTCTime extends VisibleString{constructor({value:et,valueDate:tt,...nt}={}){if(super(nt),this.year=0,this.month=0,this.day=0,this.hour=0,this.minute=0,this.second=0,et){this.fromString(et),this.valueBlock.valueHexView=new Uint8Array(et.length);for(let rt=0;rt=50?this.year=1900+rt:this.year=2e3+rt,this.month=parseInt(nt[2],10),this.day=parseInt(nt[3],10),this.hour=parseInt(nt[4],10),this.minute=parseInt(nt[5],10),this.second=parseInt(nt[6],10)}toString(et="iso"){if(et==="iso"){const tt=new Array(7);return tt[0]=padNumber(this.year<2e3?this.year-1900:this.year-2e3,2),tt[1]=padNumber(this.month,2),tt[2]=padNumber(this.day,2),tt[3]=padNumber(this.hour,2),tt[4]=padNumber(this.minute,2),tt[5]=padNumber(this.second,2),tt[6]="Z",tt.join("")}return super.toString(et)}onAsciiEncoding(){return`${this.constructor.NAME} : ${this.toDate().toISOString()}`}toJSON(){return{...super.toJSON(),year:this.year,month:this.month,day:this.day,hour:this.hour,minute:this.minute,second:this.second}}}_a$6=UTCTime;typeStore.UTCTime=_a$6;UTCTime.NAME="UTCTime";var _a$5;class GeneralizedTime extends UTCTime{constructor(et={}){var tt;super(et),(tt=this.millisecond)!==null&&tt!==void 0||(this.millisecond=0),this.idBlock.tagClass=1,this.idBlock.tagNumber=24}fromDate(et){super.fromDate(et),this.millisecond=et.getUTCMilliseconds()}toDate(){return new Date(Date.UTC(this.year,this.month-1,this.day,this.hour,this.minute,this.second,this.millisecond))}fromString(et){let tt=!1,nt="",rt="",ot=0,it,st=0,at=0;if(et[et.length-1]==="Z")nt=et.substring(0,et.length-1),tt=!0;else{const dt=new Number(et[et.length-1]);if(isNaN(dt.valueOf()))throw new Error("Wrong input string for conversion");nt=et}if(tt){if(nt.indexOf("+")!==-1)throw new Error("Wrong input string for conversion");if(nt.indexOf("-")!==-1)throw new Error("Wrong input string for conversion")}else{let dt=1,ht=nt.indexOf("+"),pt="";if(ht===-1&&(ht=nt.indexOf("-"),dt=-1),ht!==-1){if(pt=nt.substring(ht+1),nt=nt.substring(0,ht),pt.length!==2&&pt.length!==4)throw new Error("Wrong input string for conversion");let mt=parseInt(pt.substring(0,2),10);if(isNaN(mt.valueOf()))throw new Error("Wrong input string for conversion");if(st=dt*mt,pt.length===4){if(mt=parseInt(pt.substring(2,4),10),isNaN(mt.valueOf()))throw new Error("Wrong input string for conversion");at=dt*mt}}}let ct=nt.indexOf(".");if(ct===-1&&(ct=nt.indexOf(",")),ct!==-1){const dt=new Number(`0${nt.substring(ct)}`);if(isNaN(dt.valueOf()))throw new Error("Wrong input string for conversion");ot=dt.valueOf(),rt=nt.substring(0,ct)}else rt=nt;switch(!0){case rt.length===8:if(it=/(\d{4})(\d{2})(\d{2})/ig,ct!==-1)throw new Error("Wrong input string for conversion");break;case rt.length===10:if(it=/(\d{4})(\d{2})(\d{2})(\d{2})/ig,ct!==-1){let dt=60*ot;this.minute=Math.floor(dt),dt=60*(dt-this.minute),this.second=Math.floor(dt),dt=1e3*(dt-this.second),this.millisecond=Math.floor(dt)}break;case rt.length===12:if(it=/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})/ig,ct!==-1){let dt=60*ot;this.second=Math.floor(dt),dt=1e3*(dt-this.second),this.millisecond=Math.floor(dt)}break;case rt.length===14:if(it=/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/ig,ct!==-1){const dt=1e3*ot;this.millisecond=Math.floor(dt)}break;default:throw new Error("Wrong input string for conversion")}const lt=it.exec(rt);if(lt===null)throw new Error("Wrong input string for conversion");for(let dt=1;dt0&&(nt=`0${nt}`),et.push(nt)}),BigInt("0x"+et.join(""))}function pkixToRSAPublicKey(o){const et=pkixToJwk(o);if(rsaKeySize(et)>MAX_RSA_KEY_SIZE)throw new InvalidPublicKeyError("Key size is too large");const tt=sha256$2(PublicKey.encode({Type:KeyType.RSA,Data:o})),nt=create$3(SHA2_256_CODE,tt);return new RSAPublicKey(et,nt)}function isPromise$3(o){return o==null?!1:typeof o.then=="function"&&typeof o.catch=="function"&&typeof o.finally=="function"}function hashAndVerify(o,et,tt){const nt=sha256.digest(tt instanceof Uint8Array?tt:tt.subarray());if(isPromise$3(nt))return nt.then(({digest:rt})=>secp256k1.verify(et,rt,o)).catch(rt=>{throw new VerificationError(String(rt))});try{return secp256k1.verify(et,nt.digest,o)}catch(rt){throw new VerificationError(String(rt))}}class Secp256k1PublicKey{constructor(et){Ct(this,"type","secp256k1");Ct(this,"raw");Ct(this,"_key");this._key=validateSecp256k1PublicKey(et),this.raw=compressSecp256k1PublicKey(this._key)}toMultihash(){return identity.digest(publicKeyToProtobuf(this))}toCID(){return CID.createV1(114,this.toMultihash())}toString(){return base58btc.encode(this.toMultihash().bytes).substring(1)}equals(et){return et==null||!(et.raw instanceof Uint8Array)?!1:equals(this.raw,et.raw)}verify(et,tt){return hashAndVerify(this._key,tt,et)}}function unmarshalSecp256k1PublicKey(o){return new Secp256k1PublicKey(o)}function compressSecp256k1PublicKey(o){return secp256k1.ProjectivePoint.fromHex(o).toRawBytes(!0)}function validateSecp256k1PublicKey(o){try{return secp256k1.ProjectivePoint.fromHex(o),o}catch(et){throw new InvalidPublicKeyError(String(et))}}async function generateKeyPair(o,et){return generateEd25519KeyPair()}function publicKeyFromProtobuf(o){const{Type:et,Data:tt}=PublicKey.decode(o),nt=tt??new Uint8Array;switch(et){case KeyType.RSA:return pkixToRSAPublicKey(nt);case KeyType.Ed25519:return unmarshalEd25519PublicKey(nt);case KeyType.secp256k1:return unmarshalSecp256k1PublicKey(nt);default:throw new UnsupportedKeyTypeError$1}}function publicKeyFromRaw(o){return o.byteLength===32?unmarshalEd25519PublicKey(o):o.byteLength===33?unmarshalSecp256k1PublicKey(o):pkixToRSAPublicKey(o)}function publicKeyFromMultihash(o){const{Type:et,Data:tt}=PublicKey.decode(o.digest),nt=tt??new Uint8Array;switch(et){case KeyType.Ed25519:return unmarshalEd25519PublicKey(nt);case KeyType.secp256k1:return unmarshalSecp256k1PublicKey(nt);default:throw new UnsupportedKeyTypeError$1}}function publicKeyToProtobuf(o){return PublicKey.encode({Type:KeyType[o.type],Data:o.raw})}const peerIdSymbol$2=Symbol.for("@libp2p/peer-id");var ds;let InvalidParametersError$2=(ds=class extends Error{constructor(et="Invalid parameters"){super(et),this.name="InvalidParametersError"}},Ct(ds,"name","InvalidParametersError"),ds);class InvalidCIDError extends Error{constructor(et="Invalid CID"){super(et),this.name="InvalidCIDError"}}Ct(InvalidCIDError,"name","InvalidCIDError");class InvalidMultihashError extends Error{constructor(et="Invalid Multihash"){super(et),this.name="InvalidMultihashError"}}Ct(InvalidMultihashError,"name","InvalidMultihashError");class UnsupportedKeyTypeError extends Error{constructor(et="Unsupported key type"){super(et),this.name="UnsupportedKeyTypeError"}}Ct(UnsupportedKeyTypeError,"name","UnsupportedKeyTypeError");const inspect=Symbol.for("nodejs.util.inspect.custom"),LIBP2P_KEY_CODE$1=114;var Js;class PeerIdImpl{constructor(et){Ct(this,"type");Ct(this,"multihash");Ct(this,"publicKey");Ct(this,"string");Ct(this,Js,!0);this.type=et.type,this.multihash=et.multihash,Object.defineProperty(this,"string",{enumerable:!1,writable:!0})}get[Symbol.toStringTag](){return`PeerId(${this.toString()})`}toString(){return this.string==null&&(this.string=base58btc.encode(this.multihash.bytes).slice(1)),this.string}toMultihash(){return this.multihash}toCID(){return CID.createV1(LIBP2P_KEY_CODE$1,this.multihash)}toJSON(){return this.toString()}equals(et){var tt;if(et==null)return!1;if(et instanceof Uint8Array)return equals(this.multihash.bytes,et);if(typeof et=="string")return this.toString()===et;if(((tt=et==null?void 0:et.toMultihash())==null?void 0:tt.bytes)!=null)return equals(this.multihash.bytes,et.toMultihash().bytes);throw new Error("not valid Id")}[(Js=peerIdSymbol$2,inspect)](){return`PeerId(${this.toString()})`}}class RSAPeerId extends PeerIdImpl{constructor(tt){super({...tt,type:"RSA"});Ct(this,"type","RSA");Ct(this,"publicKey");this.publicKey=tt.publicKey}}class Ed25519PeerId extends PeerIdImpl{constructor(tt){super({...tt,type:"Ed25519"});Ct(this,"type","Ed25519");Ct(this,"publicKey");this.publicKey=tt.publicKey}}class Secp256k1PeerId extends PeerIdImpl{constructor(tt){super({...tt,type:"secp256k1"});Ct(this,"type","secp256k1");Ct(this,"publicKey");this.publicKey=tt.publicKey}}const TRANSPORT_IPFS_GATEWAY_HTTP_CODE$1=2336;var na,ga;class URLPeerId{constructor(et){Ct(this,"type","url");Ct(this,"multihash");Ct(this,"publicKey");Ct(this,"url");Ct(this,na,!0);this.url=et.toString(),this.multihash=identity.digest(fromString(this.url))}[(ga=inspect,na=peerIdSymbol$2,ga)](){return`PeerId(${this.url})`}toString(){return this.toCID().toString()}toMultihash(){return this.multihash}toCID(){return CID.createV1(TRANSPORT_IPFS_GATEWAY_HTTP_CODE$1,this.toMultihash())}toJSON(){return this.toString()}equals(et){return et==null?!1:(et instanceof Uint8Array&&(et=toString$8(et)),et.toString()===this.toString())}}const LIBP2P_KEY_CODE=114,TRANSPORT_IPFS_GATEWAY_HTTP_CODE=2336;function peerIdFromString$1(o,et){let tt;if(o.charAt(0)==="1"||o.charAt(0)==="Q")tt=decode$6(base58btc.decode(`z${o}`));else throw new InvalidParametersError$2('Please pass a multibase decoder for strings that do not start with "1" or "Q"');return peerIdFromMultihash(tt)}function peerIdFromPublicKey(o){if(o.type==="Ed25519")return new Ed25519PeerId({multihash:o.toCID().multihash,publicKey:o});if(o.type==="secp256k1")return new Secp256k1PeerId({multihash:o.toCID().multihash,publicKey:o});if(o.type==="RSA")return new RSAPeerId({multihash:o.toCID().multihash,publicKey:o});throw new UnsupportedKeyTypeError}function peerIdFromPrivateKey(o){return peerIdFromPublicKey(o.publicKey)}function peerIdFromMultihash(o){if(isSha256Multihash(o))return new RSAPeerId({multihash:o});if(isIdentityMultihash(o))try{const et=publicKeyFromMultihash(o);if(et.type==="Ed25519")return new Ed25519PeerId({multihash:o,publicKey:et});if(et.type==="secp256k1")return new Secp256k1PeerId({multihash:o,publicKey:et})}catch{const tt=toString$8(o.digest);return new URLPeerId(new URL(tt))}throw new InvalidMultihashError("Supplied PeerID Multihash is invalid")}function peerIdFromCID(o){if((o==null?void 0:o.multihash)==null||o.version==null||o.version===1&&o.code!==LIBP2P_KEY_CODE&&o.code!==TRANSPORT_IPFS_GATEWAY_HTTP_CODE)throw new InvalidCIDError("Supplied PeerID CID is invalid");if(o.code===TRANSPORT_IPFS_GATEWAY_HTTP_CODE){const et=toString$8(o.multihash.digest);return new URLPeerId(new URL(et))}return peerIdFromMultihash(o.multihash)}function isIdentityMultihash(o){return o.code===identity.code}function isSha256Multihash(o){return o.code===sha256.code}let AbortError$8=class extends Error{constructor(tt,nt,rt){super(tt??"The operation was aborted");Ct(this,"type");Ct(this,"code");this.type="aborted",this.name=rt??"AbortError",this.code=nt??"ABORT_ERR"}};async function raceSignal(o,et,tt){if(et==null)return o;if(et.aborted)return Promise.reject(new AbortError$8(tt==null?void 0:tt.errorMessage,tt==null?void 0:tt.errorCode,tt==null?void 0:tt.errorName));let nt;const rt=new AbortError$8(tt==null?void 0:tt.errorMessage,tt==null?void 0:tt.errorCode,tt==null?void 0:tt.errorName);try{return await Promise.race([o,new Promise((ot,it)=>{nt=()=>{it(rt)},et.addEventListener("abort",nt)})])}finally{nt!=null&&et.removeEventListener("abort",nt)}}class QueuelessPushable{constructor(){Ct(this,"readNext");Ct(this,"haveNext");Ct(this,"ended");Ct(this,"nextResult");this.ended=!1,this.readNext=pDefer(),this.haveNext=pDefer()}[Symbol.asyncIterator](){return this}async next(){if(this.nextResult==null&&await this.haveNext.promise,this.nextResult==null)throw new Error("HaveNext promise resolved but nextResult was undefined");const et=this.nextResult;return this.nextResult=void 0,this.readNext.resolve(),this.readNext=pDefer(),et}async throw(et){return this.ended=!0,et!=null&&(this.haveNext.promise.catch(()=>{}),this.haveNext.reject(et)),{done:!0,value:void 0}}async return(){const et={done:!0,value:void 0};return await this._push(void 0),et}async push(et,tt){await this._push(et,tt)}async end(et,tt){et!=null?await this.throw(et):await this._push(void 0,tt)}async _push(et,tt){if(et!=null&&this.ended)throw new Error("Cannot push value onto an ended pushable");for(;this.nextResult!=null;)await this.readNext.promise;et!=null?this.nextResult={done:!1,value:et}:(this.ended=!0,this.nextResult={done:!0,value:void 0}),this.haveNext.resolve(),this.haveNext=pDefer(),await raceSignal(this.readNext.promise,tt==null?void 0:tt.signal,tt)}}function queuelessPushable(){return new QueuelessPushable}class UnexpectedEOFError extends Error{constructor(){super(...arguments);Ct(this,"name","UnexpectedEOFError");Ct(this,"code","ERR_UNEXPECTED_EOF")}}class CodeError extends Error{constructor(tt,nt){super(tt);Ct(this,"code");this.code=nt}}let AbortError$7=class extends CodeError{constructor(tt){super(tt,"ABORT_ERR");Ct(this,"type");this.type="aborted",this.name="AbortError"}};function byteStream(o,et){const tt=queuelessPushable();o.sink(tt).catch(async it=>{await tt.end(it)}),o.sink=async it=>{for await(const st of it)await tt.push(st);await tt.end()};let nt=o.source;o.source[Symbol.iterator]!=null?nt=o.source[Symbol.iterator]():o.source[Symbol.asyncIterator]!=null&&(nt=o.source[Symbol.asyncIterator]());const rt=new Uint8ArrayList;return{read:async(it,st)=>{var lt,dt;(lt=st==null?void 0:st.signal)==null||lt.throwIfAborted();let at;const ct=new Promise((ht,pt)=>{var mt;at=()=>{pt(new AbortError$7("Read aborted"))},(mt=st==null?void 0:st.signal)==null||mt.addEventListener("abort",at)});try{if(it==null){const{done:pt,value:mt}=await Promise.race([nt.next(),ct]);return pt===!0?new Uint8ArrayList:mt}for(;rt.byteLength{var at;(at=st==null?void 0:st.signal)==null||at.throwIfAborted(),it instanceof Uint8Array?await tt.push(it,st):await tt.push(it.subarray(),st)},unwrap:()=>{if(rt.byteLength>0){const it=o.source;o.source=async function*(){(et==null?void 0:et.yieldBytes)===!1?yield rt:yield*rt,yield*it}()}return o}}}class InvalidMessageLengthError extends Error{constructor(){super(...arguments);Ct(this,"name","InvalidMessageLengthError");Ct(this,"code","ERR_INVALID_MSG_LENGTH")}}class InvalidDataLengthError extends Error{constructor(){super(...arguments);Ct(this,"name","InvalidDataLengthError");Ct(this,"code","ERR_MSG_DATA_TOO_LONG")}}class InvalidDataLengthLengthError extends Error{constructor(){super(...arguments);Ct(this,"name","InvalidDataLengthLengthError");Ct(this,"code","ERR_MSG_LENGTH_TOO_LONG")}}function lpStream(o,et={}){const tt=byteStream(o,et);et.maxDataLength!=null&&et.maxLengthLength==null&&(et.maxLengthLength=encodingLength$3(et.maxDataLength));const nt=(et==null?void 0:et.lengthDecoder)??decode$b,rt=(et==null?void 0:et.lengthEncoder)??encode$a;return{read:async it=>{let st=-1;const at=new Uint8ArrayList;for(;;){at.append(await tt.read(1,it));try{st=nt(at)}catch(ct){if(ct instanceof RangeError)continue;throw ct}if(st<0)throw new InvalidMessageLengthError("Invalid message length");if((et==null?void 0:et.maxLengthLength)!=null&&at.byteLength>et.maxLengthLength)throw new InvalidDataLengthLengthError("message length length too long");if(st>-1)break}if((et==null?void 0:et.maxDataLength)!=null&&st>et.maxDataLength)throw new InvalidDataLengthError("message length too long");return tt.read(st,it)},write:async(it,st)=>{await tt.write(new Uint8ArrayList(rt(it.byteLength),it),st)},writeV:async(it,st)=>{const at=new Uint8ArrayList(...it.flatMap(ct=>[rt(ct.byteLength),ct]));await tt.write(at,st)},unwrap:()=>tt.unwrap()}}function pair(){const o=pDefer();let et=!1;return{sink:async tt=>{if(et)throw new Error("already piped");et=!0,o.resolve(tt)},source:async function*(){yield*await o.promise}()}}function duplexPair(){const o=pair(),et=pair();return[{source:o.source,sink:et.sink},{source:et.source,sink:o.sink}]}var define_globalThis_process_env_default$2={};const NOISE_MSG_MAX_LENGTH_BYTES=65535,NOISE_MSG_MAX_LENGTH_BYTES_WITHOUT_TAG=NOISE_MSG_MAX_LENGTH_BYTES-16,DUMP_SESSION_KEYS=!!(define_globalThis_process_env_default$2!=null&&define_globalThis_process_env_default$2.DUMP_SESSION_KEYS);function number$2(o){if(!Number.isSafeInteger(o)||o<0)throw new Error(`positive integer expected, not ${o}`)}function bool(o){if(typeof o!="boolean")throw new Error(`boolean expected, not ${o}`)}function isBytes$1(o){return o instanceof Uint8Array||o!=null&&typeof o=="object"&&o.constructor.name==="Uint8Array"}function bytes(o,...et){if(!isBytes$1(o))throw new Error("Uint8Array expected");if(et.length>0&&!et.includes(o.length))throw new Error(`Uint8Array expected of length ${et}, not of length=${o.length}`)}function exists(o,et=!0){if(o.destroyed)throw new Error("Hash instance has been destroyed");if(et&&o.finished)throw new Error("Hash#digest() has already been called")}function output(o,et){bytes(o);const tt=et.outputLen;if(o.lengthnew Uint32Array(o.buffer,o.byteOffset,Math.floor(o.byteLength/4)),createView=o=>new DataView(o.buffer,o.byteOffset,o.byteLength),isLE=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;if(!isLE)throw new Error("Non little-endian hardware is not supported");function utf8ToBytes(o){if(typeof o!="string")throw new Error(`string expected, got ${typeof o}`);return new Uint8Array(new TextEncoder().encode(o))}function toBytes(o){if(typeof o=="string")o=utf8ToBytes(o);else if(isBytes$1(o))o=copyBytes(o);else throw new Error(`Uint8Array expected, got ${typeof o}`);return o}function checkOpts(o,et){if(et==null||typeof et!="object")throw new Error("options must be defined");return Object.assign(o,et)}function equalBytes(o,et){if(o.length!==et.length)return!1;let tt=0;for(let nt=0;nt(Object.assign(et,o),et);function setBigUint64(o,et,tt,nt){if(typeof o.setBigUint64=="function")return o.setBigUint64(et,tt,nt);const rt=BigInt(32),ot=BigInt(4294967295),it=Number(tt>>rt&ot),st=Number(tt&ot),at=4,ct=0;o.setUint32(et+at,it,nt),o.setUint32(et+ct,st,nt)}function copyBytes(o){return Uint8Array.from(o)}function clean(...o){for(let et=0;etUint8Array.from(o.split("").map(et=>et.charCodeAt(0))),sigma16=_utf8ToBytes("expand 16-byte k"),sigma32=_utf8ToBytes("expand 32-byte k"),sigma16_32=u32(sigma16),sigma32_32=u32(sigma32);sigma32_32.slice();function rotl(o,et){return o<>>32-et}function isAligned32(o){return o.byteOffset%4===0}const BLOCK_LEN=64,BLOCK_LEN32=16,MAX_COUNTER=2**32-1,U32_EMPTY=new Uint32Array;function runCipher(o,et,tt,nt,rt,ot,it,st){const at=rt.length,ct=new Uint8Array(BLOCK_LEN),lt=u32(ct),dt=isAligned32(rt)&&isAligned32(ot),ht=dt?u32(rt):U32_EMPTY,pt=dt?u32(ot):U32_EMPTY;for(let mt=0;mt=MAX_COUNTER)throw new Error("arx: counter overflow");const ft=Math.min(BLOCK_LEN,at-mt);if(dt&&ft===BLOCK_LEN){const yt=mt/4;if(mt%4!==0)throw new Error("arx: invalid block position");for(let gt=0,xt;gt{bytes(st),bytes(at),bytes(ct);const ht=ct.length;if(lt===void 0&&(lt=new Uint8Array(ht)),bytes(lt),number$2(dt),dt<0||dt>=MAX_COUNTER)throw new Error("arx: counter overflow");if(lt.lengtho[et++]&255|(o[et++]&255)<<8;class Poly1305{constructor(et){this.blockLen=16,this.outputLen=16,this.buffer=new Uint8Array(16),this.r=new Uint16Array(10),this.h=new Uint16Array(10),this.pad=new Uint16Array(8),this.pos=0,this.finished=!1,et=toBytes(et),bytes(et,32);const tt=u8to16(et,0),nt=u8to16(et,2),rt=u8to16(et,4),ot=u8to16(et,6),it=u8to16(et,8),st=u8to16(et,10),at=u8to16(et,12),ct=u8to16(et,14);this.r[0]=tt&8191,this.r[1]=(tt>>>13|nt<<3)&8191,this.r[2]=(nt>>>10|rt<<6)&7939,this.r[3]=(rt>>>7|ot<<9)&8191,this.r[4]=(ot>>>4|it<<12)&255,this.r[5]=it>>>1&8190,this.r[6]=(it>>>14|st<<2)&8191,this.r[7]=(st>>>11|at<<5)&8065,this.r[8]=(at>>>8|ct<<8)&8191,this.r[9]=ct>>>5&127;for(let lt=0;lt<8;lt++)this.pad[lt]=u8to16(et,16+2*lt)}process(et,tt,nt=!1){const rt=nt?0:2048,{h:ot,r:it}=this,st=it[0],at=it[1],ct=it[2],lt=it[3],dt=it[4],ht=it[5],pt=it[6],mt=it[7],ft=it[8],yt=it[9],gt=u8to16(et,tt+0),xt=u8to16(et,tt+2),vt=u8to16(et,tt+4),bt=u8to16(et,tt+6),Et=u8to16(et,tt+8),wt=u8to16(et,tt+10),kt=u8to16(et,tt+12),It=u8to16(et,tt+14);let Rt=ot[0]+(gt&8191),Pt=ot[1]+((gt>>>13|xt<<3)&8191),jt=ot[2]+((xt>>>10|vt<<6)&8191),Ot=ot[3]+((vt>>>7|bt<<9)&8191),Bt=ot[4]+((bt>>>4|Et<<12)&8191),zt=ot[5]+(Et>>>1&8191),Ft=ot[6]+((Et>>>14|wt<<2)&8191),Yt=ot[7]+((wt>>>11|kt<<5)&8191),Ht=ot[8]+((kt>>>8|It<<8)&8191),Ut=ot[9]+(It>>>5|rt),qt=0,Lt=qt+Rt*st+Pt*(5*yt)+jt*(5*ft)+Ot*(5*mt)+Bt*(5*pt);qt=Lt>>>13,Lt&=8191,Lt+=zt*(5*ht)+Ft*(5*dt)+Yt*(5*lt)+Ht*(5*ct)+Ut*(5*at),qt+=Lt>>>13,Lt&=8191;let Zt=qt+Rt*at+Pt*st+jt*(5*yt)+Ot*(5*ft)+Bt*(5*mt);qt=Zt>>>13,Zt&=8191,Zt+=zt*(5*pt)+Ft*(5*ht)+Yt*(5*dt)+Ht*(5*lt)+Ut*(5*ct),qt+=Zt>>>13,Zt&=8191;let Qt=qt+Rt*ct+Pt*at+jt*st+Ot*(5*yt)+Bt*(5*ft);qt=Qt>>>13,Qt&=8191,Qt+=zt*(5*mt)+Ft*(5*pt)+Yt*(5*ht)+Ht*(5*dt)+Ut*(5*lt),qt+=Qt>>>13,Qt&=8191;let Nt=qt+Rt*lt+Pt*ct+jt*at+Ot*st+Bt*(5*yt);qt=Nt>>>13,Nt&=8191,Nt+=zt*(5*ft)+Ft*(5*mt)+Yt*(5*pt)+Ht*(5*ht)+Ut*(5*dt),qt+=Nt>>>13,Nt&=8191;let Gt=qt+Rt*dt+Pt*lt+jt*ct+Ot*at+Bt*st;qt=Gt>>>13,Gt&=8191,Gt+=zt*(5*yt)+Ft*(5*ft)+Yt*(5*mt)+Ht*(5*pt)+Ut*(5*ht),qt+=Gt>>>13,Gt&=8191;let nn=qt+Rt*ht+Pt*dt+jt*lt+Ot*ct+Bt*at;qt=nn>>>13,nn&=8191,nn+=zt*st+Ft*(5*yt)+Yt*(5*ft)+Ht*(5*mt)+Ut*(5*pt),qt+=nn>>>13,nn&=8191;let Wt=qt+Rt*pt+Pt*ht+jt*dt+Ot*lt+Bt*ct;qt=Wt>>>13,Wt&=8191,Wt+=zt*at+Ft*st+Yt*(5*yt)+Ht*(5*ft)+Ut*(5*mt),qt+=Wt>>>13,Wt&=8191;let hn=qt+Rt*mt+Pt*pt+jt*ht+Ot*dt+Bt*lt;qt=hn>>>13,hn&=8191,hn+=zt*ct+Ft*at+Yt*st+Ht*(5*yt)+Ut*(5*ft),qt+=hn>>>13,hn&=8191;let Xt=qt+Rt*ft+Pt*mt+jt*pt+Ot*ht+Bt*dt;qt=Xt>>>13,Xt&=8191,Xt+=zt*lt+Ft*ct+Yt*at+Ht*st+Ut*(5*yt),qt+=Xt>>>13,Xt&=8191;let Jt=qt+Rt*yt+Pt*ft+jt*mt+Ot*pt+Bt*ht;qt=Jt>>>13,Jt&=8191,Jt+=zt*dt+Ft*lt+Yt*ct+Ht*at+Ut*st,qt+=Jt>>>13,Jt&=8191,qt=(qt<<2)+qt|0,qt=qt+Lt|0,Lt=qt&8191,qt=qt>>>13,Zt+=qt,ot[0]=Lt,ot[1]=Zt,ot[2]=Qt,ot[3]=Nt,ot[4]=Gt,ot[5]=nn,ot[6]=Wt,ot[7]=hn,ot[8]=Xt,ot[9]=Jt}finalize(){const{h:et,pad:tt}=this,nt=new Uint16Array(10);let rt=et[1]>>>13;et[1]&=8191;for(let st=2;st<10;st++)et[st]+=rt,rt=et[st]>>>13,et[st]&=8191;et[0]+=rt*5,rt=et[0]>>>13,et[0]&=8191,et[1]+=rt,rt=et[1]>>>13,et[1]&=8191,et[2]+=rt,nt[0]=et[0]+5,rt=nt[0]>>>13,nt[0]&=8191;for(let st=1;st<10;st++)nt[st]=et[st]+rt,rt=nt[st]>>>13,nt[st]&=8191;nt[9]-=8192;let ot=(rt^1)-1;for(let st=0;st<10;st++)nt[st]&=ot;ot=~ot;for(let st=0;st<10;st++)et[st]=et[st]&ot|nt[st];et[0]=(et[0]|et[1]<<13)&65535,et[1]=(et[1]>>>3|et[2]<<10)&65535,et[2]=(et[2]>>>6|et[3]<<7)&65535,et[3]=(et[3]>>>9|et[4]<<4)&65535,et[4]=(et[4]>>>12|et[5]<<1|et[6]<<14)&65535,et[5]=(et[6]>>>2|et[7]<<11)&65535,et[6]=(et[7]>>>5|et[8]<<8)&65535,et[7]=(et[8]>>>8|et[9]<<5)&65535;let it=et[0]+tt[0];et[0]=it&65535;for(let st=1;st<8;st++)it=(et[st]+tt[st]|0)+(it>>>16)|0,et[st]=it&65535;clean(nt)}update(et){exists(this);const{buffer:tt,blockLen:nt}=this;et=toBytes(et);const rt=et.length;for(let ot=0;ot>>0,et[ot++]=nt[it]>>>8;return et}digest(){const{buffer:et,outputLen:tt}=this;this.digestInto(et);const nt=et.slice(0,tt);return this.destroy(),nt}}function wrapConstructorWithKey(o){const et=(nt,rt)=>o(rt).update(toBytes(nt)).digest(),tt=o(new Uint8Array(32));return et.outputLen=tt.outputLen,et.blockLen=tt.blockLen,et.create=nt=>o(nt),et}const poly1305=wrapConstructorWithKey(o=>new Poly1305(o));function chachaCore(o,et,tt,nt,rt,ot=20){let it=o[0],st=o[1],at=o[2],ct=o[3],lt=et[0],dt=et[1],ht=et[2],pt=et[3],mt=et[4],ft=et[5],yt=et[6],gt=et[7],xt=rt,vt=tt[0],bt=tt[1],Et=tt[2],wt=it,kt=st,It=at,Rt=ct,Pt=lt,jt=dt,Ot=ht,Bt=pt,zt=mt,Ft=ft,Yt=yt,Ht=gt,Ut=xt,qt=vt,Lt=bt,Zt=Et;for(let Nt=0;Nt{o.update(et);const tt=et.length%16;tt&&o.update(ZEROS16.subarray(tt))},ZEROS32=new Uint8Array(32);function computeTag(o,et,tt,nt,rt){const ot=o(et,tt,ZEROS32),it=poly1305.create(ot);rt&&updatePadded(it,rt),updatePadded(it,nt);const st=new Uint8Array(16),at=createView(st);setBigUint64(at,0,BigInt(rt?rt.length:0),!0),setBigUint64(at,8,BigInt(nt.length),!0),it.update(st);const ct=it.digest();return clean(ot,st),ct}const _poly1305_aead=o=>(et,tt,nt)=>(bytes(et,32),bytes(tt),{encrypt(ot,it){const st=ot.length,at=st+16;it?bytes(it,at):it=new Uint8Array(at),o(et,tt,ot,it,1);const ct=computeTag(o,et,tt,it.subarray(0,-16),nt);return it.set(ct,st),clean(ct),it},decrypt(ot,it){const st=ot.length,at=st-16;if(st<16)throw new Error("encrypted data must be at least 16 bytes");it?bytes(it,at):it=new Uint8Array(at);const ct=ot.subarray(0,-16),lt=ot.subarray(-16),dt=computeTag(o,et,tt,ct,nt);if(!equalBytes(lt,dt))throw new Error("invalid tag");return o(et,tt,ct,it,1),clean(dt),it}}),chacha20poly1305=wrapCipher({blockSize:64,nonceLength:12,tagLength:16},_poly1305_aead(chacha20));function extract(o,et,tt){return hash$1(o),tt===void 0&&(tt=new Uint8Array(o.outputLen)),hmac(o,toBytes$2(tt),toBytes$2(et))}const HKDF_COUNTER=new Uint8Array([0]),EMPTY_BUFFER=new Uint8Array;function expand(o,et,tt,nt=32){if(hash$1(o),number$4(nt),nt>255*o.outputLen)throw new Error("Length should be <= 255*HashLen");const rt=Math.ceil(nt/o.outputLen);tt===void 0&&(tt=EMPTY_BUFFER);const ot=new Uint8Array(rt*o.outputLen),it=hmac.create(o,et),st=it._cloneInto(),at=new Uint8Array(it.outputLen);for(let ct=0;cto.generateX25519SharedKey(et.privateKey,tt).subarray(0,32),encrypt:o.chaCha20Poly1305Encrypt,decrypt:o.chaCha20Poly1305Decrypt,hash:o.hashSHA256,hkdf:o.getHKDF}}const uint16BEEncode=o=>{const et=allocUnsafe(2);return et[0]=o>>8,et[1]=o,et};uint16BEEncode.bytes=2;const uint16BEDecode=o=>{if(o.length<2)throw RangeError("Could not decode int16BE");if(o instanceof Uint8Array){let et=0;return et+=o[0]<<8,et+=o[1],et}return o.getUint16(0)};uint16BEDecode.bytes=2;function registerMetrics(o){return{xxHandshakeSuccesses:o.registerCounter("libp2p_noise_xxhandshake_successes_total",{help:"Total count of noise xxHandshakes successes_"}),xxHandshakeErrors:o.registerCounter("libp2p_noise_xxhandshake_error_total",{help:"Total count of noise xxHandshakes errors"}),encryptedPackets:o.registerCounter("libp2p_noise_encrypted_packets_total",{help:"Total count of noise encrypted packets successfully"}),decryptedPackets:o.registerCounter("libp2p_noise_decrypted_packets_total",{help:"Total count of noise decrypted packets"}),decryptErrors:o.registerCounter("libp2p_noise_decrypt_errors_total",{help:"Total count of noise decrypt errors"})}}function logLocalStaticKeys(o,et){!et.enabled||!DUMP_SESSION_KEYS||(o?(et(`LOCAL_STATIC_PUBLIC_KEY ${toString$8(o.publicKey,"hex")}`),et(`LOCAL_STATIC_PRIVATE_KEY ${toString$8(o.privateKey,"hex")}`)):et("Missing local static keys."))}function logLocalEphemeralKeys(o,et){!et.enabled||!DUMP_SESSION_KEYS||(o?(et(`LOCAL_PUBLIC_EPHEMERAL_KEY ${toString$8(o.publicKey,"hex")}`),et(`LOCAL_PRIVATE_EPHEMERAL_KEY ${toString$8(o.privateKey,"hex")}`)):et("Missing local ephemeral keys."))}function logRemoteStaticKey(o,et){!et.enabled||!DUMP_SESSION_KEYS||et(o?`REMOTE_STATIC_PUBLIC_KEY ${toString$8(o.subarray(),"hex")}`:"Missing remote static public key.")}function logRemoteEphemeralKey(o,et){!et.enabled||!DUMP_SESSION_KEYS||et(o?`REMOTE_EPHEMERAL_PUBLIC_KEY ${toString$8(o.subarray(),"hex")}`:"Missing remote ephemeral keys.")}function logCipherState(o,et,tt){!tt.enabled||!DUMP_SESSION_KEYS||(tt(`CIPHER_STATE_1 ${o.n.getUint64()} ${o.k&&toString$8(o.k,"hex")}`),tt(`CIPHER_STATE_2 ${et.n.getUint64()} ${et.k&&toString$8(et.k,"hex")}`))}const rs=class rs extends Error{constructor(tt="Invalid crypto exchange"){super(tt);Ct(this,"code");this.code=rs.code}};Ct(rs,"code","ERR_INVALID_CRYPTO_EXCHANGE");let InvalidCryptoExchangeError=rs;const MIN_NONCE=0,MAX_NONCE=4294967295,ERR_MAX_NONCE="Cipherstate has reached maximum n, a new handshake must be performed";class Nonce{constructor(et=MIN_NONCE){Ct(this,"n");Ct(this,"bytes");Ct(this,"view");this.n=et,this.bytes=alloc$2(12),this.view=new DataView(this.bytes.buffer,this.bytes.byteOffset,this.bytes.byteLength),this.view.setUint32(4,et,!0)}increment(){this.n++,this.view.setUint32(4,this.n,!0)}getBytes(){return this.bytes}getUint64(){return this.n}assertValue(){if(this.n>MAX_NONCE)throw new Error(ERR_MAX_NONCE)}}const ZEROLEN=alloc$2(0);class CipherState{constructor(et,tt=void 0,nt=0){Ct(this,"k");Ct(this,"n");Ct(this,"crypto");this.crypto=et,this.k=tt,this.n=new Nonce(nt)}hasKey(){return!!this.k}encryptWithAd(et,tt){if(!this.hasKey())return tt;this.n.assertValue();const nt=this.crypto.encrypt(tt,this.n.getBytes(),et,this.k);return this.n.increment(),nt}decryptWithAd(et,tt,nt){if(!this.hasKey())return tt;this.n.assertValue();const rt=this.crypto.decrypt(tt,this.n.getBytes(),et,this.k,nt);return this.n.increment(),rt}}class SymmetricState{constructor(et,tt){Ct(this,"cs");Ct(this,"ck");Ct(this,"h");Ct(this,"crypto");this.crypto=et;const nt=fromString(tt,"utf-8");this.h=hashProtocolName(et,nt),this.ck=this.h,this.cs=new CipherState(et)}mixKey(et){const[tt,nt]=this.crypto.hkdf(this.ck,et);this.ck=tt,this.cs=new CipherState(this.crypto,nt)}mixHash(et){this.h=this.crypto.hash(new Uint8ArrayList(this.h,et))}encryptAndHash(et){const tt=this.cs.encryptWithAd(this.h,et);return this.mixHash(tt),tt}decryptAndHash(et){const tt=this.cs.decryptWithAd(this.h,et);return this.mixHash(et),tt}split(){const[et,tt]=this.crypto.hkdf(this.ck,ZEROLEN);return[new CipherState(this.crypto,et),new CipherState(this.crypto,tt)]}}class AbstractHandshakeState{constructor(et){Ct(this,"ss");Ct(this,"s");Ct(this,"e");Ct(this,"rs");Ct(this,"re");Ct(this,"initiator");Ct(this,"crypto");const{crypto:tt,protocolName:nt,prologue:rt,initiator:ot,s:it,e:st,rs:at,re:ct}=et;this.crypto=tt,this.ss=new SymmetricState(tt,nt),this.ss.mixHash(rt),this.initiator=ot,this.s=it,this.e=st,this.rs=at,this.re=ct}writeE(){if(this.e)throw new Error("ephemeral keypair is already set");const et=this.crypto.generateKeypair();return this.ss.mixHash(et.publicKey),this.e=et,et.publicKey}writeS(){if(!this.s)throw new Error("static keypair is not set");return this.ss.encryptAndHash(this.s.publicKey)}writeEE(){if(!this.e)throw new Error("ephemeral keypair is not set");if(!this.re)throw new Error("remote ephemeral public key is not set");this.ss.mixKey(this.crypto.dh(this.e,this.re))}writeES(){if(this.initiator){if(!this.e)throw new Error("ephemeral keypair is not set");if(!this.rs)throw new Error("remote static public key is not set");this.ss.mixKey(this.crypto.dh(this.e,this.rs))}else{if(!this.s)throw new Error("static keypair is not set");if(!this.re)throw new Error("remote ephemeral public key is not set");this.ss.mixKey(this.crypto.dh(this.s,this.re))}}writeSE(){if(this.initiator){if(!this.s)throw new Error("static keypair is not set");if(!this.re)throw new Error("remote ephemeral public key is not set");this.ss.mixKey(this.crypto.dh(this.s,this.re))}else{if(!this.e)throw new Error("ephemeral keypair is not set");if(!this.rs)throw new Error("remote static public key is not set");this.ss.mixKey(this.crypto.dh(this.e,this.rs))}}readE(et,tt=0){if(this.re)throw new Error("remote ephemeral public key is already set");if(et.byteLength(et==null&&(et=message$1((tt,nt,rt={})=>{if(rt.lengthDelimited!==!1&&nt.fork(),tt.webtransportCerthashes!=null)for(const ot of tt.webtransportCerthashes)nt.uint32(10),nt.bytes(ot);rt.lengthDelimited!==!1&&nt.ldelim()},(tt,nt)=>{const rt={webtransportCerthashes:[]},ot=nt==null?tt.len:tt.pos+nt;for(;tt.pos>>3){case 1:{rt.webtransportCerthashes.push(tt.bytes());break}default:{tt.skipType(it&7);break}}}return rt})),et),o.encode=tt=>encodeMessage(tt,o.codec()),o.decode=tt=>decodeMessage(tt,o.codec())})(NoiseExtensions||(NoiseExtensions={}));var NoiseHandshakePayload;(function(o){let et;o.codec=()=>(et==null&&(et=message$1((tt,nt,rt={})=>{rt.lengthDelimited!==!1&&nt.fork(),tt.identityKey!=null&&tt.identityKey.byteLength>0&&(nt.uint32(10),nt.bytes(tt.identityKey)),tt.identitySig!=null&&tt.identitySig.byteLength>0&&(nt.uint32(18),nt.bytes(tt.identitySig)),tt.extensions!=null&&(nt.uint32(34),NoiseExtensions.codec().encode(tt.extensions,nt)),rt.lengthDelimited!==!1&&nt.ldelim()},(tt,nt)=>{const rt={identityKey:alloc$2(0),identitySig:alloc$2(0)},ot=nt==null?tt.len:tt.pos+nt;for(;tt.pos>>3){case 1:{rt.identityKey=tt.bytes();break}case 2:{rt.identitySig=tt.bytes();break}case 4:{rt.extensions=NoiseExtensions.codec().decode(tt,tt.uint32());break}default:{tt.skipType(it&7);break}}}return rt})),et),o.encode=tt=>encodeMessage(tt,o.codec()),o.decode=tt=>decodeMessage(tt,o.codec())})(NoiseHandshakePayload||(NoiseHandshakePayload={}));async function createHandshakePayload(o,et,tt){const nt=await o.sign(getSignaturePayload(et));return NoiseHandshakePayload.encode({identityKey:publicKeyToProtobuf(o.publicKey),identitySig:nt,extensions:tt})}async function decodeHandshakePayload(o,et,tt){try{const nt=NoiseHandshakePayload.decode(o),rt=publicKeyFromProtobuf(nt.identityKey);if((tt==null?void 0:tt.equals(rt))===!1)throw new Error(`Payload identity key ${rt} does not match expected remote identity key ${tt}`);if(!et)throw new Error("Remote static does not exist");const ot=getSignaturePayload(et);if(!await rt.verify(ot,nt.identitySig))throw new Error("Invalid payload signature");return nt}catch(nt){throw new UnexpectedPeerError(nt.message)}}function getSignaturePayload(o){const et=fromString("noise-libp2p-static-key:");return o instanceof Uint8Array?concat$1([et,o],et.length+o.length):(o.prepend(et),o)}async function performHandshakeInitiator(o,et){const{log:tt,connection:nt,crypto:rt,privateKey:ot,prologue:it,s:st,remoteIdentityKey:at,extensions:ct}=o,lt=await createHandshakePayload(ot,st.publicKey,ct),dt=new XXHandshakeState({crypto:rt,protocolName:"Noise_XX_25519_ChaChaPoly_SHA256",initiator:!0,prologue:it,s:st});logLocalStaticKeys(dt.s,tt),tt.trace("Stage 0 - Initiator starting to send first message."),await nt.write(dt.writeMessageA(ZEROLEN),et),tt.trace("Stage 0 - Initiator finished sending first message."),logLocalEphemeralKeys(dt.e,tt),tt.trace("Stage 1 - Initiator waiting to receive first message from responder...");const ht=dt.readMessageB(await nt.read(et));tt.trace("Stage 1 - Initiator received the message."),logRemoteEphemeralKey(dt.re,tt),logRemoteStaticKey(dt.rs,tt),tt.trace("Initiator going to check remote's signature...");const pt=await decodeHandshakePayload(ht,dt.rs,at);tt.trace("All good with the signature!"),tt.trace("Stage 2 - Initiator sending third handshake message."),await nt.write(dt.writeMessageC(lt),et),tt.trace("Stage 2 - Initiator sent message with signed payload.");const[mt,ft]=dt.ss.split();return logCipherState(mt,ft,tt),{payload:pt,encrypt:yt=>mt.encryptWithAd(ZEROLEN,yt),decrypt:(yt,gt)=>ft.decryptWithAd(ZEROLEN,yt,gt)}}async function performHandshakeResponder(o,et){const{log:tt,connection:nt,crypto:rt,privateKey:ot,prologue:it,s:st,remoteIdentityKey:at,extensions:ct}=o,lt=await createHandshakePayload(ot,st.publicKey,ct),dt=new XXHandshakeState({crypto:rt,protocolName:"Noise_XX_25519_ChaChaPoly_SHA256",initiator:!1,prologue:it,s:st});logLocalStaticKeys(dt.s,tt),tt.trace("Stage 0 - Responder waiting to receive first message."),dt.readMessageA(await nt.read(et)),tt.trace("Stage 0 - Responder received first message."),logRemoteEphemeralKey(dt.re,tt),tt.trace("Stage 1 - Responder sending out first message with signed payload and static key."),await nt.write(dt.writeMessageB(lt),et),tt.trace("Stage 1 - Responder sent the second handshake message with signed payload."),logLocalEphemeralKeys(dt.e,tt),tt.trace("Stage 2 - Responder waiting for third handshake message...");const ht=dt.readMessageC(await nt.read(et));tt.trace("Stage 2 - Responder received the message, finished handshake.");const pt=await decodeHandshakePayload(ht,dt.rs,at),[mt,ft]=dt.ss.split();return logCipherState(mt,ft,tt),{payload:pt,encrypt:yt=>ft.encryptWithAd(ZEROLEN,yt),decrypt:(yt,gt)=>mt.decryptWithAd(ZEROLEN,yt,gt)}}const CHACHA_TAG_LENGTH=16;function encryptStream(o,et){return async function*(tt){for await(const nt of tt)for(let rt=0;rtnt.length&&(ot=nt.length);let it;nt instanceof Uint8Array?it=o.encrypt(nt.subarray(rt,ot)):it=o.encrypt(nt.sublist(rt,ot)),et==null||et.encryptedPackets.increment(),yield new Uint8ArrayList(uint16BEEncode(it.byteLength),it)}}}function decryptStream(o,et){return async function*(tt){for await(const nt of tt)for(let rt=0;rtnt.length&&(ot=nt.length),ot-CHACHA_TAG_LENGTHdecode$5(it,{lengthDecoder:uint16BEDecode}),decryptStream(tt,this.metrics),nt),rt}}function noise(o={}){return et=>new Noise(et,o)}const peerDiscoverySymbol$1=Symbol.for("@libp2p/peer-discovery");function setMaxListeners$7(){}const setMaxListeners$6=(o,...et)=>{try{[...et]}catch{}};var Yn,$a;let TypedEventEmitter$2=($a=class extends EventTarget{constructor(){super();fn(this,Yn,new Map);setMaxListeners$6(1/0,this)}listenerCount(tt){const nt=Mt(this,Yn).get(tt);return nt==null?0:nt.length}addEventListener(tt,nt,rt){super.addEventListener(tt,nt,rt);let ot=Mt(this,Yn).get(tt);ot==null&&(ot=[],Mt(this,Yn).set(tt,ot)),ot.push({callback:nt,once:(rt!==!0&&rt!==!1&&(rt==null?void 0:rt.once))??!1})}removeEventListener(tt,nt,rt){super.removeEventListener(tt.toString(),nt??null,rt);let ot=Mt(this,Yn).get(tt);ot!=null&&(ot=ot.filter(({callback:it})=>it!==nt),Mt(this,Yn).set(tt,ot))}dispatchEvent(tt){const nt=super.dispatchEvent(tt);let rt=Mt(this,Yn).get(tt.type);return rt==null||(rt=rt.filter(({once:ot})=>!ot),Mt(this,Yn).set(tt.type,rt)),nt}safeDispatchEvent(tt,nt={}){return this.dispatchEvent(new CustomEvent(tt,nt))}},Yn=new WeakMap,$a);const serviceCapabilities$4=Symbol.for("@libp2p/service-capabilities"),DNS4=base("dns4"),DNS6=base("dns6"),DNSADDR=base("dnsaddr"),DNS$1=or$1(base("dns"),DNSADDR,DNS4,DNS6),IP=or$1(base("ip4"),base("ip6")),TCP$1=or$1(and$1(IP,base("tcp")),and$1(DNS$1,base("tcp"))),UDP=and$1(IP,base("udp")),UTP=and$1(UDP,base("utp")),QUIC=and$1(UDP,base("quic")),QUICV1=and$1(UDP,base("quic-v1")),_WebSockets$1=or$1(and$1(TCP$1,base("ws")),and$1(DNS$1,base("ws"))),WebSockets$2=or$1(and$1(_WebSockets$1,base("p2p")),_WebSockets$1),_WebSocketsSecure$1=or$1(and$1(TCP$1,base("wss")),and$1(DNS$1,base("wss")),and$1(TCP$1,base("tls"),base("ws")),and$1(DNS$1,base("tls"),base("ws"))),WebSocketsSecure$1=or$1(and$1(_WebSocketsSecure$1,base("p2p")),_WebSocketsSecure$1),HTTP=or$1(and$1(TCP$1,base("http")),and$1(IP,base("http")),and$1(DNS$1,base("http"))),HTTPS=or$1(and$1(TCP$1,base("https")),and$1(IP,base("https")),and$1(DNS$1,base("https"))),_WebRTCDirect$1=and$1(UDP,base("webrtc-direct"),base("certhash")),WebRTCDirect$1=or$1(and$1(_WebRTCDirect$1,base("p2p")),_WebRTCDirect$1),_WebTransport$1=and$1(QUICV1,base("webtransport"),base("certhash"),base("certhash")),WebTransport$1=or$1(and$1(_WebTransport$1,base("p2p")),_WebTransport$1),P2PWebRTCStar=or$1(and$1(WebSockets$2,base("p2p-webrtc-star"),base("p2p")),and$1(WebSocketsSecure$1,base("p2p-webrtc-star"),base("p2p")),and$1(WebSockets$2,base("p2p-webrtc-star")),and$1(WebSocketsSecure$1,base("p2p-webrtc-star"))),P2PWebRTCDirect=or$1(and$1(HTTP,base("p2p-webrtc-direct"),base("p2p")),and$1(HTTPS,base("p2p-webrtc-direct"),base("p2p")),and$1(HTTP,base("p2p-webrtc-direct")),and$1(HTTPS,base("p2p-webrtc-direct"))),Reliable=or$1(_WebSockets$1,_WebSocketsSecure$1,HTTP,HTTPS,P2PWebRTCStar,P2PWebRTCDirect,TCP$1,UTP,QUIC,DNS$1,WebRTCDirect$1,WebTransport$1),_P2P$1=or$1(and$1(Reliable,base("p2p")),P2PWebRTCStar,P2PWebRTCDirect,WebRTCDirect$1,WebTransport$1,base("p2p")),_Circuit$1=or$1(and$1(_P2P$1,base("p2p-circuit"),_P2P$1),and$1(_P2P$1,base("p2p-circuit")),and$1(base("p2p-circuit"),_P2P$1),and$1(Reliable,base("p2p-circuit")),and$1(base("p2p-circuit"),Reliable),base("p2p-circuit")),CircuitRecursive=()=>or$1(and$1(_Circuit$1,CircuitRecursive),_Circuit$1),Circuit$1=CircuitRecursive(),P2P=or$1(and$1(Circuit$1,_P2P$1,Circuit$1),and$1(_P2P$1,Circuit$1),and$1(Circuit$1,_P2P$1),Circuit$1,_P2P$1);function makeMatchesFunction(o){function et(tt){let nt;try{nt=multiaddr(tt)}catch{return!1}const rt=o(nt.protoNames());return rt===null?!1:rt===!0||rt===!1?rt:rt.length===0}return et}function and$1(...o){function et(tt){if(tt.length(nt=typeof rt=="function"?rt().partialMatch(tt):rt.partialMatch(tt),Array.isArray(nt)&&(tt=nt),nt===null)),nt}return{toString:function(){return"{ "+o.join(" ")+" }"},input:o,matches:makeMatchesFunction(et),partialMatch:et}}function or$1(...o){function et(nt){let rt=null;return o.some(ot=>{const it=typeof ot=="function"?ot().partialMatch(nt):ot.partialMatch(nt);return it!=null?(rt=it,!0):!1}),rt}return{toString:function(){return"{ "+o.join(" ")+" }"},input:o,matches:makeMatchesFunction(et),partialMatch:et}}function base(o){const et=o;function tt(rt){let ot;try{ot=multiaddr(rt)}catch{return!1}const it=ot.protoNames();return it.length===1&&it[0]===et}function nt(rt){return rt.length===0?null:rt[0]===et?rt.slice(1):null}return{toString:function(){return et},matches:tt,partialMatch:nt}}const DEFAULT_BOOTSTRAP_TAG_NAME$1="bootstrap",DEFAULT_BOOTSTRAP_TAG_VALUE$1=50,DEFAULT_BOOTSTRAP_DISCOVERY_TIMEOUT=1e3;var _c,yl,xl,El;class Bootstrap extends(El=TypedEventEmitter$2,xl=peerDiscoverySymbol$1,yl=Symbol.toStringTag,_c=serviceCapabilities$4,El){constructor(tt,nt={list:[]}){if(nt.list==null||nt.list.length===0)throw new Error("Bootstrap requires a list of peer addresses");super();Ct(this,"log");Ct(this,"timer");Ct(this,"list");Ct(this,"timeout");Ct(this,"components");Ct(this,"_init");Ct(this,xl,this);Ct(this,yl,"@libp2p/bootstrap");Ct(this,_c,["@libp2p/peer-discovery"]);this.components=tt,this.log=tt.logger.forComponent("libp2p:bootstrap"),this.timeout=nt.timeout??DEFAULT_BOOTSTRAP_DISCOVERY_TIMEOUT,this.list=[];for(const rt of nt.list){if(!P2P.matches(rt)){this.log.error("Invalid multiaddr");continue}const ot=multiaddr(rt),it=ot.getPeerId();if(it==null){this.log.error("Invalid bootstrap multiaddr without peer id");continue}const st={id:peerIdFromString$1(it),multiaddrs:[ot]};this.list.push(st)}this._init=nt}isStarted(){return!!this.timer}start(){this.isStarted()||(this.log("Starting bootstrap node discovery, discovering peers after %s ms",this.timeout),this.timer=setTimeout(()=>{this._discoverBootstrapPeers().catch(tt=>{this.log.error(tt)})},this.timeout))}async _discoverBootstrapPeers(){if(this.timer!=null)for(const tt of this.list){if(await this.components.peerStore.merge(tt.id,{tags:{[this._init.tagName??DEFAULT_BOOTSTRAP_TAG_NAME$1]:{value:this._init.tagValue??DEFAULT_BOOTSTRAP_TAG_VALUE$1,ttl:this._init.tagTTL}},multiaddrs:tt.multiaddrs}),this.timer==null)return;this.safeDispatchEvent("peer",{detail:tt}),this.components.connectionManager.openConnection(tt.id).catch(nt=>{this.log.error("could not dial bootstrap peer %p",tt.id,nt)})}}stop(){this.timer!=null&&clearTimeout(this.timer),this.timer=void 0}}Ct(Bootstrap,"tag","bootstrap");function bootstrap(o){return et=>new Bootstrap(et,o)}var hs;let UnsupportedProtocolError$1=(hs=class extends Error{constructor(et="Unsupported protocol error"){super(et),this.name="UnsupportedProtocolError"}},Ct(hs,"name","UnsupportedProtocolError"),hs);var ps;let InvalidMessageError$2=(ps=class extends Error{constructor(et="Invalid message"){super(et),this.name="InvalidMessageError"}},Ct(ps,"name","InvalidMessageError"),ps);function setMaxListeners$5(){}const setMaxListeners$4=(o,...et)=>{try{[...et]}catch{}},serviceCapabilities$3=Symbol.for("@libp2p/service-capabilities");var Envelope;(function(o){let et;o.codec=()=>(et==null&&(et=message$1((tt,nt,rt={})=>{rt.lengthDelimited!==!1&&nt.fork(),tt.publicKey!=null&&tt.publicKey.byteLength>0&&(nt.uint32(10),nt.bytes(tt.publicKey)),tt.payloadType!=null&&tt.payloadType.byteLength>0&&(nt.uint32(18),nt.bytes(tt.payloadType)),tt.payload!=null&&tt.payload.byteLength>0&&(nt.uint32(26),nt.bytes(tt.payload)),tt.signature!=null&&tt.signature.byteLength>0&&(nt.uint32(42),nt.bytes(tt.signature)),rt.lengthDelimited!==!1&&nt.ldelim()},(tt,nt,rt={})=>{const ot={publicKey:alloc$2(0),payloadType:alloc$2(0),payload:alloc$2(0),signature:alloc$2(0)},it=nt==null?tt.len:tt.pos+nt;for(;tt.pos>>3){case 1:{ot.publicKey=tt.bytes();break}case 2:{ot.payloadType=tt.bytes();break}case 3:{ot.payload=tt.bytes();break}case 5:{ot.signature=tt.bytes();break}default:{tt.skipType(st&7);break}}}return ot})),et),o.encode=tt=>encodeMessage(tt,o.codec()),o.decode=(tt,nt)=>decodeMessage(tt,o.codec(),nt)})(Envelope||(Envelope={}));class InvalidSignatureError extends Error{constructor(et="Invalid signature"){super(et),this.name="InvalidSignatureError"}}const cr=class cr{constructor(et){Ct(this,"publicKey");Ct(this,"payloadType");Ct(this,"payload");Ct(this,"signature");Ct(this,"marshaled");const{publicKey:tt,payloadType:nt,payload:rt,signature:ot}=et;this.publicKey=tt,this.payloadType=nt,this.payload=rt,this.signature=ot}marshal(){return this.marshaled==null&&(this.marshaled=Envelope.encode({publicKey:publicKeyToProtobuf(this.publicKey),payloadType:this.payloadType,payload:this.payload.subarray(),signature:this.signature})),this.marshaled}equals(et){return equals(this.marshal(),et.marshal())}async validate(et){const tt=formatSignaturePayload(et,this.payloadType,this.payload);return this.publicKey.verify(tt.subarray(),this.signature)}};Ct(cr,"createFromProtobuf",async et=>{const tt=Envelope.decode(et),nt=publicKeyFromProtobuf(tt.publicKey);return new cr({publicKey:nt,payloadType:tt.payloadType,payload:tt.payload,signature:tt.signature})}),Ct(cr,"seal",async(et,tt)=>{if(tt==null)throw new Error("Missing private key");const nt=et.domain,rt=et.codec,ot=et.marshal(),it=formatSignaturePayload(nt,rt,ot),st=await tt.sign(it.subarray());return new cr({publicKey:tt.publicKey,payloadType:rt,payload:ot,signature:st})}),Ct(cr,"openAndCertify",async(et,tt)=>{const nt=await cr.createFromProtobuf(et);if(!await nt.validate(tt))throw new InvalidSignatureError("Envelope signature is not valid for the given domain");return nt});let RecordEnvelope=cr;const formatSignaturePayload=(o,et,tt)=>{const nt=fromString(o),rt=encode$a(nt.byteLength),ot=encode$a(et.length),it=encode$a(tt.length);return new Uint8ArrayList(rt,nt,ot,et,it,tt)};function arrayEquals(o,et){const tt=(nt,rt)=>nt.toString().localeCompare(rt.toString());return o.length!==et.length?!1:(et.sort(tt),o.sort(tt).every((nt,rt)=>et[rt].equals(nt)))}const ENVELOPE_DOMAIN_PEER_RECORD="libp2p-peer-record",ENVELOPE_PAYLOAD_TYPE_PEER_RECORD=Uint8Array.from([3,1]);var PeerRecord$1;(function(o){(function(tt){let nt;tt.codec=()=>(nt==null&&(nt=message$1((rt,ot,it={})=>{it.lengthDelimited!==!1&&ot.fork(),rt.multiaddr!=null&&rt.multiaddr.byteLength>0&&(ot.uint32(10),ot.bytes(rt.multiaddr)),it.lengthDelimited!==!1&&ot.ldelim()},(rt,ot,it={})=>{const st={multiaddr:alloc$2(0)},at=ot==null?rt.len:rt.pos+ot;for(;rt.pos>>3){case 1:{st.multiaddr=rt.bytes();break}default:{rt.skipType(ct&7);break}}}return st})),nt),tt.encode=rt=>encodeMessage(rt,tt.codec()),tt.decode=(rt,ot)=>decodeMessage(rt,tt.codec(),ot)})(o.AddressInfo||(o.AddressInfo={}));let et;o.codec=()=>(et==null&&(et=message$1((tt,nt,rt={})=>{if(rt.lengthDelimited!==!1&&nt.fork(),tt.peerId!=null&&tt.peerId.byteLength>0&&(nt.uint32(10),nt.bytes(tt.peerId)),tt.seq!=null&&tt.seq!==0n&&(nt.uint32(16),nt.uint64(tt.seq)),tt.addresses!=null)for(const ot of tt.addresses)nt.uint32(26),o.AddressInfo.codec().encode(ot,nt);rt.lengthDelimited!==!1&&nt.ldelim()},(tt,nt,rt={})=>{var st,at;const ot={peerId:alloc$2(0),seq:0n,addresses:[]},it=nt==null?tt.len:tt.pos+nt;for(;tt.pos>>3){case 1:{ot.peerId=tt.bytes();break}case 2:{ot.seq=tt.uint64();break}case 3:{if(((st=rt.limits)==null?void 0:st.addresses)!=null&&ot.addresses.length===rt.limits.addresses)throw new MaxLengthError('Decode error - map field "addresses" had too many elements');ot.addresses.push(o.AddressInfo.codec().decode(tt,tt.uint32(),{limits:(at=rt.limits)==null?void 0:at.addresses$}));break}default:{tt.skipType(ct&7);break}}}return ot})),et),o.encode=tt=>encodeMessage(tt,o.codec()),o.decode=(tt,nt)=>decodeMessage(tt,o.codec(),nt)})(PeerRecord$1||(PeerRecord$1={}));const nr=class nr{constructor(et){Ct(this,"peerId");Ct(this,"multiaddrs");Ct(this,"seqNumber");Ct(this,"domain",nr.DOMAIN);Ct(this,"codec",nr.CODEC);Ct(this,"marshaled");const{peerId:tt,multiaddrs:nt,seqNumber:rt}=et;this.peerId=tt,this.multiaddrs=nt??[],this.seqNumber=rt??BigInt(Date.now())}marshal(){return this.marshaled==null&&(this.marshaled=PeerRecord$1.encode({peerId:this.peerId.toMultihash().bytes,seq:BigInt(this.seqNumber),addresses:this.multiaddrs.map(et=>({multiaddr:et.bytes}))})),this.marshaled}equals(et){return!(!(et instanceof nr)||!this.peerId.equals(et.peerId)||this.seqNumber!==et.seqNumber||!arrayEquals(this.multiaddrs,et.multiaddrs))}};Ct(nr,"createFromProtobuf",et=>{const tt=PeerRecord$1.decode(et),nt=peerIdFromMultihash(decode$6(tt.peerId)),rt=(tt.addresses??[]).map(it=>multiaddr(it.multiaddr)),ot=tt.seq;return new nr({peerId:nt,multiaddrs:rt,seqNumber:ot})}),Ct(nr,"DOMAIN",ENVELOPE_DOMAIN_PEER_RECORD),Ct(nr,"CODEC",ENVELOPE_PAYLOAD_TYPE_PEER_RECORD);let PeerRecord=nr;function isAsyncIterable$4(o){return o[Symbol.asyncIterator]!=null}function drain(o){if(isAsyncIterable$4(o))return(async()=>{for await(const et of o);})();for(const et of o);}const CustomEvent$1=globalThis.CustomEvent??Event;async function*parallel(o,et={}){let tt=et.concurrency??1/0;tt<1&&(tt=1/0);const nt=et.ordered==null?!1:et.ordered,rt=new EventTarget,ot=[];let it=pDefer(),st=pDefer(),at=!1,ct,lt=!1;rt.addEventListener("task-complete",()=>{st.resolve()}),Promise.resolve().then(async()=>{try{for await(const mt of o){if(ot.length===tt&&(it=pDefer(),await it.promise),lt)break;const ft={done:!1};ot.push(ft),mt().then(yt=>{ft.done=!0,ft.ok=!0,ft.value=yt,rt.dispatchEvent(new CustomEvent$1("task-complete"))},yt=>{ft.done=!0,ft.err=yt,rt.dispatchEvent(new CustomEvent$1("task-complete"))})}at=!0,rt.dispatchEvent(new CustomEvent$1("task-complete"))}catch(mt){ct=mt,rt.dispatchEvent(new CustomEvent$1("task-complete"))}});function dt(){var mt;return nt?(mt=ot[0])==null?void 0:mt.done:!!ot.find(ft=>ft.done)}function*ht(){for(;ot.length>0&&ot[0].done;){const mt=ot[0];if(ot.shift(),mt.ok)yield mt.value;else throw lt=!0,it.resolve(),mt.err;it.resolve()}}function*pt(){for(;dt();)for(let mt=0;mt{const it=await tt.read(ot);return rt.decode(it)},write:async(rt,ot,it)=>{await tt.write(ot.encode(rt),it)},writeV:async(rt,ot,it)=>{await tt.writeV(rt.map(st=>ot.encode(st)),it)},pb:rt=>({read:async ot=>nt.read(rt,ot),write:async(ot,it)=>nt.write(ot,rt,it),writeV:async(ot,it)=>nt.writeV(ot,rt,it),unwrap:()=>nt}),unwrap:()=>tt.unwrap()};return nt}const IDENTIFY_PROTOCOL_VERSION="0.1.0",MULTICODEC_IDENTIFY_PROTOCOL_NAME="id",MULTICODEC_IDENTIFY_PROTOCOL_VERSION="1.0.0",MAX_IDENTIFY_MESSAGE_SIZE=1024*8,MAX_PUSH_CONCURRENCY=32;var Identify$1;(function(o){let et;o.codec=()=>(et==null&&(et=message$1((tt,nt,rt={})=>{if(rt.lengthDelimited!==!1&&nt.fork(),tt.protocolVersion!=null&&(nt.uint32(42),nt.string(tt.protocolVersion)),tt.agentVersion!=null&&(nt.uint32(50),nt.string(tt.agentVersion)),tt.publicKey!=null&&(nt.uint32(10),nt.bytes(tt.publicKey)),tt.listenAddrs!=null)for(const ot of tt.listenAddrs)nt.uint32(18),nt.bytes(ot);if(tt.observedAddr!=null&&(nt.uint32(34),nt.bytes(tt.observedAddr)),tt.protocols!=null)for(const ot of tt.protocols)nt.uint32(26),nt.string(ot);tt.signedPeerRecord!=null&&(nt.uint32(66),nt.bytes(tt.signedPeerRecord)),rt.lengthDelimited!==!1&&nt.ldelim()},(tt,nt,rt={})=>{var st,at;const ot={listenAddrs:[],protocols:[]},it=nt==null?tt.len:tt.pos+nt;for(;tt.pos>>3){case 5:{ot.protocolVersion=tt.string();break}case 6:{ot.agentVersion=tt.string();break}case 1:{ot.publicKey=tt.bytes();break}case 2:{if(((st=rt.limits)==null?void 0:st.listenAddrs)!=null&&ot.listenAddrs.length===rt.limits.listenAddrs)throw new MaxLengthError('Decode error - map field "listenAddrs" had too many elements');ot.listenAddrs.push(tt.bytes());break}case 4:{ot.observedAddr=tt.bytes();break}case 3:{if(((at=rt.limits)==null?void 0:at.protocols)!=null&&ot.protocols.length===rt.limits.protocols)throw new MaxLengthError('Decode error - map field "protocols" had too many elements');ot.protocols.push(tt.string());break}case 8:{ot.signedPeerRecord=tt.bytes();break}default:{tt.skipType(ct&7);break}}}return ot})),et),o.encode=tt=>encodeMessage(tt,o.codec()),o.decode=(tt,nt)=>decodeMessage(tt,o.codec(),nt)})(Identify$1||(Identify$1={}));var define_process_default={env:{NODE_ENV:'"production"',VITE_WALLETCONNECT_PROJECT_ID:'"1d93edc21291f98e3bed6ff7617ff539"'},nextTick:"setImmediate",platform:'"browser"',version:'"v16.0.0"',browser:!0};function isElectron$1(){return!!(typeof window<"u"&&typeof window.process=="object"&&window.process.type==="renderer"||typeof define_process_default<"u"&&typeof define_process_default.versions=="object"&&define_process_default.versions.electron||typeof navigator=="object"&&typeof navigator.userAgent=="string"&&navigator.userAgent.indexOf("Electron")>=0)}var isElectron_1=isElectron$1;const detectElectron=getDefaultExportFromCjs(isElectron_1),isEnvWithDom=typeof window=="object"&&typeof document=="object"&&document.nodeType===9,isElectron=detectElectron(),isBrowser=isEnvWithDom&&!isElectron,isElectronMain=isElectron&&!isEnvWithDom,isElectronRenderer=isElectron&&isEnvWithDom,isNode=typeof globalThis.process<"u"&&typeof globalThis.process.release<"u"&&globalThis.process.release.name==="node"&&!isElectron,isWebWorker=typeof importScripts=="function"&&typeof self<"u"&&typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope,isReactNative=typeof navigator<"u"&&navigator.product==="ReactNative",defaultValues={protocolPrefix:"ipfs",timeout:5e3,maxInboundStreams:1,maxOutboundStreams:1,maxObservedAddresses:10,maxMessageSize:MAX_IDENTIFY_MESSAGE_SIZE,runOnConnectionOpen:!0,runOnSelfUpdate:!0,runOnLimitedConnection:!0,concurrency:MAX_PUSH_CONCURRENCY};function getCleanMultiaddr(o){if(o!=null&&o.length>0)try{return multiaddr(o)}catch{}}function getAgentVersion(o,et){return et!=null||(et=`${o.name}/${o.version}`,isNode||isElectronMain?et+=` UserAgent=${globalThis.process.version}`:(isBrowser||isWebWorker||isElectronRenderer||isReactNative)&&(et+=` UserAgent=${globalThis.navigator.userAgent}`)),et}async function consumeIdentifyMessage(o,et,tt,nt,rt){if(tt("received identify from %p",nt.remotePeer),rt==null)throw new InvalidMessageError$2("message was null or undefined");const ot={};if(rt.listenAddrs.length>0&&(ot.addresses=rt.listenAddrs.map(at=>({isCertified:!1,multiaddr:multiaddr(at)}))),rt.protocols.length>0&&(ot.protocols=rt.protocols),rt.publicKey!=null){const at=publicKeyFromProtobuf(rt.publicKey);if(!peerIdFromPublicKey(at).equals(nt.remotePeer))throw new InvalidMessageError$2("public key did not match remote PeerId");ot.publicKey=at}let it;if(rt.signedPeerRecord!=null){tt.trace("received signedPeerRecord from %p",nt.remotePeer);let at=rt.signedPeerRecord;const ct=await RecordEnvelope.openAndCertify(at,PeerRecord.DOMAIN);let lt=PeerRecord.createFromProtobuf(ct.payload);const dt=peerIdFromCID(ct.publicKey.toCID());if(!lt.peerId.equals(dt))throw new InvalidMessageError$2("signing key does not match PeerId in the PeerRecord");if(!nt.remotePeer.equals(lt.peerId))throw new InvalidMessageError$2("signing key does not match remote PeerId");let ht;try{ht=await o.get(lt.peerId)}catch(pt){if(pt.name!=="NotFoundError")throw pt}if(ht!=null&&(ot.metadata=ht.metadata,ht.peerRecordEnvelope!=null)){const pt=await RecordEnvelope.createFromProtobuf(ht.peerRecordEnvelope),mt=PeerRecord.createFromProtobuf(pt.payload);mt.seqNumber>=lt.seqNumber&&(tt("sequence number was lower or equal to existing sequence number - stored: %d received: %d",mt.seqNumber,lt.seqNumber),lt=mt,at=ht.peerRecordEnvelope)}ot.peerRecordEnvelope=at,ot.addresses=lt.multiaddrs.map(pt=>({isCertified:!0,multiaddr:pt})),it={seq:lt.seqNumber,addresses:lt.multiaddrs}}else tt("%p did not send a signed peer record",nt.remotePeer);if(tt.trace("patching %p with",nt.remotePeer,ot),await o.patch(nt.remotePeer,ot),rt.agentVersion!=null||rt.protocolVersion!=null){const at={};rt.agentVersion!=null&&(at.AgentVersion=fromString(rt.agentVersion)),rt.protocolVersion!=null&&(at.ProtocolVersion=fromString(rt.protocolVersion)),tt.trace("merging %p metadata",nt.remotePeer,at),await o.merge(nt.remotePeer,{metadata:at})}const st={peerId:nt.remotePeer,protocolVersion:rt.protocolVersion,agentVersion:rt.agentVersion,publicKey:rt.publicKey,listenAddrs:rt.listenAddrs.map(at=>multiaddr(at)),observedAddr:rt.observedAddr==null?void 0:multiaddr(rt.observedAddr),protocols:rt.protocols,signedPeerRecord:it,connection:nt};return et.safeDispatchEvent("peer:identify",{detail:st}),st}class AbstractIdentify{constructor(et,tt){Ct(this,"host");Ct(this,"protocol");Ct(this,"started");Ct(this,"timeout");Ct(this,"peerId");Ct(this,"privateKey");Ct(this,"peerStore");Ct(this,"registrar");Ct(this,"addressManager");Ct(this,"maxInboundStreams");Ct(this,"maxOutboundStreams");Ct(this,"maxMessageSize");Ct(this,"maxObservedAddresses");Ct(this,"events");Ct(this,"runOnLimitedConnection");Ct(this,"log");this.protocol=tt.protocol,this.started=!1,this.peerId=et.peerId,this.privateKey=et.privateKey,this.peerStore=et.peerStore,this.registrar=et.registrar,this.addressManager=et.addressManager,this.events=et.events,this.log=tt.log,this.timeout=tt.timeout??defaultValues.timeout,this.maxInboundStreams=tt.maxInboundStreams??defaultValues.maxInboundStreams,this.maxOutboundStreams=tt.maxOutboundStreams??defaultValues.maxOutboundStreams,this.maxMessageSize=tt.maxMessageSize??defaultValues.maxMessageSize,this.maxObservedAddresses=tt.maxObservedAddresses??defaultValues.maxObservedAddresses,this.runOnLimitedConnection=tt.runOnLimitedConnection??defaultValues.runOnLimitedConnection,this.host={protocolVersion:`${tt.protocolPrefix??defaultValues.protocolPrefix}/${IDENTIFY_PROTOCOL_VERSION}`,agentVersion:getAgentVersion(et.nodeInfo,tt.agentVersion)}}isStarted(){return this.started}async start(){this.started||(await this.peerStore.merge(this.peerId,{metadata:{AgentVersion:fromString(this.host.agentVersion),ProtocolVersion:fromString(this.host.protocolVersion)}}),await this.registrar.handle(this.protocol,et=>{this.handleProtocol(et).catch(tt=>{this.log.error(tt)})},{maxInboundStreams:this.maxInboundStreams,maxOutboundStreams:this.maxOutboundStreams,runOnLimitedConnection:this.runOnLimitedConnection}),this.started=!0)}async stop(){await this.registrar.unhandle(this.protocol),this.started=!1}}var Netmask_1;(function(){var o,et,tt,nt,rt,ot,it,st;st=function(at){var ct,lt,dt,ht;return ct=(at&255<<24)>>>24,lt=(at&255<<16)>>>16,dt=(at&65280)>>>8,ht=at&255,[ct,lt,dt,ht].join(".")},it=function(at){var ct,lt,dt,ht,pt,mt;for(ct=[],dt=ht=0;ht<=3&&at.length!==0;dt=++ht){if(dt>0){if(at[0]!==".")throw new Error("Invalid IP");at=at.substring(1)}mt=et(at),pt=mt[0],lt=mt[1],at=at.substring(lt),ct.push(pt)}if(at.length!==0)throw new Error("Invalid IP");switch(ct.length){case 1:if(ct[0]>4294967295)throw new Error("Invalid IP");return ct[0]>>>0;case 2:if(ct[0]>255||ct[1]>16777215)throw new Error("Invalid IP");return(ct[0]<<24|ct[1])>>>0;case 3:if(ct[0]>255||ct[1]>255||ct[2]>65535)throw new Error("Invalid IP");return(ct[0]<<24|ct[1]<<16|ct[2])>>>0;case 4:if(ct[0]>255||ct[1]>255||ct[2]>255||ct[3]>255)throw new Error("Invalid IP");return(ct[0]<<24|ct[1]<<16|ct[2]<<8|ct[3])>>>0;default:throw new Error("Invalid IP")}},tt=function(at){return at.charCodeAt(0)},nt=tt("0"),ot=tt("a"),rt=tt("A"),et=function(at){var ct,lt,dt,ht,pt;for(ht=0,ct=10,lt="9",dt=0,at.length>1&&at[dt]==="0"&&(at[dt+1]==="x"||at[dt+1]==="X"?(dt+=2,ct=16):"0"<=at[dt+1]&&at[dt+1]<="9"&&(dt++,ct=8,lt="7")),pt=dt;dt>>0;else if(ct===16)if("a"<=at[dt]&&at[dt]<="f")ht=ht*ct+(10+tt(at[dt])-ot)>>>0;else if("A"<=at[dt]&&at[dt]<="F")ht=ht*ct+(10+tt(at[dt])-rt)>>>0;else break;else break;if(ht>4294967295)throw new Error("too large");dt++}if(dt===pt)throw new Error("empty octet");return[ht,dt]},o=function(){function at(ct,lt){var dt,ht,pt;if(typeof ct!="string")throw new Error("Missing `net' parameter");if(lt||(pt=ct.split("/",2),ct=pt[0],lt=pt[1]),lt||(lt=32),typeof lt=="string"&<.indexOf(".")>-1){try{this.maskLong=it(lt)}catch{throw new Error("Invalid mask: "+lt)}for(dt=ht=32;ht>=0;dt=--ht)if(this.maskLong===4294967295<<32-dt>>>0){this.bitmask=dt;break}}else if(lt||lt===0)this.bitmask=parseInt(lt,10),this.maskLong=0,this.bitmask>0&&(this.maskLong=4294967295<<32-this.bitmask>>>0);else throw new Error("Invalid mask: empty");try{this.netLong=(it(ct)&this.maskLong)>>>0}catch{throw new Error("Invalid net address: "+ct)}if(!(this.bitmask<=32))throw new Error("Invalid mask for ip4: "+lt);this.size=Math.pow(2,32-this.bitmask),this.base=st(this.netLong),this.mask=st(this.maskLong),this.hostmask=st(~this.maskLong),this.first=this.bitmask<=30?st(this.netLong+1):this.base,this.last=this.bitmask<=30?st(this.netLong+this.size-2):st(this.netLong+this.size-1),this.broadcast=this.bitmask<=30?st(this.netLong+this.size-1):void 0}return at.prototype.contains=function(ct){return typeof ct=="string"&&(ct.indexOf("/")>0||ct.split(".").length!==4)&&(ct=new at(ct)),ct instanceof at?this.contains(ct.base)&&this.contains(ct.broadcast||ct.last):(it(ct)&this.maskLong)>>>0===(this.netLong&this.maskLong)>>>0},at.prototype.next=function(ct){return ct==null&&(ct=1),new at(st(this.netLong+this.size*ct),this.mask)},at.prototype.forEach=function(ct){var lt,dt,ht;for(ht=it(this.first),dt=it(this.last),lt=0;ht<=dt;)ct(st(ht),ht,lt),lt++,ht++},at.prototype.toString=function(){return this.base+"/"+this.bitmask},at}(),Netmask_1=o}).call(commonjsGlobal);const PRIVATE_IP_RANGES=["0.0.0.0/8","10.0.0.0/8","100.64.0.0/10","127.0.0.0/8","169.254.0.0/16","172.16.0.0/12","192.0.0.0/24","192.0.0.0/29","192.0.0.8/32","192.0.0.9/32","192.0.0.10/32","192.0.0.170/32","192.0.0.171/32","192.0.2.0/24","192.31.196.0/24","192.52.193.0/24","192.88.99.0/24","192.168.0.0/16","192.175.48.0/24","198.18.0.0/15","198.51.100.0/24","203.0.113.0/24","240.0.0.0/4","255.255.255.255/32"],NETMASK_RANGES=PRIVATE_IP_RANGES.map(o=>new Netmask_1(o));function ipv4Check(o){for(const et of NETMASK_RANGES)if(et.contains(o))return!0;return!1}function isIpv4MappedIpv6(o){return/^::ffff:([0-9a-fA-F]{1,4}):([0-9a-fA-F]{1,4})$/.test(o)}function ipv4MappedIpv6Check(o){const et=o.split(":");if(et.length<2)return!1;const tt=et[et.length-1].padStart(4,"0"),nt=et[et.length-2].padStart(4,"0"),rt=`${parseInt(nt.substring(0,2),16)}.${parseInt(nt.substring(2),16)}.${parseInt(tt.substring(0,2),16)}.${parseInt(tt.substring(2),16)}`;return ipv4Check(rt)}function isIpv4EmbeddedIpv6(o){return/^::ffff:([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})$/.test(o)}function ipv4EmbeddedIpv6Check(o){const et=o.split(":"),tt=et[et.length-1];return ipv4Check(tt)}function ipv6Check(o){return/^::$/.test(o)||/^::1$/.test(o)||/^64:ff9b::([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})\.([0-9]{1,3})$/.test(o)||/^100::([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4})$/.test(o)||/^2001::([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4})$/.test(o)||/^2001:2[0-9a-fA-F]:([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4})$/.test(o)||/^2001:db8:([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4})$/.test(o)||/^2002:([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4}):?([0-9a-fA-F]{0,4})$/.test(o)||/^f[c-d]([0-9a-fA-F]{2,2}):/i.test(o)||/^fe[8-9a-bA-B][0-9a-fA-F]:/i.test(o)||/^ff([0-9a-fA-F]{2,2}):/i.test(o)}function isPrivateIp(o){return isIPv4(o)?ipv4Check(o):isIpv4MappedIpv6(o)?ipv4MappedIpv6Check(o):isIpv4EmbeddedIpv6(o)?ipv4EmbeddedIpv6Check(o):isIPv6(o)?ipv6Check(o):void 0}const toParts=o=>o.toString().split("/").slice(1),func=o=>({match:et=>et.length<1?!1:o(et[0])?et.slice(1):!1,pattern:"fn"}),literal=o=>({match:et=>func(tt=>tt===o).match(et),pattern:o}),string$3=()=>({match:o=>func(et=>typeof et=="string").match(o),pattern:"{string}"}),number$1=()=>({match:o=>func(et=>!isNaN(parseInt(et))).match(o),pattern:"{number}"}),peerId=()=>({match:o=>{if(o.length<2||o[0]!=="p2p"&&o[0]!=="ipfs")return!1;if(o[1].startsWith("Q")||o[1].startsWith("1"))try{base58btc.decode(`z${o[1]}`)}catch{return!1}else return!1;return o.slice(2)},pattern:"/p2p/{peerid}"}),certhash=()=>({match:o=>{if(o.length<2||o[0]!=="certhash")return!1;try{base64url.decode(o[1])}catch{return!1}return o.slice(2)},pattern:"/certhash/{certhash}"}),optional=o=>({match:et=>{const tt=o.match(et);return tt===!1?et:tt},pattern:`optional(${o.pattern})`}),or=(...o)=>({match:et=>{let tt;for(const nt of o){const rt=nt.match(et);rt!==!1&&(tt==null||rt.lengthet.pattern).join(", ")})`}),and=(...o)=>({match:et=>{for(const tt of o){const nt=tt.match(et);if(nt===!1)return!1;et=nt}return et},pattern:`and(${o.map(et=>et.pattern).join(", ")})`});function fmt(...o){function et(rt){let ot=toParts(rt);for(const it of o){const st=it.match(ot);if(st===!1)return!1;ot=st}return ot}function tt(rt){return et(rt)!==!1}function nt(rt){const ot=et(rt);return ot===!1?!1:ot.length===0}return{matchers:o,matches:tt,exactMatch:nt}}const _DNS4=and(literal("dns4"),string$3()),_DNS6=and(literal("dns6"),string$3()),_DNSADDR=and(literal("dnsaddr"),string$3()),_DNS=and(literal("dns"),string$3());fmt(_DNS4,optional(peerId()));fmt(_DNS6,optional(peerId()));fmt(_DNSADDR,optional(peerId()));fmt(or(_DNS,_DNSADDR,_DNS4,_DNS6),optional(peerId()));const _IP4=and(literal("ip4"),func(isIPv4)),_IP6=and(literal("ip6"),func(isIPv6)),_IP=or(_IP4,_IP6),_IP_OR_DOMAIN=or(_IP,_DNS,_DNS4,_DNS6,_DNSADDR),IP_OR_DOMAIN=fmt(or(_IP,and(or(_DNS,_DNSADDR,_DNS4,_DNS6),optional(peerId())))),_TCP=and(_IP_OR_DOMAIN,literal("tcp"),number$1()),_UDP=and(_IP_OR_DOMAIN,literal("udp"),number$1()),TCP=fmt(and(_TCP,optional(peerId()))),_QUIC=and(_UDP,literal("quic")),_QUICV1=and(_UDP,literal("quic-v1")),QUIC_V0_OR_V1=or(_QUIC,_QUICV1),_WEB=or(_IP_OR_DOMAIN,_TCP,_UDP,_QUIC,_QUICV1),_WebSockets=or(and(_WEB,literal("ws"),optional(peerId()))),WebSockets$1=fmt(_WebSockets),_WebSocketsSecure=or(and(_WEB,literal("wss"),optional(peerId())),and(_WEB,literal("tls"),optional(and(literal("sni"),string$3())),literal("ws"),optional(peerId()))),WebSocketsSecure=fmt(_WebSocketsSecure),_WebRTCDirect=and(_UDP,literal("webrtc-direct"),optional(certhash()),optional(certhash()),optional(peerId())),WebRTCDirect=fmt(_WebRTCDirect),_WebTransport=and(_QUICV1,literal("webtransport"),optional(certhash()),optional(certhash()),optional(peerId())),WebTransport=fmt(_WebTransport),_P2P=or(_WebSockets,_WebSocketsSecure,and(_TCP,optional(peerId())),and(QUIC_V0_OR_V1,optional(peerId())),and(_IP_OR_DOMAIN,optional(peerId())),_WebRTCDirect,_WebTransport,peerId()),_Circuit=and(_P2P,literal("p2p-circuit"),peerId()),Circuit=fmt(_Circuit),_WebRTC=or(and(_P2P,literal("p2p-circuit"),literal("webrtc"),optional(peerId())),and(_P2P,literal("webrtc"),optional(peerId())),and(literal("webrtc"),optional(peerId()))),WebRTC=fmt(_WebRTC);or(and(_IP_OR_DOMAIN,literal("tcp"),number$1(),literal("http"),optional(peerId())),and(_IP_OR_DOMAIN,literal("http"),optional(peerId())));or(and(_IP_OR_DOMAIN,literal("tcp"),or(and(literal("443"),literal("http")),and(number$1(),literal("https"))),optional(peerId())),and(_IP_OR_DOMAIN,literal("tls"),literal("http"),optional(peerId())),and(_IP_OR_DOMAIN,literal("https"),optional(peerId())));or(and(literal("memory"),string$3(),optional(peerId())));var wl,Cl;class Identify extends(Cl=AbstractIdentify,wl=serviceCapabilities$3,Cl){constructor(tt,nt={}){super(tt,{...nt,protocol:`/${nt.protocolPrefix??defaultValues.protocolPrefix}/${MULTICODEC_IDENTIFY_PROTOCOL_NAME}/${MULTICODEC_IDENTIFY_PROTOCOL_VERSION}`,log:tt.logger.forComponent("libp2p:identify")});Ct(this,wl,["@libp2p/identify"]);(nt.runOnConnectionOpen??defaultValues.runOnConnectionOpen)&&tt.events.addEventListener("connection:open",rt=>{const ot=rt.detail;this.identify(ot).catch(it=>{it.name!==UnsupportedProtocolError$1.name&&this.log.error("error during identify trigged by connection:open",it)})})}async _identify(tt,nt={}){let rt;if(nt.signal==null){const ot=AbortSignal.timeout(this.timeout);setMaxListeners$4(1/0,ot),nt={...nt,signal:ot}}try{rt=await tt.newStream(this.protocol,{...nt,runOnLimitedConnection:this.runOnLimitedConnection});const it=await pbStream(rt,{maxDataLength:this.maxMessageSize}).pb(Identify$1).read(nt);return await rt.close(nt),it}catch(ot){throw rt==null||rt.abort(ot),ot}}async identify(tt,nt={}){const rt=await this._identify(tt,nt),{publicKey:ot,protocols:it,observedAddr:st}=rt;if(ot==null)throw new InvalidMessageError$2("public key was missing from identify message");const at=publicKeyFromProtobuf(ot),ct=peerIdFromCID(at.toCID());if(!tt.remotePeer.equals(ct))throw new InvalidMessageError$2("identified peer does not match the expected peer");if(this.peerId.equals(ct))throw new InvalidMessageError$2("identified peer is our own peer id?");const lt=getCleanMultiaddr(st);return this.log("identify completed for peer %p and protocols %o",ct,it),lt!=null&&(this.log("our observed address was %a",lt),isPrivateIp(lt==null?void 0:lt.nodeAddress().address)===!0?this.log("our observed address was private"):this.addressManager.getObservedAddrs().length<(this.maxObservedAddresses??1/0)&&(this.log("storing our observed address"),this.addressManager.addObservedAddr(lt))),consumeIdentifyMessage(this.peerStore,this.events,this.log,tt,rt)}async handleProtocol(tt){const{connection:nt,stream:rt}=tt,ot=AbortSignal.timeout(this.timeout);setMaxListeners$4(1/0,ot);try{const it=await this.peerStore.get(this.peerId),st=this.addressManager.getAddresses().map(dt=>dt.decapsulateCode(getProtocol("p2p").code));let at=it.peerRecordEnvelope;if(st.length>0&&at==null){const dt=new PeerRecord({peerId:this.peerId,multiaddrs:st});at=(await RecordEnvelope.seal(dt,this.privateKey)).marshal().subarray()}let ct=nt.remoteAddr.bytes;IP_OR_DOMAIN.matches(nt.remoteAddr)||(ct=void 0),await pbStream(rt).pb(Identify$1).write({protocolVersion:this.host.protocolVersion,agentVersion:this.host.agentVersion,publicKey:publicKeyToProtobuf(this.privateKey.publicKey),listenAddrs:st.map(dt=>dt.bytes),signedPeerRecord:at,observedAddr:ct,protocols:it.protocols},{signal:ot}),await rt.close({signal:ot})}catch(it){this.log.error("could not respond to identify request",it),rt.abort(it)}}}function identify(o={}){return et=>new Identify(et,o)}class MuxerClosedError extends Error{constructor(et="The muxer is closed"){super(et),this.name="MuxerClosedError"}}Ct(MuxerClosedError,"name","MuxerClosedError");var gs;let InvalidMessageError$1=(gs=class extends Error{constructor(et="Invalid message"){super(et),this.name="InvalidMessageError"}},Ct(gs,"name","InvalidMessageError"),gs);var ys;let TooManyOutboundProtocolStreamsError$1=(ys=class extends Error{constructor(et="Too many outbound protocol streams"){super(et),this.name="TooManyOutboundProtocolStreamsError"}},Ct(ys,"name","TooManyOutboundProtocolStreamsError"),ys);const serviceCapabilities$2=Symbol.for("@libp2p/service-capabilities");function getIterator(o){if(o!=null){if(typeof o[Symbol.iterator]=="function")return o[Symbol.iterator]();if(typeof o[Symbol.asyncIterator]=="function")return o[Symbol.asyncIterator]();if(typeof o.next=="function")return o}throw new Error("argument is not an iterator or iterable")}function isPromise$2(o){return o==null?!1:typeof o.then=="function"&&typeof o.catch=="function"&&typeof o.finally=="function"}function closeSource(o,et){var nt,rt;const tt=(rt=(nt=getIterator(o)).return)==null?void 0:rt.call(nt);isPromise$2(tt)&&tt.catch(ot=>{et.error("could not cause iterator to return",ot)})}const createAbortError=()=>{const o=new Error("Delay aborted");return o.name="AbortError",o},clearMethods=new WeakMap;function createDelay({clearTimeout:o,setTimeout:et}={}){return(tt,{value:nt,signal:rt}={})=>{if(rt!=null&&rt.aborted)return Promise.reject(createAbortError());let ot,it,st;const at=o??clearTimeout,ct=()=>{at(ot),st(createAbortError())},lt=()=>{rt&&rt.removeEventListener("abort",ct)},dt=new Promise((ht,pt)=>{it=()=>{lt(),ht(nt)},st=pt,ot=(et??setTimeout)(it,tt)});return rt&&rt.addEventListener("abort",ct,{once:!0}),clearMethods.set(dt,()=>{at(ot),ot=null,it()}),dt}}const delay=createDelay();class RateLimitError extends Error{constructor(tt="Rate limit exceeded",nt){super(tt);Ct(this,"remainingPoints");Ct(this,"msBeforeNext");Ct(this,"consumedPoints");Ct(this,"isFirstInDuration");this.name="RateLimitError",this.remainingPoints=nt.remainingPoints,this.msBeforeNext=nt.msBeforeNext,this.consumedPoints=nt.consumedPoints,this.isFirstInDuration=nt.isFirstInDuration}}class QueueFullError extends Error{constructor(et="The queue was full"){super(et),this.name="QueueFullError"}}Ct(QueueFullError,"name","QueueFullError");class RateLimiter{constructor(et={}){Ct(this,"memoryStorage");Ct(this,"points");Ct(this,"duration");Ct(this,"blockDuration");Ct(this,"execEvenly");Ct(this,"execEvenlyMinDelayMs");Ct(this,"keyPrefix");this.points=et.points??4,this.duration=et.duration??1,this.blockDuration=et.blockDuration??0,this.execEvenly=et.execEvenly??!1,this.execEvenlyMinDelayMs=et.execEvenlyMinDelayMs??this.duration*1e3/this.points,this.keyPrefix=et.keyPrefix??"rlflx",this.memoryStorage=new MemoryStorage}async consume(et,tt=1,nt={}){const rt=this.getKey(et),ot=this._getKeySecDuration(nt);let it=this.memoryStorage.incrby(rt,tt,ot);if(it.remainingPoints=Math.max(this.points-it.consumedPoints,0),it.consumedPoints>this.points)throw this.blockDuration>0&&it.consumedPoints<=this.points+tt&&(it=this.memoryStorage.set(rt,it.consumedPoints,this.blockDuration)),new RateLimitError("Rate limit exceeded",it);if(this.execEvenly&&it.msBeforeNext>0&&!it.isFirstInDuration){let st=Math.ceil(it.msBeforeNext/(it.remainingPoints+2));st=0?nt:this.duration)*1e3;return this.memoryStorage.set(this.getKey(et),tt,nt),{remainingPoints:0,msBeforeNext:rt===0?-1:rt,consumedPoints:tt,isFirstInDuration:!1}}get(et){const tt=this.memoryStorage.get(this.getKey(et));return tt!=null&&(tt.remainingPoints=Math.max(this.points-tt.consumedPoints,0)),tt}delete(et){this.memoryStorage.delete(this.getKey(et))}_getKeySecDuration(et){return(et==null?void 0:et.customDuration)!=null&&et.customDuration>=0?et.customDuration:this.duration}getKey(et){return this.keyPrefix.length>0?`${this.keyPrefix}:${et}`:et}parseKey(et){return et.substring(this.keyPrefix.length)}}class MemoryStorage{constructor(){Ct(this,"storage");this.storage=new Map}incrby(et,tt,nt){const rt=this.storage.get(et);if(rt!=null){const ot=rt.expiresAt!=null?rt.expiresAt.getTime()-new Date().getTime():-1;return rt.expiresAt==null||ot>0?(rt.value+=tt,{remainingPoints:0,msBeforeNext:ot,consumedPoints:rt.value,isFirstInDuration:!1}):this.set(et,tt,nt)}return this.set(et,tt,nt)}set(et,tt,nt){const rt=nt*1e3,ot=this.storage.get(et);ot!=null&&clearTimeout(ot.timeoutId);const it={value:tt,expiresAt:rt>0?new Date(Date.now()+rt):void 0};return this.storage.set(et,it),rt>0&&(it.timeoutId=setTimeout(()=>{this.storage.delete(et)},rt),it.timeoutId.unref!=null&&it.timeoutId.unref()),{remainingPoints:0,msBeforeNext:rt===0?-1:rt,consumedPoints:it.value,isFirstInDuration:!0}}get(et){const tt=this.storage.get(et);if(tt!=null)return{remainingPoints:0,msBeforeNext:tt.expiresAt!=null?tt.expiresAt.getTime()-new Date().getTime():-1,consumedPoints:tt.value,isFirstInDuration:!1}}delete(et){const tt=this.storage.get(et);return tt!=null?(tt.timeoutId!=null&&clearTimeout(tt.timeoutId),this.storage.delete(et),!0):!1}}var MessageTypes;(function(o){o[o.NEW_STREAM=0]="NEW_STREAM",o[o.MESSAGE_RECEIVER=1]="MESSAGE_RECEIVER",o[o.MESSAGE_INITIATOR=2]="MESSAGE_INITIATOR",o[o.CLOSE_RECEIVER=3]="CLOSE_RECEIVER",o[o.CLOSE_INITIATOR=4]="CLOSE_INITIATOR",o[o.RESET_RECEIVER=5]="RESET_RECEIVER",o[o.RESET_INITIATOR=6]="RESET_INITIATOR"})(MessageTypes||(MessageTypes={}));const MessageTypeNames=Object.freeze({0:"NEW_STREAM",1:"MESSAGE_RECEIVER",2:"MESSAGE_INITIATOR",3:"CLOSE_RECEIVER",4:"CLOSE_INITIATOR",5:"RESET_RECEIVER",6:"RESET_INITIATOR"}),InitiatorMessageTypes=Object.freeze({NEW_STREAM:MessageTypes.NEW_STREAM,MESSAGE:MessageTypes.MESSAGE_INITIATOR,CLOSE:MessageTypes.CLOSE_INITIATOR,RESET:MessageTypes.RESET_INITIATOR}),ReceiverMessageTypes=Object.freeze({MESSAGE:MessageTypes.MESSAGE_RECEIVER,CLOSE:MessageTypes.CLOSE_RECEIVER,RESET:MessageTypes.RESET_RECEIVER}),MAX_MSG_SIZE=1<<20,MAX_MSG_QUEUE_SIZE=4<<20;class Decoder{constructor(et=MAX_MSG_SIZE,tt=MAX_MSG_QUEUE_SIZE){Ct(this,"_buffer");Ct(this,"_headerInfo");Ct(this,"_maxMessageSize");Ct(this,"_maxUnprocessedMessageQueueSize");this._buffer=new Uint8ArrayList,this._headerInfo=null,this._maxMessageSize=et,this._maxUnprocessedMessageQueueSize=tt}write(et){if(et==null||et.length===0)return[];if(this._buffer.append(et),this._buffer.byteLength>this._maxUnprocessedMessageQueueSize)throw new InvalidMessageError$1("Unprocessed message queue size too large!");const tt=[];for(;this._buffer.length!==0;){if(this._headerInfo==null)try{this._headerInfo=this._decodeHeader(this._buffer)}catch(ct){if(ct.name==="InvalidMessageError")throw ct;break}const{id:nt,type:rt,length:ot,offset:it}=this._headerInfo;if(this._buffer.length-itthis._maxMessageSize)throw new InvalidMessageError$1("Message size too large");return{id:tt>>3,type:it,offset:nt+ot,length:rt}}}const MSB=128,REST=127;function readVarInt(o,et=0){let tt=0,nt=0,rt=et,ot;const it=o.length;do{if(rt>=it||nt>49)throw et=0,new RangeError("Could not decode varint");ot=o.get(rt++),tt+=nt<28?(ot&REST)<=MSB);return et=rt-et,{value:tt,offset:et}}const POOL_SIZE=10*1024;class Encoder{constructor(){Ct(this,"_pool");Ct(this,"_poolOffset");this._pool=allocUnsafe(POOL_SIZE),this._poolOffset=0}write(et,tt){const nt=this._pool;let rt=this._poolOffset;encode$a(et.id<<3|et.type,nt,rt),rt+=encodingLength$3(et.id<<3|et.type),(et.type===MessageTypes.NEW_STREAM||et.type===MessageTypes.MESSAGE_INITIATOR||et.type===MessageTypes.MESSAGE_RECEIVER)&&et.data!=null?(encode$a(et.data.length,nt,rt),rt+=encodingLength$3(et.data.length)):(encode$a(0,nt,rt),rt+=encodingLength$3(0));const ot=nt.subarray(this._poolOffset,rt);POOL_SIZE-rt<100?(this._pool=allocUnsafe(POOL_SIZE),this._poolOffset=0):this._poolOffset=rt,tt.append(ot),(et.type===MessageTypes.NEW_STREAM||et.type===MessageTypes.MESSAGE_INITIATOR||et.type===MessageTypes.MESSAGE_RECEIVER)&&et.data!=null&&tt.append(et.data)}}const encoder$1=new Encoder;async function*encode$4(o){for await(const et of o){const tt=new Uint8ArrayList;encoder$1.write(et,tt),yield tt}}class StreamInputBufferError extends Error{constructor(et="Stream input buffer error"){super(et),this.name="StreamInputBufferError"}}var xs;let AbortError$6=(xs=class extends Error{constructor(et="The operation was aborted"){super(et),this.name="AbortError"}},Ct(xs,"name","AbortError"),xs);class StreamResetError extends Error{constructor(et="The stream has been reset"){super(et),this.name="StreamResetError"}}Ct(StreamResetError,"name","StreamResetError");class StreamStateError extends Error{constructor(et="The stream is in an invalid state"){super(et),this.name="StreamStateError"}}Ct(StreamStateError,"name","StreamStateError");function setMaxListeners$3(){}const setMaxListeners$2=(o,...et)=>{try{[...et]}catch{}};var Zn,Sl;let TypedEventEmitter$1=(Sl=class extends EventTarget{constructor(){super();fn(this,Zn,new Map);setMaxListeners$2(1/0,this)}listenerCount(tt){const nt=Mt(this,Zn).get(tt);return nt==null?0:nt.length}addEventListener(tt,nt,rt){super.addEventListener(tt,nt,rt);let ot=Mt(this,Zn).get(tt);ot==null&&(ot=[],Mt(this,Zn).set(tt,ot)),ot.push({callback:nt,once:(rt!==!0&&rt!==!1&&(rt==null?void 0:rt.once))??!1})}removeEventListener(tt,nt,rt){super.removeEventListener(tt.toString(),nt??null,rt);let ot=Mt(this,Zn).get(tt);ot!=null&&(ot=ot.filter(({callback:it})=>it!==nt),Mt(this,Zn).set(tt,ot))}dispatchEvent(tt){const nt=super.dispatchEvent(tt);let rt=Mt(this,Zn).get(tt.type);return rt==null||(rt=rt.filter(({once:ot})=>!ot),Mt(this,Zn).set(tt.type,rt)),nt}safeDispatchEvent(tt,nt={}){return this.dispatchEvent(new CustomEvent(tt,nt))}},Zn=new WeakMap,Sl);const DEFAULT_SEND_CLOSE_WRITE_TIMEOUT=5e3;function isPromise$1(o){return o==null?!1:typeof o.then=="function"&&typeof o.catch=="function"&&typeof o.finally=="function"}class AbstractStream{constructor(et){Ct(this,"id");Ct(this,"direction");Ct(this,"timeline");Ct(this,"protocol");Ct(this,"metadata");Ct(this,"source");Ct(this,"status");Ct(this,"readStatus");Ct(this,"writeStatus");Ct(this,"log");Ct(this,"sinkController");Ct(this,"sinkEnd");Ct(this,"closed");Ct(this,"endErr");Ct(this,"streamSource");Ct(this,"onEnd");Ct(this,"onCloseRead");Ct(this,"onCloseWrite");Ct(this,"onReset");Ct(this,"onAbort");Ct(this,"sendCloseWriteTimeout");Ct(this,"sendingData");this.sinkController=new AbortController,this.sinkEnd=pDefer(),this.closed=pDefer(),this.log=et.log,this.status="open",this.readStatus="ready",this.writeStatus="ready",this.id=et.id,this.metadata=et.metadata??{},this.direction=et.direction,this.timeline={open:Date.now()},this.sendCloseWriteTimeout=et.sendCloseWriteTimeout??DEFAULT_SEND_CLOSE_WRITE_TIMEOUT,this.onEnd=et.onEnd,this.onCloseRead=et==null?void 0:et.onCloseRead,this.onCloseWrite=et==null?void 0:et.onCloseWrite,this.onReset=et==null?void 0:et.onReset,this.onAbort=et==null?void 0:et.onAbort,this.source=this.streamSource=pushable({onEnd:tt=>{tt!=null?this.log.trace("source ended with error",tt):this.log.trace("source ended"),this.onSourceEnd(tt)}}),this.sink=this.sink.bind(this)}async sink(et){if(this.writeStatus!=="ready")throw new StreamStateError(`writable end state is "${this.writeStatus}" not "ready"`);try{this.writeStatus="writing";const tt={signal:this.sinkController.signal};if(this.direction==="outbound"){const rt=this.sendNewStream(tt);isPromise$1(rt)&&await rt}const nt=()=>{closeSource(et,this.log)};try{this.sinkController.signal.addEventListener("abort",nt),this.log.trace("sink reading from source");for await(let rt of et){rt=rt instanceof Uint8Array?new Uint8ArrayList(rt):rt;const ot=this.sendData(rt,tt);isPromise$1(ot)&&(this.sendingData=pDefer(),await ot,this.sendingData.resolve(),this.sendingData=void 0)}}finally{this.sinkController.signal.removeEventListener("abort",nt)}this.log.trace('sink finished reading from source, write status is "%s"',this.writeStatus),this.writeStatus==="writing"&&(this.writeStatus="closing",this.log.trace("send close write to remote"),await this.sendCloseWrite({signal:AbortSignal.timeout(this.sendCloseWriteTimeout)}),this.writeStatus="closed"),this.onSinkEnd()}catch(tt){throw this.log.trace("sink ended with error, calling abort with error",tt),this.abort(tt),tt}finally{this.log.trace("resolve sink end"),this.sinkEnd.resolve()}}onSourceEnd(et){var tt;this.timeline.closeRead==null&&(this.timeline.closeRead=Date.now(),this.readStatus="closed",et!=null&&this.endErr==null&&(this.endErr=et),(tt=this.onCloseRead)==null||tt.call(this),this.timeline.closeWrite!=null?(this.log.trace("source and sink ended"),this.timeline.close=Date.now(),this.status!=="aborted"&&this.status!=="reset"&&(this.status="closed"),this.onEnd!=null&&this.onEnd(this.endErr),this.closed.resolve()):this.log.trace("source ended, waiting for sink to end"))}onSinkEnd(et){var tt;this.timeline.closeWrite==null&&(this.timeline.closeWrite=Date.now(),this.writeStatus="closed",et!=null&&this.endErr==null&&(this.endErr=et),(tt=this.onCloseWrite)==null||tt.call(this),this.timeline.closeRead!=null?(this.log.trace("sink and source ended"),this.timeline.close=Date.now(),this.status!=="aborted"&&this.status!=="reset"&&(this.status="closed"),this.onEnd!=null&&this.onEnd(this.endErr),this.closed.resolve()):this.log.trace("sink ended, waiting for source to end"))}async close(et){this.log.trace("closing gracefully"),this.status="closing",await raceSignal(Promise.all([this.closeWrite(et),this.closeRead(et),this.closed.promise]),et==null?void 0:et.signal),this.status="closed",this.log.trace("closed gracefully")}async closeRead(et={}){if(this.readStatus==="closing"||this.readStatus==="closed")return;this.log.trace('closing readable end of stream with starting read status "%s"',this.readStatus);const tt=this.readStatus;this.readStatus="closing",this.status!=="reset"&&this.status!=="aborted"&&this.timeline.closeRead==null&&(this.log.trace("send close read to remote"),await this.sendCloseRead(et)),tt==="ready"&&(this.log.trace("ending internal source queue with %d queued bytes",this.streamSource.readableLength),this.streamSource.end()),this.log.trace("closed readable end of stream")}async closeWrite(et={}){this.writeStatus==="closing"||this.writeStatus==="closed"||(this.log.trace('closing writable end of stream with starting write status "%s"',this.writeStatus),this.writeStatus==="ready"&&(this.log.trace("sink was never sunk, sink an empty array"),await raceSignal(this.sink([]),et.signal)),this.writeStatus==="writing"&&(this.sendingData!=null&&await raceSignal(this.sendingData.promise,et.signal),this.log.trace("aborting source passed to .sink"),this.sinkController.abort(),await raceSignal(this.sinkEnd.promise,et.signal)),this.writeStatus="closed",this.log.trace("closed writable end of stream"))}abort(et){var nt;if(this.status==="closed"||this.status==="aborted"||this.status==="reset")return;this.log("abort with error",et),this.log("try to send reset to remote");const tt=this.sendReset();isPromise$1(tt)&&tt.catch(rt=>{this.log.error("error sending reset message",rt)}),this.status="aborted",this.timeline.abort=Date.now(),this._closeSinkAndSource(et),(nt=this.onAbort)==null||nt.call(this,et)}reset(){var tt;if(this.status==="closed"||this.status==="aborted"||this.status==="reset")return;const et=new StreamResetError("stream reset");this.status="reset",this.timeline.reset=Date.now(),this._closeSinkAndSource(et),(tt=this.onReset)==null||tt.call(this)}_closeSinkAndSource(et){this._closeSink(et),this._closeSource(et)}_closeSink(et){this.writeStatus==="writing"&&(this.log.trace("end sink source"),this.sinkController.abort()),this.onSinkEnd(et)}_closeSource(et){this.readStatus!=="closing"&&this.readStatus!=="closed"&&(this.log.trace("ending source with %d bytes to be read by consumer",this.streamSource.readableLength),this.readStatus="closing",this.streamSource.end(et))}remoteCloseWrite(){if(this.readStatus==="closing"||this.readStatus==="closed"){this.log("received remote close write but local source is already closed");return}this.log.trace("remote close write"),this._closeSource()}remoteCloseRead(){if(this.writeStatus==="closing"||this.writeStatus==="closed"){this.log("received remote close read but local sink is already closed");return}this.log.trace("remote close read"),this._closeSink()}destroy(){if(this.status==="closed"||this.status==="aborted"||this.status==="reset"){this.log("received destroy but we are already closed");return}this.log.trace("stream destroyed"),this._closeSinkAndSource()}sourcePush(et){this.streamSource.push(et)}sourceReadableLength(){return this.streamSource.readableLength}}class MplexStream extends AbstractStream{constructor(tt){super(tt);Ct(this,"name");Ct(this,"streamId");Ct(this,"send");Ct(this,"types");Ct(this,"maxDataSize");this.types=tt.direction==="outbound"?InitiatorMessageTypes:ReceiverMessageTypes,this.send=tt.send,this.name=tt.name,this.streamId=tt.streamId,this.maxDataSize=tt.maxDataSize}async sendNewStream(){await this.send({id:this.streamId,type:InitiatorMessageTypes.NEW_STREAM,data:new Uint8ArrayList(fromString(this.name))})}async sendData(tt){for(tt=tt.sublist();tt.byteLength>0;){const nt=Math.min(tt.byteLength,this.maxDataSize);await this.send({id:this.streamId,type:this.types.MESSAGE,data:tt.sublist(0,nt)}),tt.consume(nt)}}async sendReset(){await this.send({id:this.streamId,type:this.types.RESET})}async sendCloseWrite(){await this.send({id:this.streamId,type:this.types.CLOSE})}async sendCloseRead(){}}function createStream(o){const{id:et,name:tt,send:nt,onEnd:rt,type:ot="initiator",maxMsgSize:it=MAX_MSG_SIZE}=o;return new MplexStream({id:ot==="initiator"?`i${et}`:`r${et}`,streamId:et,name:`${tt??et}`,direction:ot==="initiator"?"outbound":"inbound",maxDataSize:it,onEnd:rt,send:nt,log:o.logger.forComponent(`libp2p:mplex:stream:${ot}:${et}`)})}const MAX_STREAMS_INBOUND_STREAMS_PER_CONNECTION=1024,MAX_STREAMS_OUTBOUND_STREAMS_PER_CONNECTION=1024,MAX_STREAM_BUFFER_SIZE=1024*1024*4,DISCONNECT_THRESHOLD=5,CLOSE_TIMEOUT$2=500;function printMessage(o){const et={...o,type:`${MessageTypeNames[o.type]} (${o.type})`};return o.type===MessageTypes.NEW_STREAM&&(et.data=toString$8(o.data instanceof Uint8Array?o.data:o.data.subarray())),(o.type===MessageTypes.MESSAGE_INITIATOR||o.type===MessageTypes.MESSAGE_RECEIVER)&&(et.data=toString$8(o.data instanceof Uint8Array?o.data:o.data.subarray(),"base16")),et}class MplexStreamMuxer{constructor(et,tt){Ct(this,"protocol","/mplex/6.7.0");Ct(this,"sink");Ct(this,"source");Ct(this,"log");Ct(this,"_streamId");Ct(this,"_streams");Ct(this,"_init");Ct(this,"_source");Ct(this,"closeController");Ct(this,"rateLimiter");Ct(this,"closeTimeout");Ct(this,"logger");tt=tt??{},this.log=et.logger.forComponent("libp2p:mplex"),this.logger=et.logger,this._streamId=0,this._streams={initiators:new Map,receivers:new Map},this._init=tt,this.closeTimeout=tt.closeTimeout??CLOSE_TIMEOUT$2,this.sink=this._createSink(),this._source=pushable({objectMode:!0,onEnd:()=>{for(const nt of this._streams.initiators.values())nt.destroy();for(const nt of this._streams.receivers.values())nt.destroy()}}),this.source=pipe(this._source,nt=>encode$4(nt)),this.closeController=new AbortController,this.rateLimiter=new RateLimiter({points:tt.disconnectThreshold??DISCONNECT_THRESHOLD,duration:1})}get streams(){const et=[];for(const tt of this._streams.initiators.values())et.push(tt);for(const tt of this._streams.receivers.values())et.push(tt);return et}newStream(et){if(this.closeController.signal.aborted)throw new MuxerClosedError("Muxer already closed");const tt=this._streamId++;et=et==null?tt.toString():et.toString();const nt=this._streams.initiators;return this._newStream({id:tt,name:et,type:"initiator",registry:nt})}async close(et){if(this.closeController.signal.aborted)return;const tt=(et==null?void 0:et.signal)??AbortSignal.timeout(this.closeTimeout);try{await Promise.all(this.streams.map(async nt=>nt.close({signal:tt}))),this._source.end(),await this._source.onEmpty({signal:tt}),this.closeController.abort()}catch(nt){this.abort(nt)}}abort(et){this.closeController.signal.aborted||(this.streams.forEach(tt=>{tt.abort(et)}),this.closeController.abort(et))}_newReceiverStream(et){const{id:tt,name:nt}=et,rt=this._streams.receivers;return this._newStream({id:tt,name:nt,type:"receiver",registry:rt})}_newStream(et){const{id:tt,name:nt,type:rt,registry:ot}=et;if(this.log("new %s stream %s",rt,tt),rt==="initiator"&&this._streams.initiators.size===(this._init.maxOutboundStreams??MAX_STREAMS_OUTBOUND_STREAMS_PER_CONNECTION))throw new TooManyOutboundProtocolStreamsError$1("Too many outbound streams open");if(ot.has(tt))throw new Error(`${rt} stream ${tt} already exists!`);const at=createStream({id:tt,name:nt,send:async ct=>{this.log.enabled&&this.log.trace("%s stream %s send",rt,tt,printMessage(ct)),this._source.push(ct)},type:rt,onEnd:()=>{this.log("%s stream with id %s and protocol %s ended",rt,tt,at.protocol),ot.delete(tt),this._init.onStreamEnd!=null&&this._init.onStreamEnd(at)},maxMsgSize:this._init.maxMsgSize,logger:this.logger});return ot.set(tt,at),at}_createSink(){return async tt=>{const nt=()=>{closeSource(tt,this.log)};this.closeController.signal.addEventListener("abort",nt);try{const rt=new Decoder(this._init.maxMsgSize,this._init.maxUnprocessedMessageQueueSize);for await(const ot of tt)for(const it of rt.write(ot))await this._handleIncoming(it);this._source.end()}catch(rt){this.log("error in sink",rt),this._source.end(rt)}finally{this.closeController.signal.removeEventListener("abort",nt)}}}async _handleIncoming(et){const{id:tt,type:nt}=et;if(this.log.enabled&&this.log.trace("incoming message",printMessage(et)),et.type===MessageTypes.NEW_STREAM){if(this._streams.receivers.size===(this._init.maxInboundStreams??MAX_STREAMS_INBOUND_STREAMS_PER_CONNECTION)){this.log("too many inbound streams open"),this._source.push({id:tt,type:MessageTypes.RESET_RECEIVER});try{await this.rateLimiter.consume("new-stream",1)}catch{this.log("rate limit hit when opening too many new streams over the inbound stream limit - closing remote connection"),this.abort(new Error("Too many open streams"));return}return}const st=this._newReceiverStream({id:tt,name:toString$8(et.data instanceof Uint8Array?et.data:et.data.subarray())});this._init.onIncomingStream!=null&&this._init.onIncomingStream(st);return}const ot=((nt&1)===1?this._streams.initiators:this._streams.receivers).get(tt);if(ot==null){this.log("missing stream %s for message type %s",tt,MessageTypeNames[nt]);try{await this.rateLimiter.consume("missing-stream",1)}catch{this.log("rate limit hit when receiving messages for streams that do not exist - closing remote connection"),this.abort(new Error("Too many messages for missing streams"));return}return}const it=this._init.maxStreamBufferSize??MAX_STREAM_BUFFER_SIZE;try{switch(nt){case MessageTypes.MESSAGE_INITIATOR:case MessageTypes.MESSAGE_RECEIVER:if(ot.sourceReadableLength()>it)throw this._source.push({id:et.id,type:nt===MessageTypes.MESSAGE_INITIATOR?MessageTypes.RESET_RECEIVER:MessageTypes.RESET_INITIATOR}),new StreamInputBufferError("Input buffer full - increase Mplex maxBufferSize to accommodate slow consumers");ot.sourcePush(et.data);break;case MessageTypes.CLOSE_INITIATOR:case MessageTypes.CLOSE_RECEIVER:ot.remoteCloseWrite();break;case MessageTypes.RESET_INITIATOR:case MessageTypes.RESET_RECEIVER:ot.reset();break;default:this.log("unknown message type %s",nt)}}catch(st){this.log.error("error while processing message",st),ot.abort(st)}}}var Al,Rl;Rl=Symbol.toStringTag,Al=serviceCapabilities$2;class Mplex{constructor(et,tt={}){Ct(this,"protocol","/mplex/6.7.0");Ct(this,"_init");Ct(this,"components");Ct(this,Rl,"@libp2p/mplex");Ct(this,Al,["@libp2p/stream-multiplexing"]);this.components=et,this._init=tt}createStreamMuxer(et={}){return new MplexStreamMuxer(this.components,{...et,...this._init})}}function mplex(o={}){return et=>new Mplex(et,o)}function isAsyncIterable$3(o){return o[Symbol.asyncIterator]!=null}function first(o){if(isAsyncIterable$3(o))return(async()=>{for await(const et of o)return et})();for(const et of o)return et}const PING_LENGTH$1=32,PROTOCOL_VERSION$1="1.0.0",PROTOCOL_NAME$1="ping",PROTOCOL_PREFIX$1="ipfs",TIMEOUT=1e4,MAX_INBOUND_STREAMS=2,MAX_OUTBOUND_STREAMS=1;var _l;_l=Symbol.toStringTag;class PingService{constructor(et,tt={}){Ct(this,"protocol");Ct(this,"components");Ct(this,"started");Ct(this,"timeout");Ct(this,"maxInboundStreams");Ct(this,"maxOutboundStreams");Ct(this,"runOnLimitedConnection");Ct(this,"log");Ct(this,_l,"@libp2p/ping");this.components=et,this.log=et.logger.forComponent("libp2p:ping"),this.started=!1,this.protocol=`/${tt.protocolPrefix??PROTOCOL_PREFIX$1}/${PROTOCOL_NAME$1}/${PROTOCOL_VERSION$1}`,this.timeout=tt.timeout??TIMEOUT,this.maxInboundStreams=tt.maxInboundStreams??MAX_INBOUND_STREAMS,this.maxOutboundStreams=tt.maxOutboundStreams??MAX_OUTBOUND_STREAMS,this.runOnLimitedConnection=tt.runOnLimitedConnection??!0,this.handleMessage=this.handleMessage.bind(this)}async start(){await this.components.registrar.handle(this.protocol,this.handleMessage,{maxInboundStreams:this.maxInboundStreams,maxOutboundStreams:this.maxOutboundStreams,runOnLimitedConnection:this.runOnLimitedConnection}),this.started=!0}async stop(){await this.components.registrar.unhandle(this.protocol),this.started=!1}isStarted(){return this.started}handleMessage(et){this.log("incoming ping from %p",et.connection.remotePeer);const{stream:tt}=et,nt=Date.now();AbortSignal.timeout(this.timeout).addEventListener("abort",()=>{tt==null||tt.abort(new TimeoutError$3("ping timeout"))}),pipe(tt,async function*(ot){let it=0;for await(const st of ot){if(it+=st.byteLength,it>PING_LENGTH$1){tt==null||tt.abort(new InvalidMessageError$3("Too much data received"));return}yield st}},tt).catch(ot=>{this.log.error("incoming ping from %p failed with error",et.connection.remotePeer,ot),tt==null||tt.abort(ot)}).finally(()=>{const ot=Date.now()-nt;this.log("incoming ping from %p complete in %dms",et.connection.remotePeer,ot)})}async ping(et,tt={}){var at,ct;this.log("pinging %p",et);const nt=Date.now(),rt=randomBytes(PING_LENGTH$1),ot=await this.components.connectionManager.openConnection(et,tt);let it,st=()=>{};if(tt.signal==null){const lt=AbortSignal.timeout(this.timeout);tt={...tt,signal:lt}}try{it=await ot.newStream(this.protocol,{...tt,runOnLimitedConnection:this.runOnLimitedConnection}),st=()=>{it==null||it.abort(new AbortError$9)},(at=tt.signal)==null||at.addEventListener("abort",st,{once:!0});const lt=await pipe([rt],it,async ht=>first(ht)),dt=Date.now()-nt;if(lt==null)throw new ProtocolError(`Did not receive a ping ack after ${dt}ms`);if(!equals(rt,lt.subarray()))throw new ProtocolError(`Received wrong ping ack after ${dt}ms`);return this.log("ping %p complete in %dms",ot.remotePeer,dt),dt}catch(lt){throw this.log.error("error while pinging %p",ot.remotePeer,lt),it==null||it.abort(lt),lt}finally{(ct=tt.signal)==null||ct.removeEventListener("abort",st),it!=null&&await it.close()}}}function ping(o={}){return et=>new PingService(et,o)}const transportSymbol=Symbol.for("@libp2p/transport");var FaultTolerance$1;(function(o){o[o.FATAL_ALL=0]="FATAL_ALL",o[o.NO_FATAL=1]="NO_FATAL"})(FaultTolerance$1||(FaultTolerance$1={}));var vs;let AbortError$5=(vs=class extends Error{constructor(et="The operation was aborted"){super(et),this.name="AbortError"}},Ct(vs,"name","AbortError"),vs);class ConnectionFailedError extends Error{constructor(et="Connection failed"){super(et),this.name="ConnectionFailedError"}}Ct(ConnectionFailedError,"name","ConnectionFailedError");const serviceCapabilities$1=Symbol.for("@libp2p/service-capabilities"),ASSUME_HTTP_CODES=[getProtocol("tcp").code,getProtocol("dns").code,getProtocol("dnsaddr").code,getProtocol("dns4").code,getProtocol("dns6").code];function extractSNI(o){var et;return(et=extractTuple("sni",o))==null?void 0:et[1]}function extractPort(o){var tt;const et=(tt=extractTuple("tcp",o))==null?void 0:tt[1];return et==null?"":`:${et}`}function extractTuple(o,et){let tt;try{tt=getProtocol(o).code}catch{return}for(const[nt,rt]of et)if(nt===tt&&rt!=null)return[nt,rt]}function hasTLS(o){return o.some(([et,tt])=>et===getProtocol("tls").code)}function interpretNext(o,et,tt){const nt=interpreters[getProtocol(o).name];if(nt==null)throw new Error(`Can't interpret protocol ${getProtocol(o).name}`);const rt=nt(et,tt);return o===getProtocol("ip6").code?`[${rt}]`:rt}const interpreters={ip4:(o,et)=>o,ip6:(o,et)=>et.length===0?o:`[${o}]`,tcp:(o,et)=>{const tt=et.pop();if(tt==null)throw new Error("Unexpected end of multiaddr");return`tcp://${interpretNext(tt[0],tt[1]??"",et)}:${o}`},udp:(o,et)=>{const tt=et.pop();if(tt==null)throw new Error("Unexpected end of multiaddr");return`udp://${interpretNext(tt[0],tt[1]??"",et)}:${o}`},dnsaddr:(o,et)=>o,dns4:(o,et)=>o,dns6:(o,et)=>o,dns:(o,et)=>o,ipfs:(o,et)=>{const tt=et.pop();if(tt==null)throw new Error("Unexpected end of multiaddr");return`${interpretNext(tt[0],tt[1]??"",et)}/ipfs/${o}`},p2p:(o,et)=>{const tt=et.pop();if(tt==null)throw new Error("Unexpected end of multiaddr");return`${interpretNext(tt[0],tt[1]??"",et)}/p2p/${o}`},http:(o,et)=>{const tt=hasTLS(et),nt=extractSNI(et),rt=extractPort(et);if(tt&&nt!=null)return`https://${nt}${rt}`;const ot=tt?"https://":"http://",it=et.pop();if(it==null)throw new Error("Unexpected end of multiaddr");let st=interpretNext(it[0],it[1]??"",et);return st=st.replace("tcp://",""),`${ot}${st}`},"http-path":(o,et)=>{const tt=et.pop();if(tt==null)throw new Error("Unexpected end of multiaddr");const nt=interpretNext(tt[0],tt[1]??"",et),rt=decodeURIComponent(o);return`${nt}/${rt}`},tls:(o,et)=>{const tt=et.pop();if(tt==null)throw new Error("Unexpected end of multiaddr");return interpretNext(tt[0],tt[1]??"",et)},sni:(o,et)=>{const tt=et.pop();if(tt==null)throw new Error("Unexpected end of multiaddr");return interpretNext(tt[0],tt[1]??"",et)},https:(o,et)=>{const tt=et.pop();if(tt==null)throw new Error("Unexpected end of multiaddr");let nt=interpretNext(tt[0],tt[1]??"",et);return nt=nt.replace("tcp://",""),`https://${nt}`},ws:(o,et)=>{const tt=hasTLS(et),nt=extractSNI(et),rt=extractPort(et);if(tt&&nt!=null)return`wss://${nt}${rt}`;const ot=tt?"wss://":"ws://",it=et.pop();if(it==null)throw new Error("Unexpected end of multiaddr");let st=interpretNext(it[0],it[1]??"",et);return st=st.replace("tcp://",""),`${ot}${st}`},wss:(o,et)=>{const tt=et.pop();if(tt==null)throw new Error("Unexpected end of multiaddr");let nt=interpretNext(tt[0],tt[1]??"",et);return nt=nt.replace("tcp://",""),`wss://${nt}`},"p2p-websocket-star":(o,et)=>{const tt=et.pop();if(tt==null)throw new Error("Unexpected end of multiaddr");return`${interpretNext(tt[0],tt[1]??"",et)}/p2p-websocket-star`},"p2p-webrtc-star":(o,et)=>{const tt=et.pop();if(tt==null)throw new Error("Unexpected end of multiaddr");return`${interpretNext(tt[0],tt[1]??"",et)}/p2p-webrtc-star`},"p2p-webrtc-direct":(o,et)=>{const tt=et.pop();if(tt==null)throw new Error("Unexpected end of multiaddr");return`${interpretNext(tt[0],tt[1]??"",et)}/p2p-webrtc-direct`}};function multiaddrToUri(o,et){const nt=multiaddr(o).stringTuples(),rt=nt.pop();if(rt==null)throw new Error("Unexpected end of multiaddr");const ot=getProtocol(rt[0]),it=interpreters[ot.name];if(it==null)throw new Error(`No interpreter found for ${ot.name}`);let st=it(rt[1]??"",nt);return ASSUME_HTTP_CODES.includes(rt[0])&&(st=st.replace(/^.*:\/\//,""),rt[1]==="443"?st=`https://${st}`:st=`http://${st}`),(st.startsWith("http://")||st.startsWith("https://")||st.startsWith("ws://")||st.startsWith("wss://"))&&(st=new URL(st).toString(),st.endsWith("/")&&(st=st.substring(0,st.length-1))),st}const ready=async o=>{if(o.readyState>=2)throw new Error("socket closed");o.readyState!==1&&await new Promise((et,tt)=>{function nt(){o.removeEventListener("open",rt),o.removeEventListener("error",ot)}function rt(){nt(),et()}function ot(it){nt(),tt(it.error??new Error(`connect ECONNREFUSED ${o.url}`))}o.addEventListener("open",rt),o.addEventListener("error",ot)})},sink=(o,et)=>(et=et??{},et.closeOnEnd=et.closeOnEnd!==!1,async nt=>{for await(const rt of nt){try{await ready(o)}catch(ot){if(ot.message==="socket closed")break;throw ot}if(o.readyState===o.CLOSING||o.readyState===o.CLOSED)break;o.send(rt)}et.closeOnEnd!=null&&o.readyState<=1&&await new Promise((rt,ot)=>{o.addEventListener("close",it=>{if(it.wasClean||it.code===1006)rt();else{const st=Object.assign(new Error("ws error"),{event:it});ot(st)}}),setTimeout(()=>{o.close()})})});var dom={},eventIterator={};Object.defineProperty(eventIterator,"__esModule",{value:!0});class EventQueue{constructor(){this.pullQueue=[],this.pushQueue=[],this.eventHandlers={},this.isPaused=!1,this.isStopped=!1}push(et){if(this.isStopped)return;const tt={value:et,done:!1};if(this.pullQueue.length){const nt=this.pullQueue.shift();nt&&nt.resolve(tt)}else this.pushQueue.push(Promise.resolve(tt)),this.highWaterMark!==void 0&&this.pushQueue.length>=this.highWaterMark&&!this.isPaused&&(this.isPaused=!0,this.eventHandlers.highWater?this.eventHandlers.highWater():console&&console.warn(`EventIterator queue reached ${this.pushQueue.length} items`))}stop(){if(!this.isStopped){this.isStopped=!0,this.remove();for(const et of this.pullQueue)et.resolve({value:void 0,done:!0});this.pullQueue.length=0}}fail(et){if(!this.isStopped)if(this.isStopped=!0,this.remove(),this.pullQueue.length){for(const tt of this.pullQueue)tt.reject(et);this.pullQueue.length=0}else{const tt=Promise.reject(et);tt.catch(()=>{}),this.pushQueue.push(tt)}}remove(){Promise.resolve().then(()=>{this.removeCallback&&this.removeCallback()})}[Symbol.asyncIterator](){return{next:et=>{const tt=this.pushQueue.shift();return tt?(this.lowWaterMark!==void 0&&this.pushQueue.length<=this.lowWaterMark&&this.isPaused&&(this.isPaused=!1,this.eventHandlers.lowWater&&this.eventHandlers.lowWater()),tt):this.isStopped?Promise.resolve({value:void 0,done:!0}):new Promise((nt,rt)=>{this.pullQueue.push({resolve:nt,reject:rt})})},return:()=>(this.isStopped=!0,this.pushQueue.length=0,this.remove(),Promise.resolve({value:void 0,done:!0}))}}}let EventIterator$1=class{constructor(et,{highWaterMark:tt=100,lowWaterMark:nt=1}={}){const rt=new EventQueue;rt.highWaterMark=tt,rt.lowWaterMark=nt,rt.removeCallback=et({push:ot=>rt.push(ot),stop:()=>rt.stop(),fail:ot=>rt.fail(ot),on:(ot,it)=>{rt.eventHandlers[ot]=it}})||(()=>{}),this[Symbol.asyncIterator]=()=>rt[Symbol.asyncIterator](),Object.freeze(this)}};eventIterator.EventIterator=EventIterator$1;eventIterator.default=EventIterator$1;Object.defineProperty(dom,"__esModule",{value:!0});const event_iterator_1=eventIterator;var EventIterator=dom.EventIterator=event_iterator_1.EventIterator;function subscribe(o,et,tt){return new event_iterator_1.EventIterator(({push:nt})=>(this.addEventListener(o,nt,et),()=>this.removeEventListener(o,nt,et)),tt)}dom.subscribe=subscribe;dom.default=event_iterator_1.EventIterator;function isArrayBuffer(o){var et;return o instanceof ArrayBuffer||((et=o==null?void 0:o.constructor)==null?void 0:et.name)==="ArrayBuffer"&&typeof(o==null?void 0:o.byteLength)=="number"}const source=o=>{o.binaryType="arraybuffer";const et=async()=>{await new Promise((ot,it)=>{if(nt){ot();return}if(rt!=null){it(rt);return}const st=lt=>{o.removeEventListener("open",at),o.removeEventListener("error",ct),lt()},at=()=>{st(ot)},ct=lt=>{st(()=>{it(lt.error??new Error(`connect ECONNREFUSED ${o.url}`))})};o.addEventListener("open",at),o.addEventListener("error",ct)})},tt=async function*(){const ot=new EventIterator(({push:it,stop:st,fail:at})=>{const ct=dt=>{let ht=null;typeof dt.data=="string"&&(ht=fromString(dt.data)),isArrayBuffer(dt.data)&&(ht=new Uint8Array(dt.data)),dt.data instanceof Uint8Array&&(ht=dt.data),ht!=null&&it(ht)},lt=dt=>{at(dt.error??new Error("Socket error"))};return o.addEventListener("message",ct),o.addEventListener("error",lt),o.addEventListener("close",st),()=>{o.removeEventListener("message",ct),o.removeEventListener("error",lt),o.removeEventListener("close",st)}},{highWaterMark:1/0});await et();for await(const it of ot)yield isArrayBuffer(it)?new Uint8Array(it):it}();let nt=o.readyState===1,rt;return o.addEventListener("open",()=>{nt=!0,rt=null}),o.addEventListener("close",()=>{nt=!1,rt=null}),o.addEventListener("error",ot=>{nt||(rt=ot.error??new Error(`connect ECONNREFUSED ${o.url}`))}),Object.assign(tt,{connected:et})},duplex=(o,et)=>{et=et??{};const tt=source(o);let nt=et.remoteAddress,rt=et.remotePort;if(o.url!=null)try{const it=new URL(o.url);nt=it.hostname,rt=parseInt(it.port,10)}catch{}if(nt==null||rt==null)throw new Error("Remote connection did not have address and/or port");return{sink:sink(o,et),source:tt,connected:async()=>{await tt.connected()},close:async()=>{(o.readyState===o.CONNECTING||o.readyState===o.OPEN)&&await new Promise(it=>{o.addEventListener("close",()=>{it()}),o.close()})},destroy:()=>{o.terminate!=null?o.terminate():o.close()},remoteAddress:nt,remotePort:rt,socket:o}},WebSocket$1=WebSocket,map={"http:":"ws:","https:":"wss:"},defaultProtocol="ws:",wsurl=(o,et)=>{if(o.startsWith("//")&&(o=`${(et==null?void 0:et.protocol)??defaultProtocol}${o}`),o.startsWith("/")&&et!=null){const nt=et.protocol??defaultProtocol,rt=et.host,ot=et.port!=null&&(rt==null?void 0:rt.endsWith(`:${et.port}`))!==!0?`:${et.port}`:"";o=`${nt}//${rt}${ot}${o}`}const tt=new URL(o);for(const[nt,rt]of Object.entries(map))tt.protocol===nt&&(tt.protocol=rt);return tt};function connect(o,et){const tt=typeof window>"u"?void 0:window.location;et=et??{};const nt=wsurl(o,tt),rt=new WebSocket$1(nt.toString(),et.websocket);return duplex(rt,et)}class CustomProgressEvent extends Event{constructor(tt,nt){super(tt);Ct(this,"type");Ct(this,"detail");this.type=tt,this.detail=nt}}function all$1(o){return o.filter(et=>WebSocketsSecure.exactMatch(et)||WebSockets$1.exactMatch(et))}function wss(o){return o.filter(et=>WebSocketsSecure.exactMatch(et))}function createListener(){throw new Error("WebSocket Servers can not be created in the browser!")}const CLOSE_TIMEOUT$1=500;function socketToMaConn(o,et,tt){const nt=tt.logger.forComponent("libp2p:websockets:maconn"),rt=tt.metrics,ot=tt.metricPrefix??"",it={log:nt,async sink(st){try{await o.sink(async function*(){for await(const at of st)at instanceof Uint8Array?yield at:yield at.subarray()}())}catch(at){at.type!=="aborted"&&nt.error(at)}},source:o.source,remoteAddr:et,timeline:{open:Date.now()},async close(st={}){var lt,dt;const at=Date.now();if(st.signal==null){const ht=AbortSignal.timeout(CLOSE_TIMEOUT$1);st={...st,signal:ht}}const ct=()=>{const{host:ht,port:pt}=it.remoteAddr.toOptions();nt("timeout closing stream to %s:%s after %dms, destroying it manually",ht,pt,Date.now()-at),this.abort(new AbortError$5("Socket close timeout"))};(lt=st.signal)==null||lt.addEventListener("abort",ct);try{await o.close()}catch(ht){nt.error("error closing WebSocket gracefully",ht),this.abort(ht)}finally{(dt=st.signal)==null||dt.removeEventListener("abort",ct),it.timeline.close=Date.now()}},abort(st){const{host:at,port:ct}=it.remoteAddr.toOptions();nt("timeout closing stream to %s:%s due to error",at,ct,st),o.destroy(),it.timeline.close=Date.now(),rt==null||rt.increment({[`${ot}error`]:!0})}};return o.socket.addEventListener("close",()=>{rt==null||rt.increment({[`${ot}close`]:!0}),it.timeline.close==null&&(it.timeline.close=Date.now())},{once:!0}),it}var Il,Tl,Pl;Pl=transportSymbol,Tl=Symbol.toStringTag,Il=serviceCapabilities$1;class WebSockets{constructor(et,tt){Ct(this,"log");Ct(this,"init");Ct(this,"logger");Ct(this,"metrics");Ct(this,"components");Ct(this,Pl,!0);Ct(this,Tl,"@libp2p/websockets");Ct(this,Il,["@libp2p/transport"]);this.log=et.logger.forComponent("libp2p:websockets"),this.logger=et.logger,this.components=et,this.init=tt,et.metrics!=null&&(this.metrics={dialerEvents:et.metrics.registerCounterGroup("libp2p_websockets_dialer_events_total",{label:"event",help:"Total count of WebSockets dialer events by type"})})}async dial(et,tt){var it;this.log("dialing %s",et),tt=tt??{};const nt=await this._connect(et,tt),rt=socketToMaConn(nt,et,{logger:this.logger,metrics:(it=this.metrics)==null?void 0:it.dialerEvents});this.log("new outbound connection %s",rt.remoteAddr);const ot=await tt.upgrader.upgradeOutbound(rt,tt);return this.log("outbound connection %s upgraded",rt.remoteAddr),ot}async _connect(et,tt){var it,st,at,ct,lt;(it=tt==null?void 0:tt.signal)==null||it.throwIfAborted();const nt=et.toOptions();this.log("dialing %s:%s",nt.host,nt.port);const rt=pDefer(),ot=connect(multiaddrToUri(et),this.init);ot.socket.addEventListener("error",()=>{var ht;const dt=new ConnectionFailedError(`Could not connect to ${et.toString()}`);this.log.error("connection error:",dt),(ht=this.metrics)==null||ht.dialerEvents.increment({error:!0}),rt.reject(dt)});try{(st=tt.onProgress)==null||st.call(tt,new CustomProgressEvent("websockets:open-connection")),await raceSignal(Promise.race([ot.connected(),rt.promise]),tt.signal)}catch(dt){throw((at=tt.signal)==null?void 0:at.aborted)===!0&&((ct=this.metrics)==null||ct.dialerEvents.increment({abort:!0})),ot.close().catch(ht=>{this.log.error("error closing raw socket",ht)}),dt}return this.log("connected %s",et),(lt=this.metrics)==null||lt.dialerEvents.increment({connect:!0}),ot}createListener(et){return createListener({logger:this.logger,metrics:this.components.metrics},{...this.init,...et})}listenFilter(et){var tt,nt;return et=Array.isArray(et)?et:[et],((tt=this.init)==null?void 0:tt.filter)!=null?(nt=this.init)==null?void 0:nt.filter(et):isBrowser||isWebWorker?wss(et):all$1(et)}dialFilter(et){return this.listenFilter(et)}}function webSockets(o={}){return et=>new WebSockets(et,o)}const connectionSymbol=Symbol.for("@libp2p/connection"),contentRoutingSymbol=Symbol.for("@libp2p/content-routing"),peerDiscoverySymbol=Symbol.for("@libp2p/peer-discovery"),peerIdSymbol$1=Symbol.for("@libp2p/peer-id");function isPeerId$1(o){return!!(o!=null&&o[peerIdSymbol$1])}const peerRoutingSymbol=Symbol.for("@libp2p/peer-routing"),KEEP_ALIVE="keep-alive";var FaultTolerance;(function(o){o[o.FATAL_ALL=0]="FATAL_ALL",o[o.NO_FATAL=1]="NO_FATAL"})(FaultTolerance||(FaultTolerance={}));var bs;let AbortError$4=(bs=class extends Error{constructor(et="The operation was aborted"){super(et),this.name="AbortError"}},Ct(bs,"name","AbortError"),bs);var Es;let InvalidParametersError$1=(Es=class extends Error{constructor(et="Invalid parameters"){super(et),this.name="InvalidParametersError"}},Ct(Es,"name","InvalidParametersError"),Es);class ConnectionClosingError extends Error{constructor(et="The connection is closing"){super(et),this.name="ConnectionClosingError"}}Ct(ConnectionClosingError,"name","ConnectionClosingError");class ConnectionClosedError extends Error{constructor(et="The connection is closed"){super(et),this.name="ConnectionClosedError"}}Ct(ConnectionClosedError,"name","ConnectionClosedError");var ws;let NotFoundError$1=(ws=class extends Error{constructor(et="Not found"){super(et),this.name="NotFoundError"}},Ct(ws,"name","NotFoundError"),ws);class InvalidPeerIdError extends Error{constructor(et="Invalid PeerID"){super(et),this.name="InvalidPeerIdError"}}Ct(InvalidPeerIdError,"name","InvalidPeerIdError");class InvalidMultiaddrError extends Error{constructor(et="Invalid multiaddr"){super(et),this.name="InvalidMultiaddrError"}}Ct(InvalidMultiaddrError,"name","InvalidMultiaddrError");var Cs;let TimeoutError$2=(Cs=class extends Error{constructor(et="Timed out"){super(et),this.name="TimeoutError"}},Ct(Cs,"name","TimeoutError"),Cs);class NotStartedError extends Error{constructor(et="Not started"){super(et),this.name="NotStartedError"}}Ct(NotStartedError,"name","NotStartedError");class DialError extends Error{constructor(et="Dial error"){super(et),this.name="DialError"}}Ct(DialError,"name","DialError");class LimitedConnectionError extends Error{constructor(et="Limited connection"){super(et),this.name="LimitedConnectionError"}}Ct(LimitedConnectionError,"name","LimitedConnectionError");class TooManyInboundProtocolStreamsError extends Error{constructor(et="Too many inbound protocol streams"){super(et),this.name="TooManyInboundProtocolStreamsError"}}Ct(TooManyInboundProtocolStreamsError,"name","TooManyInboundProtocolStreamsError");class TooManyOutboundProtocolStreamsError extends Error{constructor(et="Too many outbound protocol streams"){super(et),this.name="TooManyOutboundProtocolStreamsError"}}Ct(TooManyOutboundProtocolStreamsError,"name","TooManyOutboundProtocolStreamsError");function setMaxListeners$1(){}const setMaxListeners=(o,...et)=>{try{[...et]}catch{}};var Xn;class TypedEventEmitter extends EventTarget{constructor(){super();fn(this,Xn,new Map);setMaxListeners(1/0,this)}listenerCount(tt){const nt=Mt(this,Xn).get(tt);return nt==null?0:nt.length}addEventListener(tt,nt,rt){super.addEventListener(tt,nt,rt);let ot=Mt(this,Xn).get(tt);ot==null&&(ot=[],Mt(this,Xn).set(tt,ot)),ot.push({callback:nt,once:(rt!==!0&&rt!==!1&&(rt==null?void 0:rt.once))??!1})}removeEventListener(tt,nt,rt){super.removeEventListener(tt.toString(),nt??null,rt);let ot=Mt(this,Xn).get(tt);ot!=null&&(ot=ot.filter(({callback:it})=>it!==nt),Mt(this,Xn).set(tt,ot))}dispatchEvent(tt){const nt=super.dispatchEvent(tt);let rt=Mt(this,Xn).get(tt.type);return rt==null||(rt=rt.filter(({once:ot})=>!ot),Mt(this,Xn).set(tt.type,rt)),nt}safeDispatchEvent(tt,nt={}){return this.dispatchEvent(new CustomEvent(tt,nt))}}Xn=new WeakMap;function isStartable(o){return o!=null&&typeof o.start=="function"&&typeof o.stop=="function"}async function start(...o){const et=[];for(const tt of o)isStartable(tt)&&et.push(tt);await Promise.all(et.map(async tt=>{tt.beforeStart!=null&&await tt.beforeStart()})),await Promise.all(et.map(async tt=>{await tt.start()})),await Promise.all(et.map(async tt=>{tt.afterStart!=null&&await tt.afterStart()}))}async function stop(...o){const et=[];for(const tt of o)isStartable(tt)&&et.push(tt);await Promise.all(et.map(async tt=>{tt.beforeStop!=null&&await tt.beforeStop()})),await Promise.all(et.map(async tt=>{await tt.stop()})),await Promise.all(et.map(async tt=>{tt.afterStop!=null&&await tt.afterStop()}))}const serviceCapabilities=Symbol.for("@libp2p/service-capabilities"),serviceDependencies=Symbol.for("@libp2p/service-dependencies");let TimeoutError$1=class extends Error{constructor(et){super(et),this.name="TimeoutError"}},AbortError$3=class extends Error{constructor(et){super(),this.name="AbortError",this.message=et}};const getDOMException=o=>globalThis.DOMException===void 0?new AbortError$3(o):new DOMException(o),getAbortedReason=o=>{const et=o.reason===void 0?getDOMException("This operation was aborted."):o.reason;return et instanceof Error?et:getDOMException(et)};function pTimeout(o,et){const{milliseconds:tt,fallback:nt,message:rt,customTimers:ot={setTimeout,clearTimeout}}=et;let it;const at=new Promise((ct,lt)=>{if(typeof tt!="number"||Math.sign(tt)!==1)throw new TypeError(`Expected \`milliseconds\` to be a positive number, got \`${tt}\``);if(et.signal){const{signal:ht}=et;ht.aborted&<(getAbortedReason(ht));const pt=()=>{lt(getAbortedReason(ht))};ht.addEventListener("abort",pt,{once:!0}),o.finally(()=>{ht.removeEventListener("abort",pt)})}if(tt===Number.POSITIVE_INFINITY){o.then(ct,lt);return}const dt=new TimeoutError$1;it=ot.setTimeout.call(void 0,()=>{if(nt){try{ct(nt())}catch(ht){lt(ht)}return}typeof o.cancel=="function"&&o.cancel(),rt===!1?ct():rt instanceof Error?lt(rt):(dt.message=rt??`Promise timed out after ${tt} milliseconds`,lt(dt))},tt),(async()=>{try{ct(await o)}catch(ht){lt(ht)}})()}).finally(()=>{at.clear()});return at.clear=()=>{ot.clearTimeout.call(void 0,it),it=void 0},at}function lowerBound(o,et,tt){let nt=0,rt=o.length;for(;rt>0;){const ot=Math.trunc(rt/2);let it=nt+ot;tt(o[it],et)<=0?(nt=++it,rt-=ot+1):rt=ot}return nt}var Jn,Ll;let PriorityQueue$1=(Ll=class{constructor(){fn(this,Jn,[])}enqueue(et,tt){tt={priority:0,...tt};const nt={priority:tt.priority,run:et};if(this.size&&Mt(this,Jn)[this.size-1].priority>=tt.priority){Mt(this,Jn).push(nt);return}const rt=lowerBound(Mt(this,Jn),nt,(ot,it)=>it.priority-ot.priority);Mt(this,Jn).splice(rt,0,nt)}dequeue(){const et=Mt(this,Jn).shift();return et==null?void 0:et.run}filter(et){return Mt(this,Jn).filter(tt=>tt.priority===et.priority).map(tt=>tt.run)}get size(){return Mt(this,Jn).length}},Jn=new WeakMap,Ll);var Qr,Yr,vr,co,Zr,lo,zn,Xr,Dn,uo,Vn,Jr,ir,ho,_n,Yl,Zl,Xl,Jl,eu,Xo,$s,Os,Jo,tu,_i;class PQueue extends EventEmitter$1{constructor(tt){var nt,rt;super();fn(this,_n);fn(this,Qr);fn(this,Yr);fn(this,vr,0);fn(this,co);fn(this,Zr);fn(this,lo,0);fn(this,zn);fn(this,Xr);fn(this,Dn);fn(this,uo);fn(this,Vn,0);fn(this,Jr);fn(this,ir);fn(this,ho);Ct(this,"timeout");if(tt={carryoverConcurrencyCount:!1,intervalCap:Number.POSITIVE_INFINITY,interval:0,concurrency:Number.POSITIVE_INFINITY,autoStart:!0,queueClass:PriorityQueue$1,...tt},!(typeof tt.intervalCap=="number"&&tt.intervalCap>=1))throw new TypeError(`Expected \`intervalCap\` to be a number from 1 and up, got \`${((nt=tt.intervalCap)==null?void 0:nt.toString())??""}\` (${typeof tt.intervalCap})`);if(tt.interval===void 0||!(Number.isFinite(tt.interval)&&tt.interval>=0))throw new TypeError(`Expected \`interval\` to be a finite number >= 0, got \`${((rt=tt.interval)==null?void 0:rt.toString())??""}\` (${typeof tt.interval})`);un(this,Qr,tt.carryoverConcurrencyCount),un(this,Yr,tt.intervalCap===Number.POSITIVE_INFINITY||tt.interval===0),un(this,co,tt.intervalCap),un(this,Zr,tt.interval),un(this,Dn,new tt.queueClass),un(this,uo,tt.queueClass),this.concurrency=tt.concurrency,this.timeout=tt.timeout,un(this,ho,tt.throwOnTimeout===!0),un(this,ir,tt.autoStart===!1)}get concurrency(){return Mt(this,Jr)}set concurrency(tt){if(!(typeof tt=="number"&&tt>=1))throw new TypeError(`Expected \`concurrency\` to be a number from 1 and up, got \`${tt}\` (${typeof tt})`);un(this,Jr,tt),gn(this,_n,Jo).call(this)}async add(tt,nt={}){return nt={timeout:this.timeout,throwOnTimeout:Mt(this,ho),...nt},new Promise((rt,ot)=>{Mt(this,Dn).enqueue(async()=>{var it;br(this,Vn)._++,br(this,vr)._++;try{(it=nt.signal)==null||it.throwIfAborted();let st=tt({signal:nt.signal});nt.timeout&&(st=pTimeout(Promise.resolve(st),{milliseconds:nt.timeout})),nt.signal&&(st=Promise.race([st,gn(this,_n,tu).call(this,nt.signal)]));const at=await st;rt(at),this.emit("completed",at)}catch(st){if(st instanceof TimeoutError$1&&!nt.throwOnTimeout){rt();return}ot(st),this.emit("error",st)}finally{gn(this,_n,Xl).call(this)}},nt),this.emit("add"),gn(this,_n,Xo).call(this)})}async addAll(tt,nt){return Promise.all(tt.map(async rt=>this.add(rt,nt)))}start(){return Mt(this,ir)?(un(this,ir,!1),gn(this,_n,Jo).call(this),this):this}pause(){un(this,ir,!0)}clear(){un(this,Dn,new(Mt(this,uo)))}async onEmpty(){Mt(this,Dn).size!==0&&await gn(this,_n,_i).call(this,"empty")}async onSizeLessThan(tt){Mt(this,Dn).sizeMt(this,Dn).size{gn(this,_n,Jl).call(this)},nt)),!0}return!1},Xo=function(){if(Mt(this,Dn).size===0)return Mt(this,zn)&&clearInterval(Mt(this,zn)),un(this,zn,void 0),this.emit("empty"),Mt(this,Vn)===0&&this.emit("idle"),!1;if(!Mt(this,ir)){const tt=!Mt(this,_n,eu);if(Mt(this,_n,Yl)&&Mt(this,_n,Zl)){const nt=Mt(this,Dn).dequeue();return nt?(this.emit("active"),nt(),tt&&gn(this,_n,$s).call(this),!0):!1}}return!1},$s=function(){Mt(this,Yr)||Mt(this,zn)!==void 0||(un(this,zn,setInterval(()=>{gn(this,_n,Os).call(this)},Mt(this,Zr))),un(this,lo,Date.now()+Mt(this,Zr)))},Os=function(){Mt(this,vr)===0&&Mt(this,Vn)===0&&Mt(this,zn)&&(clearInterval(Mt(this,zn)),un(this,zn,void 0)),un(this,vr,Mt(this,Qr)?Mt(this,Vn):0),gn(this,_n,Jo).call(this)},Jo=function(){for(;gn(this,_n,Xo).call(this););},tu=async function(tt){return new Promise((nt,rt)=>{tt.addEventListener("abort",()=>{rt(tt.reason)},{once:!0})})},_i=async function(tt,nt){return new Promise(rt=>{const ot=()=>{nt&&!nt()||(this.off(tt,ot),rt())};this.on(tt,ot)})};function getTypes(o){const et=[RecordType.A];return o==null?et:Array.isArray(o)?o.length===0?et:o:[o]}const DEFAULT_TTL=60;function toDNSResponse(o){return{Status:o.Status??0,TC:o.TC??o.flag_tc??!1,RD:o.RD??o.flag_rd??!1,RA:o.RA??o.flag_ra??!1,AD:o.AD??o.flag_ad??!1,CD:o.CD??o.flag_cd??!1,Question:(o.Question??o.questions??[]).map(et=>({name:et.name,type:RecordType[et.type]})),Answer:(o.Answer??o.answers??[]).map(et=>({name:et.name,type:RecordType[et.type],TTL:et.TTL??et.ttl??DEFAULT_TTL,data:et.data instanceof Uint8Array?toString$8(et.data):et.data}))}}const DEFAULT_QUERY_CONCURRENCY=4;function dnsJsonOverHttps(o,et={}){const tt=new PQueue({concurrency:et.queryConcurrency??DEFAULT_QUERY_CONCURRENCY});return async(nt,rt={})=>{var st;const ot=new URLSearchParams;ot.set("name",nt),getTypes(rt.types).forEach(at=>{ot.append("type",RecordType[at])}),(st=rt.onProgress)==null||st.call(rt,new CustomProgressEvent("dns:query",{detail:nt}));const it=await tt.add(async()=>{var lt;const at=await fetch(`${o}?${ot}`,{headers:{accept:"application/dns-json"},signal:rt==null?void 0:rt.signal});if(at.status!==200)throw new Error(`Unexpected HTTP status: ${at.status} - ${at.statusText}`);const ct=toDNSResponse(await at.json());return(lt=rt.onProgress)==null||lt.call(rt,new CustomProgressEvent("dns:response",{detail:ct})),ct},{signal:rt.signal});if(it==null)throw new Error("No DNS response received");return it}}function defaultResolver(){return[dnsJsonOverHttps("https://cloudflare-dns.com/dns-query"),dnsJsonOverHttps("https://dns.google/resolve")]}var hashlru=function(o){if(!o)throw Error("hashlru must have a max value, of type number, greater than 0");var et=0,tt=Object.create(null),nt=Object.create(null);function rt(ot,it){tt[ot]=it,et++,et>=o&&(et=0,nt=tt,tt=Object.create(null))}return{has:function(ot){return tt[ot]!==void 0||nt[ot]!==void 0},remove:function(ot){tt[ot]!==void 0&&(tt[ot]=void 0),nt[ot]!==void 0&&(nt[ot]=void 0)},get:function(ot){var it=tt[ot];if(it!==void 0)return it;if((it=nt[ot])!==void 0)return rt(ot,it),it},set:function(ot,it){tt[ot]!==void 0?tt[ot]=it:rt(ot,it)},clear:function(){tt=Object.create(null),nt=Object.create(null)}}};const hashlru$1=getDefaultExportFromCjs(hashlru);class CachedAnswers{constructor(et){Ct(this,"lru");this.lru=hashlru$1(et)}get(et,tt){let nt=!0;const rt=[];for(const ot of tt){const it=this.getAnswers(et,ot);if(it.length===0){nt=!1;break}rt.push(...it)}if(nt)return toDNSResponse({answers:rt})}getAnswers(et,tt){const nt=`${et.toLowerCase()}-${tt}`,rt=this.lru.get(nt);if(rt!=null){const ot=rt.filter(it=>it.expires>Date.now()).map(({expires:it,value:st})=>({...st,TTL:Math.round((it-Date.now())/1e3),type:RecordType[st.type]}));return ot.length===0&&this.lru.remove(nt),ot}return[]}add(et,tt){const nt=`${et.toLowerCase()}-${tt.type}`,rt=this.lru.get(nt)??[];rt.push({expires:Date.now()+(tt.TTL??DEFAULT_TTL)*1e3,value:tt}),this.lru.set(nt,rt)}remove(et,tt){const nt=`${et.toLowerCase()}-${tt}`;this.lru.remove(nt)}clear(){this.lru.clear()}}function cache(o){return new CachedAnswers(o)}const DEFAULT_ANSWER_CACHE_SIZE=1e3;class DNS{constructor(et){Ct(this,"resolvers");Ct(this,"cache");this.resolvers={},this.cache=cache(et.cacheSize??DEFAULT_ANSWER_CACHE_SIZE),Object.entries(et.resolvers??{}).forEach(([tt,nt])=>{Array.isArray(nt)||(nt=[nt]),tt.endsWith(".")||(tt=`${tt}.`),this.resolvers[tt]=nt}),this.resolvers["."]==null&&(this.resolvers["."]=defaultResolver())}async query(et,tt={}){var at,ct,lt;const nt=getTypes(tt.types),rt=tt.cached!==!1?this.cache.get(et,nt):void 0;if(rt!=null)return(at=tt.onProgress)==null||at.call(tt,new CustomProgressEvent("dns:cache",{detail:rt})),rt;const ot=`${et.split(".").pop()}.`,it=(this.resolvers[ot]??this.resolvers["."]).sort(()=>Math.random()>.5?-1:1),st=[];for(const dt of it){if(((ct=tt.signal)==null?void 0:ct.aborted)===!0)break;try{const ht=await dt(et,{...tt,types:nt});for(const pt of ht.Answer)this.cache.add(et,pt);return ht}catch(ht){st.push(ht),(lt=tt.onProgress)==null||lt.call(tt,new CustomProgressEvent("dns:error",{detail:ht}))}}throw st.length===1?st[0]:new AggregateError(st,`DNS lookup of ${et} ${nt} failed`)}}var RecordType;(function(o){o[o.A=1]="A",o[o.CNAME=5]="CNAME",o[o.TXT=16]="TXT",o[o.AAAA=28]="AAAA"})(RecordType||(RecordType={}));function dns(o={}){return new DNS(o)}const MAX_RECURSIVE_DEPTH=32,{code:dnsaddrCode}=getProtocol("dnsaddr");class RecursionLimitError extends Error{constructor(et="Max recursive depth reached"){super(et),this.name="RecursionLimitError"}}const dnsaddrResolver=async function(et,tt={}){const nt=tt.maxRecursiveDepth??MAX_RECURSIVE_DEPTH;if(nt===0)throw new RecursionLimitError("Max recursive depth reached");const[,rt]=et.stringTuples().find(([ct])=>ct===dnsaddrCode)??[],it=await((tt==null?void 0:tt.dns)??dns()).query(`_dnsaddr.${rt}`,{signal:tt==null?void 0:tt.signal,types:[RecordType.TXT]}),st=et.getPeerId(),at=[];for(const ct of it.Answer){const lt=ct.data.replace(/["']/g,"").trim().split("=")[1];if(lt==null||st!=null&&!lt.includes(st))continue;const dt=multiaddr(lt);if(lt.startsWith("/dnsaddr")){const ht=await dt.resolve({...tt,maxRecursiveDepth:nt-1});at.push(...ht.map(pt=>pt.toString()))}else at.push(dt.toString())}return at};var isPlainObj=o=>{if(Object.prototype.toString.call(o)!=="[object Object]")return!1;const et=Object.getPrototypeOf(o);return et===null||et===Object.prototype};const isOptionObject=isPlainObj,{hasOwnProperty:hasOwnProperty$1}=Object.prototype,{propertyIsEnumerable}=Object,defineProperty$1=(o,et,tt)=>Object.defineProperty(o,et,{value:tt,writable:!0,enumerable:!0,configurable:!0}),globalThis$1=commonjsGlobal,defaultMergeOptions={concatArrays:!1,ignoreUndefined:!1},getEnumerableOwnPropertyKeys=o=>{const et=[];for(const tt in o)hasOwnProperty$1.call(o,tt)&&et.push(tt);if(Object.getOwnPropertySymbols){const tt=Object.getOwnPropertySymbols(o);for(const nt of tt)propertyIsEnumerable.call(o,nt)&&et.push(nt)}return et};function clone(o){return Array.isArray(o)?cloneArray(o):isOptionObject(o)?cloneOptionObject(o):o}function cloneArray(o){const et=o.slice(0,0);return getEnumerableOwnPropertyKeys(o).forEach(tt=>{defineProperty$1(et,tt,clone(o[tt]))}),et}function cloneOptionObject(o){const et=Object.getPrototypeOf(o)===null?Object.create(null):{};return getEnumerableOwnPropertyKeys(o).forEach(tt=>{defineProperty$1(et,tt,clone(o[tt]))}),et}const mergeKeys=(o,et,tt,nt)=>(tt.forEach(rt=>{typeof et[rt]>"u"&&nt.ignoreUndefined||(rt in o&&o[rt]!==Object.getPrototypeOf(o)?defineProperty$1(o,rt,merge$1(o[rt],et[rt],nt)):defineProperty$1(o,rt,clone(et[rt])))}),o),concatArrays=(o,et,tt)=>{let nt=o.slice(0,0),rt=0;return[o,et].forEach(ot=>{const it=[];for(let st=0;st!it.includes(st)),tt)}),nt};function merge$1(o,et,tt){return tt.concatArrays&&Array.isArray(o)&&Array.isArray(et)?concatArrays(o,et,tt):!isOptionObject(et)||!isOptionObject(o)?clone(et):mergeKeys(o,et,getEnumerableOwnPropertyKeys(et),tt)}var mergeOptions=function(...o){const et=merge$1(clone(defaultMergeOptions),this!==globalThis$1&&this||{},defaultMergeOptions);let tt={_:{}};for(const nt of o)if(nt!==void 0){if(!isOptionObject(nt))throw new TypeError("`"+nt+"` is not an Option Object");tt=merge$1(tt,{_:nt},et)}return tt._};const mergeOptions$1=getDefaultExportFromCjs(mergeOptions);var define_globalThis_process_env_default$1={};const DefaultConfig={addresses:{listen:[],announce:[],noAnnounce:[],announceFilter:o=>o},connectionManager:{resolvers:{dnsaddr:dnsaddrResolver}},transportManager:{faultTolerance:FaultTolerance.FATAL_ALL}};async function validateConfig(o){const et=mergeOptions$1(DefaultConfig,o);if(et.connectionProtector===null&&(define_globalThis_process_env_default$1==null?void 0:define_globalThis_process_env_default$1.LIBP2P_FORCE_PNET)!=null)throw new InvalidParametersError$1("Private network is enforced, but no protector was provided");return et}const s=1e3,m=s*60,h=m*60,d=h*24,w=d*7,y=d*365.25;function ms(o,et){try{if(typeof o=="string"&&o.length>0)return parse$3(o);if(typeof o=="number"&&isFinite(o))return et!=null&&et.long?fmtLong(o):fmtShort(o);throw new Error("Value is not a string or number.")}catch(tt){const nt=isError$1(tt)?`${tt.message}. value=${JSON.stringify(o)}`:"An unknown error has occured.";throw new Error(nt)}}function parse$3(o){if(o=String(o),o.length>100)throw new Error("Value exceeds the maximum length of 100 characters.");const et=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(o);if(!et)return NaN;const tt=parseFloat(et[1]),nt=(et[2]||"ms").toLowerCase();switch(nt){case"years":case"year":case"yrs":case"yr":case"y":return tt*y;case"weeks":case"week":case"w":return tt*w;case"days":case"day":case"d":return tt*d;case"hours":case"hour":case"hrs":case"hr":case"h":return tt*h;case"minutes":case"minute":case"mins":case"min":case"m":return tt*m;case"seconds":case"second":case"secs":case"sec":case"s":return tt*s;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return tt;default:throw new Error(`The unit ${nt} was matched, but no matching case exists.`)}}function fmtShort(o){const et=Math.abs(o);return et>=d?`${Math.round(o/d)}d`:et>=h?`${Math.round(o/h)}h`:et>=m?`${Math.round(o/m)}m`:et>=s?`${Math.round(o/s)}s`:`${o}ms`}function fmtLong(o){const et=Math.abs(o);return et>=d?plural(o,et,d,"day"):et>=h?plural(o,et,h,"hour"):et>=m?plural(o,et,m,"minute"):et>=s?plural(o,et,s,"second"):`${o} ms`}function plural(o,et,tt,nt){const rt=et>=tt*1.5;return`${Math.round(o/tt)} ${nt}${rt?"s":""}`}function isError$1(o){return typeof o=="object"&&o!==null&&"message"in o}function setup(o){tt.debug=tt,tt.default=tt,tt.coerce=at,tt.disable=ot,tt.enable=rt,tt.enabled=it,tt.humanize=ms,tt.destroy=ct,Object.keys(o).forEach(lt=>{tt[lt]=o[lt]}),tt.names=[],tt.skips=[],tt.formatters={};function et(lt){let dt=0;for(let ht=0;ht{if(wt==="%%")return"%";bt++;const It=tt.formatters[kt];if(typeof It=="function"){const Rt=yt[bt];wt=It.call(gt,Rt),yt.splice(bt,1),bt--}return wt}),tt.formatArgs.call(gt,yt),(gt.log||tt.log).apply(gt,yt)}return ft.namespace=lt,ft.useColors=tt.useColors(),ft.color=tt.selectColor(lt),ft.extend=nt,ft.destroy=tt.destroy,Object.defineProperty(ft,"enabled",{enumerable:!0,configurable:!1,get:()=>ht!==null?ht:(pt!==tt.namespaces&&(pt=tt.namespaces,mt=tt.enabled(lt)),mt),set:yt=>{ht=yt}}),typeof tt.init=="function"&&tt.init(ft),ft}function nt(lt,dt){const ht=tt(this.namespace+(typeof dt>"u"?":":dt)+lt);return ht.log=this.log,ht}function rt(lt){tt.save(lt),tt.namespaces=lt,tt.names=[],tt.skips=[];let dt;const ht=(typeof lt=="string"?lt:"").split(/[\s,]+/),pt=ht.length;for(dt=0;dt"-"+dt)].join(",");return tt.enable(""),lt}function it(lt){if(lt[lt.length-1]==="*")return!0;let dt,ht;for(dt=0,ht=tt.skips.length;dt=31||typeof navigator<"u"&&((rt=navigator.userAgent)==null?void 0:rt.toLowerCase().match(/applewebkit\/(\d+)/))}function formatArgs(o){if(o[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+o[0]+(this.useColors?"%c ":" ")+"+"+ms(this.diff),!this.useColors)return;const et="color: "+this.color;o.splice(1,0,et,"color: inherit");let tt=0,nt=0;o[0].replace(/%[a-zA-Z%]/g,rt=>{rt!=="%%"&&(tt++,rt==="%c"&&(nt=tt))}),o.splice(nt,0,et)}const log$a=console.debug??console.log??(()=>{});function save(o){try{o?storage==null||storage.setItem("debug",o):storage==null||storage.removeItem("debug")}catch{}}function load$1(){let o;try{o=storage==null?void 0:storage.getItem("debug")}catch{}return!o&&typeof globalThis.process<"u"&&"env"in globalThis.process&&(o=define_globalThis_process_env_default.DEBUG),o}function localstorage(){try{return localStorage}catch{}}function setupFormatters(o){o.j=function(et){try{return JSON.stringify(et)}catch(tt){return"[UnexpectedJSONParseError]: "+tt.message}}}const weald=setup({formatArgs,save,load:load$1,useColors,setupFormatters,colors,storage,log:log$a});weald.formatters.b=o=>o==null?"undefined":base58btc.baseEncode(o);weald.formatters.t=o=>o==null?"undefined":base32$2.baseEncode(o);weald.formatters.m=o=>o==null?"undefined":base64$2.baseEncode(o);weald.formatters.p=o=>o==null?"undefined":o.toString();weald.formatters.c=o=>o==null?"undefined":o.toString();weald.formatters.k=o=>o==null?"undefined":o.toString();weald.formatters.a=o=>o==null?"undefined":o.toString();weald.formatters.e=o=>o==null?"undefined":notEmpty(o.stack)??notEmpty(o.message)??o.toString();function createDisabledLogger(o){const et=()=>{};return et.enabled=!1,et.color="",et.diff=0,et.log=()=>{},et.namespace=o,et.destroy=()=>!0,et.extend=()=>et,et}function defaultLogger(){return{forComponent(o){return logger$2(o)}}}function logger$2(o){let et=createDisabledLogger(`${o}:trace`);return weald.enabled(`${o}:trace`)&&weald.names.map(tt=>tt.toString()).find(tt=>tt.includes(":trace"))!=null&&(et=weald(`${o}:trace`)),Object.assign(weald(o),{error:weald(`${o}:error`),trace:et})}function notEmpty(o){if(o!=null&&(o=o.trim(),o.length!==0))return o}function mapIterable(o,et){const tt={[Symbol.iterator]:()=>tt,next:()=>{const nt=o.next(),rt=nt.value;return nt.done===!0||rt==null?{done:!0,value:void 0}:{done:!1,value:et(rt)}}};return tt}function peerIdFromString(o){const et=decode$6(base58btc.decode(`z${o}`));return peerIdFromMultihash(et)}class PeerMap{constructor(et){Ct(this,"map");if(this.map=new Map,et!=null)for(const[tt,nt]of et.entries())this.map.set(tt.toString(),{key:tt,value:nt})}[Symbol.iterator](){return this.entries()}clear(){this.map.clear()}delete(et){return this.map.delete(et.toString())}entries(){return mapIterable(this.map.entries(),et=>[et[1].key,et[1].value])}forEach(et){this.map.forEach((tt,nt)=>{et(tt.value,tt.key,this)})}get(et){var tt;return(tt=this.map.get(et.toString()))==null?void 0:tt.value}has(et){return this.map.has(et.toString())}set(et,tt){this.map.set(et.toString(),{key:et,value:tt})}keys(){return mapIterable(this.map.values(),et=>et.key)}values(){return mapIterable(this.map.values(),et=>et.value)}get size(){return this.map.size}}class PeerSet{constructor(et){Ct(this,"set");if(this.set=new Set,et!=null)for(const tt of et)this.set.add(tt.toString())}get size(){return this.set.size}[Symbol.iterator](){return this.values()}add(et){this.set.add(et.toString())}clear(){this.set.clear()}delete(et){this.set.delete(et.toString())}entries(){return mapIterable(this.set.entries(),et=>{const tt=peerIdFromString(et[0]);return[tt,tt]})}forEach(et){this.set.forEach(tt=>{const nt=peerIdFromString(tt);et(nt,nt,this)})}has(et){return this.set.has(et.toString())}values(){return mapIterable(this.set.values(),et=>peerIdFromString(et))}intersection(et){const tt=new PeerSet;for(const nt of et)this.has(nt)&&tt.add(nt);return tt}difference(et){const tt=new PeerSet;for(const nt of this)et.has(nt)||tt.add(nt);return tt}union(et){const tt=new PeerSet;for(const nt of et)tt.add(nt);for(const nt of this)tt.add(nt);return tt}}var murmurHash3js={exports:{}};(function(o,et){(function(tt,nt){var rt={version:"3.0.0",x86:{},x64:{},inputValidation:!0};function ot(ft){if(!Array.isArray(ft)&&!ArrayBuffer.isView(ft))return!1;for(var yt=0;yt255)return!1;return!0}function it(ft,yt){return(ft&65535)*yt+(((ft>>>16)*yt&65535)<<16)}function st(ft,yt){return ft<>>32-yt}function at(ft){return ft^=ft>>>16,ft=it(ft,2246822507),ft^=ft>>>13,ft=it(ft,3266489909),ft^=ft>>>16,ft}function ct(ft,yt){ft=[ft[0]>>>16,ft[0]&65535,ft[1]>>>16,ft[1]&65535],yt=[yt[0]>>>16,yt[0]&65535,yt[1]>>>16,yt[1]&65535];var gt=[0,0,0,0];return gt[3]+=ft[3]+yt[3],gt[2]+=gt[3]>>>16,gt[3]&=65535,gt[2]+=ft[2]+yt[2],gt[1]+=gt[2]>>>16,gt[2]&=65535,gt[1]+=ft[1]+yt[1],gt[0]+=gt[1]>>>16,gt[1]&=65535,gt[0]+=ft[0]+yt[0],gt[0]&=65535,[gt[0]<<16|gt[1],gt[2]<<16|gt[3]]}function lt(ft,yt){ft=[ft[0]>>>16,ft[0]&65535,ft[1]>>>16,ft[1]&65535],yt=[yt[0]>>>16,yt[0]&65535,yt[1]>>>16,yt[1]&65535];var gt=[0,0,0,0];return gt[3]+=ft[3]*yt[3],gt[2]+=gt[3]>>>16,gt[3]&=65535,gt[2]+=ft[2]*yt[3],gt[1]+=gt[2]>>>16,gt[2]&=65535,gt[2]+=ft[3]*yt[2],gt[1]+=gt[2]>>>16,gt[2]&=65535,gt[1]+=ft[1]*yt[3],gt[0]+=gt[1]>>>16,gt[1]&=65535,gt[1]+=ft[2]*yt[2],gt[0]+=gt[1]>>>16,gt[1]&=65535,gt[1]+=ft[3]*yt[1],gt[0]+=gt[1]>>>16,gt[1]&=65535,gt[0]+=ft[0]*yt[3]+ft[1]*yt[2]+ft[2]*yt[1]+ft[3]*yt[0],gt[0]&=65535,[gt[0]<<16|gt[1],gt[2]<<16|gt[3]]}function dt(ft,yt){return yt%=64,yt===32?[ft[1],ft[0]]:yt<32?[ft[0]<>>32-yt,ft[1]<>>32-yt]:(yt-=32,[ft[1]<>>32-yt,ft[0]<>>32-yt])}function ht(ft,yt){return yt%=64,yt===0?ft:yt<32?[ft[0]<>>32-yt,ft[1]<>>1]),ft=lt(ft,[4283543511,3981806797]),ft=pt(ft,[0,ft[0]>>>1]),ft=lt(ft,[3301882366,444984403]),ft=pt(ft,[0,ft[0]>>>1]),ft}rt.x86.hash32=function(ft,yt){if(rt.inputValidation&&!ot(ft))return nt;yt=yt||0;for(var gt=ft.length%4,xt=ft.length-gt,vt=yt,bt=0,Et=3432918353,wt=461845907,kt=0;kt>>0},rt.x86.hash128=function(ft,yt){if(rt.inputValidation&&!ot(ft))return nt;yt=yt||0;for(var gt=ft.length%16,xt=ft.length-gt,vt=yt,bt=yt,Et=yt,wt=yt,kt=0,It=0,Rt=0,Pt=0,jt=597399067,Ot=2869860233,Bt=951274213,zt=2716044179,Ft=0;Ft>>0).toString(16)).slice(-8)+("00000000"+(bt>>>0).toString(16)).slice(-8)+("00000000"+(Et>>>0).toString(16)).slice(-8)+("00000000"+(wt>>>0).toString(16)).slice(-8)},rt.x64.hash128=function(ft,yt){if(rt.inputValidation&&!ot(ft))return nt;yt=yt||0;for(var gt=ft.length%16,xt=ft.length-gt,vt=[0,yt],bt=[0,yt],Et=[0,0],wt=[0,0],kt=[2277735313,289559509],It=[1291169091,658871167],Rt=0;Rt>>0).toString(16)).slice(-8)+("00000000"+(vt[1]>>>0).toString(16)).slice(-8)+("00000000"+(bt[0]>>>0).toString(16)).slice(-8)+("00000000"+(bt[1]>>>0).toString(16)).slice(-8)},o.exports&&(et=o.exports=rt),et.murmurHash3=rt})()})(murmurHash3js,murmurHash3js.exports);const MAX_FINGERPRINT_SIZE=64;class Fingerprint{constructor(et,tt,nt,rt=2){Ct(this,"fp");Ct(this,"h");Ct(this,"seed");if(rt>MAX_FINGERPRINT_SIZE)throw new TypeError("Invalid Fingerprint Size");const ot=tt.hashV(et,nt),it=alloc$2(rt);for(let st=0;stet.equals(tt))}add(et){if(!(et instanceof Fingerprint))throw new TypeError("Invalid Fingerprint");for(let tt=0;ttet.equals(nt));return tt>-1?(this.contents[tt]=null,!0):!1}}const FNV_PRIMES={32:16777619n,64:1099511628211n,128:309485009821345068724781371n,256:374144419156711147060143317175368453031918731002211n,512:35835915874844867368919076489095108449946327955754392558399825615420669938882575126094039892345713852759n,1024:5016456510113118655434598811035278955030765345404790744303017523831112055108147451509157692220295382716162651878526895249385292291816524375083746691371804094271873160484737966720260389217684476157468082573n},FNV_OFFSETS={32:2166136261n,64:14695981039346656037n,128:144066263297769815596495629667062367629n,256:100029257958052580907070968620625704837092796014241193945225284501741471925557n,512:9659303129496669498009435400716310466090418745672637896108374329434462657994582932197716438449813051892206539805784495328239340083876191928701583869517785n,1024:14197795064947621068722070641403218320880622795441933960878474914617582723252296732303717722150864096521202355549365628174669108571814760471015076148029755969804077320157692458563003215304957150157403644460363550505412711285966361610267868082893823963790439336411086884584107735010676915n},cachedEncoder=new globalThis.TextEncoder;function fnv1aUint8Array(o,et){const tt=FNV_PRIMES[et];let nt=FNV_OFFSETS[et];for(let rt=0;rt0;){const it=cachedEncoder.encodeInto(ot,tt);ot=ot.slice(it.read);for(let st=0;stNumber(fnv1a$1(o,{size:32})),hashV:(o,et)=>numberToBuffer(fnv1a.hash(o,et))};function numberToBuffer(o){let et=o.toString(16);return et.length%2===1&&(et=`0${et}`),fromString(et,"base16")}const maxCuckooCount=500;class CuckooFilter{constructor(et){Ct(this,"bucketSize");Ct(this,"filterSize");Ct(this,"fingerprintSize");Ct(this,"buckets");Ct(this,"count");Ct(this,"hash");Ct(this,"seed");this.filterSize=et.filterSize,this.bucketSize=et.bucketSize??4,this.fingerprintSize=et.fingerprintSize??2,this.count=0,this.buckets=[],this.hash=et.hash??fnv1a,this.seed=et.seed??getRandomInt(0,Math.pow(2,10))}add(et){typeof et=="string"&&(et=fromString(et));const tt=new Fingerprint(et,this.hash,this.seed,this.fingerprintSize),nt=this.hash.hash(et,this.seed)%this.filterSize,rt=(nt^tt.hash())%this.filterSize;if(this.buckets[nt]==null&&(this.buckets[nt]=new Bucket(this.bucketSize)),this.buckets[rt]==null&&(this.buckets[rt]=new Bucket(this.bucketSize)),this.buckets[nt].add(tt)||this.buckets[rt].add(tt))return this.count++,!0;const ot=[nt,rt];let it=ot[getRandomInt(0,ot.length-1)];this.buckets[it]==null&&(this.buckets[it]=new Bucket(this.bucketSize));for(let st=0;st.002?2:o>1e-5?4:8}function optimize(o,et=.001){const tt=calculateBucketSize(et),nt=MAX_LOAD[tt],rt=Math.round(o/nt),ot=Math.min(Math.ceil(Math.log2(1/et)+Math.log2(2*tt)),MAX_FINGERPRINT_SIZE);return{filterSize:rt,bucketSize:tt,fingerprintSize:ot}}class ScalableCuckooFilter{constructor(et){Ct(this,"filterSize");Ct(this,"bucketSize");Ct(this,"fingerprintSize");Ct(this,"scale");Ct(this,"filterSeries");Ct(this,"hash");Ct(this,"seed");this.bucketSize=et.bucketSize??4,this.filterSize=et.filterSize??(1<<18)/this.bucketSize,this.fingerprintSize=et.fingerprintSize??2,this.scale=et.scale??2,this.hash=et.hash??fnv1a,this.seed=et.seed??getRandomInt(0,Math.pow(2,10)),this.filterSeries=[new CuckooFilter({filterSize:this.filterSize,bucketSize:this.bucketSize,fingerprintSize:this.fingerprintSize,hash:this.hash,seed:this.seed})]}add(et){if(typeof et=="string"&&(et=fromString(et)),this.has(et))return!0;let tt=this.filterSeries.find(nt=>nt.reliable);if(tt==null){const nt=this.filterSize*Math.pow(this.scale,this.filterSeries.length);tt=new CuckooFilter({filterSize:nt,bucketSize:this.bucketSize,fingerprintSize:this.fingerprintSize,hash:this.hash,seed:this.seed}),this.filterSeries.push(tt)}return tt.add(et)}has(et){typeof et=="string"&&(et=fromString(et));for(let tt=0;ttet+tt.count,0)}}function createScalableCuckooFilter(o,et=.001,tt){return new ScalableCuckooFilter({...optimize(o,et)})}const peerIdSymbol=Symbol.for("@libp2p/peer-id");function isPeerId(o){return!!(o!=null&&o[peerIdSymbol])}class InvalidParametersError extends Error{constructor(et="Invalid parameters"){super(et),this.name="InvalidParametersError"}}Ct(InvalidParametersError,"name","InvalidParametersError");const events={},observable=o=>{o.addEventListener("message",et=>{observable.dispatchEvent("message",o,et)}),o.port!=null&&o.port.addEventListener("message",et=>{observable.dispatchEvent("message",o,et)})};observable.addEventListener=(o,et)=>{events[o]==null&&(events[o]=[]),events[o].push(et)};observable.removeEventListener=(o,et)=>{events[o]!=null&&(events[o]=events[o].filter(tt=>tt===et))};observable.dispatchEvent=function(o,et,tt){events[o]!=null&&events[o].forEach(nt=>nt(et,tt))};const WORKER_REQUEST_READ_LOCK="lock:worker:request-read",WORKER_RELEASE_READ_LOCK="lock:worker:release-read",MASTER_GRANT_READ_LOCK="lock:master:grant-read",WORKER_REQUEST_WRITE_LOCK="lock:worker:request-write",WORKER_RELEASE_WRITE_LOCK="lock:worker:release-write",MASTER_GRANT_WRITE_LOCK="lock:master:grant-write",nanoid=(o=21)=>Math.random().toString().substring(2),handleWorkerLockRequest=(o,et,tt,nt,rt)=>(ot,it)=>{if(it.data.type!==tt)return;const st={type:it.data.type,name:it.data.name,identifier:it.data.identifier};o.dispatchEvent(new MessageEvent(et,{data:{name:st.name,handler:async()=>{ot.postMessage({type:rt,name:st.name,identifier:st.identifier}),await new Promise(at=>{const ct=lt=>{if((lt==null?void 0:lt.data)==null)return;const dt={type:lt.data.type,name:lt.data.name,identifier:lt.data.identifier};dt.type===nt&&dt.identifier===st.identifier&&(ot.removeEventListener("message",ct),at())};ot.addEventListener("message",ct)})}}}))},makeWorkerLockRequest=(o,et,tt,nt)=>async()=>{const rt=nanoid();return globalThis.postMessage({type:et,identifier:rt,name:o}),new Promise(ot=>{const it=st=>{if((st==null?void 0:st.data)==null)return;const at={type:st.data.type,identifier:st.data.identifier};at.type===tt&&at.identifier===rt&&(globalThis.removeEventListener("message",it),ot(()=>{globalThis.postMessage({type:nt,identifier:rt,name:o})}))};globalThis.addEventListener("message",it)})},defaultOptions$4={singleProcess:!1},impl=o=>{if(o=Object.assign({},defaultOptions$4,o),!!globalThis.document||o.singleProcess){const tt=new EventTarget;return observable.addEventListener("message",handleWorkerLockRequest(tt,"requestReadLock",WORKER_REQUEST_READ_LOCK,WORKER_RELEASE_READ_LOCK,MASTER_GRANT_READ_LOCK)),observable.addEventListener("message",handleWorkerLockRequest(tt,"requestWriteLock",WORKER_REQUEST_WRITE_LOCK,WORKER_RELEASE_WRITE_LOCK,MASTER_GRANT_WRITE_LOCK)),tt}return{isWorker:!0,readLock:tt=>makeWorkerLockRequest(tt,WORKER_REQUEST_READ_LOCK,MASTER_GRANT_READ_LOCK,WORKER_RELEASE_READ_LOCK),writeLock:tt=>makeWorkerLockRequest(tt,WORKER_REQUEST_WRITE_LOCK,MASTER_GRANT_WRITE_LOCK,WORKER_RELEASE_WRITE_LOCK)}},mutexes={};let implementation;async function createReleaseable(o,et){let tt;const nt=new Promise(rt=>{tt=rt});return o.add(async()=>pTimeout((async()=>{await new Promise(rt=>{tt(()=>{rt()})})})(),{milliseconds:et.timeout})),nt}const createMutex=(o,et)=>{if(implementation.isWorker===!0)return{readLock:implementation.readLock(o,et),writeLock:implementation.writeLock(o,et)};const tt=new PQueue({concurrency:1});let nt;return{async readLock(){if(nt!=null)return createReleaseable(nt,et);nt=new PQueue({concurrency:et.concurrency,autoStart:!1});const rt=nt,ot=createReleaseable(nt,et);return tt.add(async()=>{rt.start(),await rt.onIdle().then(()=>{nt===rt&&(nt=null)})}),ot},async writeLock(){return nt=null,createReleaseable(tt,et)}}},defaultOptions$3={name:"lock",concurrency:1/0,timeout:846e5,singleProcess:!1};function createMortice(o){const et=Object.assign({},defaultOptions$3,o);return implementation==null&&(implementation=impl(et),implementation.isWorker!==!0&&(implementation.addEventListener("requestReadLock",tt=>{mutexes[tt.data.name]!=null&&mutexes[tt.data.name].readLock().then(async nt=>tt.data.handler().finally(()=>{nt()}))}),implementation.addEventListener("requestWriteLock",async tt=>{mutexes[tt.data.name]!=null&&mutexes[tt.data.name].writeLock().then(async nt=>tt.data.handler().finally(()=>{nt()}))}))),mutexes[et.name]==null&&(mutexes[et.name]=createMutex(et.name,et)),mutexes[et.name]}var Peer;(function(o){(function(tt){let nt;tt.codec=()=>(nt==null&&(nt=message$1((rt,ot,it={})=>{it.lengthDelimited!==!1&&ot.fork(),rt.key!=null&&rt.key!==""&&(ot.uint32(10),ot.string(rt.key)),rt.value!=null&&rt.value.byteLength>0&&(ot.uint32(18),ot.bytes(rt.value)),it.lengthDelimited!==!1&&ot.ldelim()},(rt,ot,it={})=>{const st={key:"",value:alloc$2(0)},at=ot==null?rt.len:rt.pos+ot;for(;rt.pos>>3){case 1:{st.key=rt.string();break}case 2:{st.value=rt.bytes();break}default:{rt.skipType(ct&7);break}}}return st})),nt),tt.encode=rt=>encodeMessage(rt,tt.codec()),tt.decode=(rt,ot)=>decodeMessage(rt,tt.codec(),ot)})(o.Peer$metadataEntry||(o.Peer$metadataEntry={})),function(tt){let nt;tt.codec=()=>(nt==null&&(nt=message$1((rt,ot,it={})=>{it.lengthDelimited!==!1&&ot.fork(),rt.key!=null&&rt.key!==""&&(ot.uint32(10),ot.string(rt.key)),rt.value!=null&&(ot.uint32(18),Tag.codec().encode(rt.value,ot)),it.lengthDelimited!==!1&&ot.ldelim()},(rt,ot,it={})=>{var ct;const st={key:""},at=ot==null?rt.len:rt.pos+ot;for(;rt.pos>>3){case 1:{st.key=rt.string();break}case 2:{st.value=Tag.codec().decode(rt,rt.uint32(),{limits:(ct=it.limits)==null?void 0:ct.value});break}default:{rt.skipType(lt&7);break}}}return st})),nt),tt.encode=rt=>encodeMessage(rt,tt.codec()),tt.decode=(rt,ot)=>decodeMessage(rt,tt.codec(),ot)}(o.Peer$tagsEntry||(o.Peer$tagsEntry={}));let et;o.codec=()=>(et==null&&(et=message$1((tt,nt,rt={})=>{if(rt.lengthDelimited!==!1&&nt.fork(),tt.addresses!=null)for(const ot of tt.addresses)nt.uint32(10),Address.codec().encode(ot,nt);if(tt.protocols!=null)for(const ot of tt.protocols)nt.uint32(18),nt.string(ot);if(tt.publicKey!=null&&(nt.uint32(34),nt.bytes(tt.publicKey)),tt.peerRecordEnvelope!=null&&(nt.uint32(42),nt.bytes(tt.peerRecordEnvelope)),tt.metadata!=null&&tt.metadata.size!==0)for(const[ot,it]of tt.metadata.entries())nt.uint32(50),o.Peer$metadataEntry.codec().encode({key:ot,value:it},nt);if(tt.tags!=null&&tt.tags.size!==0)for(const[ot,it]of tt.tags.entries())nt.uint32(58),o.Peer$tagsEntry.codec().encode({key:ot,value:it},nt);rt.lengthDelimited!==!1&&nt.ldelim()},(tt,nt,rt={})=>{var st,at,ct,lt,dt,ht;const ot={addresses:[],protocols:[],metadata:new Map,tags:new Map},it=nt==null?tt.len:tt.pos+nt;for(;tt.pos>>3){case 1:{if(((st=rt.limits)==null?void 0:st.addresses)!=null&&ot.addresses.length===rt.limits.addresses)throw new MaxLengthError('Decode error - map field "addresses" had too many elements');ot.addresses.push(Address.codec().decode(tt,tt.uint32(),{limits:(at=rt.limits)==null?void 0:at.addresses$}));break}case 2:{if(((ct=rt.limits)==null?void 0:ct.protocols)!=null&&ot.protocols.length===rt.limits.protocols)throw new MaxLengthError('Decode error - map field "protocols" had too many elements');ot.protocols.push(tt.string());break}case 4:{ot.publicKey=tt.bytes();break}case 5:{ot.peerRecordEnvelope=tt.bytes();break}case 6:{if(((lt=rt.limits)==null?void 0:lt.metadata)!=null&&ot.metadata.size===rt.limits.metadata)throw new MaxSizeError('Decode error - map field "metadata" had too many elements');const mt=o.Peer$metadataEntry.codec().decode(tt,tt.uint32());ot.metadata.set(mt.key,mt.value);break}case 7:{if(((dt=rt.limits)==null?void 0:dt.tags)!=null&&ot.tags.size===rt.limits.tags)throw new MaxSizeError('Decode error - map field "tags" had too many elements');const mt=o.Peer$tagsEntry.codec().decode(tt,tt.uint32(),{limits:{value:(ht=rt.limits)==null?void 0:ht.tags$value}});ot.tags.set(mt.key,mt.value);break}default:{tt.skipType(pt&7);break}}}return ot})),et),o.encode=tt=>encodeMessage(tt,o.codec()),o.decode=(tt,nt)=>decodeMessage(tt,o.codec(),nt)})(Peer||(Peer={}));var Address;(function(o){let et;o.codec=()=>(et==null&&(et=message$1((tt,nt,rt={})=>{rt.lengthDelimited!==!1&&nt.fork(),tt.multiaddr!=null&&tt.multiaddr.byteLength>0&&(nt.uint32(10),nt.bytes(tt.multiaddr)),tt.isCertified!=null&&(nt.uint32(16),nt.bool(tt.isCertified)),rt.lengthDelimited!==!1&&nt.ldelim()},(tt,nt,rt={})=>{const ot={multiaddr:alloc$2(0)},it=nt==null?tt.len:tt.pos+nt;for(;tt.pos>>3){case 1:{ot.multiaddr=tt.bytes();break}case 2:{ot.isCertified=tt.bool();break}default:{tt.skipType(st&7);break}}}return ot})),et),o.encode=tt=>encodeMessage(tt,o.codec()),o.decode=(tt,nt)=>decodeMessage(tt,o.codec(),nt)})(Address||(Address={}));var Tag;(function(o){let et;o.codec=()=>(et==null&&(et=message$1((tt,nt,rt={})=>{rt.lengthDelimited!==!1&&nt.fork(),tt.value!=null&&tt.value!==0&&(nt.uint32(8),nt.uint32(tt.value)),tt.expiry!=null&&(nt.uint32(16),nt.uint64(tt.expiry)),rt.lengthDelimited!==!1&&nt.ldelim()},(tt,nt,rt={})=>{const ot={value:0},it=nt==null?tt.len:tt.pos+nt;for(;tt.pos>>3){case 1:{ot.value=tt.uint32();break}case 2:{ot.expiry=tt.uint64();break}default:{tt.skipType(st&7);break}}}return ot})),et),o.encode=tt=>encodeMessage(tt,o.codec()),o.decode=(tt,nt)=>decodeMessage(tt,o.codec(),nt)})(Tag||(Tag={}));function bytesToPeer(o,et){const tt=Peer.decode(et);if(tt.publicKey!=null&&o.publicKey==null){const ot=publicKeyFromProtobuf(tt.publicKey);o=peerIdFromPublicKey(ot)}const nt=new Map,rt=BigInt(Date.now());for(const[ot,it]of tt.tags.entries())it.expiry!=null&&it.expiry({multiaddr:multiaddr(ot),isCertified:it??!1})),metadata:tt.metadata,peerRecordEnvelope:tt.peerRecordEnvelope??void 0,tags:nt}}const pathSepS="/",pathSepB=new TextEncoder().encode(pathSepS),pathSep=pathSepB[0];class Key{constructor(et,tt){Ct(this,"_buf");if(typeof et=="string")this._buf=fromString(et);else if(et instanceof Uint8Array)this._buf=et;else throw new Error("Invalid key, should be String of Uint8Array");if(tt==null&&(tt=!0),tt&&this.clean(),this._buf.byteLength===0||this._buf[0]!==pathSep)throw new Error("Invalid key")}toString(et="utf8"){return toString$8(this._buf,et)}uint8Array(){return this._buf}get[Symbol.toStringTag](){return`Key(${this.toString()})`}static withNamespaces(et){return new Key(et.join(pathSepS))}static random(){return new Key(Math.random().toString().substring(2))}static asKey(et){return et instanceof Uint8Array||typeof et=="string"?new Key(et):typeof et.uint8Array=="function"?new Key(et.uint8Array()):null}clean(){if((this._buf==null||this._buf.byteLength===0)&&(this._buf=pathSepB),this._buf[0]!==pathSep){const et=new Uint8Array(this._buf.byteLength+1);et.fill(pathSep,0,1),et.set(this._buf,1),this._buf=et}for(;this._buf.byteLength>1&&this._buf[this._buf.byteLength-1]===pathSep;)this._buf=this._buf.subarray(0,-1)}less(et){const tt=this.list(),nt=et.list();for(let rt=0;rtit)return!1}return tt.lengthtt.namespaces()))])}}function namespaceType(o){const et=o.split(":");return et.length<2?"":et.slice(0,-1).join(":")}function namespaceValue(o){const et=o.split(":");return et[et.length-1]}function flatten(o){return[].concat(...o)}const NAMESPACE_COMMON="/peers/";function peerIdToDatastoreKey(o){if(!isPeerId(o)||o.type==null)throw new InvalidParametersError("Invalid PeerId");const et=o.toCID().toString();return new Key(`${NAMESPACE_COMMON}${et}`)}async function dedupeFilterAndSortAddresses(o,et,tt){const nt=new Map;for(const rt of tt){if(rt==null)continue;if(rt.multiaddr instanceof Uint8Array&&(rt.multiaddr=multiaddr(rt.multiaddr)),!isMultiaddr(rt.multiaddr))throw new InvalidParametersError("Multiaddr was invalid");if(!await et(o,rt.multiaddr))continue;const ot=rt.isCertified??!1,it=rt.multiaddr.toString(),st=nt.get(it);st!=null?rt.isCertified=st.isCertified||ot:nt.set(it,{multiaddr:rt.multiaddr,isCertified:ot})}return[...nt.values()].sort((rt,ot)=>rt.multiaddr.toString().localeCompare(ot.multiaddr.toString())).map(({isCertified:rt,multiaddr:ot})=>({isCertified:rt,multiaddr:ot.bytes}))}async function toPeerPB(o,et,tt,nt){if(et==null)throw new InvalidParametersError("Invalid PeerData");if(et.publicKey!=null&&o.publicKey!=null&&!et.publicKey.equals(o.publicKey))throw new InvalidParametersError("publicKey bytes do not match peer id publicKey bytes");const rt=nt.existingPeer;if(rt!=null&&!o.equals(rt.id))throw new InvalidParametersError("peer id did not match existing peer id");let ot=(rt==null?void 0:rt.addresses)??[],it=new Set((rt==null?void 0:rt.protocols)??[]),st=(rt==null?void 0:rt.metadata)??new Map,at=(rt==null?void 0:rt.tags)??new Map,ct=rt==null?void 0:rt.peerRecordEnvelope;if(tt==="patch"){if((et.multiaddrs!=null||et.addresses!=null)&&(ot=[],et.multiaddrs!=null&&ot.push(...et.multiaddrs.map(ht=>({isCertified:!1,multiaddr:ht}))),et.addresses!=null&&ot.push(...et.addresses)),et.protocols!=null&&(it=new Set(et.protocols)),et.metadata!=null){const ht=et.metadata instanceof Map?[...et.metadata.entries()]:Object.entries(et.metadata);st=createSortedMap(ht,{validate:validateMetadata})}if(et.tags!=null){const ht=et.tags instanceof Map?[...et.tags.entries()]:Object.entries(et.tags);at=createSortedMap(ht,{validate:validateTag,map:mapTag})}et.peerRecordEnvelope!=null&&(ct=et.peerRecordEnvelope)}if(tt==="merge"){if(et.multiaddrs!=null&&ot.push(...et.multiaddrs.map(ht=>({isCertified:!1,multiaddr:ht}))),et.addresses!=null&&ot.push(...et.addresses),et.protocols!=null&&(it=new Set([...it,...et.protocols])),et.metadata!=null){const ht=et.metadata instanceof Map?[...et.metadata.entries()]:Object.entries(et.metadata);for(const[pt,mt]of ht)mt==null?st.delete(pt):st.set(pt,mt);st=createSortedMap([...st.entries()],{validate:validateMetadata})}if(et.tags!=null){const ht=et.tags instanceof Map?[...et.tags.entries()]:Object.entries(et.tags),pt=new Map(at);for(const[mt,ft]of ht)ft==null?pt.delete(mt):pt.set(mt,ft);at=createSortedMap([...pt.entries()],{validate:validateTag,map:mapTag})}et.peerRecordEnvelope!=null&&(ct=et.peerRecordEnvelope)}let lt;(rt==null?void 0:rt.id.publicKey)!=null?lt=publicKeyToProtobuf(rt.id.publicKey):et.publicKey!=null?lt=publicKeyToProtobuf(et.publicKey):o.publicKey!=null&&(lt=publicKeyToProtobuf(o.publicKey));const dt={addresses:await dedupeFilterAndSortAddresses(o,nt.addressFilter??(async()=>!0),ot),protocols:[...it.values()].sort((ht,pt)=>ht.localeCompare(pt)),metadata:st,tags:at,publicKey:lt,peerRecordEnvelope:ct};return o.type!=="RSA"&&delete dt.publicKey,dt}function createSortedMap(o,et){var nt;const tt=new Map;for(const[rt,ot]of o)ot!=null&&et.validate(rt,ot);for(const[rt,ot]of o.sort(([it],[st])=>it.localeCompare(st)))ot!=null&&tt.set(rt,((nt=et.map)==null?void 0:nt.call(et,rt,ot))??ot);return tt}function validateMetadata(o,et){if(typeof o!="string")throw new InvalidParametersError("Metadata key must be a string");if(!(et instanceof Uint8Array))throw new InvalidParametersError("Metadata value must be a Uint8Array")}function validateTag(o,et){if(typeof o!="string")throw new InvalidParametersError("Tag name must be a string");if(et.value!=null){if(parseInt(`${et.value}`,10)!==et.value)throw new InvalidParametersError("Tag value must be an integer");if(et.value<0||et.value>100)throw new InvalidParametersError("Tag value must be between 0-100")}if(et.ttl!=null){if(parseInt(`${et.ttl}`,10)!==et.ttl)throw new InvalidParametersError("Tag ttl must be an integer");if(et.ttl<0)throw new InvalidParametersError("Tag ttl must be between greater than 0")}}function mapTag(o,et){let tt;return et.expiry!=null&&(tt=et.expiry),et.ttl!=null&&(tt=BigInt(Date.now()+Number(et.ttl))),{value:et.value??0,expiry:tt}}function decodePeer(o,et){const tt=o.toString().split("/")[2],nt=CID.parse(tt,base32$2),rt=peerIdFromCID(nt);return bytesToPeer(rt,et)}function mapQuery(o){return o==null?{}:{prefix:NAMESPACE_COMMON,filters:(o.filters??[]).map(et=>({key:tt,value:nt})=>et(decodePeer(tt,nt))),orders:(o.orders??[]).map(et=>(tt,nt)=>et(decodePeer(tt.key,tt.value),decodePeer(nt.key,nt.value)))}}var er,es,ts;class PersistentStore{constructor(et,tt={}){fn(this,er);Ct(this,"peerId");Ct(this,"datastore");Ct(this,"lock");Ct(this,"addressFilter");this.peerId=et.peerId,this.datastore=et.datastore,this.addressFilter=tt.addressFilter,this.lock=createMortice({name:"peer-store",singleProcess:!0})}async has(et){return this.datastore.has(peerIdToDatastoreKey(et))}async delete(et){if(this.peerId.equals(et))throw new InvalidParametersError("Cannot delete self peer");await this.datastore.delete(peerIdToDatastoreKey(et))}async load(et){const tt=await this.datastore.get(peerIdToDatastoreKey(et));return bytesToPeer(et,tt)}async save(et,tt){const{existingBuf:nt,existingPeer:rt}=await gn(this,er,es).call(this,et),ot=await toPeerPB(et,tt,"patch",{addressFilter:this.addressFilter});return gn(this,er,ts).call(this,et,ot,nt,rt)}async patch(et,tt){const{existingBuf:nt,existingPeer:rt}=await gn(this,er,es).call(this,et),ot=await toPeerPB(et,tt,"patch",{addressFilter:this.addressFilter,existingPeer:rt});return gn(this,er,ts).call(this,et,ot,nt,rt)}async merge(et,tt){const{existingBuf:nt,existingPeer:rt}=await gn(this,er,es).call(this,et),ot=await toPeerPB(et,tt,"merge",{addressFilter:this.addressFilter,existingPeer:rt});return gn(this,er,ts).call(this,et,ot,nt,rt)}async*all(et){for await(const{key:tt,value:nt}of this.datastore.query(mapQuery(et??{}))){const rt=decodePeer(tt,nt);rt.id.equals(this.peerId)||(yield rt)}}}er=new WeakSet,es=async function(et){try{const tt=await this.datastore.get(peerIdToDatastoreKey(et)),nt=bytesToPeer(et,tt);return{existingBuf:tt,existingPeer:nt}}catch(tt){if(tt.name!=="NotFoundError")throw tt}return{}},ts=async function(et,tt,nt,rt){const ot=Peer.encode(tt);return nt!=null&&equals(ot,nt)?{peer:bytesToPeer(et,ot),previous:rt,updated:!1}:(await this.datastore.put(peerIdToDatastoreKey(et),ot),{peer:bytesToPeer(et,ot),previous:rt,updated:!0})};var Nl,eo,ns;Nl=Symbol.toStringTag;class PersistentPeerStore{constructor(et,tt={}){fn(this,eo);Ct(this,"store");Ct(this,"events");Ct(this,"peerId");Ct(this,"log");Ct(this,Nl,"@libp2p/peer-store");this.log=et.logger.forComponent("libp2p:peer-store"),this.events=et.events,this.peerId=et.peerId,this.store=new PersistentStore(et,tt)}async forEach(et,tt){this.log.trace("forEach await read lock");const nt=await this.store.lock.readLock();this.log.trace("forEach got read lock");try{for await(const rt of this.store.all(tt))et(rt)}finally{this.log.trace("forEach release read lock"),nt()}}async all(et){this.log.trace("all await read lock");const tt=await this.store.lock.readLock();this.log.trace("all got read lock");try{return await all$2(this.store.all(et))}finally{this.log.trace("all release read lock"),tt()}}async delete(et){this.log.trace("delete await write lock");const tt=await this.store.lock.writeLock();this.log.trace("delete got write lock");try{await this.store.delete(et)}finally{this.log.trace("delete release write lock"),tt()}}async has(et){this.log.trace("has await read lock");const tt=await this.store.lock.readLock();this.log.trace("has got read lock");try{return await this.store.has(et)}finally{this.log.trace("has release read lock"),tt()}}async get(et){this.log.trace("get await read lock");const tt=await this.store.lock.readLock();this.log.trace("get got read lock");try{return await this.store.load(et)}finally{this.log.trace("get release read lock"),tt()}}async save(et,tt){this.log.trace("save await write lock");const nt=await this.store.lock.writeLock();this.log.trace("save got write lock");try{const rt=await this.store.save(et,tt);return gn(this,eo,ns).call(this,et,rt),rt.peer}finally{this.log.trace("save release write lock"),nt()}}async patch(et,tt){this.log.trace("patch await write lock");const nt=await this.store.lock.writeLock();this.log.trace("patch got write lock");try{const rt=await this.store.patch(et,tt);return gn(this,eo,ns).call(this,et,rt),rt.peer}finally{this.log.trace("patch release write lock"),nt()}}async merge(et,tt){this.log.trace("merge await write lock");const nt=await this.store.lock.writeLock();this.log.trace("merge got write lock");try{const rt=await this.store.merge(et,tt);return gn(this,eo,ns).call(this,et,rt),rt.peer}finally{this.log.trace("merge release write lock"),nt()}}async consumePeerRecord(et,tt){const nt=await RecordEnvelope.openAndCertify(et,PeerRecord.DOMAIN),rt=peerIdFromCID(nt.publicKey.toCID());if((tt==null?void 0:tt.equals(rt))===!1)return this.log("envelope peer id was not the expected peer id - expected: %p received: %p",tt,rt),!1;const ot=PeerRecord.createFromProtobuf(nt.payload);let it;try{it=await this.get(rt)}catch(st){if(st.name!=="NotFoundError")throw st}if((it==null?void 0:it.peerRecordEnvelope)!=null){const st=await RecordEnvelope.createFromProtobuf(it.peerRecordEnvelope),at=PeerRecord.createFromProtobuf(st.payload);if(at.seqNumber>=ot.seqNumber)return this.log("sequence number was lower or equal to existing sequence number - stored: %d received: %d",at.seqNumber,ot.seqNumber),!1}return await this.patch(ot.peerId,{peerRecordEnvelope:et,addresses:ot.multiaddrs.map(st=>({isCertified:!0,multiaddr:st}))}),!0}}eo=new WeakSet,ns=function(et,tt){tt.updated&&(this.peerId.equals(et)?this.events.safeDispatchEvent("self:peer:update",{detail:tt}):this.events.safeDispatchEvent("peer:update",{detail:tt}))};function persistentPeerStore(o,et={}){return new PersistentPeerStore(o,et)}const jr=class jr extends Error{constructor(tt="Not Found"){super(tt);Ct(this,"name",jr.name);Ct(this,"code",jr.code)}};Ct(jr,"name","NotFoundError"),Ct(jr,"code","ERR_NOT_FOUND");let NotFoundError=jr;function peekable(o){const[et,tt]=o[Symbol.asyncIterator]!=null?[o[Symbol.asyncIterator](),Symbol.asyncIterator]:[o[Symbol.iterator](),Symbol.iterator],nt=[];return{peek:()=>et.next(),push:rt=>{nt.push(rt)},next:()=>nt.length>0?{done:!1,value:nt.shift()}:et.next(),[tt](){return this}}}function isAsyncIterable$2(o){return o[Symbol.asyncIterator]!=null}function filter(o,et){let tt=0;if(isAsyncIterable$2(o))return async function*(){for await(const at of o)await et(at,tt++)&&(yield at)}();const nt=peekable(o),{value:rt,done:ot}=nt.next();if(ot===!0)return function*(){}();const it=et(rt,tt++);if(typeof it.then=="function")return async function*(){await it&&(yield rt);for await(const at of nt)await et(at,tt++)&&(yield at)}();const st=et;return function*(){it===!0&&(yield rt);for(const at of nt)st(at,tt++)&&(yield at)}()}function isAsyncIterable$1(o){return o[Symbol.asyncIterator]!=null}function sort(o,et){return isAsyncIterable$1(o)?async function*(){yield*(await all$2(o)).sort(et)}():function*(){yield*all$2(o).sort(et)}()}function isAsyncIterable(o){return o[Symbol.asyncIterator]!=null}function take(o,et){return isAsyncIterable(o)?async function*(){let tt=0;if(!(et<1)){for await(const nt of o)if(yield nt,tt++,tt===et)return}}():function*(){let tt=0;if(!(et<1)){for(const nt of o)if(yield nt,tt++,tt===et)return}}()}class BaseDatastore{put(et,tt,nt){return Promise.reject(new Error(".put is not implemented"))}get(et,tt){return Promise.reject(new Error(".get is not implemented"))}has(et,tt){return Promise.reject(new Error(".has is not implemented"))}delete(et,tt){return Promise.reject(new Error(".delete is not implemented"))}async*putMany(et,tt={}){for await(const{key:nt,value:rt}of et)await this.put(nt,rt,tt),yield nt}async*getMany(et,tt={}){for await(const nt of et)yield{key:nt,value:await this.get(nt,tt)}}async*deleteMany(et,tt={}){for await(const nt of et)await this.delete(nt,tt),yield nt}batch(){let et=[],tt=[];return{put(nt,rt){et.push({key:nt,value:rt})},delete(nt){tt.push(nt)},commit:async nt=>{await drain(this.putMany(et,nt)),et=[],await drain(this.deleteMany(tt,nt)),tt=[]}}}async*_all(et,tt){throw new Error("._all is not implemented")}async*_allKeys(et,tt){throw new Error("._allKeys is not implemented")}query(et,tt){let nt=this._all(et,tt);if(et.prefix!=null){const rt=et.prefix;nt=filter(nt,ot=>ot.key.toString().startsWith(rt))}if(Array.isArray(et.filters)&&(nt=et.filters.reduce((rt,ot)=>filter(rt,ot),nt)),Array.isArray(et.orders)&&(nt=et.orders.reduce((rt,ot)=>sort(rt,ot),nt)),et.offset!=null){let rt=0;const ot=et.offset;nt=filter(nt,()=>rt++>=ot)}return et.limit!=null&&(nt=take(nt,et.limit)),nt}queryKeys(et,tt){let nt=this._allKeys(et,tt);if(et.prefix!=null){const rt=et.prefix;nt=filter(nt,ot=>ot.toString().startsWith(rt))}if(Array.isArray(et.filters)&&(nt=et.filters.reduce((rt,ot)=>filter(rt,ot),nt)),Array.isArray(et.orders)&&(nt=et.orders.reduce((rt,ot)=>sort(rt,ot),nt)),et.offset!=null){const rt=et.offset;let ot=0;nt=filter(nt,()=>ot++>=rt)}return et.limit!=null&&(nt=take(nt,et.limit)),nt}}class MemoryDatastore extends BaseDatastore{constructor(){super();Ct(this,"data");this.data=new Map}put(tt,nt){return this.data.set(tt.toString(),nt),tt}get(tt){const nt=this.data.get(tt.toString());if(nt==null)throw new NotFoundError;return nt}has(tt){return this.data.has(tt.toString())}delete(tt){this.data.delete(tt.toString())}*_all(){for(const[tt,nt]of this.data.entries())yield{key:new Key(tt),value:nt}}*_allKeys(){for(const tt of this.data.keys())yield new Key(tt)}}function debounce(o,et){let tt;return function(){const nt=function(){tt=void 0,o()};clearTimeout(tt),tt=setTimeout(nt,et)}}const defaultAddressFilter=o=>o;function stripPeerId(o,et){const tt=o.getPeerId();return tt!=null&&peerIdFromString$1(tt).equals(et)&&(o=o.decapsulate(multiaddr(`/p2p/${et.toString()}`))),o}var $l;$l=Symbol.toStringTag;class DefaultAddressManager{constructor(et,tt={}){Ct(this,"log");Ct(this,"components");Ct(this,"listen");Ct(this,"announce");Ct(this,"observed");Ct(this,"announceFilter");Ct(this,$l,"@libp2p/address-manager");const{listen:nt=[],announce:rt=[]}=tt;this.components=et,this.log=et.logger.forComponent("libp2p:address-manager"),this.listen=nt.map(ot=>ot.toString()),this.announce=new Set(rt.map(ot=>ot.toString())),this.observed=new Map,this.announceFilter=tt.announceFilter??defaultAddressFilter,this._updatePeerStoreAddresses=debounce(this._updatePeerStoreAddresses.bind(this),1e3),et.events.addEventListener("transport:listening",()=>{this._updatePeerStoreAddresses()}),et.events.addEventListener("transport:close",()=>{this._updatePeerStoreAddresses()})}_updatePeerStoreAddresses(){const et=this.getAnnounceAddrs().concat(this.components.transportManager.getAddrs()).concat([...this.observed.entries()].filter(([tt,nt])=>nt.confident).map(([tt])=>multiaddr(tt))).map(tt=>tt.getPeerId()===this.components.peerId.toString()?tt.decapsulate(`/p2p/${this.components.peerId.toString()}`):tt);this.components.peerStore.patch(this.components.peerId,{multiaddrs:et}).catch(tt=>{this.log.error("error updating addresses",tt)})}getListenAddrs(){return Array.from(this.listen).map(et=>multiaddr(et))}getAnnounceAddrs(){return Array.from(this.announce).map(et=>multiaddr(et))}getObservedAddrs(){return Array.from(this.observed).map(([et])=>multiaddr(et))}addObservedAddr(et){et=stripPeerId(et,this.components.peerId);const tt=et.toString();this.observed.has(tt)||this.observed.set(tt,{confident:!1})}confirmObservedAddr(et){et=stripPeerId(et,this.components.peerId);const tt=et.toString(),rt=(this.observed.get(tt)??{confident:!1}).confident;this.observed.set(tt,{confident:!0}),rt||this._updatePeerStoreAddresses()}removeObservedAddr(et){et=stripPeerId(et,this.components.peerId);const tt=et.toString();this.observed.delete(tt)}getAddresses(){let et=this.getAnnounceAddrs().map(nt=>nt.toString());et.length===0&&(et=this.components.transportManager.getAddrs().map(nt=>nt.toString())),et=et.concat(Array.from(this.observed).filter(([nt,rt])=>rt.confident).map(([nt])=>nt));const tt=new Set(et);return this.announceFilter(Array.from(tt).map(nt=>multiaddr(nt))).map(nt=>{var rt;return((rt=nt.protos().pop())==null?void 0:rt.path)===!0||nt.getPeerId()===this.components.peerId.toString()?nt:nt.encapsulate(`/p2p/${this.components.peerId.toString()}`)})}}var messages;(function(o){o.NOT_STARTED_YET="The libp2p node is not started yet",o.NOT_FOUND="Not found"})(messages||(messages={}));class MissingServiceError extends Error{constructor(et="Missing service"){super(et),this.name="MissingServiceError"}}class UnmetServiceDependenciesError extends Error{constructor(et="Unmet service dependencies"){super(et),this.name="UnmetServiceDependenciesError"}}class NoContentRoutersError extends Error{constructor(et="No content routers available"){super(et),this.name="NoContentRoutersError"}}class NoPeerRoutersError extends Error{constructor(et="No peer routers available"){super(et),this.name="NoPeerRoutersError"}}class QueriedForSelfError extends Error{constructor(et="Should not try to find self"){super(et),this.name="QueriedForSelfError"}}class UnhandledProtocolError extends Error{constructor(et="Unhandled protocol error"){super(et),this.name="UnhandledProtocolError"}}class DuplicateProtocolHandlerError extends Error{constructor(et="Duplicate protocol handler error"){super(et),this.name="DuplicateProtocolHandlerError"}}class DialDeniedError extends Error{constructor(et="Dial denied error"){super(et),this.name="DialDeniedError"}}class NoValidAddressesError extends Error{constructor(et="No valid addresses"){super(et),this.name="NoValidAddressesError"}}class ConnectionInterceptedError extends Error{constructor(et="Connection intercepted"){super(et),this.name="ConnectionInterceptedError"}}class ConnectionDeniedError extends Error{constructor(et="Connection denied"){super(et),this.name="ConnectionDeniedError"}}class MuxerUnavailableError extends Error{constructor(et="Stream is not multiplexed"){super(et),this.name="MuxerUnavailableError"}}class EncryptionFailedError extends Error{constructor(et="Encryption failed"){super(et),this.name="EncryptionFailedError"}}class TransportUnavailableError extends Error{constructor(et="Transport unavailable"){super(et),this.name="TransportUnavailableError"}}class DefaultComponents{constructor(et={}){Ct(this,"components",{});Ct(this,"_started",!1);this.components={};for(const[tt,nt]of Object.entries(et))this.components[tt]=nt;this.components.logger==null&&(this.components.logger=defaultLogger())}isStarted(){return this._started}async _invokeStartableMethod(et){await Promise.all(Object.values(this.components).filter(tt=>isStartable(tt)).map(async tt=>{var nt;await((nt=tt[et])==null?void 0:nt.call(tt))}))}async beforeStart(){await this._invokeStartableMethod("beforeStart")}async start(){await this._invokeStartableMethod("start"),this._started=!0}async afterStart(){await this._invokeStartableMethod("afterStart")}async beforeStop(){await this._invokeStartableMethod("beforeStop")}async stop(){await this._invokeStartableMethod("stop"),this._started=!1}async afterStop(){await this._invokeStartableMethod("afterStop")}}const OPTIONAL_SERVICES=["metrics","connectionProtector","dns"],NON_SERVICE_PROPERTIES=["components","isStarted","beforeStart","start","afterStart","beforeStop","stop","afterStop","then","_invokeStartableMethod"];function defaultComponents(o={}){const et=new DefaultComponents(o);return new Proxy(et,{get(nt,rt,ot){if(typeof rt=="string"&&!NON_SERVICE_PROPERTIES.includes(rt)){const it=et.components[rt];if(it==null&&!OPTIONAL_SERVICES.includes(rt))throw new MissingServiceError(`${rt} not set`);return it}return Reflect.get(nt,rt,ot)},set(nt,rt,ot){return typeof rt=="string"?et.components[rt]=ot:Reflect.set(nt,rt,ot),!0}})}function checkServiceDependencies(o){const et={};for(const tt of Object.values(o.components))for(const nt of getServiceCapabilities(tt))et[nt]=!0;for(const tt of Object.values(o.components))for(const nt of getServiceDependencies(tt))if(et[nt]!==!0)throw new UnmetServiceDependenciesError(`Service "${getServiceName(tt)}" required capability "${nt}" but it was not provided by any component, you may need to add additional configuration when creating your node.`)}function getServiceCapabilities(o){return Array.isArray(o==null?void 0:o[serviceCapabilities])?o[serviceCapabilities]:[]}function getServiceDependencies(o){return Array.isArray(o==null?void 0:o[serviceDependencies])?o[serviceDependencies]:[]}function getServiceName(o){return(o==null?void 0:o[Symbol.toStringTag])??(o==null?void 0:o.toString())??"unknown"}function connectionGater(o={}){return{denyDialPeer:async()=>!1,denyDialMultiaddr:async et=>{const tt=et.stringTuples();return tt[0][0]===4||tt[0][0]===41?!!isPrivateIp(`${tt[0][1]}`):!1},denyInboundConnection:async()=>!1,denyOutboundConnection:async()=>!1,denyInboundEncryptedConnection:async()=>!1,denyOutboundEncryptedConnection:async()=>!1,denyInboundUpgradedConnection:async()=>!1,denyOutboundUpgradedConnection:async()=>!1,filterMultiaddrForPeer:async()=>!0,...o}}function getPeerAddress(o){if(isPeerId$1(o))return{peerId:o,multiaddrs:[]};Array.isArray(o)||(o=[o]);let et;if(o.length>0){const tt=o[0].getPeerId();et=tt==null?void 0:peerIdFromString$1(tt),o.forEach(nt=>{if(!isMultiaddr(nt))throw new InvalidMultiaddrError("Invalid multiaddr");const rt=nt.getPeerId();if(rt==null){if(et!=null)throw new InvalidParametersError$1("Multiaddrs must all have the same peer id or have no peer id")}else{const ot=peerIdFromString$1(rt);if((et==null?void 0:et.equals(ot))!==!0)throw new InvalidParametersError$1("Multiaddrs must all have the same peer id or have no peer id")}})}return{peerId:et,multiaddrs:o}}const DEFAULT_CLOSABLE_PROTOCOLS=["/ipfs/id/1.0.0","/ipfs/id/push/1.0.0","/libp2p/autonat/1.0.0","/libp2p/dcutr"];async function safelyCloseConnectionIfUnused(o,et){var rt;const tt=((rt=o==null?void 0:o.streams)==null?void 0:rt.map(ot=>ot.protocol))??[],nt=(et==null?void 0:et.closableProtocols)??DEFAULT_CLOSABLE_PROTOCOLS;if(!(tt.filter(ot=>ot!=null&&!nt.includes(ot)).length>0))try{await(o==null?void 0:o.close(et))}catch(ot){o==null||o.abort(ot)}}const DIAL_TIMEOUT=5e3,UPGRADE_TIMEOUT=3e3,PROTOCOL_NEGOTIATION_TIMEOUT=2e3,MAX_PEER_ADDRS_TO_DIAL=25,INBOUND_CONNECTION_THRESHOLD=5,MAX_INCOMING_PENDING_CONNECTIONS=10,MAX_PARALLEL_RECONNECTS=5,LAST_DIAL_FAILURE_KEY="last-dial-failure",LAST_DIAL_SUCCESS_KEY="last-dial-success",MAX_DIAL_QUEUE_LENGTH=500,MAX_CONNECTIONS=100,MAX_PARALLEL_DIALS=50,defaultOptions$2={maxConnections:MAX_CONNECTIONS,allow:[]};class ConnectionPruner{constructor(et,tt={}){Ct(this,"maxConnections");Ct(this,"connectionManager");Ct(this,"peerStore");Ct(this,"allow");Ct(this,"events");Ct(this,"log");this.maxConnections=tt.maxConnections??defaultOptions$2.maxConnections,this.allow=tt.allow??defaultOptions$2.allow,this.connectionManager=et.connectionManager,this.peerStore=et.peerStore,this.events=et.events,this.log=et.logger.forComponent("libp2p:connection-manager:connection-pruner"),this.maybePruneConnections=this.maybePruneConnections.bind(this)}start(){this.events.addEventListener("connection:open",this.maybePruneConnections)}stop(){this.events.removeEventListener("connection:open",this.maybePruneConnections)}maybePruneConnections(){this._maybePruneConnections().catch(et=>{this.log.error("error while pruning connections %e",et)})}async _maybePruneConnections(){const et=this.connectionManager.getConnections(),tt=et.length;if(this.log("checking max connections limit %d/%d",tt,this.maxConnections),tt<=this.maxConnections)return;const nt=new PeerMap;for(const st of et){const at=st.remotePeer;if(!nt.has(at)){nt.set(at,0);try{const ct=await this.peerStore.get(at);nt.set(at,[...ct.tags.values()].reduce((lt,dt)=>lt+dt.value,0))}catch(ct){ct.name!=="NotFoundError"&&this.log.error("error loading peer tags",ct)}}}const rt=this.sortConnections(et,nt),ot=Math.max(tt-this.maxConnections,0),it=[];for(const st of rt)if(this.log("too many connections open - closing a connection to %p",st.remotePeer),this.allow.some(ct=>st.remoteAddr.toString().startsWith(ct.toString()))||it.push(st),it.length===ot)break;await Promise.all(it.map(async st=>{await safelyCloseConnectionIfUnused(st,{signal:AbortSignal.timeout(1e3)})})),this.events.safeDispatchEvent("connection:prune",{detail:it})}sortConnections(et,tt){return et.sort((nt,rt)=>{const ot=nt.timeline.open,it=rt.timeline.open;return otit?-1:0}).sort((nt,rt)=>nt.direction==="outbound"&&rt.direction==="inbound"?1:nt.direction==="inbound"&&rt.direction==="outbound"?-1:0).sort((nt,rt)=>nt.streams.length>rt.streams.length?1:nt.streams.length{const ot=tt.get(nt.remotePeer)??0,it=tt.get(rt.remotePeer)??0;return ot>it?1:ot{function st(){tt==null||tt.removeEventListener("abort",lt),o.removeEventListener(et,at),(nt==null?void 0:nt.errorEvent)!=null&&o.removeEventListener(nt.errorEvent,ct)}const at=dt=>{var ht;try{if(((ht=nt==null?void 0:nt.filter)==null?void 0:ht.call(nt,dt))===!1)return}catch(pt){st(),it(pt);return}st(),ot(dt)},ct=dt=>{st(),it(dt.detail)},lt=()=>{st(),it(rt)};tt==null||tt.addEventListener("abort",lt),o.addEventListener(et,at),(nt==null?void 0:nt.errorEvent)!=null&&o.addEventListener(nt.errorEvent,ct)})}class JobRecipient{constructor(et){Ct(this,"deferred");Ct(this,"signal");var tt;this.signal=et,this.deferred=pDefer(),this.onAbort=this.onAbort.bind(this),(tt=this.signal)==null||tt.addEventListener("abort",this.onAbort)}onAbort(){var et;this.deferred.reject(((et=this.signal)==null?void 0:et.reason)??new AbortError$6)}cleanup(){var et;(et=this.signal)==null||et.removeEventListener("abort",this.onAbort)}}function randomId(){return`${parseInt(String(Math.random()*1e9),10).toString()}${Date.now()}`}class Job{constructor(et,tt){Ct(this,"id");Ct(this,"fn");Ct(this,"options");Ct(this,"recipients");Ct(this,"status");Ct(this,"timeline");Ct(this,"controller");this.id=randomId(),this.status="queued",this.fn=et,this.options=tt,this.recipients=[],this.timeline={created:Date.now()},this.controller=new AbortController,setMaxListeners$2(1/0,this.controller.signal),this.onAbort=this.onAbort.bind(this)}abort(et){this.controller.abort(et)}onAbort(){this.recipients.reduce((tt,nt)=>{var rt;return tt&&((rt=nt.signal)==null?void 0:rt.aborted)===!0},!0)&&(this.controller.abort(new AbortError$6),this.cleanup())}async join(et={}){var nt;const tt=new JobRecipient(et.signal);return this.recipients.push(tt),(nt=et.signal)==null||nt.addEventListener("abort",this.onAbort),tt.deferred.promise}async run(){this.status="running",this.timeline.started=Date.now();try{this.controller.signal.throwIfAborted();const et=await raceSignal(this.fn({...this.options??{},signal:this.controller.signal}),this.controller.signal);this.recipients.forEach(tt=>{tt.deferred.resolve(et)}),this.status="complete"}catch(et){this.recipients.forEach(tt=>{tt.deferred.reject(et)}),this.status="errored"}finally{this.timeline.finished=Date.now(),this.cleanup()}}cleanup(){this.recipients.forEach(et=>{var tt;et.cleanup(),(tt=et.signal)==null||tt.removeEventListener("abort",this.onAbort)})}}class Queue extends TypedEventEmitter$1{constructor(tt={}){var nt;super();Ct(this,"concurrency");Ct(this,"maxSize");Ct(this,"queue");Ct(this,"pending");Ct(this,"sort");this.concurrency=tt.concurrency??Number.POSITIVE_INFINITY,this.maxSize=tt.maxSize??Number.POSITIVE_INFINITY,this.pending=0,tt.metricName!=null&&((nt=tt.metrics)==null||nt.registerMetricGroup(tt.metricName,{calculate:()=>({size:this.queue.length,running:this.pending,queued:this.queue.length-this.pending})})),this.sort=tt.sort,this.queue=[]}tryToStartAnother(){if(this.size===0)return queueMicrotask(()=>{this.safeDispatchEvent("empty")}),this.running===0&&queueMicrotask(()=>{this.safeDispatchEvent("idle")}),!1;if(this.pending{for(let nt=0;nt(this.safeDispatchEvent("completed",{detail:it}),this.safeDispatchEvent("success",{detail:{job:rt,result:it}}),it)).catch(it=>{if(rt.status==="queued"){for(let st=0;st{tt.abort(new AbortError$6)}),this.clear()}async onEmpty(tt){this.size!==0&&await raceEvent(this,"empty",tt==null?void 0:tt.signal)}async onSizeLessThan(tt,nt){this.sizethis.size{ht!=null?this.abort():this.clear(),nt.end(ht)},ot=ht=>{ht.detail!=null&&nt.push(ht.detail)},it=ht=>{rt(ht.detail)},st=()=>{rt()},at=()=>{rt(new AbortError$6("Queue aborted"))};this.addEventListener("completed",ot),this.addEventListener("error",it),this.addEventListener("idle",st),(lt=tt==null?void 0:tt.signal)==null||lt.addEventListener("abort",at);try{yield*nt}finally{this.removeEventListener("completed",ot),this.removeEventListener("error",it),this.removeEventListener("idle",st),(dt=tt==null?void 0:tt.signal)==null||dt.removeEventListener("abort",at),rt()}}}class PriorityQueue extends Queue{constructor(et={}){super({...et,sort:(tt,nt)=>tt.options.priority>nt.options.priority?-1:tt.options.priorityrt.toString())),nt}const defaultOptions$1={maxParallelDials:MAX_PARALLEL_DIALS,maxDialQueueLength:MAX_DIAL_QUEUE_LENGTH,maxPeerAddrsToDial:MAX_PEER_ADDRS_TO_DIAL,dialTimeout:DIAL_TIMEOUT,resolvers:{dnsaddr:dnsaddrResolver}};class DialQueue{constructor(et,tt={}){Ct(this,"queue");Ct(this,"components");Ct(this,"addressSorter");Ct(this,"maxPeerAddrsToDial");Ct(this,"maxDialQueueLength");Ct(this,"dialTimeout");Ct(this,"shutDownController");Ct(this,"connections");Ct(this,"log");this.addressSorter=tt.addressSorter,this.maxPeerAddrsToDial=tt.maxPeerAddrsToDial??defaultOptions$1.maxPeerAddrsToDial,this.maxDialQueueLength=tt.maxDialQueueLength??defaultOptions$1.maxDialQueueLength,this.dialTimeout=tt.dialTimeout??defaultOptions$1.dialTimeout,this.connections=tt.connections??new PeerMap,this.log=et.logger.forComponent("libp2p:connection-manager:dial-queue"),this.components=et,this.shutDownController=new AbortController,setMaxListeners(1/0,this.shutDownController.signal);for(const[nt,rt]of Object.entries(tt.resolvers??{}))resolvers$1.set(nt,rt);this.queue=new PriorityQueue({concurrency:tt.maxParallelDials??defaultOptions$1.maxParallelDials,metricName:"libp2p_dial_queue",metrics:et.metrics}),this.queue.addEventListener("error",nt=>{nt.detail.name!==AbortError$4.name&&this.log.error("error in dial queue - %e",nt.detail)})}start(){this.shutDownController=new AbortController,setMaxListeners(1/0,this.shutDownController.signal)}stop(){this.shutDownController.abort(),this.queue.abort()}async dial(et,tt={}){var st,at,ct;const{peerId:nt,multiaddrs:rt}=getPeerAddress(et),ot=Array.from(this.connections.values()).flat().find(lt=>tt.force===!0?!1:lt.remotePeer.equals(nt)?!0:rt.find(dt=>dt.equals(lt.remoteAddr)));if((ot==null?void 0:ot.status)==="open")return this.log("already connected to %a",ot.remoteAddr),(st=tt.onProgress)==null||st.call(tt,new CustomProgressEvent("dial-queue:already-connected")),ot;const it=this.queue.queue.find(lt=>{if((nt==null?void 0:nt.equals(lt.options.peerId))===!0)return!0;const dt=lt.options.multiaddrs;if(dt==null)return!1;for(const ht of rt)if(dt.has(ht.toString()))return!0;return!1});if(it!=null){this.log("joining existing dial target for %p",nt);for(const lt of rt)it.options.multiaddrs.add(lt.toString());return(at=tt.onProgress)==null||at.call(tt,new CustomProgressEvent("dial-queue:already-in-dial-queue")),it.join(tt)}if(this.queue.size>=this.maxDialQueueLength)throw new DialError("Dial queue is full");return this.log("creating dial target for %p",nt,rt.map(lt=>lt.toString())),(ct=tt.onProgress)==null||ct.call(tt,new CustomProgressEvent("dial-queue:add-to-dial-queue")),this.queue.add(async lt=>{var pt,mt;(pt=lt==null?void 0:lt.onProgress)==null||pt.call(lt,new CustomProgressEvent("dial-queue:start-dial"));const dt=this.createDialAbortController(lt==null?void 0:lt.signal);let ht;try{ht=await this.calculateMultiaddrs(nt,lt==null?void 0:lt.multiaddrs,{...lt,signal:dt}),(mt=lt==null?void 0:lt.onProgress)==null||mt.call(lt,new CustomProgressEvent("dial-queue:calculated-addresses",ht)),ht.map(({multiaddr:ft})=>ft.toString()).forEach(ft=>{lt==null||lt.multiaddrs.add(ft)})}catch(ft){throw dt.clear(),ft}try{let ft=0;const yt=[];for(const gt of ht){if(ft===this.maxPeerAddrsToDial)throw this.log("dialed maxPeerAddrsToDial (%d) addresses for %p, not trying any others",ft,nt),new DialError("Peer had more than maxPeerAddrsToDial");ft++;try{const xt=await this.components.transportManager.dial(gt.multiaddr,{...lt,signal:dt});this.log("dial to %a succeeded",gt.multiaddr);try{await this.components.peerStore.merge(xt.remotePeer,{multiaddrs:[xt.remoteAddr],metadata:{[LAST_DIAL_SUCCESS_KEY]:fromString(Date.now().toString())}})}catch(vt){this.log.error("could not update last dial failure key for %p",nt,vt)}return xt}catch(xt){if(this.log.error("dial failed to %a",gt.multiaddr,xt),nt!=null)try{await this.components.peerStore.merge(nt,{metadata:{[LAST_DIAL_FAILURE_KEY]:fromString(Date.now().toString())}})}catch(vt){this.log.error("could not update last dial failure key for %p",nt,vt)}if(dt.aborted)throw new TimeoutError$2(xt.message);yt.push(xt)}}throw yt.length===1?yt[0]:new AggregateError(yt,"All multiaddr dials failed")}finally{dt.clear()}},{peerId:nt,priority:tt.priority??DEFAULT_DIAL_PRIORITY,multiaddrs:new Set(rt.map(lt=>lt.toString())),signal:tt.signal,onProgress:tt.onProgress})}createDialAbortController(et){const tt=anySignal([AbortSignal.timeout(this.dialTimeout),this.shutDownController.signal,et]);return setMaxListeners(1/0,tt),tt}async calculateMultiaddrs(et,tt=new Set,nt={}){var dt,ht;const rt=[...tt].map(pt=>({multiaddr:multiaddr(pt),isCertified:!1}));if(et!=null){if(this.components.peerId.equals(et))throw new DialError("Tried to dial self");if(await((ht=(dt=this.components.connectionGater).denyDialPeer)==null?void 0:ht.call(dt,et))===!0)throw new DialDeniedError("The dial request is blocked by gater.allowDialPeer");if(rt.length===0){this.log("loading multiaddrs for %p",et);try{const pt=await this.components.peerStore.get(et);rt.push(...pt.addresses),this.log("loaded multiaddrs for %p",et,rt.map(({multiaddr:mt})=>mt.toString()))}catch(pt){if(pt.name!=="NotFoundError")throw pt}}if(rt.length===0){this.log("looking up multiaddrs for %p in the peer routing",et);try{const pt=await this.components.peerRouting.findPeer(et);this.log("found multiaddrs for %p in the peer routing",et,rt.map(({multiaddr:mt})=>mt.toString())),rt.push(...pt.multiaddrs.map(mt=>({multiaddr:mt,isCertified:!1})))}catch(pt){pt.name!=="NoPeerRoutersError"&&this.log.error("looking up multiaddrs for %p in the peer routing failed",et,pt)}}}let ot=(await Promise.all(rt.map(async pt=>{const mt=await resolveMultiaddrs(pt.multiaddr,{dns:this.components.dns,...nt,log:this.log});return mt.length===1&&mt[0].equals(pt.multiaddr)?pt:mt.map(ft=>({multiaddr:ft,isCertified:!1}))}))).flat();if(et!=null){const pt=`/p2p/${et.toString()}`;ot=ot.map(mt=>{const ft=mt.multiaddr.protos().pop();return(ft==null?void 0:ft.path)===!0?mt:mt.multiaddr.getPeerId()==null?{multiaddr:mt.multiaddr.encapsulate(pt),isCertified:mt.isCertified}:mt})}const it=ot.filter(pt=>{if(this.components.transportManager.dialTransportForMultiaddr(pt.multiaddr)==null)return!1;const mt=pt.multiaddr.getPeerId();return et!=null&&mt!=null?et.equals(mt):!0}),st=new Map;for(const pt of it){const mt=pt.multiaddr.toString(),ft=st.get(mt);if(ft!=null){ft.isCertified=ft.isCertified||pt.isCertified||!1;continue}st.set(mt,pt)}const at=[...st.values()];if(at.length===0)throw new NoValidAddressesError("The dial request has no valid addresses");const ct=[];for(const pt of at)this.components.connectionGater.denyDialMultiaddr!=null&&await this.components.connectionGater.denyDialMultiaddr(pt.multiaddr)||ct.push(pt);const lt=this.addressSorter==null?defaultAddressSorter(ct):ct.sort(this.addressSorter);if(lt.length===0)throw new DialDeniedError("The connection gater denied all addresses in the dial request");return this.log.trace("addresses for %p before filtering",et??"unknown peer",ot.map(({multiaddr:pt})=>pt.toString())),this.log.trace("addresses for %p after filtering",et??"unknown peer",lt.map(({multiaddr:pt})=>pt.toString())),lt}async isDialable(et,tt={}){Array.isArray(et)||(et=[et]);try{const nt=await this.calculateMultiaddrs(void 0,new Set(et.map(rt=>rt.toString())),tt);return tt.runOnLimitedConnection===!1?nt.find(rt=>!Circuit.matches(rt.multiaddr))!=null:!0}catch(nt){this.log.trace("error calculating if multiaddr(s) were dialable",nt)}return!1}}class PeerQueue extends Queue{has(et){return this.find(et)!=null}find(et){return this.queue.find(tt=>et.equals(tt.options.peerId))}}var retry$2={};function RetryOperation(o,et){typeof et=="boolean"&&(et={forever:et}),this._originalTimeouts=JSON.parse(JSON.stringify(o)),this._timeouts=o,this._options=et||{},this._maxRetryTime=et&&et.maxRetryTime||1/0,this._fn=null,this._errors=[],this._attempts=1,this._operationTimeout=null,this._operationTimeoutCb=null,this._timeout=null,this._operationStart=null,this._timer=null,this._options.forever&&(this._cachedTimeouts=this._timeouts.slice(0))}var retry_operation=RetryOperation;RetryOperation.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts.slice(0)};RetryOperation.prototype.stop=function(){this._timeout&&clearTimeout(this._timeout),this._timer&&clearTimeout(this._timer),this._timeouts=[],this._cachedTimeouts=null};RetryOperation.prototype.retry=function(o){if(this._timeout&&clearTimeout(this._timeout),!o)return!1;var et=new Date().getTime();if(o&&et-this._operationStart>=this._maxRetryTime)return this._errors.push(o),this._errors.unshift(new Error("RetryOperation timeout occurred")),!1;this._errors.push(o);var tt=this._timeouts.shift();if(tt===void 0)if(this._cachedTimeouts)this._errors.splice(0,this._errors.length-1),tt=this._cachedTimeouts.slice(-1);else return!1;var nt=this;return this._timer=setTimeout(function(){nt._attempts++,nt._operationTimeoutCb&&(nt._timeout=setTimeout(function(){nt._operationTimeoutCb(nt._attempts)},nt._operationTimeout),nt._options.unref&&nt._timeout.unref()),nt._fn(nt._attempts)},tt),this._options.unref&&this._timer.unref(),!0};RetryOperation.prototype.attempt=function(o,et){this._fn=o,et&&(et.timeout&&(this._operationTimeout=et.timeout),et.cb&&(this._operationTimeoutCb=et.cb));var tt=this;this._operationTimeoutCb&&(this._timeout=setTimeout(function(){tt._operationTimeoutCb()},tt._operationTimeout)),this._operationStart=new Date().getTime(),this._fn(this._attempts)};RetryOperation.prototype.try=function(o){console.log("Using RetryOperation.try() is deprecated"),this.attempt(o)};RetryOperation.prototype.start=function(o){console.log("Using RetryOperation.start() is deprecated"),this.attempt(o)};RetryOperation.prototype.start=RetryOperation.prototype.try;RetryOperation.prototype.errors=function(){return this._errors};RetryOperation.prototype.attempts=function(){return this._attempts};RetryOperation.prototype.mainError=function(){if(this._errors.length===0)return null;for(var o={},et=null,tt=0,nt=0;nt=tt&&(et=rt,tt=it)}return et};(function(o){var et=retry_operation;o.operation=function(tt){var nt=o.timeouts(tt);return new et(nt,{forever:tt&&(tt.forever||tt.retries===1/0),unref:tt&&tt.unref,maxRetryTime:tt&&tt.maxRetryTime})},o.timeouts=function(tt){if(tt instanceof Array)return[].concat(tt);var nt={retries:10,factor:2,minTimeout:1*1e3,maxTimeout:1/0,randomize:!1};for(var rt in tt)nt[rt]=tt[rt];if(nt.minTimeout>nt.maxTimeout)throw new Error("minTimeout is greater than maxTimeout");for(var ot=[],it=0;itobjectToString.call(o)==="[object Error]",errorMessages=new Set(["network error","Failed to fetch","NetworkError when attempting to fetch resource.","The Internet connection appears to be offline.","Load failed","Network request failed","fetch failed","terminated"]);function isNetworkError(o){return o&&isError(o)&&o.name==="TypeError"&&typeof o.message=="string"?o.message==="Load failed"?o.stack===void 0:errorMessages.has(o.message):!1}let AbortError$1=class extends Error{constructor(et){super(),et instanceof Error?(this.originalError=et,{message:et}=et):(this.originalError=new Error(et),this.originalError.stack=this.stack),this.name="AbortError",this.message=et}};const decorateErrorWithCounts=(o,et,tt)=>{const nt=tt.retries-(et-1);return o.attemptNumber=et,o.retriesLeft=nt,o};async function pRetry(o,et){return new Promise((tt,nt)=>{et={onFailedAttempt(){},retries:10,shouldRetry:()=>!0,...et};const rt=retry$1.operation(et),ot=()=>{var st;rt.stop(),nt((st=et.signal)==null?void 0:st.reason)};et.signal&&!et.signal.aborted&&et.signal.addEventListener("abort",ot,{once:!0});const it=()=>{var st;(st=et.signal)==null||st.removeEventListener("abort",ot),rt.stop()};rt.attempt(async st=>{try{const at=await o(st);it(),tt(at)}catch(at){try{if(!(at instanceof Error))throw new TypeError(`Non-error was thrown: "${at}". You should only throw errors.`);if(at instanceof AbortError$1)throw at.originalError;if(at instanceof TypeError&&!isNetworkError(at))throw at;if(decorateErrorWithCounts(at,st,et),await et.shouldRetry(at)||(rt.stop(),nt(at)),await et.onFailedAttempt(at),!rt.retry(at))throw rt.mainError()}catch(ct){decorateErrorWithCounts(ct,st,et),it(),nt(ct)}}})})}class ReconnectQueue{constructor(et,tt={}){Ct(this,"log");Ct(this,"queue");Ct(this,"started");Ct(this,"peerStore");Ct(this,"retries");Ct(this,"retryInterval");Ct(this,"backoffFactor");Ct(this,"connectionManager");Ct(this,"events");this.log=et.logger.forComponent("libp2p:reconnect-queue"),this.peerStore=et.peerStore,this.connectionManager=et.connectionManager,this.queue=new PeerQueue({concurrency:tt.maxParallelReconnects??MAX_PARALLEL_RECONNECTS,metricName:"libp2p_reconnect_queue",metrics:et.metrics}),this.started=!1,this.retries=tt.retries??5,this.backoffFactor=tt.backoffFactor,this.retryInterval=tt.retryInterval,this.events=et.events,et.events.addEventListener("peer:disconnect",nt=>{this.maybeReconnect(nt.detail).catch(rt=>{this.log.error("failed to maybe reconnect to %p - %e",nt.detail,rt)})})}async maybeReconnect(et){if(!this.started)return;const tt=await this.peerStore.get(et);hasKeepAliveTag(tt)&&(this.queue.has(et)||this.queue.add(async nt=>{await pRetry(async rt=>{if(this.started)try{await this.connectionManager.openConnection(et,{signal:nt==null?void 0:nt.signal})}catch(ot){throw this.log("reconnecting to %p attempt %d of %d failed - %e",et,rt,this.retries,ot),ot}},{signal:nt==null?void 0:nt.signal,retries:this.retries,factor:this.backoffFactor,minTimeout:this.retryInterval})},{peerId:et}).catch(async nt=>{this.log.error("failed to reconnect to %p - %e",et,nt);const rt={};[...tt.tags.keys()].forEach(ot=>{ot.startsWith(KEEP_ALIVE)&&(rt[ot]=void 0)}),await this.peerStore.merge(et,{tags:rt}),this.events.safeDispatchEvent("peer:reconnect-failure",{detail:et})}).catch(async nt=>{this.log.error("failed to remove keep-alive tag from %p - %e",et,nt)}))}start(){this.started=!0}async afterStart(){Promise.resolve().then(async()=>{const et=await this.peerStore.all({filters:[tt=>hasKeepAliveTag(tt)]});await Promise.all(et.map(async tt=>{await this.connectionManager.openConnection(tt.id).catch(nt=>{this.log.error(nt)})}))}).catch(et=>{this.log.error(et)})}stop(){this.started=!1,this.queue.abort()}}function hasKeepAliveTag(o){for(const et of o.tags.keys())if(et.startsWith(KEEP_ALIVE))return!0;return!1}const DEFAULT_DIAL_PRIORITY=50,defaultOptions={maxConnections:MAX_CONNECTIONS,inboundConnectionThreshold:INBOUND_CONNECTION_THRESHOLD,maxIncomingPendingConnections:MAX_INCOMING_PENDING_CONNECTIONS};var Ol;Ol=Symbol.toStringTag;class DefaultConnectionManager{constructor(et,tt={}){Ct(this,"started");Ct(this,"connections");Ct(this,"allow");Ct(this,"deny");Ct(this,"maxIncomingPendingConnections");Ct(this,"incomingPendingConnections");Ct(this,"outboundPendingConnections");Ct(this,"maxConnections");Ct(this,"dialQueue");Ct(this,"reconnectQueue");Ct(this,"connectionPruner");Ct(this,"inboundConnectionRateLimiter");Ct(this,"peerStore");Ct(this,"metrics");Ct(this,"events");Ct(this,"log");Ct(this,"peerId");Ct(this,Ol,"@libp2p/connection-manager");if(this.maxConnections=tt.maxConnections??defaultOptions.maxConnections,this.maxConnections<1)throw new InvalidParametersError$1("Connection Manager maxConnections must be greater than 0");this.connections=new PeerMap,this.started=!1,this.peerId=et.peerId,this.peerStore=et.peerStore,this.metrics=et.metrics,this.events=et.events,this.log=et.logger.forComponent("libp2p:connection-manager"),this.onConnect=this.onConnect.bind(this),this.onDisconnect=this.onDisconnect.bind(this),this.allow=(tt.allow??[]).map(nt=>multiaddr(nt)),this.deny=(tt.deny??[]).map(nt=>multiaddr(nt)),this.incomingPendingConnections=0,this.maxIncomingPendingConnections=tt.maxIncomingPendingConnections??defaultOptions.maxIncomingPendingConnections,this.outboundPendingConnections=0,this.inboundConnectionRateLimiter=new RateLimiter({points:tt.inboundConnectionThreshold??defaultOptions.inboundConnectionThreshold,duration:1}),this.connectionPruner=new ConnectionPruner({connectionManager:this,peerStore:et.peerStore,events:et.events,logger:et.logger},{maxConnections:this.maxConnections,allow:this.allow}),this.dialQueue=new DialQueue(et,{addressSorter:tt.addressSorter,maxParallelDials:tt.maxParallelDials??MAX_PARALLEL_DIALS,maxDialQueueLength:tt.maxDialQueueLength??MAX_DIAL_QUEUE_LENGTH,maxPeerAddrsToDial:tt.maxPeerAddrsToDial??MAX_PEER_ADDRS_TO_DIAL,dialTimeout:tt.dialTimeout??DIAL_TIMEOUT,resolvers:tt.resolvers??{dnsaddr:dnsaddrResolver},connections:this.connections}),this.reconnectQueue=new ReconnectQueue({events:et.events,peerStore:et.peerStore,logger:et.logger,connectionManager:this},{retries:tt.reconnectRetries,retryInterval:tt.reconnectRetryInterval,backoffFactor:tt.reconnectBackoffFactor,maxParallelReconnects:tt.maxParallelReconnects})}async start(){var et,tt,nt;(et=this.metrics)==null||et.registerMetricGroup("libp2p_connection_manager_connections",{calculate:()=>{const rt={inbound:0,"inbound pending":this.incomingPendingConnections,outbound:0,"outbound pending":this.outboundPendingConnections};for(const ot of this.connections.values())for(const it of ot)rt[it.direction]++;return rt}}),(tt=this.metrics)==null||tt.registerMetricGroup("libp2p_protocol_streams_total",{label:"protocol",calculate:()=>{const rt={};for(const ot of this.connections.values())for(const it of ot)for(const st of it.streams){const at=`${st.direction} ${st.protocol??"unnegotiated"}`;rt[at]=(rt[at]??0)+1}return rt}}),(nt=this.metrics)==null||nt.registerMetricGroup("libp2p_connection_manager_protocol_streams_per_connection_90th_percentile",{label:"protocol",calculate:()=>{const rt={};for(const it of this.connections.values())for(const st of it){const at={};for(const ct of st.streams){const lt=`${ct.direction} ${ct.protocol??"unnegotiated"}`;at[lt]=(at[lt]??0)+1}for(const[ct,lt]of Object.entries(at))rt[ct]=rt[ct]??[],rt[ct].push(lt)}const ot={};for(let[it,st]of Object.entries(rt)){st=st.sort((ct,lt)=>ct-lt);const at=Math.floor(st.length*.9);ot[it]=st[at]}return ot}}),this.events.addEventListener("connection:open",this.onConnect),this.events.addEventListener("connection:close",this.onDisconnect),await start(this.dialQueue,this.reconnectQueue,this.connectionPruner),this.started=!0,this.log("started")}async stop(){this.events.removeEventListener("connection:open",this.onConnect),this.events.removeEventListener("connection:close",this.onDisconnect),await stop(this.reconnectQueue,this.dialQueue,this.connectionPruner);const et=[];for(const tt of this.connections.values())for(const nt of tt)et.push((async()=>{try{await nt.close()}catch(rt){this.log.error(rt)}})());this.log("closing %d connections",et.length),await Promise.all(et),this.connections.clear(),this.log("stopped")}onConnect(et){this._onConnect(et).catch(tt=>{this.log.error(tt)})}async _onConnect(et){const{detail:tt}=et;if(!this.started){await tt.close();return}if(tt.status!=="open")return;const nt=tt.remotePeer,rt=!this.connections.has(nt),ot=this.connections.get(nt)??[];ot.push(tt),this.connections.set(nt,ot),nt.publicKey!=null&&nt.type==="RSA"&&await this.peerStore.patch(nt,{publicKey:nt.publicKey}),rt&&this.events.safeDispatchEvent("peer:connect",{detail:tt.remotePeer})}onDisconnect(et){const{detail:tt}=et,nt=tt.remotePeer,ot=(this.connections.get(nt)??[]).filter(it=>it.id!==tt.id);this.connections.set(nt,ot),ot.length===0&&(this.log("onDisconnect remove all connections for peer %p",nt),this.connections.delete(nt),this.events.safeDispatchEvent("peer:disconnect",{detail:tt.remotePeer}))}getConnections(et){if(et!=null)return this.connections.get(et)??[];let tt=[];for(const nt of this.connections.values())tt=tt.concat(nt);return tt}getConnectionsMap(){return this.connections}async openConnection(et,tt={}){var nt,rt;if(!this.started)throw new NotStartedError("Not started");this.outboundPendingConnections++;try{(nt=tt.signal)==null||nt.throwIfAborted();const{peerId:ot}=getPeerAddress(et);if(this.peerId.equals(ot))throw new InvalidPeerIdError("Can not dial self");if(ot!=null&&tt.force!==!0){this.log("dial %p",ot);const ct=this.getConnections(ot).find(lt=>lt.limits==null);if(ct!=null)return this.log("had an existing non-limited connection to %p",ot),(rt=tt.onProgress)==null||rt.call(tt,new CustomProgressEvent("dial-queue:already-connected")),ct}const it=await this.dialQueue.dial(et,{...tt,priority:tt.priority??DEFAULT_DIAL_PRIORITY});if(it.status!=="open")throw new ConnectionClosedError("Remote closed connection during opening");let st=this.connections.get(it.remotePeer);st==null&&(st=[],this.connections.set(it.remotePeer,st));let at=!1;for(const ct of st)if(ct.id===it.id&&(at=!0),tt.force!==!0&&ct.id!==it.id&&ct.remoteAddr.equals(it.remoteAddr))return it.abort(new InvalidMultiaddrError("Duplicate multiaddr connection")),ct;return at||st.push(it),it}finally{this.outboundPendingConnections--}}async closeConnections(et,tt={}){const nt=this.connections.get(et)??[];await Promise.all(nt.map(async rt=>{try{await rt.close(tt)}catch(ot){rt.abort(ot)}}))}async acceptIncomingConnection(et){if(this.deny.some(rt=>et.remoteAddr.toString().startsWith(rt.toString())))return this.log("connection from %a refused - connection remote address was in deny list",et.remoteAddr),!1;if(this.allow.some(rt=>et.remoteAddr.toString().startsWith(rt.toString())))return this.incomingPendingConnections++,!0;if(this.incomingPendingConnections===this.maxIncomingPendingConnections)return this.log("connection from %a refused - incomingPendingConnections exceeded by host",et.remoteAddr),!1;if(et.remoteAddr.isThinWaistAddress()){const rt=et.remoteAddr.nodeAddress().address;try{await this.inboundConnectionRateLimiter.consume(rt,1)}catch{return this.log("connection from %a refused - inboundConnectionThreshold exceeded by host %s",et.remoteAddr,rt),!1}}return this.getConnections().length({id:tt.id,status:et[tt.status],peerId:tt.options.peerId,multiaddrs:[...tt.options.multiaddrs].map(nt=>multiaddr(nt))}))}async isDialable(et,tt={}){return this.dialQueue.isDialable(et,tt)}}class MovingAverage{constructor(et){Ct(this,"movingAverage");Ct(this,"variance");Ct(this,"deviation");Ct(this,"forecast");Ct(this,"timespan");Ct(this,"previousTime");this.timespan=et,this.movingAverage=0,this.variance=0,this.deviation=0,this.forecast=0}alpha(et,tt){return 1-Math.exp(-(et-tt)/this.timespan)}push(et,tt=Date.now()){if(this.previousTime!=null){const nt=this.alpha(tt,this.previousTime),rt=et-this.movingAverage,ot=nt*rt;this.movingAverage=nt*et+(1-nt)*this.movingAverage,this.variance=(1-nt)*(this.variance+rt*ot),this.deviation=Math.sqrt(this.variance),this.forecast=this.movingAverage+nt*rt}else this.movingAverage=et;this.previousTime=tt}}const DEFAULT_TIMEOUT_MULTIPLIER=1.2,DEFAULT_FAILURE_MULTIPLIER=2,DEFAULT_MIN_TIMEOUT=2e3;class AdaptiveTimeout{constructor(et={}){Ct(this,"success");Ct(this,"failure");Ct(this,"next");Ct(this,"metric");Ct(this,"timeoutMultiplier");Ct(this,"failureMultiplier");Ct(this,"minTimeout");var tt;this.success=new MovingAverage(et.interval??5e3),this.failure=new MovingAverage(et.interval??5e3),this.next=new MovingAverage(et.interval??5e3),this.failureMultiplier=et.failureMultiplier??DEFAULT_FAILURE_MULTIPLIER,this.timeoutMultiplier=et.timeoutMultiplier??DEFAULT_TIMEOUT_MULTIPLIER,this.minTimeout=et.minTimeout??DEFAULT_MIN_TIMEOUT,et.metricName!=null&&(this.metric=(tt=et.metrics)==null?void 0:tt.registerMetricGroup(et.metricName))}getTimeoutSignal(et={}){const tt=Math.max(Math.round(this.next.movingAverage*(et.timeoutFactor??this.timeoutMultiplier)),this.minTimeout),nt=AbortSignal.timeout(tt),rt=anySignal([et.signal,nt]);return setMaxListeners$2(1/0,rt,nt),rt.start=Date.now(),rt.timeout=tt,rt}cleanUp(et){var nt,rt;const tt=Date.now()-et.start;et.aborted?(this.failure.push(tt),this.next.push(tt*this.failureMultiplier),(nt=this.metric)==null||nt.update({failureMovingAverage:this.failure.movingAverage,failureDeviation:this.failure.deviation,failureForecast:this.failure.forecast,failureVariance:this.failure.variance,failure:tt})):(this.success.push(tt),this.next.push(tt),(rt=this.metric)==null||rt.update({successMovingAverage:this.success.movingAverage,successDeviation:this.success.deviation,successForecast:this.success.forecast,successVariance:this.success.variance,success:tt}))}}const DEFAULT_PING_INTERVAL_MS=1e4,PROTOCOL_VERSION="1.0.0",PROTOCOL_NAME="ping",PROTOCOL_PREFIX="ipfs",PING_LENGTH=32,DEFAULT_ABORT_CONNECTION_ON_PING_FAILURE=!0;var Ml,Bl;Bl=Symbol.toStringTag,Ml=serviceCapabilities;class ConnectionMonitor{constructor(et,tt={}){Ct(this,"protocol");Ct(this,"components");Ct(this,"log");Ct(this,"heartbeatInterval");Ct(this,"pingIntervalMs");Ct(this,"abortController");Ct(this,"timeout");Ct(this,"abortConnectionOnPingFailure");Ct(this,Bl,"@libp2p/connection-monitor");Ct(this,Ml,["@libp2p/connection-monitor"]);this.components=et,this.protocol=`/${tt.protocolPrefix??PROTOCOL_PREFIX}/${PROTOCOL_NAME}/${PROTOCOL_VERSION}`,this.log=et.logger.forComponent("libp2p:connection-monitor"),this.pingIntervalMs=tt.pingInterval??DEFAULT_PING_INTERVAL_MS,this.abortConnectionOnPingFailure=tt.abortConnectionOnPingFailure??DEFAULT_ABORT_CONNECTION_ON_PING_FAILURE,this.timeout=new AdaptiveTimeout({...tt.pingTimeout??{},metrics:et.metrics,metricName:"libp2p_connection_monitor_ping_time_milliseconds"})}start(){this.abortController=new AbortController,setMaxListeners(1/0,this.abortController.signal),this.heartbeatInterval=setInterval(()=>{this.components.connectionManager.getConnections().forEach(et=>{Promise.resolve().then(async()=>{var nt;let tt=Date.now();try{const rt=this.timeout.getTimeoutSignal({signal:(nt=this.abortController)==null?void 0:nt.signal}),ot=await et.newStream(this.protocol,{signal:rt,runOnLimitedConnection:!0}),it=byteStream(ot);tt=Date.now(),await Promise.all([it.write(randomBytes(PING_LENGTH),{signal:rt}),it.read(PING_LENGTH,{signal:rt})]),et.rtt=Date.now()-tt,await it.unwrap().close({signal:rt})}catch(rt){if(rt.name!=="UnsupportedProtocolError")throw rt;et.rtt=(Date.now()-tt)/2}}).catch(tt=>{this.log.error("error during heartbeat",tt),this.abortConnectionOnPingFailure?(this.log.error("aborting connection due to ping failure"),et.abort(tt)):this.log("connection ping failed, but not aborting due to abortConnectionOnPingFailure flag")})})},this.pingIntervalMs)}stop(){var et;(et=this.abortController)==null||et.abort(),this.heartbeatInterval!=null&&clearInterval(this.heartbeatInterval)}}var Dl;Dl=Symbol.toStringTag;class CompoundContentRouting{constructor(et,tt){Ct(this,"routers");Ct(this,"started");Ct(this,"components");Ct(this,Dl,"@libp2p/content-routing");this.routers=tt.routers??[],this.started=!1,this.components=et}isStarted(){return this.started}async start(){this.started=!0}async stop(){this.started=!1}async*findProviders(et,tt={}){if(this.routers.length===0)throw new NoContentRoutersError("No content routers available");const nt=this,rt=new PeerSet;for await(const ot of merge$2(...nt.routers.map(it=>it.findProviders(et,tt))))ot!=null&&(ot.multiaddrs.length>0&&await this.components.peerStore.merge(ot.id,{multiaddrs:ot.multiaddrs}),!rt.has(ot.id)&&(rt.add(ot.id),yield ot))}async provide(et,tt={}){if(this.routers.length===0)throw new NoContentRoutersError("No content routers available");await Promise.all(this.routers.map(async nt=>{await nt.provide(et,tt)}))}async put(et,tt,nt){if(!this.isStarted())throw new NotStartedError;await Promise.all(this.routers.map(async rt=>{await rt.put(et,tt,nt)}))}async get(et,tt){if(!this.isStarted())throw new NotStartedError;return Promise.any(this.routers.map(async nt=>nt.get(et,tt)))}}var Fl;Fl=Symbol.toStringTag;class DefaultPeerRouting{constructor(et,tt={}){Ct(this,"log");Ct(this,"peerId");Ct(this,"peerStore");Ct(this,"routers");Ct(this,Fl,"@libp2p/peer-routing");this.log=et.logger.forComponent("libp2p:peer-routing"),this.peerId=et.peerId,this.peerStore=et.peerStore,this.routers=tt.routers??[]}async findPeer(et,tt){if(this.routers.length===0)throw new NoPeerRoutersError("No peer routers available");if(et.toString()===this.peerId.toString())throw new QueriedForSelfError("Should not try to find self");const nt=this,rt=merge$2(...this.routers.map(ot=>async function*(){try{yield await ot.findPeer(et,tt)}catch(it){nt.log.error(it)}}()));for await(const ot of rt)if(ot!=null)return ot.multiaddrs.length>0&&await this.peerStore.merge(ot.id,{multiaddrs:ot.multiaddrs}),ot;throw new NotFoundError$1}async*getClosestPeers(et,tt={}){if(this.routers.length===0)throw new NoPeerRoutersError("No peer routers available");const nt=this,rt=createScalableCuckooFilter(1024);for await(const ot of parallel(async function*(){const it=merge$2(...nt.routers.map(st=>st.getClosestPeers(et,tt)));for await(let st of it)yield async()=>{if(st.multiaddrs.length===0)try{st=await nt.findPeer(st.id,{...tt,useCache:!1})}catch(at){nt.log.error("could not find peer multiaddrs",at);return}return st}}()))ot!=null&&(ot.multiaddrs.length>0&&await this.peerStore.merge(ot.id,{multiaddrs:ot.multiaddrs}),!rt.has(ot.id.toMultihash().bytes)&&(rt.add(ot.id.toMultihash().bytes),yield ot))}}var Ul,zl;class RandomWalk extends(zl=TypedEventEmitter,Ul=Symbol.toStringTag,zl){constructor(tt){super();Ct(this,"peerRouting");Ct(this,"log");Ct(this,"walking");Ct(this,"walkers");Ct(this,"shutdownController");Ct(this,"walkController");Ct(this,"needNext");Ct(this,Ul,"@libp2p/random-walk");this.log=tt.logger.forComponent("libp2p:random-walk"),this.peerRouting=tt.peerRouting,this.walkers=0,this.walking=!1,this.shutdownController=new AbortController,setMaxListeners(1/0,this.shutdownController.signal)}start(){this.shutdownController=new AbortController,setMaxListeners(1/0,this.shutdownController.signal)}stop(){this.shutdownController.abort()}async*walk(tt){var rt,ot;this.walking||this.startWalk(),this.walkers++;const nt=anySignal([this.shutdownController.signal,tt==null?void 0:tt.signal]);setMaxListeners(1/0,nt);try{for(;;)(rt=this.needNext)==null||rt.resolve(),this.needNext=pDefer(),yield(await raceEvent(this,"walk:peer",nt,{errorEvent:"walk:error"})).detail}finally{nt.clear(),this.walkers--,this.walkers===0&&((ot=this.walkController)==null||ot.abort(),this.walkController=void 0)}}startWalk(){this.walking=!0,this.walkController=new AbortController,setMaxListeners(1/0,this.walkController.signal);const tt=anySignal([this.walkController.signal,this.shutdownController.signal]);setMaxListeners(1/0,tt);const nt=Date.now();let rt=0;Promise.resolve().then(async()=>{for(this.log("start walk");this.walkers>0;)try{const ot=randomBytes(32);let it=Date.now();for await(const st of this.peerRouting.getClosestPeers(ot,{signal:tt}))tt.aborted&&this.log("aborting walk"),tt.throwIfAborted(),this.log("found peer %p after %dms for %d walkers",st.id,Date.now()-it,this.walkers),rt++,this.safeDispatchEvent("walk:peer",{detail:st}),this.walkers===1&&this.needNext!=null&&(this.log("wait for need next"),await raceSignal(this.needNext.promise,tt)),it=Date.now();this.log("walk iteration for %b and %d walkers finished, found %d peers",ot,this.walkers,rt)}catch(ot){this.log.error("randomwalk errored",ot),this.safeDispatchEvent("walk:error",{detail:ot})}this.log("no walkers left, ended walk")}).catch(ot=>{this.log.error("randomwalk errored",ot)}).finally(()=>{this.log("finished walk, found %d peers after %dms",rt,Date.now()-nt),this.walking=!1})}}const DEFAULT_MAX_INBOUND_STREAMS=32,DEFAULT_MAX_OUTBOUND_STREAMS=64;var Vl;Vl=Symbol.toStringTag;class DefaultRegistrar{constructor(et){Ct(this,"log");Ct(this,"topologies");Ct(this,"handlers");Ct(this,"components");Ct(this,Vl,"@libp2p/registrar");this.log=et.logger.forComponent("libp2p:registrar"),this.topologies=new Map,this.handlers=new Map,this.components=et,this._onDisconnect=this._onDisconnect.bind(this),this._onPeerUpdate=this._onPeerUpdate.bind(this),this._onPeerIdentify=this._onPeerIdentify.bind(this),this.components.events.addEventListener("peer:disconnect",this._onDisconnect),this.components.events.addEventListener("peer:update",this._onPeerUpdate),this.components.events.addEventListener("peer:identify",this._onPeerIdentify)}getProtocols(){return Array.from(new Set([...this.handlers.keys()])).sort()}getHandler(et){const tt=this.handlers.get(et);if(tt==null)throw new UnhandledProtocolError(`No handler registered for protocol ${et}`);return tt}getTopologies(et){const tt=this.topologies.get(et);return tt==null?[]:[...tt.values()]}async handle(et,tt,nt){if(this.handlers.has(et))throw new DuplicateProtocolHandlerError(`Handler already registered for protocol ${et}`);const rt=mergeOptions$1.bind({ignoreUndefined:!0})({maxInboundStreams:DEFAULT_MAX_INBOUND_STREAMS,maxOutboundStreams:DEFAULT_MAX_OUTBOUND_STREAMS},nt);this.handlers.set(et,{handler:tt,options:rt}),await this.components.peerStore.merge(this.components.peerId,{protocols:[et]})}async unhandle(et){(Array.isArray(et)?et:[et]).forEach(nt=>{this.handlers.delete(nt)}),await this.components.peerStore.patch(this.components.peerId,{protocols:this.getProtocols()})}async register(et,tt){if(tt==null)throw new InvalidParametersError$1("invalid topology");const nt=`${(Math.random()*1e9).toString(36)}${Date.now()}`;let rt=this.topologies.get(et);return rt==null&&(rt=new Map,this.topologies.set(et,rt)),rt.set(nt,tt),nt}unregister(et){for(const[tt,nt]of this.topologies.entries())nt.has(et)&&(nt.delete(et),nt.size===0&&this.topologies.delete(tt))}_onDisconnect(et){const tt=et.detail;this.components.peerStore.get(tt).then(nt=>{var rt,ot,it;for(const st of nt.protocols){const at=this.topologies.get(st);if(at!=null)for(const ct of at.values())((rt=ct.filter)==null?void 0:rt.has(tt))!==!1&&((ot=ct.filter)==null||ot.remove(tt),(it=ct.onDisconnect)==null||it.call(ct,tt))}}).catch(nt=>{nt.name!=="NotFoundError"&&this.log.error("could not inform topologies of disconnecting peer %p",tt,nt)})}_onPeerUpdate(et){var ot,it,st;const{peer:tt,previous:nt}=et.detail,rt=((nt==null?void 0:nt.protocols)??[]).filter(at=>!tt.protocols.includes(at));for(const at of rt){const ct=this.topologies.get(at);if(ct!=null)for(const lt of ct.values())((ot=lt.filter)==null?void 0:ot.has(tt.id))!==!1&&((it=lt.filter)==null||it.remove(tt.id),(st=lt.onDisconnect)==null||st.call(lt,tt.id))}}_onPeerIdentify(et){var ot,it,st;const tt=et.detail.protocols,nt=et.detail.connection,rt=et.detail.peerId;for(const at of tt){const ct=this.topologies.get(at);if(ct!=null)for(const lt of ct.values())nt.limits!=null&<.notifyOnLimitedConnection!==!0||((ot=lt.filter)==null?void 0:ot.has(rt))!==!0&&((it=lt.filter)==null||it.add(rt),(st=lt.onConnect)==null||st.call(lt,rt,nt))}}}class TrackedMap extends Map{constructor(tt){super();Ct(this,"metric");const{name:nt,metrics:rt}=tt;this.metric=rt.registerMetric(nt),this.updateComponentMetric()}set(tt,nt){return super.set(tt,nt),this.updateComponentMetric(),this}delete(tt){const nt=super.delete(tt);return this.updateComponentMetric(),nt}clear(){super.clear(),this.updateComponentMetric()}updateComponentMetric(){this.metric.update(this.size)}}function trackedMap(o){const{name:et,metrics:tt}=o;let nt;return tt!=null?nt=new TrackedMap({name:et,metrics:tt}):nt=new Map,nt}var Hl;Hl=Symbol.toStringTag;class DefaultTransportManager{constructor(et,tt={}){Ct(this,"log");Ct(this,"components");Ct(this,"transports");Ct(this,"listeners");Ct(this,"faultTolerance");Ct(this,"started");Ct(this,Hl,"@libp2p/transport-manager");this.log=et.logger.forComponent("libp2p:transports"),this.components=et,this.started=!1,this.transports=new Map,this.listeners=trackedMap({name:"libp2p_transport_manager_listeners",metrics:this.components.metrics}),this.faultTolerance=tt.faultTolerance??FaultTolerance.FATAL_ALL}add(et){const tt=et[Symbol.toStringTag];if(tt==null)throw new InvalidParametersError$1("Transport must have a valid tag");if(this.transports.has(tt))throw new InvalidParametersError$1(`There is already a transport with the tag ${tt}`);this.log("adding transport %s",tt),this.transports.set(tt,et),this.listeners.has(tt)||this.listeners.set(tt,[])}isStarted(){return this.started}start(){this.started=!0}async afterStart(){const et=this.components.addressManager.getListenAddrs();await this.listen(et)}async stop(){const et=[];for(const[tt,nt]of this.listeners)for(this.log("closing listeners for %s",tt);nt.length>0;){const rt=nt.pop();rt!=null&&et.push(rt.close())}await Promise.all(et),this.log("all listeners closed");for(const tt of this.listeners.keys())this.listeners.set(tt,[]);this.started=!1}async dial(et,tt){var rt;const nt=this.dialTransportForMultiaddr(et);if(nt==null)throw new TransportUnavailableError(`No transport available for address ${String(et)}`);return(rt=tt==null?void 0:tt.onProgress)==null||rt.call(tt,new CustomProgressEvent("transport-manager:selected-transport",nt[Symbol.toStringTag])),nt.dial(et,{...tt,upgrader:this.components.upgrader})}getAddrs(){let et=[];for(const tt of this.listeners.values())for(const nt of tt)et=[...et,...nt.getAddrs()];return et}getTransports(){return Array.of(...this.transports.values())}getListeners(){return Array.of(...this.listeners.values()).flat()}dialTransportForMultiaddr(et){for(const tt of this.transports.values())if(tt.dialFilter([et]).length>0)return tt}listenTransportForMultiaddr(et){for(const tt of this.transports.values())if(tt.listenFilter([et]).length>0)return tt}async listen(et){if(!this.isStarted())throw new NotStartedError("Not started");if(et==null||et.length===0){this.log("no addresses were provided for listening, this node is dial only");return}const tt=[];for(const[nt,rt]of this.transports.entries()){const ot=rt.listenFilter(et),it=[];for(const ct of ot){this.log("creating listener for %s on %a",nt,ct);const lt=rt.createListener({upgrader:this.components.upgrader});let dt=this.listeners.get(nt)??[];dt==null&&(dt=[],this.listeners.set(nt,dt)),dt.push(lt),lt.addEventListener("listening",()=>{this.components.events.safeDispatchEvent("transport:listening",{detail:lt})}),lt.addEventListener("close",()=>{const ht=dt.findIndex(pt=>pt===lt);dt.splice(ht,1),this.components.events.safeDispatchEvent("transport:close",{detail:lt})}),it.push(lt.listen(ct))}if(it.length===0){tt.push(nt);continue}if((await Promise.allSettled(it)).find(ct=>ct.status==="fulfilled")==null&&this.faultTolerance!==FaultTolerance.NO_FATAL)throw new NoValidAddressesError(`Transport (${nt}) could not listen on any available address`)}if(tt.length===this.transports.size){const nt=`no valid addresses were provided for transports [${tt.join(", ")}]`;if(this.faultTolerance===FaultTolerance.FATAL_ALL)throw new NoValidAddressesError(nt);this.log(`libp2p in dial mode only: ${nt}`)}}async remove(et){const tt=this.listeners.get(et)??[];this.log.trace("removing transport %s",et);const nt=[];for(this.log.trace("closing listeners for %s",et);tt.length>0;){const rt=tt.pop();rt!=null&&nt.push(rt.close())}await Promise.all(nt),this.transports.delete(et),this.listeners.delete(et)}async removeAll(){const et=[];for(const tt of this.transports.keys())et.push(this.remove(tt));await Promise.all(et)}}const PROTOCOL_ID="/multistream/1.0.0",MAX_PROTOCOL_LENGTH=1024;class UnsupportedProtocolError extends Error{constructor(et="Unsupported protocol error"){super(et),this.name="UnsupportedProtocolError"}}Ct(UnsupportedProtocolError,"name","UnsupportedProtocolError");class InvalidMessageError extends Error{constructor(et="Invalid message"){super(et),this.name="InvalidMessageError"}}Ct(InvalidMessageError,"name","InvalidMessageError");const NewLine=fromString(` `);async function write$1(o,et,tt){await o.write(et,tt)}async function writeAll(o,et,tt){await o.writeV(et,tt)}async function read(o,et){const tt=await o.read(et);if(tt.byteLength===0||tt.get(tt.byteLength-1)!==NewLine[0])throw et.log.error("Invalid mss message - missing newline",tt),new InvalidMessageError("Missing newline");return tt.sublist(0,-1)}async function readString(o,et){const tt=await read(o,et);return toString$8(tt.subarray())}async function select(o,et,tt){if(et=Array.isArray(et)?[...et]:[et],et.length===1&&tt.negotiateFully===!1)return optimisticSelect(o,et[0],tt);const nt=lpStream(o,{...tt,maxDataLength:MAX_PROTOCOL_LENGTH}),rt=et.shift();if(rt==null)throw new Error("At least one protocol must be specified");tt.log.trace('select: write ["%s", "%s"]',PROTOCOL_ID,rt);const ot=fromString(`${PROTOCOL_ID} `),it=fromString(`${rt} `);await writeAll(nt,[ot,it],tt),tt.log.trace("select: reading multistream-select header");let st=await readString(nt,tt);if(tt.log.trace('select: read "%s"',st),st===PROTOCOL_ID&&(tt.log.trace("select: reading protocol response"),st=await readString(nt,tt),tt.log.trace('select: read "%s"',st)),st===rt)return{stream:nt.unwrap(),protocol:rt};for(const at of et){tt.log.trace('select: write "%s"',at),await write$1(nt,fromString(`${at} @@ -3954,7 +3954,7 @@ ${et.join(` * @author Chen, Yi-Cyuan [emn178@gmail.com] * @copyright Chen, Yi-Cyuan 2015-2023 * @license MIT - */(function(){var tt="input is invalid type",nt="finalize already called",rt=typeof window=="object",ot=rt?window:{};ot.JS_SHA3_NO_WINDOW&&(rt=!1);var it=!rt&&typeof self=="object",st=!ot.JS_SHA3_NO_NODE_JS&&typeof et=="object"&&et.versions&&et.versions.node;st?ot=globalThis:it&&(ot=self);for(var at=!ot.JS_SHA3_NO_COMMON_JS&&!0&&o.exports,ct=!ot.JS_SHA3_NO_ARRAY_BUFFER&&typeof ArrayBuffer<"u",lt="0123456789abcdef".split(""),dt=[31,7936,2031616,520093696],ht=[4,1024,262144,67108864],pt=[1,256,65536,16777216],mt=[6,1536,393216,100663296],ft=[0,8,16,24],yt=[1,0,32898,0,32906,2147483648,2147516416,2147483648,32907,0,2147483649,0,2147516545,2147483648,32777,2147483648,138,0,136,0,2147516425,0,2147483658,0,2147516555,0,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,2147483648,32778,0,2147483658,2147483648,2147516545,2147483648,32896,2147483648,2147483649,0,2147516424,2147483648],gt=[224,256,384,512],xt=[128,256],vt=["hex","buffer","arrayBuffer","array","digest"],bt={128:168,256:136},Et=ot.JS_SHA3_NO_NODE_JS||!Array.isArray?function(_t){return Object.prototype.toString.call(_t)==="[object Array]"}:Array.isArray,wt=ct&&(ot.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW||!ArrayBuffer.isView)?function(_t){return typeof _t=="object"&&_t.buffer&&_t.buffer.constructor===ArrayBuffer}:ArrayBuffer.isView,kt=function(_t){var Dt=typeof _t;if(Dt==="string")return[_t,!0];if(Dt!=="object"||_t===null)throw new Error(tt);if(ct&&_t.constructor===ArrayBuffer)return[new Uint8Array(_t),!1];if(!Et(_t)&&!wt(_t))throw new Error(tt);return[_t,!1]},Tt=function(_t){return kt(_t)[0].length===0},Rt=function(_t){for(var Dt=[],Vt=0;Vt<_t.length;++Vt)Dt[Vt]=_t[Vt];return Dt},Pt=function(_t,Dt,Vt){return function(en){return new Xt(_t,Dt,_t).update(en)[Vt]()}},$t=function(_t,Dt,Vt){return function(en,an){return new Xt(_t,Dt,an).update(en)[Vt]()}},Ot=function(_t,Dt,Vt){return function(en,an,dn,ln){return Lt["cshake"+_t].update(en,an,dn,ln)[Vt]()}},Bt=function(_t,Dt,Vt){return function(en,an,dn,ln){return Lt["kmac"+_t].update(en,an,dn,ln)[Vt]()}},zt=function(_t,Dt,Vt,en){for(var an=0;an>5,this.byteCount=this.blockCount<<2,this.outputBlocks=Vt>>5,this.extraBytes=(Vt&31)>>3;for(var en=0;en<50;++en)this.s[en]=0}Xt.prototype.update=function(_t){if(this.finalized)throw new Error(nt);var Dt=kt(_t);_t=Dt[0];for(var Vt=Dt[1],en=this.blocks,an=this.byteCount,dn=_t.length,ln=this.blockCount,pn=0,kn=this.s,mn,wn;pn>2]|=wn<>2]|=(192|wn>>6)<>2]|=(128|wn&63)<=57344?(en[mn>>2]|=(224|wn>>12)<>2]|=(128|wn>>6&63)<>2]|=(128|wn&63)<>2]|=(240|wn>>18)<>2]|=(128|wn>>12&63)<>2]|=(128|wn>>6&63)<>2]|=(128|wn&63)<>2]|=_t[pn]<=an){for(this.start=mn-an,this.block=en[ln],mn=0;mn>8,Vt=_t&255;Vt>0;)an.unshift(Vt),_t=_t>>8,Vt=_t&255,++en;return Dt?an.push(en):an.unshift(en),this.update(an),an.length},Xt.prototype.encodeString=function(_t){var Dt=kt(_t);_t=Dt[0];var Vt=Dt[1],en=0,an=_t.length;if(Vt)for(var dn=0;dn<_t.length;++dn){var ln=_t.charCodeAt(dn);ln<128?en+=1:ln<2048?en+=2:ln<55296||ln>=57344?en+=3:(ln=65536+((ln&1023)<<10|_t.charCodeAt(++dn)&1023),en+=4)}else en=an;return en+=this.encode(en*8),this.update(_t),en},Xt.prototype.bytepad=function(_t,Dt){for(var Vt=this.encode(Dt),en=0;en<_t.length;++en)Vt+=this.encodeString(_t[en]);var an=(Dt-Vt%Dt)%Dt,dn=[];return dn.length=an,this.update(dn),this},Xt.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var _t=this.blocks,Dt=this.lastByteIndex,Vt=this.blockCount,en=this.s;if(_t[Dt>>2]|=this.padding[Dt&3],this.lastByteIndex===this.byteCount)for(_t[0]=_t[Vt],Dt=1;Dt>4&15]+lt[pn&15]+lt[pn>>12&15]+lt[pn>>8&15]+lt[pn>>20&15]+lt[pn>>16&15]+lt[pn>>28&15]+lt[pn>>24&15];dn%_t===0&&(Dt=Rt(Dt),tn(Dt),an=0)}return en&&(pn=Dt[an],ln+=lt[pn>>4&15]+lt[pn&15],en>1&&(ln+=lt[pn>>12&15]+lt[pn>>8&15]),en>2&&(ln+=lt[pn>>20&15]+lt[pn>>16&15])),ln},Xt.prototype.arrayBuffer=function(){this.finalize();var _t=this.blockCount,Dt=this.s,Vt=this.outputBlocks,en=this.extraBytes,an=0,dn=0,ln=this.outputBits>>3,pn;en?pn=new ArrayBuffer(Vt+1<<2):pn=new ArrayBuffer(ln);for(var kn=new Uint32Array(pn);dn>8&255,ln[pn+2]=kn>>16&255,ln[pn+3]=kn>>24&255;dn%_t===0&&(Dt=Rt(Dt),tn(Dt))}return en&&(pn=dn<<2,kn=Dt[an],ln[pn]=kn&255,en>1&&(ln[pn+1]=kn>>8&255),en>2&&(ln[pn+2]=kn>>16&255)),ln};function Jt(_t,Dt,Vt){Xt.call(this,_t,Dt,Vt)}Jt.prototype=new Xt,Jt.prototype.finalize=function(){return this.encode(this.outputBits,!0),Xt.prototype.finalize.call(this)};var tn=function(_t){var Dt,Vt,en,an,dn,ln,pn,kn,mn,wn,In,Pn,yn,En,on,It,St,At,jt,Kt,rn,sn,xn,Rn,vn,An,bn,fo,mo,go,yo,xo,vo,bo,Eo,wo,Co,So,ko,Ao,Ro,_o,To,Io,Po,Lo,No,$o,jo,Oo,Mo,Bo,Do,Fo,Uo,zo,Vo,Ho,Wo,Go,qo,Ko,Qo;for(en=0;en<48;en+=2)an=_t[0]^_t[10]^_t[20]^_t[30]^_t[40],dn=_t[1]^_t[11]^_t[21]^_t[31]^_t[41],ln=_t[2]^_t[12]^_t[22]^_t[32]^_t[42],pn=_t[3]^_t[13]^_t[23]^_t[33]^_t[43],kn=_t[4]^_t[14]^_t[24]^_t[34]^_t[44],mn=_t[5]^_t[15]^_t[25]^_t[35]^_t[45],wn=_t[6]^_t[16]^_t[26]^_t[36]^_t[46],In=_t[7]^_t[17]^_t[27]^_t[37]^_t[47],Pn=_t[8]^_t[18]^_t[28]^_t[38]^_t[48],yn=_t[9]^_t[19]^_t[29]^_t[39]^_t[49],Dt=Pn^(ln<<1|pn>>>31),Vt=yn^(pn<<1|ln>>>31),_t[0]^=Dt,_t[1]^=Vt,_t[10]^=Dt,_t[11]^=Vt,_t[20]^=Dt,_t[21]^=Vt,_t[30]^=Dt,_t[31]^=Vt,_t[40]^=Dt,_t[41]^=Vt,Dt=an^(kn<<1|mn>>>31),Vt=dn^(mn<<1|kn>>>31),_t[2]^=Dt,_t[3]^=Vt,_t[12]^=Dt,_t[13]^=Vt,_t[22]^=Dt,_t[23]^=Vt,_t[32]^=Dt,_t[33]^=Vt,_t[42]^=Dt,_t[43]^=Vt,Dt=ln^(wn<<1|In>>>31),Vt=pn^(In<<1|wn>>>31),_t[4]^=Dt,_t[5]^=Vt,_t[14]^=Dt,_t[15]^=Vt,_t[24]^=Dt,_t[25]^=Vt,_t[34]^=Dt,_t[35]^=Vt,_t[44]^=Dt,_t[45]^=Vt,Dt=kn^(Pn<<1|yn>>>31),Vt=mn^(yn<<1|Pn>>>31),_t[6]^=Dt,_t[7]^=Vt,_t[16]^=Dt,_t[17]^=Vt,_t[26]^=Dt,_t[27]^=Vt,_t[36]^=Dt,_t[37]^=Vt,_t[46]^=Dt,_t[47]^=Vt,Dt=wn^(an<<1|dn>>>31),Vt=In^(dn<<1|an>>>31),_t[8]^=Dt,_t[9]^=Vt,_t[18]^=Dt,_t[19]^=Vt,_t[28]^=Dt,_t[29]^=Vt,_t[38]^=Dt,_t[39]^=Vt,_t[48]^=Dt,_t[49]^=Vt,En=_t[0],on=_t[1],Lo=_t[11]<<4|_t[10]>>>28,No=_t[10]<<4|_t[11]>>>28,fo=_t[20]<<3|_t[21]>>>29,mo=_t[21]<<3|_t[20]>>>29,Go=_t[31]<<9|_t[30]>>>23,qo=_t[30]<<9|_t[31]>>>23,_o=_t[40]<<18|_t[41]>>>14,To=_t[41]<<18|_t[40]>>>14,bo=_t[2]<<1|_t[3]>>>31,Eo=_t[3]<<1|_t[2]>>>31,It=_t[13]<<12|_t[12]>>>20,St=_t[12]<<12|_t[13]>>>20,$o=_t[22]<<10|_t[23]>>>22,jo=_t[23]<<10|_t[22]>>>22,go=_t[33]<<13|_t[32]>>>19,yo=_t[32]<<13|_t[33]>>>19,Ko=_t[42]<<2|_t[43]>>>30,Qo=_t[43]<<2|_t[42]>>>30,Fo=_t[5]<<30|_t[4]>>>2,Uo=_t[4]<<30|_t[5]>>>2,wo=_t[14]<<6|_t[15]>>>26,Co=_t[15]<<6|_t[14]>>>26,At=_t[25]<<11|_t[24]>>>21,jt=_t[24]<<11|_t[25]>>>21,Oo=_t[34]<<15|_t[35]>>>17,Mo=_t[35]<<15|_t[34]>>>17,xo=_t[45]<<29|_t[44]>>>3,vo=_t[44]<<29|_t[45]>>>3,Rn=_t[6]<<28|_t[7]>>>4,vn=_t[7]<<28|_t[6]>>>4,zo=_t[17]<<23|_t[16]>>>9,Vo=_t[16]<<23|_t[17]>>>9,So=_t[26]<<25|_t[27]>>>7,ko=_t[27]<<25|_t[26]>>>7,Kt=_t[36]<<21|_t[37]>>>11,rn=_t[37]<<21|_t[36]>>>11,Bo=_t[47]<<24|_t[46]>>>8,Do=_t[46]<<24|_t[47]>>>8,Io=_t[8]<<27|_t[9]>>>5,Po=_t[9]<<27|_t[8]>>>5,An=_t[18]<<20|_t[19]>>>12,bn=_t[19]<<20|_t[18]>>>12,Ho=_t[29]<<7|_t[28]>>>25,Wo=_t[28]<<7|_t[29]>>>25,Ao=_t[38]<<8|_t[39]>>>24,Ro=_t[39]<<8|_t[38]>>>24,sn=_t[48]<<14|_t[49]>>>18,xn=_t[49]<<14|_t[48]>>>18,_t[0]=En^~It&At,_t[1]=on^~St&jt,_t[10]=Rn^~An&fo,_t[11]=vn^~bn&mo,_t[20]=bo^~wo&So,_t[21]=Eo^~Co&ko,_t[30]=Io^~Lo&$o,_t[31]=Po^~No&jo,_t[40]=Fo^~zo&Ho,_t[41]=Uo^~Vo&Wo,_t[2]=It^~At&Kt,_t[3]=St^~jt&rn,_t[12]=An^~fo&go,_t[13]=bn^~mo&yo,_t[22]=wo^~So&Ao,_t[23]=Co^~ko&Ro,_t[32]=Lo^~$o&Oo,_t[33]=No^~jo&Mo,_t[42]=zo^~Ho&Go,_t[43]=Vo^~Wo&qo,_t[4]=At^~Kt&sn,_t[5]=jt^~rn&xn,_t[14]=fo^~go&xo,_t[15]=mo^~yo&vo,_t[24]=So^~Ao&_o,_t[25]=ko^~Ro&To,_t[34]=$o^~Oo&Bo,_t[35]=jo^~Mo&Do,_t[44]=Ho^~Go&Ko,_t[45]=Wo^~qo&Qo,_t[6]=Kt^~sn&En,_t[7]=rn^~xn&on,_t[16]=go^~xo&Rn,_t[17]=yo^~vo&vn,_t[26]=Ao^~_o&bo,_t[27]=Ro^~To&Eo,_t[36]=Oo^~Bo&Io,_t[37]=Mo^~Do&Po,_t[46]=Go^~Ko&Fo,_t[47]=qo^~Qo&Uo,_t[8]=sn^~En&It,_t[9]=xn^~on&St,_t[18]=xo^~Rn&An,_t[19]=vo^~vn&bn,_t[28]=_o^~bo&wo,_t[29]=To^~Eo&Co,_t[38]=Bo^~Io&Lo,_t[39]=Do^~Po&No,_t[48]=Ko^~Fo&zo,_t[49]=Qo^~Uo&Vo,_t[0]^=yt[en],_t[1]^=yt[en+1]};if(at)o.exports=Lt;else for(Qt=0;Qtot+MULTIADDR_LENGTH_SIZE+it.bytes.length,0),tt=new Uint8Array(et),nt=new DataView(tt.buffer);let rt=0;return o.forEach(ot=>{if(ot.getPeerId())throw new Error("`multiaddr` field MUST not contain peer id");nt.setUint16(rt,ot.bytes.length),rt+=MULTIADDR_LENGTH_SIZE,tt.set(ot.bytes,rt),rt+=ot.bytes.length}),tt}function encodeWaku2(o){let et=0;return o.lightPush&&(et+=1),et=et<<1,o.filter&&(et+=1),et=et<<1,o.store&&(et+=1),et=et<<1,o.relay&&(et+=1),et}function decodeWaku2(o){const et={relay:!1,store:!1,filter:!1,lightPush:!1};return o%2&&(et.relay=!0),o=o>>1,o%2&&(et.store=!0),o=o>>1,o%2&&(et.filter=!0),o=o>>1,o%2&&(et.lightPush=!0),et}class RawEnr extends Map{constructor(tt={},nt=BigInt(1),rt){super(Object.entries(tt));Ct(this,"seq");Ct(this,"signature");this.seq=nt,this.signature=rt}set(tt,nt){return this.signature=void 0,this.seq++,super.set(tt,nt)}get id(){const tt=this.get("id");if(!tt)throw new Error("id not found.");return bytesToUtf8(tt)}get publicKey(){switch(this.id){case"v4":return this.get("secp256k1");default:throw new Error(ERR_INVALID_ID)}}get rs(){const tt=this.get("rs");if(tt)return decodeRelayShard(tt)}get rsv(){const tt=this.get("rsv");if(tt)return decodeRelayShard(tt)}get ip(){return getStringValue(this,"ip","ip4")}set ip(tt){setStringValue(this,"ip","ip4",tt)}get tcp(){return getNumberAsStringValue(this,"tcp","tcp")}set tcp(tt){setNumberAsStringValue(this,"tcp","tcp",tt)}get udp(){return getNumberAsStringValue(this,"udp","udp")}set udp(tt){setNumberAsStringValue(this,"udp","udp",tt)}get ip6(){return getStringValue(this,"ip6","ip6")}set ip6(tt){setStringValue(this,"ip6","ip6",tt)}get tcp6(){return getNumberAsStringValue(this,"tcp6","tcp")}set tcp6(tt){setNumberAsStringValue(this,"tcp6","tcp",tt)}get udp6(){return getNumberAsStringValue(this,"udp6","udp")}set udp6(tt){setNumberAsStringValue(this,"udp6","udp",tt)}get multiaddrs(){const tt=this.get("multiaddrs");if(tt)return decodeMultiaddrs(tt)}set multiaddrs(tt){deleteUndefined(this,"multiaddrs",tt,encodeMultiaddrs)}get waku2(){const tt=this.get("waku2");if(tt)return decodeWaku2(tt[0])}set waku2(tt){deleteUndefined(this,"waku2",tt,nt=>new Uint8Array([encodeWaku2(nt)]))}}function getStringValue(o,et,tt){const nt=o.get(et);if(nt)return convertToString(tt,nt)}function getNumberAsStringValue(o,et,tt){const nt=o.get(et);if(nt)return Number(convertToString(tt,nt))}function setStringValue(o,et,tt,nt){deleteUndefined(o,et,nt,convertToBytes.bind({},tt))}function setNumberAsStringValue(o,et,tt,nt){setStringValue(o,et,tt,nt==null?void 0:nt.toString(10))}function deleteUndefined(o,et,tt,nt){tt!==void 0?o.set(et,nt(tt)):o.delete(et)}async function sign(o,et){return sign$1(keccak256(et),o,{der:!1})}function nodeId(o){const tt=Point.fromHex(o).toRawBytes(!1);return bytesToHex$1(keccak256(tt.slice(1)))}const log$9=new Logger$1("enr");var TransportProtocol;(function(o){o.TCP="tcp",o.UDP="udp"})(TransportProtocol||(TransportProtocol={}));var TransportProtocolPerIpVersion;(function(o){o.TCP4="tcp4",o.UDP4="udp4",o.TCP6="tcp6",o.UDP6="udp6"})(TransportProtocolPerIpVersion||(TransportProtocolPerIpVersion={}));const os=class os extends RawEnr{constructor(){super(...arguments);Ct(this,"peerId");Ct(this,"getLocationMultiaddr",locationMultiaddrFromEnrFields.bind({},this))}static create(tt={},nt=BigInt(1),rt){const ot=new os(tt,nt,rt);try{const it=ot.publicKey;it&&(ot.peerId=createPeerIdFromPublicKey(it))}catch(it){log$9.error("Could not calculate peer id for ENR",it)}return ot}get nodeId(){switch(this.id){case"v4":return this.publicKey?nodeId(this.publicKey):void 0;default:throw new Error(ERR_INVALID_ID)}}get shardInfo(){return this.rs&&this.rsv&&log$9.warn("ENR contains both `rs` and `rsv` fields."),this.rs||this.rsv}setLocationMultiaddr(tt){const nt=tt.protoNames();if(nt.length!==2&&nt[1]!=="udp"&&nt[1]!=="tcp")throw new Error("Invalid multiaddr");const rt=tt.tuples();if(!rt[0][1]||!rt[1][1])throw new Error("Invalid multiaddr");rt[0][0]===4?(this.set("ip",rt[0][1]),this.set(nt[1],rt[1][1])):(this.set("ip6",rt[0][1]),this.set(nt[1]+"6",rt[1][1]))}getAllLocationMultiaddrs(){const tt=[];for(const rt of Object.values(TransportProtocolPerIpVersion)){const ot=this.getLocationMultiaddr(rt);ot&&tt.push(ot)}const nt=this.multiaddrs??[];return tt.concat(nt).map(rt=>this.peerId?rt.encapsulate(`/p2p/${this.peerId.toString()}`):rt)}get peerInfo(){const tt=this.peerId;if(tt)return{id:tt,multiaddrs:this.getAllLocationMultiaddrs()}}getFullMultiaddr(tt){if(this.peerId){const nt=this.getLocationMultiaddr(tt);if(nt)return nt.encapsulate(`/p2p/${this.peerId.toString()}`)}}getFullMultiaddrs(){if(this.peerId&&this.multiaddrs){const tt=this.peerId;return this.multiaddrs.map(nt=>nt.encapsulate(`/p2p/${tt.toString()}`))}return[]}verify(tt,nt){if(!this.get("id")||this.id!=="v4")throw new Error(ERR_INVALID_ID);if(!this.publicKey)throw new Error("Failed to verify ENR: No public key");return verifySignature(nt,keccak256(tt),this.publicKey)}async sign(tt,nt){switch(this.id){case"v4":this.signature=await sign(nt,tt);break;default:throw new Error(ERR_INVALID_ID)}return this.signature}};Ct(os,"RECORD_PREFIX","enr:");let ENR=os;const version$2="logger/5.7.0";let _permanentCensorErrors=!1,_censorErrors=!1;const LogLevels={debug:1,default:2,info:2,warning:3,error:4,off:5};let _logLevel=LogLevels.default,_globalLogger=null;function _checkNormalize(){try{const o=[];if(["NFD","NFC","NFKD","NFKC"].forEach(et=>{try{if("test".normalize(et)!=="test")throw new Error("bad normalize")}catch{o.push(et)}}),o.length)throw new Error("missing "+o.join(", "));if("é".normalize("NFD")!=="é")throw new Error("broken implementation")}catch(o){return o.message}return null}const _normalizeError=_checkNormalize();var LogLevel;(function(o){o.DEBUG="DEBUG",o.INFO="INFO",o.WARNING="WARNING",o.ERROR="ERROR",o.OFF="OFF"})(LogLevel||(LogLevel={}));var ErrorCode;(function(o){o.UNKNOWN_ERROR="UNKNOWN_ERROR",o.NOT_IMPLEMENTED="NOT_IMPLEMENTED",o.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",o.NETWORK_ERROR="NETWORK_ERROR",o.SERVER_ERROR="SERVER_ERROR",o.TIMEOUT="TIMEOUT",o.BUFFER_OVERRUN="BUFFER_OVERRUN",o.NUMERIC_FAULT="NUMERIC_FAULT",o.MISSING_NEW="MISSING_NEW",o.INVALID_ARGUMENT="INVALID_ARGUMENT",o.MISSING_ARGUMENT="MISSING_ARGUMENT",o.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",o.CALL_EXCEPTION="CALL_EXCEPTION",o.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",o.NONCE_EXPIRED="NONCE_EXPIRED",o.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",o.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",o.TRANSACTION_REPLACED="TRANSACTION_REPLACED",o.ACTION_REJECTED="ACTION_REJECTED"})(ErrorCode||(ErrorCode={}));const HEX="0123456789abcdef";class Logger{constructor(et){Object.defineProperty(this,"version",{enumerable:!0,value:et,writable:!1})}_log(et,tt){const nt=et.toLowerCase();LogLevels[nt]==null&&this.throwArgumentError("invalid log level name","logLevel",et),!(_logLevel>LogLevels[nt])&&console.log.apply(console,tt)}debug(...et){this._log(Logger.levels.DEBUG,et)}info(...et){this._log(Logger.levels.INFO,et)}warn(...et){this._log(Logger.levels.WARNING,et)}makeError(et,tt,nt){if(_censorErrors)return this.makeError("censored error",tt,{});tt||(tt=Logger.errors.UNKNOWN_ERROR),nt||(nt={});const rt=[];Object.keys(nt).forEach(at=>{const ct=nt[at];try{if(ct instanceof Uint8Array){let lt="";for(let dt=0;dt>4],lt+=HEX[ct[dt]&15];rt.push(at+"=Uint8Array(0x"+lt+")")}else rt.push(at+"="+JSON.stringify(ct))}catch{rt.push(at+"="+JSON.stringify(nt[at].toString()))}}),rt.push(`code=${tt}`),rt.push(`version=${this.version}`);const ot=et;let it="";switch(tt){case ErrorCode.NUMERIC_FAULT:{it="NUMERIC_FAULT";const at=et;switch(at){case"overflow":case"underflow":case"division-by-zero":it+="-"+at;break;case"negative-power":case"negative-width":it+="-unsupported";break;case"unbound-bitwise-result":it+="-unbound-result";break}break}case ErrorCode.CALL_EXCEPTION:case ErrorCode.INSUFFICIENT_FUNDS:case ErrorCode.MISSING_NEW:case ErrorCode.NONCE_EXPIRED:case ErrorCode.REPLACEMENT_UNDERPRICED:case ErrorCode.TRANSACTION_REPLACED:case ErrorCode.UNPREDICTABLE_GAS_LIMIT:it=tt;break}it&&(et+=" [ See: https://links.ethers.org/v5-errors-"+it+" ]"),rt.length&&(et+=" ("+rt.join(", ")+")");const st=new Error(et);return st.reason=ot,st.code=tt,Object.keys(nt).forEach(function(at){st[at]=nt[at]}),st}throwError(et,tt,nt){throw this.makeError(et,tt,nt)}throwArgumentError(et,tt,nt){return this.throwError(et,Logger.errors.INVALID_ARGUMENT,{argument:tt,value:nt})}assert(et,tt,nt,rt){et||this.throwError(tt,nt,rt)}assertArgument(et,tt,nt,rt){et||this.throwArgumentError(tt,nt,rt)}checkNormalize(et){_normalizeError&&this.throwError("platform missing String.prototype.normalize",Logger.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:_normalizeError})}checkSafeUint53(et,tt){typeof et=="number"&&(tt==null&&(tt="value not safe"),(et<0||et>=9007199254740991)&&this.throwError(tt,Logger.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:et}),et%1&&this.throwError(tt,Logger.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:et}))}checkArgumentCount(et,tt,nt){nt?nt=": "+nt:nt="",ettt&&this.throwError("too many arguments"+nt,Logger.errors.UNEXPECTED_ARGUMENT,{count:et,expectedCount:tt})}checkNew(et,tt){(et===Object||et==null)&&this.throwError("missing new",Logger.errors.MISSING_NEW,{name:tt.name})}checkAbstract(et,tt){et===tt?this.throwError("cannot instantiate abstract class "+JSON.stringify(tt.name)+" directly; use a sub-class",Logger.errors.UNSUPPORTED_OPERATION,{name:et.name,operation:"new"}):(et===Object||et==null)&&this.throwError("missing new",Logger.errors.MISSING_NEW,{name:tt.name})}static globalLogger(){return _globalLogger||(_globalLogger=new Logger(version$2)),_globalLogger}static setCensorship(et,tt){if(!et&&tt&&this.globalLogger().throwError("cannot permanently disable censorship",Logger.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),_permanentCensorErrors){if(!et)return;this.globalLogger().throwError("error censorship permanent",Logger.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}_censorErrors=!!et,_permanentCensorErrors=!!tt}static setLogLevel(et){const tt=LogLevels[et.toLowerCase()];if(tt==null){Logger.globalLogger().warn("invalid log level - "+et);return}_logLevel=tt}static from(et){return new Logger(et)}}Logger.errors=ErrorCode;Logger.levels=LogLevel;const version$1="bytes/5.7.0",logger$1=new Logger(version$1);function isHexable(o){return!!o.toHexString}function addSlice(o){return o.slice||(o.slice=function(){const et=Array.prototype.slice.call(arguments);return addSlice(new Uint8Array(Array.prototype.slice.apply(o,et)))}),o}function isBytesLike(o){return isHexString(o)&&!(o.length%2)||isBytes(o)}function isInteger(o){return typeof o=="number"&&o==o&&o%1===0}function isBytes(o){if(o==null)return!1;if(o.constructor===Uint8Array)return!0;if(typeof o=="string"||!isInteger(o.length)||o.length<0)return!1;for(let et=0;et=256)return!1}return!0}function arrayify(o,et){if(et||(et={}),typeof o=="number"){logger$1.checkSafeUint53(o,"invalid arrayify value");const tt=[];for(;o;)tt.unshift(o&255),o=parseInt(String(o/256));return tt.length===0&&tt.push(0),addSlice(new Uint8Array(tt))}if(et.allowMissingPrefix&&typeof o=="string"&&o.substring(0,2)!=="0x"&&(o="0x"+o),isHexable(o)&&(o=o.toHexString()),isHexString(o)){let tt=o.substring(2);tt.length%2&&(et.hexPad==="left"?tt="0"+tt:et.hexPad==="right"?tt+="0":logger$1.throwArgumentError("hex data is odd-length","value",o));const nt=[];for(let rt=0;rt>4]+HexCharacters[rt&15]}return tt}return logger$1.throwArgumentError("invalid hexlify value","value",o)}const version="rlp/5.7.0",logger=new Logger(version);function arrayifyInteger(o){const et=[];for(;o;)et.unshift(o&255),o>>=8;return et}function unarrayifyInteger(o,et,tt){let nt=0;for(let rt=0;rtet+1+nt&&logger.throwError("child data too short",Logger.errors.BUFFER_OVERRUN,{})}return{consumed:1+nt,result:rt}}function _decode(o,et){if(o.length===0&&logger.throwError("data too short",Logger.errors.BUFFER_OVERRUN,{}),o[et]>=248){const tt=o[et]-247;et+1+tt>o.length&&logger.throwError("data short segment too short",Logger.errors.BUFFER_OVERRUN,{});const nt=unarrayifyInteger(o,et+1,tt);return et+1+tt+nt>o.length&&logger.throwError("data long segment too short",Logger.errors.BUFFER_OVERRUN,{}),_decodeChildren(o,et,et+1+tt,tt+nt)}else if(o[et]>=192){const tt=o[et]-192;return et+1+tt>o.length&&logger.throwError("data array too short",Logger.errors.BUFFER_OVERRUN,{}),_decodeChildren(o,et,et+1,tt)}else if(o[et]>=184){const tt=o[et]-183;et+1+tt>o.length&&logger.throwError("data array too short",Logger.errors.BUFFER_OVERRUN,{});const nt=unarrayifyInteger(o,et+1,tt);et+1+tt+nt>o.length&&logger.throwError("data array too short",Logger.errors.BUFFER_OVERRUN,{});const rt=hexlify(o.slice(et+1+tt,et+1+tt+nt));return{consumed:1+tt+nt,result:rt}}else if(o[et]>=128){const tt=o[et]-128;et+1+tt>o.length&&logger.throwError("data too short",Logger.errors.BUFFER_OVERRUN,{});const nt=hexlify(o.slice(et+1,et+1+tt));return{consumed:1+tt,result:nt}}return{consumed:1,result:hexlify(o[et])}}function decode$4(o){const et=arrayify(o),tt=_decode(et,0);return tt.consumed!==et.length&&logger.throwArgumentError("invalid rlp data","data",o),tt.result}const log$8=new Logger$1("enr:decoder");class EnrDecoder{static fromString(et){if(!et.startsWith(ENR.RECORD_PREFIX))throw new Error(`"string encoded ENR must start with '${ENR.RECORD_PREFIX}'`);return EnrDecoder.fromRLP(fromString(et.slice(4),"base64url"))}static fromRLP(et){const tt=decode$4(et).map(hexToBytes$1);return fromValues(tt)}}async function fromValues(o){const{signature:et,seq:tt,kvs:nt}=checkValues(o),rt={};for(let st=0;stv4Regex$1.test(o),encode(o,et,tt){tt=~~tt,et=et||new Uint8Array(tt+v4Size);const nt=o.length;let rt=0;for(let ot=0;oto.length>0&&v6Regex$1.test(o),encode(o,et,tt){tt=~~tt;let nt=tt+v6Size,rt=-1,ot=0,it=0,st=!0,at=!1;et=et||new Uint8Array(tt+v6Size);for(let ct=0;ct>8),tt=97?lt-=87:lt>=65?lt-=55:(lt-=48,it=it*10+lt),ot=(ot<<4)+lt)}if(st===!1)at===!0?(tt>8),tt=rt+2;ct--)et[ct]=et[ct-2];et[rt]=0,et[rt+1]=0,rt=tt}if(rt!==tt&&rt!==-1)for(tt>nt-2&&(tt=nt-2);nt>rt;)et[--nt]=ttrt?et[--tt]:0;else for(;tt=SURROGATE_B||(o.charCodeAt(ot)&64512)!==SURROGATE_B?et+=3:(nt=ot,et+=4)}}return et}function encode$1(o,et,tt){const nt=o.length;tt==null&&(tt=0),et===void 0&&(et=new Uint8Array(encodingLength$1(o)+tt));let rt=tt;for(let ot=0;ot>6,et[rt++]=128|it&63;else if((it&63488)!==SURROGATE_A)et[rt++]=224|(it&61440)>>12,et[rt++]=128|(it&4032)>>6,et[rt++]=128|it&63;else{const st=ot+1;if(st===nt||it>=SURROGATE_B)et[rt++]=239,et[rt++]=191,et[rt++]=189;else{const at=o.charCodeAt(st);(at&64512)!==SURROGATE_B?(et[rt++]=239,et[rt++]=191,et[rt++]=189):(ot=st,it=65536|(it&1023)<<10|at&1023,et[rt++]=240|(it&1835008)>>18,et[rt++]=128|(it&258048)>>12,et[rt++]=128|(it&4032)>>6,et[rt++]=128|it&63)}}}return encode$1.bytes=rt-tt,et}encode$1.bytes=0;function decode$2(o,et,tt){let nt="";et==null&&(et=0),tt==null&&(tt=o.length);for(let rt=et;rt191&&ot<224)it=(ot&31)<<6|o[rt++]&63;else if(ot>239&&ot<365){it=((ot&7)<<18|(o[rt++]&63)<<12|(o[rt++]&63)<<6|o[rt++]&63)-65536;const st=SURROGATE_A|it>>10&1023;nt+=String.fromCharCode(st),it=SURROGATE_B|it&1023}else it=(ot&15)<<12|(o[rt++]&63)<<6|o[rt++]&63;nt+=String.fromCharCode(it)}return decode$2.bytes=tt-et,nt}decode$2.bytes=0;const isU8Arr=o=>o instanceof Uint8Array;function bytelength(o){return typeof o=="string"?encodingLength$1(o):o.byteLength}function from(o){return o instanceof Uint8Array?o:Array.isArray(o)?new Uint8Array(o):encode$1(o)}function write(o,et,tt){if(typeof et!="string")throw new Error("unknown input type");return encode$1(et,o,tt),encode$1.bytes}const P_24=Math.pow(2,24),P_16=Math.pow(2,16),P_8=Math.pow(2,8),readUInt32BE=(o,et)=>o[et]*P_24+o[et+1]*P_16+o[et+2]*P_8+o[et+3],readUInt16BE=(o,et)=>o[et]<<8|o[et+1],writeUInt32BE=(o,et,tt)=>(et=+et,o[tt+3]=et,et=et>>>8,o[tt+2]=et,et=et>>>8,o[tt+1]=et,et=et>>>8,o[tt]=et,tt+4),writeUInt16BE=(o,et,tt)=>(o[tt]=et>>8,o[tt+1]=et&255,tt+2);function copy(o,et,tt,nt,rt){return tt<0&&(nt-=tt,tt=0),nt<0&&(nt=0),rt<0?new Uint8Array(0):tt>=et.length||nt>=rt?0:_copyActual(o,et,tt,nt,rt)}function _copyActual(o,et,tt,nt,rt){rt-nt>et.length-tt&&(rt=nt+et.length-tt);let ot=rt-nt;const it=o.length-nt;return ot>it&&(ot=it),(nt!==0||rto)}}const name$1=codec({encode(o,et,tt){et||(et=new Uint8Array(name$1.encodingLength(o))),tt||(tt=0);const nt=tt,rt=o.replace(/^\.|\.$/gm,"");if(rt.length){const ot=rt.split(".");for(let it=0;it=o.length)throw new Error("Cannot decode name (buffer overflow)");const st=o[et++];if(ot+=it?0:1,st===0)break;if(st&192)if((st&192)===192){if(et+1>o.length)throw new Error("Cannot decode name (buffer overflow)");const at=readUInt16BE(o,et-1)-49152;if(at>=nt)throw new Error("Cannot decode name (bad pointer)");et=at,nt=at,ot+=it?0:1,it=!0}else throw new Error("Cannot decode name (bad label)");else{if(et+st>o.length)throw new Error("Cannot decode name (buffer overflow)");if(rt+=st+1,rt>254)throw new Error("Cannot decode name (name too long)");tt.push(decode$2(o,et,et+st)),et+=st,ot+=it?0:st}}return name$1.decode.bytes=ot,tt.length===0?".":tt.join(".")},encodingLength(o){return o==="."||o===".."?1:bytelength(o.replace(/^\.|\.$/gm,""))+2}}),string$2=codec({encode(o,et,tt){et||(et=new Uint8Array(string$2.encodingLength(o))),tt||(tt=0);const nt=write(et,o,tt+1);return et[tt]=nt,string$2.encode.bytes=nt+1,et},decode(o,et){et||(et=0);const tt=o[et],nt=decode$2(o,et+1,et+1+tt);return string$2.decode.bytes=tt+1,nt},encodingLength(o){return bytelength(o)+1}}),header=codec({bytes:12,encode(o,et,tt){et||(et=new Uint8Array(header.encodingLength(o))),tt||(tt=0);const nt=(o.flags||0)&32767,rt=o.type==="response"?RESPONSE_FLAG:QUERY_FLAG;return writeUInt16BE(et,o.id||0,tt),writeUInt16BE(et,nt|rt,tt+2),writeUInt16BE(et,o.questions.length,tt+4),writeUInt16BE(et,o.answers.length,tt+6),writeUInt16BE(et,o.authorities.length,tt+8),writeUInt16BE(et,o.additionals.length,tt+10),et},decode(o,et){if(et||(et=0),o.length<12)throw new Error("Header must be 12 bytes");const tt=readUInt16BE(o,et+2);return{id:readUInt16BE(o,et),type:tt&RESPONSE_FLAG?"response":"query",flags:tt&32767,flag_qr:(tt>>15&1)===1,opcode:toString$4(tt>>11&15),flag_aa:(tt>>10&1)===1,flag_tc:(tt>>9&1)===1,flag_rd:(tt>>8&1)===1,flag_ra:(tt>>7&1)===1,flag_z:(tt>>6&1)===1,flag_ad:(tt>>5&1)===1,flag_cd:(tt>>4&1)===1,rcode:toString$5(tt&15),questions:new Array(readUInt16BE(o,et+4)),answers:new Array(readUInt16BE(o,et+6)),authorities:new Array(readUInt16BE(o,et+8)),additionals:new Array(readUInt16BE(o,et+10))}},encodingLength(){return 12}}),runknown=codec({encode(o,et,tt){et||(et=new Uint8Array(runknown.encodingLength(o))),tt||(tt=0);const nt=o.length;return writeUInt16BE(et,nt,tt),copy(o,et,tt+2,0,nt),runknown.encode.bytes=nt+2,et},decode(o,et){et||(et=0);const tt=readUInt16BE(o,et),nt=o.slice(et+2,et+2+tt);return runknown.decode.bytes=tt+2,nt},encodingLength(o){return o.length+2}}),rns=codec({encode(o,et,tt){return et||(et=new Uint8Array(rns.encodingLength(o))),tt||(tt=0),name$1.encode(o,et,tt+2),writeUInt16BE(et,name$1.encode.bytes,tt),rns.encode.bytes=name$1.encode.bytes+2,et},decode(o,et){et||(et=0);const tt=readUInt16BE(o,et),nt=name$1.decode(o,et+2);return rns.decode.bytes=tt+2,nt},encodingLength(o){return name$1.encodingLength(o)+2}}),rsoa=codec({encode(o,et,tt){et||(et=new Uint8Array(rsoa.encodingLength(o))),tt||(tt=0);const nt=tt;return tt+=2,name$1.encode(o.mname,et,tt),tt+=name$1.encode.bytes,name$1.encode(o.rname,et,tt),tt+=name$1.encode.bytes,writeUInt32BE(et,o.serial||0,tt),tt+=4,writeUInt32BE(et,o.refresh||0,tt),tt+=4,writeUInt32BE(et,o.retry||0,tt),tt+=4,writeUInt32BE(et,o.expire||0,tt),tt+=4,writeUInt32BE(et,o.minimum||0,tt),tt+=4,writeUInt16BE(et,tt-nt-2,nt),rsoa.encode.bytes=tt-nt,et},decode(o,et){et||(et=0);const tt=et,nt={};return et+=2,nt.mname=name$1.decode(o,et),et+=name$1.decode.bytes,nt.rname=name$1.decode(o,et),et+=name$1.decode.bytes,nt.serial=readUInt32BE(o,et),et+=4,nt.refresh=readUInt32BE(o,et),et+=4,nt.retry=readUInt32BE(o,et),et+=4,nt.expire=readUInt32BE(o,et),et+=4,nt.minimum=readUInt32BE(o,et),et+=4,rsoa.decode.bytes=et-tt,nt},encodingLength(o){return 22+name$1.encodingLength(o.mname)+name$1.encodingLength(o.rname)}}),rtxt=codec({encode(o,et,tt){Array.isArray(o)||(o=[o]);for(let rt=0;rt0;){const ot=o[et++];if(--nt,ntnew Uint8Array(o),roption=codec({encode(o,et,tt){et||(et=new Uint8Array(roption.encodingLength(o))),tt||(tt=0);const nt=tt,rt=toCode(o.code);if(writeUInt16BE(et,rt,tt),tt+=2,o.data)writeUInt16BE(et,o.data.length,tt),tt+=2,copy(o.data,et,tt),tt+=o.data.length;else switch(rt){case 8:{const ot=o.sourcePrefixLength||0,it=o.family||familyOf(o.ip),st=encode$2(o.ip,alloc),at=Math.ceil(ot/8);writeUInt16BE(et,at+4,tt),tt+=2,writeUInt16BE(et,it,tt),tt+=2,et[tt++]=ot,et[tt++]=o.scopePrefixLength||0,copy(st,et,tt,0,at),tt+=at}break;case 11:o.timeout?(writeUInt16BE(et,2,tt),tt+=2,writeUInt16BE(et,o.timeout,tt),tt+=2):(writeUInt16BE(et,0,tt),tt+=2);break;case 12:{const ot=o.length||0;writeUInt16BE(et,ot,tt),tt+=2,et.fill(0,tt,tt+ot),tt+=ot}break;case 14:{const ot=o.tags.length*2;writeUInt16BE(et,ot,tt),tt+=2;for(const it of o.tags)writeUInt16BE(et,it,tt),tt+=2}break;default:throw new Error(`Unknown roption code: ${o.code}`)}return roption.encode.bytes=tt-nt,et},decode(o,et){et||(et=0);const tt={};tt.code=readUInt16BE(o,et),tt.type=toString$2(tt.code),et+=2;const nt=readUInt16BE(o,et);switch(et+=2,tt.data=o.slice(et,et+nt),tt.code){case 8:tt.family=readUInt16BE(o,et),et+=2,tt.sourcePrefixLength=o[et++],tt.scopePrefixLength=o[et++];{const rt=new Uint8Array(tt.family===1?4:16);copy(o,rt,0,et,et+nt-4),tt.ip=decode$3(rt)}break;case 11:nt>0&&(tt.timeout=readUInt16BE(o,et),et+=2);break;case 14:tt.tags=[];for(let rt=0;rt0;)nt[ot++]=roption.decode(o,et),et+=roption.decode.bytes,rt-=roption.decode.bytes;return ropt.decode.bytes=et-tt,nt},encodingLength(o){return 2+encodingLengthList(o||[],roption)}}),rdnskey=codec({encode(o,et,tt){et||(et=new Uint8Array(rdnskey.encodingLength(o))),tt||(tt=0);const nt=tt,rt=o.key;if(!isU8Arr(rt))throw new Error("Key must be a Buffer");return tt+=2,writeUInt16BE(et,o.flags,tt),tt+=2,et[tt]=rdnskey.PROTOCOL_DNSSEC,tt+=1,et[tt]=o.algorithm,tt+=1,copy(rt,et,tt,0,rt.length),tt+=rt.length,rdnskey.encode.bytes=tt-nt,writeUInt16BE(et,rdnskey.encode.bytes-2,nt),et},decode(o,et){et||(et=0);const tt=et,nt={},rt=readUInt16BE(o,et);if(et+=2,nt.flags=readUInt16BE(o,et),et+=2,o[et]!==rdnskey.PROTOCOL_DNSSEC)throw new Error("Protocol must be 3");return et+=1,nt.algorithm=o[et],et+=1,nt.key=o.slice(et,tt+rt+2),et+=nt.key.length,rdnskey.decode.bytes=et-tt,nt},encodingLength(o){return 6+bytelength(o.key)}});rdnskey.PROTOCOL_DNSSEC=3;rdnskey.ZONE_KEY=128;rdnskey.SECURE_ENTRYPOINT=32768;const rrrsig=codec({encode(o,et,tt){et||(et=new Uint8Array(rrrsig.encodingLength(o))),tt||(tt=0);const nt=tt,rt=o.signature;if(!isU8Arr(rt))throw new Error("Signature must be a Buffer");return tt+=2,writeUInt16BE(et,toType(o.typeCovered),tt),tt+=2,et[tt]=o.algorithm,tt+=1,et[tt]=o.labels,tt+=1,writeUInt32BE(et,o.originalTTL,tt),tt+=4,writeUInt32BE(et,o.expiration,tt),tt+=4,writeUInt32BE(et,o.inception,tt),tt+=4,writeUInt16BE(et,o.keyTag,tt),tt+=2,name$1.encode(o.signersName,et,tt),tt+=name$1.encode.bytes,copy(rt,et,tt,0,rt.length),tt+=rt.length,rrrsig.encode.bytes=tt-nt,writeUInt16BE(et,rrrsig.encode.bytes-2,nt),et},decode(o,et){et||(et=0);const tt=et,nt={},rt=readUInt16BE(o,et);return et+=2,nt.typeCovered=toString$6(readUInt16BE(o,et)),et+=2,nt.algorithm=o[et],et+=1,nt.labels=o[et],et+=1,nt.originalTTL=readUInt32BE(o,et),et+=4,nt.expiration=readUInt32BE(o,et),et+=4,nt.inception=readUInt32BE(o,et),et+=4,nt.keyTag=readUInt16BE(o,et),et+=2,nt.signersName=name$1.decode(o,et),et+=name$1.decode.bytes,nt.signature=o.slice(et,tt+rt+2),et+=nt.signature.length,rrrsig.decode.bytes=et-tt,nt},encodingLength(o){return 20+name$1.encodingLength(o.signersName)+bytelength(o.signature)}}),rrp=codec({encode(o,et,tt){et||(et=new Uint8Array(rrp.encodingLength(o))),tt||(tt=0);const nt=tt;return tt+=2,name$1.encode(o.mbox||".",et,tt),tt+=name$1.encode.bytes,name$1.encode(o.txt||".",et,tt),tt+=name$1.encode.bytes,rrp.encode.bytes=tt-nt,writeUInt16BE(et,rrp.encode.bytes-2,nt),et},decode(o,et){et||(et=0);const tt=et,nt={};return et+=2,nt.mbox=name$1.decode(o,et)||".",et+=name$1.decode.bytes,nt.txt=name$1.decode(o,et)||".",et+=name$1.decode.bytes,rrp.decode.bytes=et-tt,nt},encodingLength(o){return 2+name$1.encodingLength(o.mbox||".")+name$1.encodingLength(o.txt||".")}}),typebitmap=codec({encode(o,et,tt){et||(et=new Uint8Array(typebitmap.encodingLength(o))),tt||(tt=0);const nt=tt,rt=[];for(let ot=0;ot>8]===void 0&&(rt[it>>8]=[]),rt[it>>8][it>>3&31]|=1<<7-(it&7)}for(let ot=0;ot>8]=Math.max(et[rt>>8]||0,rt&255)}let tt=0;for(let nt=0;nt>15&1)===1,tt.options=ropt.decode(o,et+8),et+=8+ropt.decode.bytes;else{const rt=readUInt16BE(o,et+2);tt.ttl=readUInt32BE(o,et+4),tt.class=toString$3(rt&NOT_FLUSH_MASK),tt.flush=!!(rt&FLUSH_MASK);const ot=renc(tt.type);tt.data=ot.decode(o,et+8),et+=8+ot.decode.bytes}return answer.decode.bytes=et-nt,tt},encodingLength(o){const et=o.data!==null&&o.data!==void 0?o.data:o.options;return name$1.encodingLength(o.name)+8+renc(o.type).encodingLength(et)}}),question=codec({encode(o,et,tt){et||(et=new Uint8Array(question.encodingLength(o))),tt||(tt=0);const nt=tt;return name$1.encode(o.name,et,tt),tt+=name$1.encode.bytes,writeUInt16BE(et,toType(o.type),tt),tt+=2,writeUInt16BE(et,toClass(o.class===void 0?"IN":o.class),tt),tt+=2,question.encode.bytes=tt-nt,o},decode(o,et){et||(et=0);const tt=et,nt={};return nt.name=name$1.decode(o,et),et+=name$1.decode.bytes,nt.type=toString$6(readUInt16BE(o,et)),et+=2,nt.class=toString$3(readUInt16BE(o,et)),et+=2,!!(nt.class&QU_MASK)&&(nt.class&=NOT_QU_MASK),question.decode.bytes=et-tt,nt},encodingLength(o){return name$1.encodingLength(o.name)+4}}),RECURSION_DESIRED=256,packet={encode:function(o,et,tt){const nt=!et;nt&&(et=new Uint8Array(encodingLength(o))),tt||(tt=0);const rt=tt;return o.questions||(o.questions=[]),o.answers||(o.answers=[]),o.authorities||(o.authorities=[]),o.additionals||(o.additionals=[]),header.encode(o,et,tt),tt+=header.encode.bytes,tt=encodeList(o.questions,question,et,tt),tt=encodeList(o.answers,answer,et,tt),tt=encodeList(o.authorities,answer,et,tt),tt=encodeList(o.additionals,answer,et,tt),packet.encode.bytes=tt-rt,nt&&encode.bytes!==et.length?et.slice(0,encode.bytes):et},decode:function(o,et){et||(et=0);const tt=et,nt=header.decode(o,et);return et+=header.decode.bytes,et=decodeList(nt.questions,question,o,et),et=decodeList(nt.answers,answer,o,et),et=decodeList(nt.authorities,answer,o,et),et=decodeList(nt.additionals,answer,o,et),packet.decode.bytes=et-tt,nt},encodingLength:function(o){return header.encodingLength(o)+encodingLengthList(o.questions||[],question)+encodingLengthList(o.answers||[],answer)+encodingLengthList(o.authorities||[],answer)+encodingLengthList(o.additionals||[],answer)}};packet.encode.bytes=0;packet.decode.bytes=0;const encode=packet.encode,decode$1=packet.decode,encodingLength=packet.encodingLength;function encodingLengthList(o,et){let tt=0;for(let nt=0;nt255)throw new Error(`Character #${at} in charset [code=${ct}, char=${et.charAt(at)}] is too high! (max=255)`);if(rt[ct]!==0)throw new Error(`Character [code=${ct}, char=${et.charAt(at)}] is more than once in the charset!`);rt[ct]=at,ot[at]=ct}const it=tt.charCodeAt(0),st={name:o,encodingLength(at){const ct=at.length,lt=ct*.75|0;return at.charCodeAt(ct-1)===it?at.charCodeAt(ct-2)===it?lt-2:lt-1:lt},encode(at,ct,lt){ct==null&&(ct=new Uint8Array(st.encodingLength(at))),lt==null&&(lt=0);let dt=at.length;at.charCodeAt(dt-1)===it&&(at.charCodeAt(dt-2)===it?dt-=2:dt-=1);const ht=dt%4,pt=dt-ht;let mt=lt,ft=0;for(;ft>16,ct[mt++]=yt>>8,ct[mt++]=yt,ft+=4}if(ht===3){const yt=rt[at.charCodeAt(ft)]<<10|rt[at.charCodeAt(ft+1)]<<4|rt[at.charCodeAt(ft+2)]>>2;ct[mt++]=yt>>8,ct[mt++]=yt}else ht===2&&(ct[mt++]=rt[at.charCodeAt(ft)]<<2|rt[at.charCodeAt(ft+1)]>>4);return st.encode.bytes=mt-lt,ct},decode(at,ct,lt){ct==null&&(ct=0),lt==null&&(lt=at.length);const dt=lt-ct,ht=dt%3,pt=ct+dt-ht,mt=[];for(let ft=ct;ft>18&63],ot[yt>>12&63],ot[yt>>6&63],ot[yt&63])}if(ht===2){const ft=(at[lt-2]<<8)+at[lt-1];mt.push(ot[ft>>10],ot[ft>>4&63],ot[ft<<2&63]),nt===PREFERS_PADDING&&mt.push(it)}else if(ht===1){const ft=at[lt-1];mt.push(ot[ft>>2],ot[ft<<4&63]),nt===PREFERS_PADDING&&mt.push(it,it)}return st.decode.bytes=dt,String.fromCharCode.apply(String,mt)}};return st}make("base64","ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/","=",PREFERS_PADDING);const base64URL=make("base64-url","ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_","=",PREFERS_NO_PADDING);let AbortError=typeof globalThis<"u"?globalThis.AbortError:typeof window<"u"?window.AbortError:null;AbortError||(AbortError=class extends Error{constructor(et="Request aborted."){super(et)}});AbortError.prototype.name="AbortError";AbortError.prototype.code="ABORT_ERR";const URL$1=typeof globalThis<"u"&&globalThis.URL||require("url").URL;class HTTPStatusError extends Error{constructor(et,tt,nt){super("status="+tt+" while requesting "+et+" ["+nt+"]"),this.uri=et,this.status=tt,this.method=nt}toJSON(){return{code:this.code,uri:this.uri,status:this.status,method:this.method,endpoint:this.endpoint}}}HTTPStatusError.prototype.name="HTTPStatusError";HTTPStatusError.prototype.code="HTTP_STATUS";class ResponseError extends Error{constructor(et,tt){super(et),this.cause=tt}toJSON(){return{message:this.message,endpoint:this.endpoint,code:this.code,cause:reduceError(this.cause)}}}ResponseError.prototype.name="ResponseError";ResponseError.prototype.code="RESPONSE_ERR";class TimeoutError extends Error{constructor(et){super("Timeout (t="+et+")."),this.timeout=et}toJSON(){return{code:this.code,endpoint:this.endpoint,timeout:this.timeout}}}TimeoutError.prototype.name="TimeoutError";TimeoutError.prototype.code="ETIMEOUT";const v4Regex=/^((\d{1,3}\.){3,3}\d{1,3})(:(\d{2,5}))?$/,v6Regex=/^((::)?(((\d{1,3}\.){3}(\d{1,3}){1})?([0-9a-f]){0,4}:{0,2}){1,8}(::)?)(:(\d{2,5}))?$/i;function reduceError(o){if(typeof o=="string")return{message:o};try{const tt=JSON.stringify(o);if(tt!=="{}")return JSON.parse(tt)}catch{}const et={message:String(o.message||o)};return o.code!==void 0&&(et.code=String(o.code)),et}const baseParts=/^(([a-z0-9]+:)\/\/)?([^/[\s:]+|\[[^\]]+\])?(:([^/\s]+))?(\/[^\s]*)?(.*)$/,httpFlags=/\[(post|get|((ipv4|ipv6|name)=([^\]]+)))\]/ig,updFlags=/\[(((pk|name)=([^\]]+)))\]/ig;function parseEndpoint(o){const et=baseParts.exec(o),tt=et[2]||"https:",nt=et[3],rt=et[5],ot=et[6],it=et[7];if(tt==="https:"||tt==="http:"){const st=parseFlags(it,httpFlags);return{name:st.name,protocol:tt,ipv4:st.ipv4,ipv6:st.ipv6,host:nt,port:rt,path:ot,method:st.post?"POST":"GET"}}if(tt==="udp:"||tt==="udp4:"||tt==="udp6:"){const st=parseFlags(it,updFlags),at=/^\[(.*)\]$/.exec(nt);if(at&&tt==="udp4:")throw new Error(`Endpoint parsing error: Cannot use ipv6 host with udp4: (endpoint=${o})`);if(!at&&tt==="udp6:")throw new Error(`Endpoint parsing error: Incorrectly formatted host for udp6: (endpoint=${o})`);return at?new UDP6Endpoint({protocol:"udp6:",ipv6:at[1],port:rt,pk:st.pk,name:st.name}):new UDP4Endpoint({protocol:"udp4:",ipv4:nt,port:rt,pk:st.pk,name:st.name})}throw new InvalidProtocolError(tt,o)}function parseFlags(o,et){et.lastIndex=0;const tt={};for(;;){const nt=et.exec(o);if(!nt)break;nt[2]?tt[nt[3].toLowerCase()]=nt[4]:tt[nt[1].toLowerCase()]=!0}return tt}class InvalidProtocolError extends Error{constructor(et,tt){super(`Invalid Endpoint: unsupported protocol "${et}" for endpoint: ${tt}, supported protocols: ${supportedProtocols.join(", ")}`),this.protocol=et,this.endpoint=tt}toJSON(){return{code:this.code,endpoint:this.endpoint,timeout:this.timeout}}}InvalidProtocolError.prototype.name="InvalidProtocolError";InvalidProtocolError.prototype.code="EPROTOCOL";const supportedProtocols=["http:","https:","udp4:","udp6:"];class BaseEndpoint{constructor(et,tt){this.name=et.name||null,this.protocol=et.protocol;const nt=typeof et.port=="string"?et.port=parseInt(et.port,10):et.port;if(nt==null)this.port=tt?this.protocol==="https:"?443:80:et.pk?443:53;else{if(typeof nt!="number"&&!isNaN(nt))throw new Error(`Invalid Endpoint: port "${et.port}" needs to be a number: ${JSON.stringify(et)}`);this.port=nt}}toJSON(){return this.toString()}}class UDPEndpoint extends BaseEndpoint{constructor(et){super(et,!1),this.pk=et.pk||null}toString(){const et=this.port!==(this.pk?443:53)?`:${this.port}`:"",tt=this.pk?` [pk=${this.pk}]`:"",nt=this.name?` [name=${this.name}]`:"";return`udp://${this.ipv4||`[${this.ipv6}]`}${et}${tt}${nt}`}}class UDP4Endpoint extends UDPEndpoint{constructor(et){if(super(Object.assign({protocol:"udp4:"},et)),!et.ipv4||typeof et.ipv4!="string")throw new Error(`Invalid Endpoint: .ipv4 "${et.ipv4}" needs to be set: ${JSON.stringify(et)}`);this.ipv4=et.ipv4}}class UDP6Endpoint extends UDPEndpoint{constructor(et){if(super(Object.assign({protocol:"udp6:"},et)),!et.ipv6||typeof et.ipv6!="string")throw new Error(`Invalid Endpoint: .ipv6 "${et.ipv6}" needs to be set: ${JSON.stringify(et)}`);this.ipv6=et.ipv6}}function safeHost(o){return v6Regex.test(o)&&!v4Regex.test(o)?`[${o}]`:o}class HTTPEndpoint extends BaseEndpoint{constructor(et){if(super(Object.assign({protocol:"https:"},et),!0),et.host||(et.ipv4&&(et.host=et.ipv4),et.ipv6&&(et.host=`[${et.ipv6}]`)),!et.host||typeof et.host!="string")throw new Error(`Invalid Endpoint: host "${et.path}" needs to be set: ${JSON.stringify(et)}`);if(this.host=et.host,this.path=et.path||"/dns-query",this.method=/^post$/i.test(et.method)?"POST":"GET",this.ipv4=et.ipv4,this.ipv6=et.ipv6,!this.ipv6){const nt=v6Regex.exec(this.host);nt&&(this.ipv6=nt[1])}this.ipv4||v4Regex.test(this.host)&&(this.ipv4=this.host);const tt=`${this.protocol}//${safeHost(this.host)}:${this.port}${this.path}`;try{this.url=new URL$1(tt)}catch(nt){throw new Error(nt.message+` [${tt}]`)}}toString(){const et=this.protocol==="https:"?"":"http://",tt=this.port!==(this.protocol==="https:"?443:80)?`:${this.port}`:"",nt=this.method!=="GET"?" [post]":"",rt=this.path==="/dns-query"?"":this.path,ot=this.name?` [name=${this.name}]`:"",it=this.ipv4&&this.ipv4!==this.host?` [ipv4=${this.ipv4}]`:"",st=this.ipv6&&this.ipv6!==this.host?` [ipv6=${this.ipv6}]`:"";return`${et}${safeHost(this.host)}${tt}${rt}${nt}${it}${st}${ot}`}}function toEndpoint(o){let et;if(typeof o=="string")et=parseEndpoint(o);else{if(typeof o!="object"||o===null||Array.isArray(o))throw new Error(`Can not convert ${o} to an endpoint`);if(o instanceof BaseEndpoint)return o;et=o}(et.protocol===null||et.protocol===void 0)&&(et.protocol="https:");const tt=et.protocol;if(tt==="udp4:")return new UDP4Endpoint(et);if(tt==="udp6:")return new UDP6Endpoint(et);if(tt==="https:"||tt==="http:")return new HTTPEndpoint(et);throw new InvalidProtocolError(tt,JSON.stringify(et))}const contentType="application/dns-message";function noop$1(){}function queryDns(){throw new Error('Only "doh" endpoints are supported in the browser')}async function loadJSON(o,et,tt,nt){const rt=et?et.localStoragePrefix+et.name:null;if(rt)try{const st=JSON.parse(localStorage.getItem(rt));if(st&&st.time>et.maxTime)return st}catch{}const{data:ot}=await requestRaw(o,"GET",null,tt,nt),it={time:Date.now(),data:JSON.parse(decode$2(ot))};if(rt)try{localStorage.setItem(rt,JSON.stringify(it))}catch{it.time=null}return it}function requestRaw(o,et,tt,nt,rt){return new Promise((ot,it)=>{const st=new URL$1(o);et==="GET"&&tt&&(st.search="?dns="+base64URL.decode(tt));const at=st.toString(),ct=new XMLHttpRequest;ct.open(et,at,!0),ct.setRequestHeader("Accept",contentType),et==="POST"&&ct.setRequestHeader("Content-Type",contentType),ct.responseType="arraybuffer",ct.timeout=nt,ct.ontimeout=lt,ct.onreadystatechange=ht,ct.onerror=mt,ct.onload=dt,et==="POST"?ct.send(tt):ct.send(),rt&&rt.addEventListener("abort",ft);function lt(){pt(new TimeoutError(nt));try{ct.abort()}catch{}}function dt(){if(ct.status!==200)pt(new HTTPStatusError(at,ct.status,et));else{let yt;if(typeof ct.response=="string")yt=encode$1(ct.response);else if(ct.response instanceof Uint8Array)yt=ct.response;else if(Array.isArray(ct.response)||ct.response instanceof ArrayBuffer)yt=new Uint8Array(ct.response);else throw new Error("Unprocessable response "+ct.response);pt(null,yt)}}function ht(){if(ct.readyState>1&&ct.status!==200&&ct.status!==0){pt(new HTTPStatusError(at,ct.status,et));try{ct.abort()}catch{}}}let pt=function(yt,gt){pt=noop$1,rt&&rt.removeEventListener("abort",ft),ot(yt?{error:yt,response:ct}:{data:gt,response:ct})};function mt(){pt(ct.status===200?new Error("Inexplicable XHR Error"):new HTTPStatusError(at,ct.status,et))}function ft(){pt(new AbortError);try{ct.abort()}catch{}}})}function request(o,et,tt,nt,rt){return requestRaw(o,et,tt,nt,rt)}function processResolvers$1(o){return o.filter(et=>et.cors||et.endpoint.cors)}const resolvers={data:[{name:"adfree.usableprivacy.net",endpoint:{protocol:"https:",host:"adfree.usableprivacy.net"},description:`Public updns DoH service with advertising, tracker and malware filters. + */(function(){var tt="input is invalid type",nt="finalize already called",rt=typeof window=="object",ot=rt?window:{};ot.JS_SHA3_NO_WINDOW&&(rt=!1);var it=!rt&&typeof self=="object",st=!ot.JS_SHA3_NO_NODE_JS&&typeof et=="object"&&et.versions&&et.versions.node;st?ot=globalThis:it&&(ot=self);for(var at=!ot.JS_SHA3_NO_COMMON_JS&&!0&&o.exports,ct=!ot.JS_SHA3_NO_ARRAY_BUFFER&&typeof ArrayBuffer<"u",lt="0123456789abcdef".split(""),dt=[31,7936,2031616,520093696],ht=[4,1024,262144,67108864],pt=[1,256,65536,16777216],mt=[6,1536,393216,100663296],ft=[0,8,16,24],yt=[1,0,32898,0,32906,2147483648,2147516416,2147483648,32907,0,2147483649,0,2147516545,2147483648,32777,2147483648,138,0,136,0,2147516425,0,2147483658,0,2147516555,0,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,2147483648,32778,0,2147483658,2147483648,2147516545,2147483648,32896,2147483648,2147483649,0,2147516424,2147483648],gt=[224,256,384,512],xt=[128,256],vt=["hex","buffer","arrayBuffer","array","digest"],bt={128:168,256:136},Et=ot.JS_SHA3_NO_NODE_JS||!Array.isArray?function(_t){return Object.prototype.toString.call(_t)==="[object Array]"}:Array.isArray,wt=ct&&(ot.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW||!ArrayBuffer.isView)?function(_t){return typeof _t=="object"&&_t.buffer&&_t.buffer.constructor===ArrayBuffer}:ArrayBuffer.isView,kt=function(_t){var Dt=typeof _t;if(Dt==="string")return[_t,!0];if(Dt!=="object"||_t===null)throw new Error(tt);if(ct&&_t.constructor===ArrayBuffer)return[new Uint8Array(_t),!1];if(!Et(_t)&&!wt(_t))throw new Error(tt);return[_t,!1]},It=function(_t){return kt(_t)[0].length===0},Rt=function(_t){for(var Dt=[],Vt=0;Vt<_t.length;++Vt)Dt[Vt]=_t[Vt];return Dt},Pt=function(_t,Dt,Vt){return function(en){return new Xt(_t,Dt,_t).update(en)[Vt]()}},jt=function(_t,Dt,Vt){return function(en,an){return new Xt(_t,Dt,an).update(en)[Vt]()}},Ot=function(_t,Dt,Vt){return function(en,an,dn,ln){return Lt["cshake"+_t].update(en,an,dn,ln)[Vt]()}},Bt=function(_t,Dt,Vt){return function(en,an,dn,ln){return Lt["kmac"+_t].update(en,an,dn,ln)[Vt]()}},zt=function(_t,Dt,Vt,en){for(var an=0;an>5,this.byteCount=this.blockCount<<2,this.outputBlocks=Vt>>5,this.extraBytes=(Vt&31)>>3;for(var en=0;en<50;++en)this.s[en]=0}Xt.prototype.update=function(_t){if(this.finalized)throw new Error(nt);var Dt=kt(_t);_t=Dt[0];for(var Vt=Dt[1],en=this.blocks,an=this.byteCount,dn=_t.length,ln=this.blockCount,pn=0,kn=this.s,mn,wn;pn>2]|=wn<>2]|=(192|wn>>6)<>2]|=(128|wn&63)<=57344?(en[mn>>2]|=(224|wn>>12)<>2]|=(128|wn>>6&63)<>2]|=(128|wn&63)<>2]|=(240|wn>>18)<>2]|=(128|wn>>12&63)<>2]|=(128|wn>>6&63)<>2]|=(128|wn&63)<>2]|=_t[pn]<=an){for(this.start=mn-an,this.block=en[ln],mn=0;mn>8,Vt=_t&255;Vt>0;)an.unshift(Vt),_t=_t>>8,Vt=_t&255,++en;return Dt?an.push(en):an.unshift(en),this.update(an),an.length},Xt.prototype.encodeString=function(_t){var Dt=kt(_t);_t=Dt[0];var Vt=Dt[1],en=0,an=_t.length;if(Vt)for(var dn=0;dn<_t.length;++dn){var ln=_t.charCodeAt(dn);ln<128?en+=1:ln<2048?en+=2:ln<55296||ln>=57344?en+=3:(ln=65536+((ln&1023)<<10|_t.charCodeAt(++dn)&1023),en+=4)}else en=an;return en+=this.encode(en*8),this.update(_t),en},Xt.prototype.bytepad=function(_t,Dt){for(var Vt=this.encode(Dt),en=0;en<_t.length;++en)Vt+=this.encodeString(_t[en]);var an=(Dt-Vt%Dt)%Dt,dn=[];return dn.length=an,this.update(dn),this},Xt.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var _t=this.blocks,Dt=this.lastByteIndex,Vt=this.blockCount,en=this.s;if(_t[Dt>>2]|=this.padding[Dt&3],this.lastByteIndex===this.byteCount)for(_t[0]=_t[Vt],Dt=1;Dt>4&15]+lt[pn&15]+lt[pn>>12&15]+lt[pn>>8&15]+lt[pn>>20&15]+lt[pn>>16&15]+lt[pn>>28&15]+lt[pn>>24&15];dn%_t===0&&(Dt=Rt(Dt),tn(Dt),an=0)}return en&&(pn=Dt[an],ln+=lt[pn>>4&15]+lt[pn&15],en>1&&(ln+=lt[pn>>12&15]+lt[pn>>8&15]),en>2&&(ln+=lt[pn>>20&15]+lt[pn>>16&15])),ln},Xt.prototype.arrayBuffer=function(){this.finalize();var _t=this.blockCount,Dt=this.s,Vt=this.outputBlocks,en=this.extraBytes,an=0,dn=0,ln=this.outputBits>>3,pn;en?pn=new ArrayBuffer(Vt+1<<2):pn=new ArrayBuffer(ln);for(var kn=new Uint32Array(pn);dn>8&255,ln[pn+2]=kn>>16&255,ln[pn+3]=kn>>24&255;dn%_t===0&&(Dt=Rt(Dt),tn(Dt))}return en&&(pn=dn<<2,kn=Dt[an],ln[pn]=kn&255,en>1&&(ln[pn+1]=kn>>8&255),en>2&&(ln[pn+2]=kn>>16&255)),ln};function Jt(_t,Dt,Vt){Xt.call(this,_t,Dt,Vt)}Jt.prototype=new Xt,Jt.prototype.finalize=function(){return this.encode(this.outputBits,!0),Xt.prototype.finalize.call(this)};var tn=function(_t){var Dt,Vt,en,an,dn,ln,pn,kn,mn,wn,Tn,Pn,yn,En,on,Tt,St,At,$t,Kt,rn,sn,xn,Rn,vn,An,bn,fo,mo,go,yo,xo,vo,bo,Eo,wo,Co,So,ko,Ao,Ro,_o,Io,To,Po,Lo,No,jo,$o,Oo,Mo,Bo,Do,Fo,Uo,zo,Vo,Ho,Wo,Go,qo,Ko,Qo;for(en=0;en<48;en+=2)an=_t[0]^_t[10]^_t[20]^_t[30]^_t[40],dn=_t[1]^_t[11]^_t[21]^_t[31]^_t[41],ln=_t[2]^_t[12]^_t[22]^_t[32]^_t[42],pn=_t[3]^_t[13]^_t[23]^_t[33]^_t[43],kn=_t[4]^_t[14]^_t[24]^_t[34]^_t[44],mn=_t[5]^_t[15]^_t[25]^_t[35]^_t[45],wn=_t[6]^_t[16]^_t[26]^_t[36]^_t[46],Tn=_t[7]^_t[17]^_t[27]^_t[37]^_t[47],Pn=_t[8]^_t[18]^_t[28]^_t[38]^_t[48],yn=_t[9]^_t[19]^_t[29]^_t[39]^_t[49],Dt=Pn^(ln<<1|pn>>>31),Vt=yn^(pn<<1|ln>>>31),_t[0]^=Dt,_t[1]^=Vt,_t[10]^=Dt,_t[11]^=Vt,_t[20]^=Dt,_t[21]^=Vt,_t[30]^=Dt,_t[31]^=Vt,_t[40]^=Dt,_t[41]^=Vt,Dt=an^(kn<<1|mn>>>31),Vt=dn^(mn<<1|kn>>>31),_t[2]^=Dt,_t[3]^=Vt,_t[12]^=Dt,_t[13]^=Vt,_t[22]^=Dt,_t[23]^=Vt,_t[32]^=Dt,_t[33]^=Vt,_t[42]^=Dt,_t[43]^=Vt,Dt=ln^(wn<<1|Tn>>>31),Vt=pn^(Tn<<1|wn>>>31),_t[4]^=Dt,_t[5]^=Vt,_t[14]^=Dt,_t[15]^=Vt,_t[24]^=Dt,_t[25]^=Vt,_t[34]^=Dt,_t[35]^=Vt,_t[44]^=Dt,_t[45]^=Vt,Dt=kn^(Pn<<1|yn>>>31),Vt=mn^(yn<<1|Pn>>>31),_t[6]^=Dt,_t[7]^=Vt,_t[16]^=Dt,_t[17]^=Vt,_t[26]^=Dt,_t[27]^=Vt,_t[36]^=Dt,_t[37]^=Vt,_t[46]^=Dt,_t[47]^=Vt,Dt=wn^(an<<1|dn>>>31),Vt=Tn^(dn<<1|an>>>31),_t[8]^=Dt,_t[9]^=Vt,_t[18]^=Dt,_t[19]^=Vt,_t[28]^=Dt,_t[29]^=Vt,_t[38]^=Dt,_t[39]^=Vt,_t[48]^=Dt,_t[49]^=Vt,En=_t[0],on=_t[1],Lo=_t[11]<<4|_t[10]>>>28,No=_t[10]<<4|_t[11]>>>28,fo=_t[20]<<3|_t[21]>>>29,mo=_t[21]<<3|_t[20]>>>29,Go=_t[31]<<9|_t[30]>>>23,qo=_t[30]<<9|_t[31]>>>23,_o=_t[40]<<18|_t[41]>>>14,Io=_t[41]<<18|_t[40]>>>14,bo=_t[2]<<1|_t[3]>>>31,Eo=_t[3]<<1|_t[2]>>>31,Tt=_t[13]<<12|_t[12]>>>20,St=_t[12]<<12|_t[13]>>>20,jo=_t[22]<<10|_t[23]>>>22,$o=_t[23]<<10|_t[22]>>>22,go=_t[33]<<13|_t[32]>>>19,yo=_t[32]<<13|_t[33]>>>19,Ko=_t[42]<<2|_t[43]>>>30,Qo=_t[43]<<2|_t[42]>>>30,Fo=_t[5]<<30|_t[4]>>>2,Uo=_t[4]<<30|_t[5]>>>2,wo=_t[14]<<6|_t[15]>>>26,Co=_t[15]<<6|_t[14]>>>26,At=_t[25]<<11|_t[24]>>>21,$t=_t[24]<<11|_t[25]>>>21,Oo=_t[34]<<15|_t[35]>>>17,Mo=_t[35]<<15|_t[34]>>>17,xo=_t[45]<<29|_t[44]>>>3,vo=_t[44]<<29|_t[45]>>>3,Rn=_t[6]<<28|_t[7]>>>4,vn=_t[7]<<28|_t[6]>>>4,zo=_t[17]<<23|_t[16]>>>9,Vo=_t[16]<<23|_t[17]>>>9,So=_t[26]<<25|_t[27]>>>7,ko=_t[27]<<25|_t[26]>>>7,Kt=_t[36]<<21|_t[37]>>>11,rn=_t[37]<<21|_t[36]>>>11,Bo=_t[47]<<24|_t[46]>>>8,Do=_t[46]<<24|_t[47]>>>8,To=_t[8]<<27|_t[9]>>>5,Po=_t[9]<<27|_t[8]>>>5,An=_t[18]<<20|_t[19]>>>12,bn=_t[19]<<20|_t[18]>>>12,Ho=_t[29]<<7|_t[28]>>>25,Wo=_t[28]<<7|_t[29]>>>25,Ao=_t[38]<<8|_t[39]>>>24,Ro=_t[39]<<8|_t[38]>>>24,sn=_t[48]<<14|_t[49]>>>18,xn=_t[49]<<14|_t[48]>>>18,_t[0]=En^~Tt&At,_t[1]=on^~St&$t,_t[10]=Rn^~An&fo,_t[11]=vn^~bn&mo,_t[20]=bo^~wo&So,_t[21]=Eo^~Co&ko,_t[30]=To^~Lo&jo,_t[31]=Po^~No&$o,_t[40]=Fo^~zo&Ho,_t[41]=Uo^~Vo&Wo,_t[2]=Tt^~At&Kt,_t[3]=St^~$t&rn,_t[12]=An^~fo&go,_t[13]=bn^~mo&yo,_t[22]=wo^~So&Ao,_t[23]=Co^~ko&Ro,_t[32]=Lo^~jo&Oo,_t[33]=No^~$o&Mo,_t[42]=zo^~Ho&Go,_t[43]=Vo^~Wo&qo,_t[4]=At^~Kt&sn,_t[5]=$t^~rn&xn,_t[14]=fo^~go&xo,_t[15]=mo^~yo&vo,_t[24]=So^~Ao&_o,_t[25]=ko^~Ro&Io,_t[34]=jo^~Oo&Bo,_t[35]=$o^~Mo&Do,_t[44]=Ho^~Go&Ko,_t[45]=Wo^~qo&Qo,_t[6]=Kt^~sn&En,_t[7]=rn^~xn&on,_t[16]=go^~xo&Rn,_t[17]=yo^~vo&vn,_t[26]=Ao^~_o&bo,_t[27]=Ro^~Io&Eo,_t[36]=Oo^~Bo&To,_t[37]=Mo^~Do&Po,_t[46]=Go^~Ko&Fo,_t[47]=qo^~Qo&Uo,_t[8]=sn^~En&Tt,_t[9]=xn^~on&St,_t[18]=xo^~Rn&An,_t[19]=vo^~vn&bn,_t[28]=_o^~bo&wo,_t[29]=Io^~Eo&Co,_t[38]=Bo^~To&Lo,_t[39]=Do^~Po&No,_t[48]=Ko^~Fo&zo,_t[49]=Qo^~Uo&Vo,_t[0]^=yt[en],_t[1]^=yt[en+1]};if(at)o.exports=Lt;else for(Qt=0;Qtot+MULTIADDR_LENGTH_SIZE+it.bytes.length,0),tt=new Uint8Array(et),nt=new DataView(tt.buffer);let rt=0;return o.forEach(ot=>{if(ot.getPeerId())throw new Error("`multiaddr` field MUST not contain peer id");nt.setUint16(rt,ot.bytes.length),rt+=MULTIADDR_LENGTH_SIZE,tt.set(ot.bytes,rt),rt+=ot.bytes.length}),tt}function encodeWaku2(o){let et=0;return o.lightPush&&(et+=1),et=et<<1,o.filter&&(et+=1),et=et<<1,o.store&&(et+=1),et=et<<1,o.relay&&(et+=1),et}function decodeWaku2(o){const et={relay:!1,store:!1,filter:!1,lightPush:!1};return o%2&&(et.relay=!0),o=o>>1,o%2&&(et.store=!0),o=o>>1,o%2&&(et.filter=!0),o=o>>1,o%2&&(et.lightPush=!0),et}class RawEnr extends Map{constructor(tt={},nt=BigInt(1),rt){super(Object.entries(tt));Ct(this,"seq");Ct(this,"signature");this.seq=nt,this.signature=rt}set(tt,nt){return this.signature=void 0,this.seq++,super.set(tt,nt)}get id(){const tt=this.get("id");if(!tt)throw new Error("id not found.");return bytesToUtf8(tt)}get publicKey(){switch(this.id){case"v4":return this.get("secp256k1");default:throw new Error(ERR_INVALID_ID)}}get rs(){const tt=this.get("rs");if(tt)return decodeRelayShard(tt)}get rsv(){const tt=this.get("rsv");if(tt)return decodeRelayShard(tt)}get ip(){return getStringValue(this,"ip","ip4")}set ip(tt){setStringValue(this,"ip","ip4",tt)}get tcp(){return getNumberAsStringValue(this,"tcp","tcp")}set tcp(tt){setNumberAsStringValue(this,"tcp","tcp",tt)}get udp(){return getNumberAsStringValue(this,"udp","udp")}set udp(tt){setNumberAsStringValue(this,"udp","udp",tt)}get ip6(){return getStringValue(this,"ip6","ip6")}set ip6(tt){setStringValue(this,"ip6","ip6",tt)}get tcp6(){return getNumberAsStringValue(this,"tcp6","tcp")}set tcp6(tt){setNumberAsStringValue(this,"tcp6","tcp",tt)}get udp6(){return getNumberAsStringValue(this,"udp6","udp")}set udp6(tt){setNumberAsStringValue(this,"udp6","udp",tt)}get multiaddrs(){const tt=this.get("multiaddrs");if(tt)return decodeMultiaddrs(tt)}set multiaddrs(tt){deleteUndefined(this,"multiaddrs",tt,encodeMultiaddrs)}get waku2(){const tt=this.get("waku2");if(tt)return decodeWaku2(tt[0])}set waku2(tt){deleteUndefined(this,"waku2",tt,nt=>new Uint8Array([encodeWaku2(nt)]))}}function getStringValue(o,et,tt){const nt=o.get(et);if(nt)return convertToString(tt,nt)}function getNumberAsStringValue(o,et,tt){const nt=o.get(et);if(nt)return Number(convertToString(tt,nt))}function setStringValue(o,et,tt,nt){deleteUndefined(o,et,nt,convertToBytes.bind({},tt))}function setNumberAsStringValue(o,et,tt,nt){setStringValue(o,et,tt,nt==null?void 0:nt.toString(10))}function deleteUndefined(o,et,tt,nt){tt!==void 0?o.set(et,nt(tt)):o.delete(et)}async function sign(o,et){return sign$1(keccak256(et),o,{der:!1})}function nodeId(o){const tt=Point.fromHex(o).toRawBytes(!1);return bytesToHex$1(keccak256(tt.slice(1)))}const log$9=new Logger$1("enr");var TransportProtocol;(function(o){o.TCP="tcp",o.UDP="udp"})(TransportProtocol||(TransportProtocol={}));var TransportProtocolPerIpVersion;(function(o){o.TCP4="tcp4",o.UDP4="udp4",o.TCP6="tcp6",o.UDP6="udp6"})(TransportProtocolPerIpVersion||(TransportProtocolPerIpVersion={}));const os=class os extends RawEnr{constructor(){super(...arguments);Ct(this,"peerId");Ct(this,"getLocationMultiaddr",locationMultiaddrFromEnrFields.bind({},this))}static create(tt={},nt=BigInt(1),rt){const ot=new os(tt,nt,rt);try{const it=ot.publicKey;it&&(ot.peerId=createPeerIdFromPublicKey(it))}catch(it){log$9.error("Could not calculate peer id for ENR",it)}return ot}get nodeId(){switch(this.id){case"v4":return this.publicKey?nodeId(this.publicKey):void 0;default:throw new Error(ERR_INVALID_ID)}}get shardInfo(){return this.rs&&this.rsv&&log$9.warn("ENR contains both `rs` and `rsv` fields."),this.rs||this.rsv}setLocationMultiaddr(tt){const nt=tt.protoNames();if(nt.length!==2&&nt[1]!=="udp"&&nt[1]!=="tcp")throw new Error("Invalid multiaddr");const rt=tt.tuples();if(!rt[0][1]||!rt[1][1])throw new Error("Invalid multiaddr");rt[0][0]===4?(this.set("ip",rt[0][1]),this.set(nt[1],rt[1][1])):(this.set("ip6",rt[0][1]),this.set(nt[1]+"6",rt[1][1]))}getAllLocationMultiaddrs(){const tt=[];for(const rt of Object.values(TransportProtocolPerIpVersion)){const ot=this.getLocationMultiaddr(rt);ot&&tt.push(ot)}const nt=this.multiaddrs??[];return tt.concat(nt).map(rt=>this.peerId?rt.encapsulate(`/p2p/${this.peerId.toString()}`):rt)}get peerInfo(){const tt=this.peerId;if(tt)return{id:tt,multiaddrs:this.getAllLocationMultiaddrs()}}getFullMultiaddr(tt){if(this.peerId){const nt=this.getLocationMultiaddr(tt);if(nt)return nt.encapsulate(`/p2p/${this.peerId.toString()}`)}}getFullMultiaddrs(){if(this.peerId&&this.multiaddrs){const tt=this.peerId;return this.multiaddrs.map(nt=>nt.encapsulate(`/p2p/${tt.toString()}`))}return[]}verify(tt,nt){if(!this.get("id")||this.id!=="v4")throw new Error(ERR_INVALID_ID);if(!this.publicKey)throw new Error("Failed to verify ENR: No public key");return verifySignature(nt,keccak256(tt),this.publicKey)}async sign(tt,nt){switch(this.id){case"v4":this.signature=await sign(nt,tt);break;default:throw new Error(ERR_INVALID_ID)}return this.signature}};Ct(os,"RECORD_PREFIX","enr:");let ENR=os;const version$2="logger/5.7.0";let _permanentCensorErrors=!1,_censorErrors=!1;const LogLevels={debug:1,default:2,info:2,warning:3,error:4,off:5};let _logLevel=LogLevels.default,_globalLogger=null;function _checkNormalize(){try{const o=[];if(["NFD","NFC","NFKD","NFKC"].forEach(et=>{try{if("test".normalize(et)!=="test")throw new Error("bad normalize")}catch{o.push(et)}}),o.length)throw new Error("missing "+o.join(", "));if("é".normalize("NFD")!=="é")throw new Error("broken implementation")}catch(o){return o.message}return null}const _normalizeError=_checkNormalize();var LogLevel;(function(o){o.DEBUG="DEBUG",o.INFO="INFO",o.WARNING="WARNING",o.ERROR="ERROR",o.OFF="OFF"})(LogLevel||(LogLevel={}));var ErrorCode;(function(o){o.UNKNOWN_ERROR="UNKNOWN_ERROR",o.NOT_IMPLEMENTED="NOT_IMPLEMENTED",o.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",o.NETWORK_ERROR="NETWORK_ERROR",o.SERVER_ERROR="SERVER_ERROR",o.TIMEOUT="TIMEOUT",o.BUFFER_OVERRUN="BUFFER_OVERRUN",o.NUMERIC_FAULT="NUMERIC_FAULT",o.MISSING_NEW="MISSING_NEW",o.INVALID_ARGUMENT="INVALID_ARGUMENT",o.MISSING_ARGUMENT="MISSING_ARGUMENT",o.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",o.CALL_EXCEPTION="CALL_EXCEPTION",o.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",o.NONCE_EXPIRED="NONCE_EXPIRED",o.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",o.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",o.TRANSACTION_REPLACED="TRANSACTION_REPLACED",o.ACTION_REJECTED="ACTION_REJECTED"})(ErrorCode||(ErrorCode={}));const HEX="0123456789abcdef";class Logger{constructor(et){Object.defineProperty(this,"version",{enumerable:!0,value:et,writable:!1})}_log(et,tt){const nt=et.toLowerCase();LogLevels[nt]==null&&this.throwArgumentError("invalid log level name","logLevel",et),!(_logLevel>LogLevels[nt])&&console.log.apply(console,tt)}debug(...et){this._log(Logger.levels.DEBUG,et)}info(...et){this._log(Logger.levels.INFO,et)}warn(...et){this._log(Logger.levels.WARNING,et)}makeError(et,tt,nt){if(_censorErrors)return this.makeError("censored error",tt,{});tt||(tt=Logger.errors.UNKNOWN_ERROR),nt||(nt={});const rt=[];Object.keys(nt).forEach(at=>{const ct=nt[at];try{if(ct instanceof Uint8Array){let lt="";for(let dt=0;dt>4],lt+=HEX[ct[dt]&15];rt.push(at+"=Uint8Array(0x"+lt+")")}else rt.push(at+"="+JSON.stringify(ct))}catch{rt.push(at+"="+JSON.stringify(nt[at].toString()))}}),rt.push(`code=${tt}`),rt.push(`version=${this.version}`);const ot=et;let it="";switch(tt){case ErrorCode.NUMERIC_FAULT:{it="NUMERIC_FAULT";const at=et;switch(at){case"overflow":case"underflow":case"division-by-zero":it+="-"+at;break;case"negative-power":case"negative-width":it+="-unsupported";break;case"unbound-bitwise-result":it+="-unbound-result";break}break}case ErrorCode.CALL_EXCEPTION:case ErrorCode.INSUFFICIENT_FUNDS:case ErrorCode.MISSING_NEW:case ErrorCode.NONCE_EXPIRED:case ErrorCode.REPLACEMENT_UNDERPRICED:case ErrorCode.TRANSACTION_REPLACED:case ErrorCode.UNPREDICTABLE_GAS_LIMIT:it=tt;break}it&&(et+=" [ See: https://links.ethers.org/v5-errors-"+it+" ]"),rt.length&&(et+=" ("+rt.join(", ")+")");const st=new Error(et);return st.reason=ot,st.code=tt,Object.keys(nt).forEach(function(at){st[at]=nt[at]}),st}throwError(et,tt,nt){throw this.makeError(et,tt,nt)}throwArgumentError(et,tt,nt){return this.throwError(et,Logger.errors.INVALID_ARGUMENT,{argument:tt,value:nt})}assert(et,tt,nt,rt){et||this.throwError(tt,nt,rt)}assertArgument(et,tt,nt,rt){et||this.throwArgumentError(tt,nt,rt)}checkNormalize(et){_normalizeError&&this.throwError("platform missing String.prototype.normalize",Logger.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:_normalizeError})}checkSafeUint53(et,tt){typeof et=="number"&&(tt==null&&(tt="value not safe"),(et<0||et>=9007199254740991)&&this.throwError(tt,Logger.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:et}),et%1&&this.throwError(tt,Logger.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:et}))}checkArgumentCount(et,tt,nt){nt?nt=": "+nt:nt="",ettt&&this.throwError("too many arguments"+nt,Logger.errors.UNEXPECTED_ARGUMENT,{count:et,expectedCount:tt})}checkNew(et,tt){(et===Object||et==null)&&this.throwError("missing new",Logger.errors.MISSING_NEW,{name:tt.name})}checkAbstract(et,tt){et===tt?this.throwError("cannot instantiate abstract class "+JSON.stringify(tt.name)+" directly; use a sub-class",Logger.errors.UNSUPPORTED_OPERATION,{name:et.name,operation:"new"}):(et===Object||et==null)&&this.throwError("missing new",Logger.errors.MISSING_NEW,{name:tt.name})}static globalLogger(){return _globalLogger||(_globalLogger=new Logger(version$2)),_globalLogger}static setCensorship(et,tt){if(!et&&tt&&this.globalLogger().throwError("cannot permanently disable censorship",Logger.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),_permanentCensorErrors){if(!et)return;this.globalLogger().throwError("error censorship permanent",Logger.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}_censorErrors=!!et,_permanentCensorErrors=!!tt}static setLogLevel(et){const tt=LogLevels[et.toLowerCase()];if(tt==null){Logger.globalLogger().warn("invalid log level - "+et);return}_logLevel=tt}static from(et){return new Logger(et)}}Logger.errors=ErrorCode;Logger.levels=LogLevel;const version$1="bytes/5.7.0",logger$1=new Logger(version$1);function isHexable(o){return!!o.toHexString}function addSlice(o){return o.slice||(o.slice=function(){const et=Array.prototype.slice.call(arguments);return addSlice(new Uint8Array(Array.prototype.slice.apply(o,et)))}),o}function isBytesLike(o){return isHexString(o)&&!(o.length%2)||isBytes(o)}function isInteger(o){return typeof o=="number"&&o==o&&o%1===0}function isBytes(o){if(o==null)return!1;if(o.constructor===Uint8Array)return!0;if(typeof o=="string"||!isInteger(o.length)||o.length<0)return!1;for(let et=0;et=256)return!1}return!0}function arrayify(o,et){if(et||(et={}),typeof o=="number"){logger$1.checkSafeUint53(o,"invalid arrayify value");const tt=[];for(;o;)tt.unshift(o&255),o=parseInt(String(o/256));return tt.length===0&&tt.push(0),addSlice(new Uint8Array(tt))}if(et.allowMissingPrefix&&typeof o=="string"&&o.substring(0,2)!=="0x"&&(o="0x"+o),isHexable(o)&&(o=o.toHexString()),isHexString(o)){let tt=o.substring(2);tt.length%2&&(et.hexPad==="left"?tt="0"+tt:et.hexPad==="right"?tt+="0":logger$1.throwArgumentError("hex data is odd-length","value",o));const nt=[];for(let rt=0;rt>4]+HexCharacters[rt&15]}return tt}return logger$1.throwArgumentError("invalid hexlify value","value",o)}const version="rlp/5.7.0",logger=new Logger(version);function arrayifyInteger(o){const et=[];for(;o;)et.unshift(o&255),o>>=8;return et}function unarrayifyInteger(o,et,tt){let nt=0;for(let rt=0;rtet+1+nt&&logger.throwError("child data too short",Logger.errors.BUFFER_OVERRUN,{})}return{consumed:1+nt,result:rt}}function _decode(o,et){if(o.length===0&&logger.throwError("data too short",Logger.errors.BUFFER_OVERRUN,{}),o[et]>=248){const tt=o[et]-247;et+1+tt>o.length&&logger.throwError("data short segment too short",Logger.errors.BUFFER_OVERRUN,{});const nt=unarrayifyInteger(o,et+1,tt);return et+1+tt+nt>o.length&&logger.throwError("data long segment too short",Logger.errors.BUFFER_OVERRUN,{}),_decodeChildren(o,et,et+1+tt,tt+nt)}else if(o[et]>=192){const tt=o[et]-192;return et+1+tt>o.length&&logger.throwError("data array too short",Logger.errors.BUFFER_OVERRUN,{}),_decodeChildren(o,et,et+1,tt)}else if(o[et]>=184){const tt=o[et]-183;et+1+tt>o.length&&logger.throwError("data array too short",Logger.errors.BUFFER_OVERRUN,{});const nt=unarrayifyInteger(o,et+1,tt);et+1+tt+nt>o.length&&logger.throwError("data array too short",Logger.errors.BUFFER_OVERRUN,{});const rt=hexlify(o.slice(et+1+tt,et+1+tt+nt));return{consumed:1+tt+nt,result:rt}}else if(o[et]>=128){const tt=o[et]-128;et+1+tt>o.length&&logger.throwError("data too short",Logger.errors.BUFFER_OVERRUN,{});const nt=hexlify(o.slice(et+1,et+1+tt));return{consumed:1+tt,result:nt}}return{consumed:1,result:hexlify(o[et])}}function decode$4(o){const et=arrayify(o),tt=_decode(et,0);return tt.consumed!==et.length&&logger.throwArgumentError("invalid rlp data","data",o),tt.result}const log$8=new Logger$1("enr:decoder");class EnrDecoder{static fromString(et){if(!et.startsWith(ENR.RECORD_PREFIX))throw new Error(`"string encoded ENR must start with '${ENR.RECORD_PREFIX}'`);return EnrDecoder.fromRLP(fromString(et.slice(4),"base64url"))}static fromRLP(et){const tt=decode$4(et).map(hexToBytes$1);return fromValues(tt)}}async function fromValues(o){const{signature:et,seq:tt,kvs:nt}=checkValues(o),rt={};for(let st=0;stv4Regex$1.test(o),encode(o,et,tt){tt=~~tt,et=et||new Uint8Array(tt+v4Size);const nt=o.length;let rt=0;for(let ot=0;oto.length>0&&v6Regex$1.test(o),encode(o,et,tt){tt=~~tt;let nt=tt+v6Size,rt=-1,ot=0,it=0,st=!0,at=!1;et=et||new Uint8Array(tt+v6Size);for(let ct=0;ct>8),tt=97?lt-=87:lt>=65?lt-=55:(lt-=48,it=it*10+lt),ot=(ot<<4)+lt)}if(st===!1)at===!0?(tt>8),tt=rt+2;ct--)et[ct]=et[ct-2];et[rt]=0,et[rt+1]=0,rt=tt}if(rt!==tt&&rt!==-1)for(tt>nt-2&&(tt=nt-2);nt>rt;)et[--nt]=ttrt?et[--tt]:0;else for(;tt=SURROGATE_B||(o.charCodeAt(ot)&64512)!==SURROGATE_B?et+=3:(nt=ot,et+=4)}}return et}function encode$1(o,et,tt){const nt=o.length;tt==null&&(tt=0),et===void 0&&(et=new Uint8Array(encodingLength$1(o)+tt));let rt=tt;for(let ot=0;ot>6,et[rt++]=128|it&63;else if((it&63488)!==SURROGATE_A)et[rt++]=224|(it&61440)>>12,et[rt++]=128|(it&4032)>>6,et[rt++]=128|it&63;else{const st=ot+1;if(st===nt||it>=SURROGATE_B)et[rt++]=239,et[rt++]=191,et[rt++]=189;else{const at=o.charCodeAt(st);(at&64512)!==SURROGATE_B?(et[rt++]=239,et[rt++]=191,et[rt++]=189):(ot=st,it=65536|(it&1023)<<10|at&1023,et[rt++]=240|(it&1835008)>>18,et[rt++]=128|(it&258048)>>12,et[rt++]=128|(it&4032)>>6,et[rt++]=128|it&63)}}}return encode$1.bytes=rt-tt,et}encode$1.bytes=0;function decode$2(o,et,tt){let nt="";et==null&&(et=0),tt==null&&(tt=o.length);for(let rt=et;rt191&&ot<224)it=(ot&31)<<6|o[rt++]&63;else if(ot>239&&ot<365){it=((ot&7)<<18|(o[rt++]&63)<<12|(o[rt++]&63)<<6|o[rt++]&63)-65536;const st=SURROGATE_A|it>>10&1023;nt+=String.fromCharCode(st),it=SURROGATE_B|it&1023}else it=(ot&15)<<12|(o[rt++]&63)<<6|o[rt++]&63;nt+=String.fromCharCode(it)}return decode$2.bytes=tt-et,nt}decode$2.bytes=0;const isU8Arr=o=>o instanceof Uint8Array;function bytelength(o){return typeof o=="string"?encodingLength$1(o):o.byteLength}function from(o){return o instanceof Uint8Array?o:Array.isArray(o)?new Uint8Array(o):encode$1(o)}function write(o,et,tt){if(typeof et!="string")throw new Error("unknown input type");return encode$1(et,o,tt),encode$1.bytes}const P_24=Math.pow(2,24),P_16=Math.pow(2,16),P_8=Math.pow(2,8),readUInt32BE=(o,et)=>o[et]*P_24+o[et+1]*P_16+o[et+2]*P_8+o[et+3],readUInt16BE=(o,et)=>o[et]<<8|o[et+1],writeUInt32BE=(o,et,tt)=>(et=+et,o[tt+3]=et,et=et>>>8,o[tt+2]=et,et=et>>>8,o[tt+1]=et,et=et>>>8,o[tt]=et,tt+4),writeUInt16BE=(o,et,tt)=>(o[tt]=et>>8,o[tt+1]=et&255,tt+2);function copy(o,et,tt,nt,rt){return tt<0&&(nt-=tt,tt=0),nt<0&&(nt=0),rt<0?new Uint8Array(0):tt>=et.length||nt>=rt?0:_copyActual(o,et,tt,nt,rt)}function _copyActual(o,et,tt,nt,rt){rt-nt>et.length-tt&&(rt=nt+et.length-tt);let ot=rt-nt;const it=o.length-nt;return ot>it&&(ot=it),(nt!==0||rto)}}const name$1=codec({encode(o,et,tt){et||(et=new Uint8Array(name$1.encodingLength(o))),tt||(tt=0);const nt=tt,rt=o.replace(/^\.|\.$/gm,"");if(rt.length){const ot=rt.split(".");for(let it=0;it=o.length)throw new Error("Cannot decode name (buffer overflow)");const st=o[et++];if(ot+=it?0:1,st===0)break;if(st&192)if((st&192)===192){if(et+1>o.length)throw new Error("Cannot decode name (buffer overflow)");const at=readUInt16BE(o,et-1)-49152;if(at>=nt)throw new Error("Cannot decode name (bad pointer)");et=at,nt=at,ot+=it?0:1,it=!0}else throw new Error("Cannot decode name (bad label)");else{if(et+st>o.length)throw new Error("Cannot decode name (buffer overflow)");if(rt+=st+1,rt>254)throw new Error("Cannot decode name (name too long)");tt.push(decode$2(o,et,et+st)),et+=st,ot+=it?0:st}}return name$1.decode.bytes=ot,tt.length===0?".":tt.join(".")},encodingLength(o){return o==="."||o===".."?1:bytelength(o.replace(/^\.|\.$/gm,""))+2}}),string$2=codec({encode(o,et,tt){et||(et=new Uint8Array(string$2.encodingLength(o))),tt||(tt=0);const nt=write(et,o,tt+1);return et[tt]=nt,string$2.encode.bytes=nt+1,et},decode(o,et){et||(et=0);const tt=o[et],nt=decode$2(o,et+1,et+1+tt);return string$2.decode.bytes=tt+1,nt},encodingLength(o){return bytelength(o)+1}}),header=codec({bytes:12,encode(o,et,tt){et||(et=new Uint8Array(header.encodingLength(o))),tt||(tt=0);const nt=(o.flags||0)&32767,rt=o.type==="response"?RESPONSE_FLAG:QUERY_FLAG;return writeUInt16BE(et,o.id||0,tt),writeUInt16BE(et,nt|rt,tt+2),writeUInt16BE(et,o.questions.length,tt+4),writeUInt16BE(et,o.answers.length,tt+6),writeUInt16BE(et,o.authorities.length,tt+8),writeUInt16BE(et,o.additionals.length,tt+10),et},decode(o,et){if(et||(et=0),o.length<12)throw new Error("Header must be 12 bytes");const tt=readUInt16BE(o,et+2);return{id:readUInt16BE(o,et),type:tt&RESPONSE_FLAG?"response":"query",flags:tt&32767,flag_qr:(tt>>15&1)===1,opcode:toString$4(tt>>11&15),flag_aa:(tt>>10&1)===1,flag_tc:(tt>>9&1)===1,flag_rd:(tt>>8&1)===1,flag_ra:(tt>>7&1)===1,flag_z:(tt>>6&1)===1,flag_ad:(tt>>5&1)===1,flag_cd:(tt>>4&1)===1,rcode:toString$5(tt&15),questions:new Array(readUInt16BE(o,et+4)),answers:new Array(readUInt16BE(o,et+6)),authorities:new Array(readUInt16BE(o,et+8)),additionals:new Array(readUInt16BE(o,et+10))}},encodingLength(){return 12}}),runknown=codec({encode(o,et,tt){et||(et=new Uint8Array(runknown.encodingLength(o))),tt||(tt=0);const nt=o.length;return writeUInt16BE(et,nt,tt),copy(o,et,tt+2,0,nt),runknown.encode.bytes=nt+2,et},decode(o,et){et||(et=0);const tt=readUInt16BE(o,et),nt=o.slice(et+2,et+2+tt);return runknown.decode.bytes=tt+2,nt},encodingLength(o){return o.length+2}}),rns=codec({encode(o,et,tt){return et||(et=new Uint8Array(rns.encodingLength(o))),tt||(tt=0),name$1.encode(o,et,tt+2),writeUInt16BE(et,name$1.encode.bytes,tt),rns.encode.bytes=name$1.encode.bytes+2,et},decode(o,et){et||(et=0);const tt=readUInt16BE(o,et),nt=name$1.decode(o,et+2);return rns.decode.bytes=tt+2,nt},encodingLength(o){return name$1.encodingLength(o)+2}}),rsoa=codec({encode(o,et,tt){et||(et=new Uint8Array(rsoa.encodingLength(o))),tt||(tt=0);const nt=tt;return tt+=2,name$1.encode(o.mname,et,tt),tt+=name$1.encode.bytes,name$1.encode(o.rname,et,tt),tt+=name$1.encode.bytes,writeUInt32BE(et,o.serial||0,tt),tt+=4,writeUInt32BE(et,o.refresh||0,tt),tt+=4,writeUInt32BE(et,o.retry||0,tt),tt+=4,writeUInt32BE(et,o.expire||0,tt),tt+=4,writeUInt32BE(et,o.minimum||0,tt),tt+=4,writeUInt16BE(et,tt-nt-2,nt),rsoa.encode.bytes=tt-nt,et},decode(o,et){et||(et=0);const tt=et,nt={};return et+=2,nt.mname=name$1.decode(o,et),et+=name$1.decode.bytes,nt.rname=name$1.decode(o,et),et+=name$1.decode.bytes,nt.serial=readUInt32BE(o,et),et+=4,nt.refresh=readUInt32BE(o,et),et+=4,nt.retry=readUInt32BE(o,et),et+=4,nt.expire=readUInt32BE(o,et),et+=4,nt.minimum=readUInt32BE(o,et),et+=4,rsoa.decode.bytes=et-tt,nt},encodingLength(o){return 22+name$1.encodingLength(o.mname)+name$1.encodingLength(o.rname)}}),rtxt=codec({encode(o,et,tt){Array.isArray(o)||(o=[o]);for(let rt=0;rt0;){const ot=o[et++];if(--nt,ntnew Uint8Array(o),roption=codec({encode(o,et,tt){et||(et=new Uint8Array(roption.encodingLength(o))),tt||(tt=0);const nt=tt,rt=toCode(o.code);if(writeUInt16BE(et,rt,tt),tt+=2,o.data)writeUInt16BE(et,o.data.length,tt),tt+=2,copy(o.data,et,tt),tt+=o.data.length;else switch(rt){case 8:{const ot=o.sourcePrefixLength||0,it=o.family||familyOf(o.ip),st=encode$2(o.ip,alloc),at=Math.ceil(ot/8);writeUInt16BE(et,at+4,tt),tt+=2,writeUInt16BE(et,it,tt),tt+=2,et[tt++]=ot,et[tt++]=o.scopePrefixLength||0,copy(st,et,tt,0,at),tt+=at}break;case 11:o.timeout?(writeUInt16BE(et,2,tt),tt+=2,writeUInt16BE(et,o.timeout,tt),tt+=2):(writeUInt16BE(et,0,tt),tt+=2);break;case 12:{const ot=o.length||0;writeUInt16BE(et,ot,tt),tt+=2,et.fill(0,tt,tt+ot),tt+=ot}break;case 14:{const ot=o.tags.length*2;writeUInt16BE(et,ot,tt),tt+=2;for(const it of o.tags)writeUInt16BE(et,it,tt),tt+=2}break;default:throw new Error(`Unknown roption code: ${o.code}`)}return roption.encode.bytes=tt-nt,et},decode(o,et){et||(et=0);const tt={};tt.code=readUInt16BE(o,et),tt.type=toString$2(tt.code),et+=2;const nt=readUInt16BE(o,et);switch(et+=2,tt.data=o.slice(et,et+nt),tt.code){case 8:tt.family=readUInt16BE(o,et),et+=2,tt.sourcePrefixLength=o[et++],tt.scopePrefixLength=o[et++];{const rt=new Uint8Array(tt.family===1?4:16);copy(o,rt,0,et,et+nt-4),tt.ip=decode$3(rt)}break;case 11:nt>0&&(tt.timeout=readUInt16BE(o,et),et+=2);break;case 14:tt.tags=[];for(let rt=0;rt0;)nt[ot++]=roption.decode(o,et),et+=roption.decode.bytes,rt-=roption.decode.bytes;return ropt.decode.bytes=et-tt,nt},encodingLength(o){return 2+encodingLengthList(o||[],roption)}}),rdnskey=codec({encode(o,et,tt){et||(et=new Uint8Array(rdnskey.encodingLength(o))),tt||(tt=0);const nt=tt,rt=o.key;if(!isU8Arr(rt))throw new Error("Key must be a Buffer");return tt+=2,writeUInt16BE(et,o.flags,tt),tt+=2,et[tt]=rdnskey.PROTOCOL_DNSSEC,tt+=1,et[tt]=o.algorithm,tt+=1,copy(rt,et,tt,0,rt.length),tt+=rt.length,rdnskey.encode.bytes=tt-nt,writeUInt16BE(et,rdnskey.encode.bytes-2,nt),et},decode(o,et){et||(et=0);const tt=et,nt={},rt=readUInt16BE(o,et);if(et+=2,nt.flags=readUInt16BE(o,et),et+=2,o[et]!==rdnskey.PROTOCOL_DNSSEC)throw new Error("Protocol must be 3");return et+=1,nt.algorithm=o[et],et+=1,nt.key=o.slice(et,tt+rt+2),et+=nt.key.length,rdnskey.decode.bytes=et-tt,nt},encodingLength(o){return 6+bytelength(o.key)}});rdnskey.PROTOCOL_DNSSEC=3;rdnskey.ZONE_KEY=128;rdnskey.SECURE_ENTRYPOINT=32768;const rrrsig=codec({encode(o,et,tt){et||(et=new Uint8Array(rrrsig.encodingLength(o))),tt||(tt=0);const nt=tt,rt=o.signature;if(!isU8Arr(rt))throw new Error("Signature must be a Buffer");return tt+=2,writeUInt16BE(et,toType(o.typeCovered),tt),tt+=2,et[tt]=o.algorithm,tt+=1,et[tt]=o.labels,tt+=1,writeUInt32BE(et,o.originalTTL,tt),tt+=4,writeUInt32BE(et,o.expiration,tt),tt+=4,writeUInt32BE(et,o.inception,tt),tt+=4,writeUInt16BE(et,o.keyTag,tt),tt+=2,name$1.encode(o.signersName,et,tt),tt+=name$1.encode.bytes,copy(rt,et,tt,0,rt.length),tt+=rt.length,rrrsig.encode.bytes=tt-nt,writeUInt16BE(et,rrrsig.encode.bytes-2,nt),et},decode(o,et){et||(et=0);const tt=et,nt={},rt=readUInt16BE(o,et);return et+=2,nt.typeCovered=toString$6(readUInt16BE(o,et)),et+=2,nt.algorithm=o[et],et+=1,nt.labels=o[et],et+=1,nt.originalTTL=readUInt32BE(o,et),et+=4,nt.expiration=readUInt32BE(o,et),et+=4,nt.inception=readUInt32BE(o,et),et+=4,nt.keyTag=readUInt16BE(o,et),et+=2,nt.signersName=name$1.decode(o,et),et+=name$1.decode.bytes,nt.signature=o.slice(et,tt+rt+2),et+=nt.signature.length,rrrsig.decode.bytes=et-tt,nt},encodingLength(o){return 20+name$1.encodingLength(o.signersName)+bytelength(o.signature)}}),rrp=codec({encode(o,et,tt){et||(et=new Uint8Array(rrp.encodingLength(o))),tt||(tt=0);const nt=tt;return tt+=2,name$1.encode(o.mbox||".",et,tt),tt+=name$1.encode.bytes,name$1.encode(o.txt||".",et,tt),tt+=name$1.encode.bytes,rrp.encode.bytes=tt-nt,writeUInt16BE(et,rrp.encode.bytes-2,nt),et},decode(o,et){et||(et=0);const tt=et,nt={};return et+=2,nt.mbox=name$1.decode(o,et)||".",et+=name$1.decode.bytes,nt.txt=name$1.decode(o,et)||".",et+=name$1.decode.bytes,rrp.decode.bytes=et-tt,nt},encodingLength(o){return 2+name$1.encodingLength(o.mbox||".")+name$1.encodingLength(o.txt||".")}}),typebitmap=codec({encode(o,et,tt){et||(et=new Uint8Array(typebitmap.encodingLength(o))),tt||(tt=0);const nt=tt,rt=[];for(let ot=0;ot>8]===void 0&&(rt[it>>8]=[]),rt[it>>8][it>>3&31]|=1<<7-(it&7)}for(let ot=0;ot>8]=Math.max(et[rt>>8]||0,rt&255)}let tt=0;for(let nt=0;nt>15&1)===1,tt.options=ropt.decode(o,et+8),et+=8+ropt.decode.bytes;else{const rt=readUInt16BE(o,et+2);tt.ttl=readUInt32BE(o,et+4),tt.class=toString$3(rt&NOT_FLUSH_MASK),tt.flush=!!(rt&FLUSH_MASK);const ot=renc(tt.type);tt.data=ot.decode(o,et+8),et+=8+ot.decode.bytes}return answer.decode.bytes=et-nt,tt},encodingLength(o){const et=o.data!==null&&o.data!==void 0?o.data:o.options;return name$1.encodingLength(o.name)+8+renc(o.type).encodingLength(et)}}),question=codec({encode(o,et,tt){et||(et=new Uint8Array(question.encodingLength(o))),tt||(tt=0);const nt=tt;return name$1.encode(o.name,et,tt),tt+=name$1.encode.bytes,writeUInt16BE(et,toType(o.type),tt),tt+=2,writeUInt16BE(et,toClass(o.class===void 0?"IN":o.class),tt),tt+=2,question.encode.bytes=tt-nt,o},decode(o,et){et||(et=0);const tt=et,nt={};return nt.name=name$1.decode(o,et),et+=name$1.decode.bytes,nt.type=toString$6(readUInt16BE(o,et)),et+=2,nt.class=toString$3(readUInt16BE(o,et)),et+=2,!!(nt.class&QU_MASK)&&(nt.class&=NOT_QU_MASK),question.decode.bytes=et-tt,nt},encodingLength(o){return name$1.encodingLength(o.name)+4}}),RECURSION_DESIRED=256,packet={encode:function(o,et,tt){const nt=!et;nt&&(et=new Uint8Array(encodingLength(o))),tt||(tt=0);const rt=tt;return o.questions||(o.questions=[]),o.answers||(o.answers=[]),o.authorities||(o.authorities=[]),o.additionals||(o.additionals=[]),header.encode(o,et,tt),tt+=header.encode.bytes,tt=encodeList(o.questions,question,et,tt),tt=encodeList(o.answers,answer,et,tt),tt=encodeList(o.authorities,answer,et,tt),tt=encodeList(o.additionals,answer,et,tt),packet.encode.bytes=tt-rt,nt&&encode.bytes!==et.length?et.slice(0,encode.bytes):et},decode:function(o,et){et||(et=0);const tt=et,nt=header.decode(o,et);return et+=header.decode.bytes,et=decodeList(nt.questions,question,o,et),et=decodeList(nt.answers,answer,o,et),et=decodeList(nt.authorities,answer,o,et),et=decodeList(nt.additionals,answer,o,et),packet.decode.bytes=et-tt,nt},encodingLength:function(o){return header.encodingLength(o)+encodingLengthList(o.questions||[],question)+encodingLengthList(o.answers||[],answer)+encodingLengthList(o.authorities||[],answer)+encodingLengthList(o.additionals||[],answer)}};packet.encode.bytes=0;packet.decode.bytes=0;const encode=packet.encode,decode$1=packet.decode,encodingLength=packet.encodingLength;function encodingLengthList(o,et){let tt=0;for(let nt=0;nt255)throw new Error(`Character #${at} in charset [code=${ct}, char=${et.charAt(at)}] is too high! (max=255)`);if(rt[ct]!==0)throw new Error(`Character [code=${ct}, char=${et.charAt(at)}] is more than once in the charset!`);rt[ct]=at,ot[at]=ct}const it=tt.charCodeAt(0),st={name:o,encodingLength(at){const ct=at.length,lt=ct*.75|0;return at.charCodeAt(ct-1)===it?at.charCodeAt(ct-2)===it?lt-2:lt-1:lt},encode(at,ct,lt){ct==null&&(ct=new Uint8Array(st.encodingLength(at))),lt==null&&(lt=0);let dt=at.length;at.charCodeAt(dt-1)===it&&(at.charCodeAt(dt-2)===it?dt-=2:dt-=1);const ht=dt%4,pt=dt-ht;let mt=lt,ft=0;for(;ft>16,ct[mt++]=yt>>8,ct[mt++]=yt,ft+=4}if(ht===3){const yt=rt[at.charCodeAt(ft)]<<10|rt[at.charCodeAt(ft+1)]<<4|rt[at.charCodeAt(ft+2)]>>2;ct[mt++]=yt>>8,ct[mt++]=yt}else ht===2&&(ct[mt++]=rt[at.charCodeAt(ft)]<<2|rt[at.charCodeAt(ft+1)]>>4);return st.encode.bytes=mt-lt,ct},decode(at,ct,lt){ct==null&&(ct=0),lt==null&&(lt=at.length);const dt=lt-ct,ht=dt%3,pt=ct+dt-ht,mt=[];for(let ft=ct;ft>18&63],ot[yt>>12&63],ot[yt>>6&63],ot[yt&63])}if(ht===2){const ft=(at[lt-2]<<8)+at[lt-1];mt.push(ot[ft>>10],ot[ft>>4&63],ot[ft<<2&63]),nt===PREFERS_PADDING&&mt.push(it)}else if(ht===1){const ft=at[lt-1];mt.push(ot[ft>>2],ot[ft<<4&63]),nt===PREFERS_PADDING&&mt.push(it,it)}return st.decode.bytes=dt,String.fromCharCode.apply(String,mt)}};return st}make("base64","ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/","=",PREFERS_PADDING);const base64URL=make("base64-url","ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_","=",PREFERS_NO_PADDING);let AbortError=typeof globalThis<"u"?globalThis.AbortError:typeof window<"u"?window.AbortError:null;AbortError||(AbortError=class extends Error{constructor(et="Request aborted."){super(et)}});AbortError.prototype.name="AbortError";AbortError.prototype.code="ABORT_ERR";const URL$1=typeof globalThis<"u"&&globalThis.URL||require("url").URL;class HTTPStatusError extends Error{constructor(et,tt,nt){super("status="+tt+" while requesting "+et+" ["+nt+"]"),this.uri=et,this.status=tt,this.method=nt}toJSON(){return{code:this.code,uri:this.uri,status:this.status,method:this.method,endpoint:this.endpoint}}}HTTPStatusError.prototype.name="HTTPStatusError";HTTPStatusError.prototype.code="HTTP_STATUS";class ResponseError extends Error{constructor(et,tt){super(et),this.cause=tt}toJSON(){return{message:this.message,endpoint:this.endpoint,code:this.code,cause:reduceError(this.cause)}}}ResponseError.prototype.name="ResponseError";ResponseError.prototype.code="RESPONSE_ERR";class TimeoutError extends Error{constructor(et){super("Timeout (t="+et+")."),this.timeout=et}toJSON(){return{code:this.code,endpoint:this.endpoint,timeout:this.timeout}}}TimeoutError.prototype.name="TimeoutError";TimeoutError.prototype.code="ETIMEOUT";const v4Regex=/^((\d{1,3}\.){3,3}\d{1,3})(:(\d{2,5}))?$/,v6Regex=/^((::)?(((\d{1,3}\.){3}(\d{1,3}){1})?([0-9a-f]){0,4}:{0,2}){1,8}(::)?)(:(\d{2,5}))?$/i;function reduceError(o){if(typeof o=="string")return{message:o};try{const tt=JSON.stringify(o);if(tt!=="{}")return JSON.parse(tt)}catch{}const et={message:String(o.message||o)};return o.code!==void 0&&(et.code=String(o.code)),et}const baseParts=/^(([a-z0-9]+:)\/\/)?([^/[\s:]+|\[[^\]]+\])?(:([^/\s]+))?(\/[^\s]*)?(.*)$/,httpFlags=/\[(post|get|((ipv4|ipv6|name)=([^\]]+)))\]/ig,updFlags=/\[(((pk|name)=([^\]]+)))\]/ig;function parseEndpoint(o){const et=baseParts.exec(o),tt=et[2]||"https:",nt=et[3],rt=et[5],ot=et[6],it=et[7];if(tt==="https:"||tt==="http:"){const st=parseFlags(it,httpFlags);return{name:st.name,protocol:tt,ipv4:st.ipv4,ipv6:st.ipv6,host:nt,port:rt,path:ot,method:st.post?"POST":"GET"}}if(tt==="udp:"||tt==="udp4:"||tt==="udp6:"){const st=parseFlags(it,updFlags),at=/^\[(.*)\]$/.exec(nt);if(at&&tt==="udp4:")throw new Error(`Endpoint parsing error: Cannot use ipv6 host with udp4: (endpoint=${o})`);if(!at&&tt==="udp6:")throw new Error(`Endpoint parsing error: Incorrectly formatted host for udp6: (endpoint=${o})`);return at?new UDP6Endpoint({protocol:"udp6:",ipv6:at[1],port:rt,pk:st.pk,name:st.name}):new UDP4Endpoint({protocol:"udp4:",ipv4:nt,port:rt,pk:st.pk,name:st.name})}throw new InvalidProtocolError(tt,o)}function parseFlags(o,et){et.lastIndex=0;const tt={};for(;;){const nt=et.exec(o);if(!nt)break;nt[2]?tt[nt[3].toLowerCase()]=nt[4]:tt[nt[1].toLowerCase()]=!0}return tt}class InvalidProtocolError extends Error{constructor(et,tt){super(`Invalid Endpoint: unsupported protocol "${et}" for endpoint: ${tt}, supported protocols: ${supportedProtocols.join(", ")}`),this.protocol=et,this.endpoint=tt}toJSON(){return{code:this.code,endpoint:this.endpoint,timeout:this.timeout}}}InvalidProtocolError.prototype.name="InvalidProtocolError";InvalidProtocolError.prototype.code="EPROTOCOL";const supportedProtocols=["http:","https:","udp4:","udp6:"];class BaseEndpoint{constructor(et,tt){this.name=et.name||null,this.protocol=et.protocol;const nt=typeof et.port=="string"?et.port=parseInt(et.port,10):et.port;if(nt==null)this.port=tt?this.protocol==="https:"?443:80:et.pk?443:53;else{if(typeof nt!="number"&&!isNaN(nt))throw new Error(`Invalid Endpoint: port "${et.port}" needs to be a number: ${JSON.stringify(et)}`);this.port=nt}}toJSON(){return this.toString()}}class UDPEndpoint extends BaseEndpoint{constructor(et){super(et,!1),this.pk=et.pk||null}toString(){const et=this.port!==(this.pk?443:53)?`:${this.port}`:"",tt=this.pk?` [pk=${this.pk}]`:"",nt=this.name?` [name=${this.name}]`:"";return`udp://${this.ipv4||`[${this.ipv6}]`}${et}${tt}${nt}`}}class UDP4Endpoint extends UDPEndpoint{constructor(et){if(super(Object.assign({protocol:"udp4:"},et)),!et.ipv4||typeof et.ipv4!="string")throw new Error(`Invalid Endpoint: .ipv4 "${et.ipv4}" needs to be set: ${JSON.stringify(et)}`);this.ipv4=et.ipv4}}class UDP6Endpoint extends UDPEndpoint{constructor(et){if(super(Object.assign({protocol:"udp6:"},et)),!et.ipv6||typeof et.ipv6!="string")throw new Error(`Invalid Endpoint: .ipv6 "${et.ipv6}" needs to be set: ${JSON.stringify(et)}`);this.ipv6=et.ipv6}}function safeHost(o){return v6Regex.test(o)&&!v4Regex.test(o)?`[${o}]`:o}class HTTPEndpoint extends BaseEndpoint{constructor(et){if(super(Object.assign({protocol:"https:"},et),!0),et.host||(et.ipv4&&(et.host=et.ipv4),et.ipv6&&(et.host=`[${et.ipv6}]`)),!et.host||typeof et.host!="string")throw new Error(`Invalid Endpoint: host "${et.path}" needs to be set: ${JSON.stringify(et)}`);if(this.host=et.host,this.path=et.path||"/dns-query",this.method=/^post$/i.test(et.method)?"POST":"GET",this.ipv4=et.ipv4,this.ipv6=et.ipv6,!this.ipv6){const nt=v6Regex.exec(this.host);nt&&(this.ipv6=nt[1])}this.ipv4||v4Regex.test(this.host)&&(this.ipv4=this.host);const tt=`${this.protocol}//${safeHost(this.host)}:${this.port}${this.path}`;try{this.url=new URL$1(tt)}catch(nt){throw new Error(nt.message+` [${tt}]`)}}toString(){const et=this.protocol==="https:"?"":"http://",tt=this.port!==(this.protocol==="https:"?443:80)?`:${this.port}`:"",nt=this.method!=="GET"?" [post]":"",rt=this.path==="/dns-query"?"":this.path,ot=this.name?` [name=${this.name}]`:"",it=this.ipv4&&this.ipv4!==this.host?` [ipv4=${this.ipv4}]`:"",st=this.ipv6&&this.ipv6!==this.host?` [ipv6=${this.ipv6}]`:"";return`${et}${safeHost(this.host)}${tt}${rt}${nt}${it}${st}${ot}`}}function toEndpoint(o){let et;if(typeof o=="string")et=parseEndpoint(o);else{if(typeof o!="object"||o===null||Array.isArray(o))throw new Error(`Can not convert ${o} to an endpoint`);if(o instanceof BaseEndpoint)return o;et=o}(et.protocol===null||et.protocol===void 0)&&(et.protocol="https:");const tt=et.protocol;if(tt==="udp4:")return new UDP4Endpoint(et);if(tt==="udp6:")return new UDP6Endpoint(et);if(tt==="https:"||tt==="http:")return new HTTPEndpoint(et);throw new InvalidProtocolError(tt,JSON.stringify(et))}const contentType="application/dns-message";function noop$1(){}function queryDns(){throw new Error('Only "doh" endpoints are supported in the browser')}async function loadJSON(o,et,tt,nt){const rt=et?et.localStoragePrefix+et.name:null;if(rt)try{const st=JSON.parse(localStorage.getItem(rt));if(st&&st.time>et.maxTime)return st}catch{}const{data:ot}=await requestRaw(o,"GET",null,tt,nt),it={time:Date.now(),data:JSON.parse(decode$2(ot))};if(rt)try{localStorage.setItem(rt,JSON.stringify(it))}catch{it.time=null}return it}function requestRaw(o,et,tt,nt,rt){return new Promise((ot,it)=>{const st=new URL$1(o);et==="GET"&&tt&&(st.search="?dns="+base64URL.decode(tt));const at=st.toString(),ct=new XMLHttpRequest;ct.open(et,at,!0),ct.setRequestHeader("Accept",contentType),et==="POST"&&ct.setRequestHeader("Content-Type",contentType),ct.responseType="arraybuffer",ct.timeout=nt,ct.ontimeout=lt,ct.onreadystatechange=ht,ct.onerror=mt,ct.onload=dt,et==="POST"?ct.send(tt):ct.send(),rt&&rt.addEventListener("abort",ft);function lt(){pt(new TimeoutError(nt));try{ct.abort()}catch{}}function dt(){if(ct.status!==200)pt(new HTTPStatusError(at,ct.status,et));else{let yt;if(typeof ct.response=="string")yt=encode$1(ct.response);else if(ct.response instanceof Uint8Array)yt=ct.response;else if(Array.isArray(ct.response)||ct.response instanceof ArrayBuffer)yt=new Uint8Array(ct.response);else throw new Error("Unprocessable response "+ct.response);pt(null,yt)}}function ht(){if(ct.readyState>1&&ct.status!==200&&ct.status!==0){pt(new HTTPStatusError(at,ct.status,et));try{ct.abort()}catch{}}}let pt=function(yt,gt){pt=noop$1,rt&&rt.removeEventListener("abort",ft),ot(yt?{error:yt,response:ct}:{data:gt,response:ct})};function mt(){pt(ct.status===200?new Error("Inexplicable XHR Error"):new HTTPStatusError(at,ct.status,et))}function ft(){pt(new AbortError);try{ct.abort()}catch{}}})}function request(o,et,tt,nt,rt){return requestRaw(o,et,tt,nt,rt)}function processResolvers$1(o){return o.filter(et=>et.cors||et.endpoint.cors)}const resolvers={data:[{name:"adfree.usableprivacy.net",endpoint:{protocol:"https:",host:"adfree.usableprivacy.net"},description:`Public updns DoH service with advertising, tracker and malware filters. Hosted in Europe by @usableprivacy, details see: https://docs.usableprivacy.com`,country:"Germany",location:{lat:51.2993,long:9.491},filter:!0},{name:"adguard-dns-doh",endpoint:{protocol:"https:",host:"dns.adguard.com",ipv4:"94.140.15.15"},description:"Remove ads and protect your computer from malware (over DoH)",country:"France",location:{lat:48.8582,long:2.3387},filter:!0},{name:"adguard-dns-family-doh",endpoint:{protocol:"https:",host:"dns-family.adguard.com",ipv4:"94.140.15.16"},description:"Adguard DNS with safesearch and adult content blocking (over DoH)",country:"France",location:{lat:48.8582,long:2.3387},filter:!0},{name:"adguard-dns-unfiltered-doh",endpoint:{protocol:"https:",host:"dns-unfiltered.adguard.com",ipv4:"94.140.14.140"},description:"AdGuard public DNS servers without filters (over DoH)",country:"France",location:{lat:48.8582,long:2.3387}},{name:"ahadns-doh-chi",endpoint:{protocol:"https:",host:"doh.chi.ahadns.net",cors:!0},description:`A zero logging DNS with support for DNS-over-HTTPS (DoH) & DNS-over-TLS (DoT). Blocks ads, malware, trackers, viruses, ransomware, telemetry and more. No persistent logs. DNSSEC. Hosted in Chicago, USA. By https://ahadns.com/ Server statistics can be seen at: https://statistics.ahadns.com/?server=chi`,country:"United States",location:{lat:41.8483,long:-87.6517},filter:!0,cors:!0},{name:"ahadns-doh-in",endpoint:{protocol:"https:",host:"doh.in.ahadns.net",cors:!0},description:`A zero logging DNS with support for DNS-over-HTTPS (DoH) & DNS-over-TLS (DoT). Blocks ads, malware, trackers, viruses, ransomware, telemetry and more. No persistent logs. DNSSEC. Hosted in Mumbai, India. By https://ahadns.com/ Server statistics can be seen at: https://statistics.ahadns.com/?server=in`,country:"India",location:{lat:19.0748,long:72.8856},filter:!0,cors:!0},{name:"ahadns-doh-la",endpoint:{protocol:"https:",host:"doh.la.ahadns.net",cors:!0},description:`A zero logging DNS with support for DNS-over-HTTPS (DoH) & DNS-over-TLS (DoT). Blocks ads, malware, trackers, viruses, ransomware, telemetry and more. No persistent logs. DNSSEC. Hosted in Los Angeles, USA. By https://ahadns.com/ @@ -4047,7 +4047,7 @@ https://www.dnscrypt.uk`,country:"United Kingdom",location:{lat:51.4964,long:-.1 * @author Chen, Yi-Cyuan [emn178@gmail.com] * @copyright Chen, Yi-Cyuan 2015-2018 * @license MIT - */(function(){var tt=typeof window=="object"?window:{},nt=!tt.HI_BASE32_NO_NODE_JS&&typeof et=="object"&&et.versions&&et.versions.node;nt&&(tt=globalThis);var rt=!tt.HI_BASE32_NO_COMMON_JS&&!0&&o.exports,ot="ABCDEFGHIJKLMNOPQRSTUVWXYZ234567".split(""),it={A:0,B:1,C:2,D:3,E:4,F:5,G:6,H:7,I:8,J:9,K:10,L:11,M:12,N:13,O:14,P:15,Q:16,R:17,S:18,T:19,U:20,V:21,W:22,X:23,Y:24,Z:25,2:26,3:27,4:28,5:29,6:30,7:31},st=[0,0,0,0,0,0,0,0],at=function(gt,xt){xt.length>10&&(xt="..."+xt.substr(-10));var vt=new Error("Decoded data is not valid UTF-8. Maybe try base32.decode.asBytes()? Partial data after reading "+gt+" bytes: "+xt+" <-");throw vt.position=gt,vt},ct=function(gt){for(var xt="",vt=gt.length,bt=0,Et=0,wt,kt;bt191&&wt<=223?(kt=wt&31,Et=1):wt<=239?(kt=wt&15,Et=2):wt<=247?(kt=wt&7,Et=3):at(bt,xt);for(var Tt=0;Tt191)&&at(bt,xt),kt<<=6,kt+=wt&63;kt>=55296&&kt<=57343&&at(bt,xt),kt>1114111&&at(bt,xt),kt<=65535?xt+=String.fromCharCode(kt):(kt-=65536,xt+=String.fromCharCode((kt>>10)+55296),xt+=String.fromCharCode((kt&1023)+56320))}return xt},lt=function(gt){if(gt==="")return[];if(!/^[A-Z2-7=]+$/.test(gt))throw new Error("Invalid base32 characters");gt=gt.replace(/=/g,"");for(var xt,vt,bt,Et,wt,kt,Tt,Rt,Pt=[],$t=0,Ot=gt.length,Bt=0,zt=Ot>>3<<3;Bt>>2)&255,Pt[$t++]=(vt<<6|bt<<1|Et>>>4)&255,Pt[$t++]=(Et<<4|wt>>>1)&255,Pt[$t++]=(wt<<7|kt<<2|Tt>>>3)&255,Pt[$t++]=(Tt<<5|Rt)&255;var Ft=Ot-zt;return Ft===2?(xt=it[gt.charAt(Bt++)],vt=it[gt.charAt(Bt++)],Pt[$t++]=(xt<<3|vt>>>2)&255):Ft===4?(xt=it[gt.charAt(Bt++)],vt=it[gt.charAt(Bt++)],bt=it[gt.charAt(Bt++)],Et=it[gt.charAt(Bt++)],Pt[$t++]=(xt<<3|vt>>>2)&255,Pt[$t++]=(vt<<6|bt<<1|Et>>>4)&255):Ft===5?(xt=it[gt.charAt(Bt++)],vt=it[gt.charAt(Bt++)],bt=it[gt.charAt(Bt++)],Et=it[gt.charAt(Bt++)],wt=it[gt.charAt(Bt++)],Pt[$t++]=(xt<<3|vt>>>2)&255,Pt[$t++]=(vt<<6|bt<<1|Et>>>4)&255,Pt[$t++]=(Et<<4|wt>>>1)&255):Ft===7&&(xt=it[gt.charAt(Bt++)],vt=it[gt.charAt(Bt++)],bt=it[gt.charAt(Bt++)],Et=it[gt.charAt(Bt++)],wt=it[gt.charAt(Bt++)],kt=it[gt.charAt(Bt++)],Tt=it[gt.charAt(Bt++)],Pt[$t++]=(xt<<3|vt>>>2)&255,Pt[$t++]=(vt<<6|bt<<1|Et>>>4)&255,Pt[$t++]=(Et<<4|wt>>>1)&255,Pt[$t++]=(wt<<7|kt<<2|Tt>>>3)&255),Pt},dt=function(gt){for(var xt,vt,bt,Et,wt,kt="",Tt=gt.length,Rt=0,Pt=parseInt(Tt/5)*5;Rt>>3]+ot[(xt<<2|vt>>>6)&31]+ot[vt>>>1&31]+ot[(vt<<4|bt>>>4)&31]+ot[(bt<<1|Et>>>7)&31]+ot[Et>>>2&31]+ot[(Et<<3|wt>>>5)&31]+ot[wt&31];var $t=Tt-Pt;return $t===1?(xt=gt.charCodeAt(Rt),kt+=ot[xt>>>3]+ot[xt<<2&31]+"======"):$t===2?(xt=gt.charCodeAt(Rt++),vt=gt.charCodeAt(Rt),kt+=ot[xt>>>3]+ot[(xt<<2|vt>>>6)&31]+ot[vt>>>1&31]+ot[vt<<4&31]+"===="):$t===3?(xt=gt.charCodeAt(Rt++),vt=gt.charCodeAt(Rt++),bt=gt.charCodeAt(Rt),kt+=ot[xt>>>3]+ot[(xt<<2|vt>>>6)&31]+ot[vt>>>1&31]+ot[(vt<<4|bt>>>4)&31]+ot[bt<<1&31]+"==="):$t===4&&(xt=gt.charCodeAt(Rt++),vt=gt.charCodeAt(Rt++),bt=gt.charCodeAt(Rt++),Et=gt.charCodeAt(Rt),kt+=ot[xt>>>3]+ot[(xt<<2|vt>>>6)&31]+ot[vt>>>1&31]+ot[(vt<<4|bt>>>4)&31]+ot[(bt<<1|Et>>>7)&31]+ot[Et>>>2&31]+ot[Et<<3&31]+"="),kt},ht=function(gt){var xt,vt,bt,Et,wt,kt,Tt=!1,Rt="",Pt=0,$t,Ot=0,Bt=gt.length;if(gt==="")return Rt;do{for(st[0]=st[5],st[1]=st[6],st[2]=st[7],$t=Ot;Pt>6,st[$t++]=128|kt&63):kt<55296||kt>=57344?(st[$t++]=224|kt>>12,st[$t++]=128|kt>>6&63,st[$t++]=128|kt&63):(kt=65536+((kt&1023)<<10|gt.charCodeAt(++Pt)&1023),st[$t++]=240|kt>>18,st[$t++]=128|kt>>12&63,st[$t++]=128|kt>>6&63,st[$t++]=128|kt&63);Ot=$t-5,Pt===Bt&&++Pt,Pt>Bt&&$t<6&&(Tt=!0),xt=st[0],$t>4?(vt=st[1],bt=st[2],Et=st[3],wt=st[4],Rt+=ot[xt>>>3]+ot[(xt<<2|vt>>>6)&31]+ot[vt>>>1&31]+ot[(vt<<4|bt>>>4)&31]+ot[(bt<<1|Et>>>7)&31]+ot[Et>>>2&31]+ot[(Et<<3|wt>>>5)&31]+ot[wt&31]):$t===1?Rt+=ot[xt>>>3]+ot[xt<<2&31]+"======":$t===2?(vt=st[1],Rt+=ot[xt>>>3]+ot[(xt<<2|vt>>>6)&31]+ot[vt>>>1&31]+ot[vt<<4&31]+"===="):$t===3?(vt=st[1],bt=st[2],Rt+=ot[xt>>>3]+ot[(xt<<2|vt>>>6)&31]+ot[vt>>>1&31]+ot[(vt<<4|bt>>>4)&31]+ot[bt<<1&31]+"==="):(vt=st[1],bt=st[2],Et=st[3],Rt+=ot[xt>>>3]+ot[(xt<<2|vt>>>6)&31]+ot[vt>>>1&31]+ot[(vt<<4|bt>>>4)&31]+ot[(bt<<1|Et>>>7)&31]+ot[Et>>>2&31]+ot[Et<<3&31]+"=")}while(!Tt);return Rt},pt=function(gt){for(var xt,vt,bt,Et,wt,kt="",Tt=gt.length,Rt=0,Pt=parseInt(Tt/5)*5;Rt>>3]+ot[(xt<<2|vt>>>6)&31]+ot[vt>>>1&31]+ot[(vt<<4|bt>>>4)&31]+ot[(bt<<1|Et>>>7)&31]+ot[Et>>>2&31]+ot[(Et<<3|wt>>>5)&31]+ot[wt&31];var $t=Tt-Pt;return $t===1?(xt=gt[Rt],kt+=ot[xt>>>3]+ot[xt<<2&31]+"======"):$t===2?(xt=gt[Rt++],vt=gt[Rt],kt+=ot[xt>>>3]+ot[(xt<<2|vt>>>6)&31]+ot[vt>>>1&31]+ot[vt<<4&31]+"===="):$t===3?(xt=gt[Rt++],vt=gt[Rt++],bt=gt[Rt],kt+=ot[xt>>>3]+ot[(xt<<2|vt>>>6)&31]+ot[vt>>>1&31]+ot[(vt<<4|bt>>>4)&31]+ot[bt<<1&31]+"==="):$t===4&&(xt=gt[Rt++],vt=gt[Rt++],bt=gt[Rt++],Et=gt[Rt],kt+=ot[xt>>>3]+ot[(xt<<2|vt>>>6)&31]+ot[vt>>>1&31]+ot[(vt<<4|bt>>>4)&31]+ot[(bt<<1|Et>>>7)&31]+ot[Et>>>2&31]+ot[Et<<3&31]+"="),kt},mt=function(gt,xt){var vt=typeof gt!="string";return vt&>.constructor===ArrayBuffer&&(gt=new Uint8Array(gt)),vt?pt(gt):xt?dt(gt):ht(gt)},ft=function(gt,xt){if(!xt)return ct(lt(gt));if(gt==="")return"";if(!/^[A-Z2-7=]+$/.test(gt))throw new Error("Invalid base32 characters");var vt,bt,Et,wt,kt,Tt,Rt,Pt,$t="",Ot=gt.indexOf("=");Ot===-1&&(Ot=gt.length);for(var Bt=0,zt=Ot>>3<<3;Bt>>2)&255)+String.fromCharCode((bt<<6|Et<<1|wt>>>4)&255)+String.fromCharCode((wt<<4|kt>>>1)&255)+String.fromCharCode((kt<<7|Tt<<2|Rt>>>3)&255)+String.fromCharCode((Rt<<5|Pt)&255);var Ft=Ot-zt;return Ft===2?(vt=it[gt.charAt(Bt++)],bt=it[gt.charAt(Bt++)],$t+=String.fromCharCode((vt<<3|bt>>>2)&255)):Ft===4?(vt=it[gt.charAt(Bt++)],bt=it[gt.charAt(Bt++)],Et=it[gt.charAt(Bt++)],wt=it[gt.charAt(Bt++)],$t+=String.fromCharCode((vt<<3|bt>>>2)&255)+String.fromCharCode((bt<<6|Et<<1|wt>>>4)&255)):Ft===5?(vt=it[gt.charAt(Bt++)],bt=it[gt.charAt(Bt++)],Et=it[gt.charAt(Bt++)],wt=it[gt.charAt(Bt++)],kt=it[gt.charAt(Bt++)],$t+=String.fromCharCode((vt<<3|bt>>>2)&255)+String.fromCharCode((bt<<6|Et<<1|wt>>>4)&255)+String.fromCharCode((wt<<4|kt>>>1)&255)):Ft===7&&(vt=it[gt.charAt(Bt++)],bt=it[gt.charAt(Bt++)],Et=it[gt.charAt(Bt++)],wt=it[gt.charAt(Bt++)],kt=it[gt.charAt(Bt++)],Tt=it[gt.charAt(Bt++)],Rt=it[gt.charAt(Bt++)],$t+=String.fromCharCode((vt<<3|bt>>>2)&255)+String.fromCharCode((bt<<6|Et<<1|wt>>>4)&255)+String.fromCharCode((wt<<4|kt>>>1)&255)+String.fromCharCode((kt<<7|Tt<<2|Rt>>>3)&255)),$t},yt={encode:mt,decode:ft};ft.asBytes=lt,rt?o.exports=yt:tt.base32=yt})()})(base32$1);var base32Exports=base32$1.exports;const base32=getDefaultExportFromCjs(base32Exports),Cr=class Cr{static parseAndVerifyRoot(et,tt){if(!et.startsWith(this.ROOT_PREFIX))throw new Error(`ENRTree root entry must start with '${this.ROOT_PREFIX}'`);const nt=Cr.parseRootValues(et),rt=base32.decode.asBytes(tt),ot=et.split(" sig")[0],it=utf8ToBytes$1(ot),st=fromString(nt.signature,"base64url").slice(0,64);if(!verifySignature(st,keccak256(it),new Uint8Array(rt)))throw new Error("Unable to verify ENRTree root signature");return nt.eRoot}static parseRootValues(et){const tt=et.match(/^enrtree-root:v1 e=([^ ]+) l=([^ ]+) seq=(\d+) sig=([^ ]+)$/);if(!Array.isArray(tt))throw new Error("Could not parse ENRTree root entry");tt.shift();const[nt,rt,ot,it]=tt;if(!nt)throw new Error("Could not parse 'e' value from ENRTree root entry");if(!rt)throw new Error("Could not parse 'l' value from ENRTree root entry");if(!ot)throw new Error("Could not parse 'seq' value from ENRTree root entry");if(!it)throw new Error("Could not parse 'sig' value from ENRTree root entry");return{eRoot:nt,lRoot:rt,seq:Number(ot),signature:it}}static parseTree(et){if(!et.startsWith(this.TREE_PREFIX))throw new Error(`ENRTree tree entry must start with '${this.TREE_PREFIX}'`);const tt=et.match(/^enrtree:\/\/([^@]+)@(.+)$/);if(!Array.isArray(tt))throw new Error("Could not parse ENRTree tree entry");tt.shift();const[nt,rt]=tt;if(!nt)throw new Error("Could not parse public key from ENRTree tree entry");if(!rt)throw new Error("Could not parse domain from ENRTree tree entry");return{publicKey:nt,domain:rt}}static parseBranch(et){if(!et.startsWith(this.BRANCH_PREFIX))throw new Error(`ENRTree branch entry must start with '${this.BRANCH_PREFIX}'`);return et.split(this.BRANCH_PREFIX)[1].split(",")}};Ct(Cr,"RECORD_PREFIX",ENR.RECORD_PREFIX),Ct(Cr,"TREE_PREFIX","enrtree:"),Ct(Cr,"BRANCH_PREFIX","enrtree-branch:"),Ct(Cr,"ROOT_PREFIX","enrtree-root:");let ENRTree=Cr;const log$6=new Logger$1("discovery:fetch_nodes");async function fetchNodesUntilCapabilitiesFulfilled(o,et,tt){const nt={relay:o.relay??0,store:o.store??0,filter:o.filter??0,lightPush:o.lightPush??0},rt=nt.relay+nt.store+nt.filter+nt.lightPush,ot={relay:0,store:0,filter:0,lightPush:0};let it=0;const st=[];for(;!isSatisfied(nt,ot)&&it=o.relay&&et.store>=o.store&&et.filter>=o.filter&&et.lightPush>=o.lightPush}function isNewPeer(o,et){if(!o.nodeId)return!1;for(const tt of et)if(o.nodeId===tt.nodeId)return!1;return!0}function addCapabilities(o,et){o.relay&&(et.relay+=1),o.store&&(et.store+=1),o.filter&&(et.filter+=1),o.lightPush&&(et.lightPush+=1)}function helpsSatisfyCapabilities(o,et,tt){if(isSatisfied(et,tt))throw"Internal Error: Waku2 wanted capabilities are already fulfilled";const nt=missingCapabilities(et,tt);return nt.relay&&o.relay||nt.store&&o.store||nt.filter&&o.filter||nt.lightPush&&o.lightPush}function missingCapabilities(o,et){return{relay:et.relaythis._search(ot,it));return log$5.info("retrieved peers: ",st.map(at=>{var ct,lt;return{id:(ct=at.peerId)==null?void 0:ct.toString(),multiaddrs:(lt=at.multiaddrs)==null?void 0:lt.map(dt=>dt.toString())}})),st}async*getNextPeer(et,tt){const nt=Math.floor(Math.random()*et.length),{publicKey:rt,domain:ot}=ENRTree.parseTree(et[nt]),it={domain:ot,publicKey:rt,visits:{}};for await(const st of yieldNodesUntilCapabilitiesFulfilled(tt,this._errorTolerance,()=>this._search(ot,it)))yield st}async _search(et,tt){try{const nt=await this._getTXTRecord(et,tt);tt.visits[et]=!0;let rt,ot;const it=getEntryType(nt);try{switch(it){case ENRTree.ROOT_PREFIX:return rt=ENRTree.parseAndVerifyRoot(nt,tt.publicKey),await this._search(rt,tt);case ENRTree.BRANCH_PREFIX:return ot=ENRTree.parseBranch(nt),rt=selectRandomPath(ot,tt),await this._search(rt,tt);case ENRTree.RECORD_PREFIX:return EnrDecoder.fromString(nt);default:return null}}catch(st){return log$5.error(`Failed to search DNS tree ${it} at subdomain ${et}: ${st}`),null}}catch(nt){return log$5.error(`Failed to retrieve TXT record at subdomain ${et}: ${nt}`),null}}async _getTXTRecord(et,tt){if(this._DNSTreeCache[et])return this._DNSTreeCache[et];const nt=et!==tt.domain?`${et}.${tt.domain}`:tt.domain,rt=await this.dns.resolveTXT(nt);if(!rt.length)throw new Error("Received empty result array while fetching TXT record");if(!rt[0].length)throw new Error("Received empty TXT record");const ot=rt.join("");return this._DNSTreeCache[et]=ot,ot}}function getEntryType(o){return o.startsWith(ENRTree.ROOT_PREFIX)?ENRTree.ROOT_PREFIX:o.startsWith(ENRTree.BRANCH_PREFIX)?ENRTree.BRANCH_PREFIX:o.startsWith(ENRTree.RECORD_PREFIX)?ENRTree.RECORD_PREFIX:""}function selectRandomPath(o,et){const tt={};for(const[rt,ot]of o.entries())et.visits[ot]&&(tt[rt]=!0);if(Object.keys(tt).length===o.length)throw new Error("Unresolvable circular path detected");let nt;do nt=Math.floor(Math.random()*o.length);while(tt[nt]);return o[nt]}const log$4=new Logger$1("peer-discovery-dns");class PeerDiscoveryDns extends TypedEventEmitter$3{constructor(tt,nt){super();Ct(this,"nextPeer");Ct(this,"_started");Ct(this,"_components");Ct(this,"_options");this._started=!1,this._components=tt,this._options=nt;const{enrUrls:rt}=nt;log$4.info("Use following EIP-1459 ENR Tree URLs: ",rt)}async start(){log$4.info("Starting peer discovery via dns"),this._started=!0,await this.findPeers()}async findPeers(){if(!this.nextPeer){let{enrUrls:tt}=this._options;Array.isArray(tt)||(tt=[tt]);const{wantedNodeCapabilityCount:nt}=this._options,rt=await DnsNodeDiscovery.dnsOverHttp();this.nextPeer=rt.getNextPeer.bind(rt,tt,nt)}for await(const tt of this.nextPeer()){if(!this._started)return;const{peerInfo:nt,shardInfo:rt}=tt;if(!nt)continue;const ot={[DEFAULT_BOOTSTRAP_TAG_NAME]:{value:this._options.tagValue??DEFAULT_BOOTSTRAP_TAG_VALUE,ttl:this._options.tagTTL??DEFAULT_BOOTSTRAP_TAG_TTL}};let it=!1;await this._components.peerStore.has(nt.id)?(await this._components.peerStore.get(nt.id)).tags.has(DEFAULT_BOOTSTRAP_TAG_NAME)||(it=!0,await this._components.peerStore.merge(nt.id,{tags:ot})):(it=!0,await this._components.peerStore.save(nt.id,{tags:ot,...rt&&{metadata:{shardInfo:encodeRelayShard(rt)}}})),it&&this.dispatchEvent(new CustomEvent("peer",{detail:nt}))}}stop(){this._started=!1}get[peerDiscoverySymbol$2](){return!0}get[Symbol.toStringTag](){return DNS_DISCOVERY_TAG}}function wakuDnsDiscovery(o,et=DEFAULT_NODE_REQUIREMENTS){return tt=>new PeerDiscoveryDns(tt,{enrUrls:o,wantedNodeCapabilityCount:et})}class PeerExchangeRPC{constructor(et){Ct(this,"proto");this.proto=et}static createRequest(et){const{numPeers:tt}=et;return new PeerExchangeRPC({query:{numPeers:tt},response:void 0})}encode(){return PeerExchangeRPC$1.encode(this.proto)}static decode(et){const tt=PeerExchangeRPC$1.decode(et);return new PeerExchangeRPC(tt)}get query(){return this.proto.query}get response(){return this.proto.response}}const PeerExchangeCodec="/vac/waku/peer-exchange/2.0.0-alpha1",log$3=new Logger$1("peer-exchange");class WakuPeerExchange extends BaseProtocol{constructor(et,tt){super(PeerExchangeCodec,et,log$3,tt)}async query(et){const{numPeers:tt,peerId:nt}=et,rt=PeerExchangeRPC.createRequest({numPeers:BigInt(tt)}),ot=await this.components.peerStore.get(nt);if(!ot)return{peerInfos:null,error:ProtocolError$1.NO_PEER_AVAILABLE};let it;try{it=await this.getStream(ot)}catch(at){return log$3.error("Failed to get stream",at),{peerInfos:null,error:ProtocolError$1.NO_STREAM_AVAILABLE}}const st=await pipe([rt.encode()],encode$5,it,decode$5,async at=>await all$2(at));try{const at=new Uint8ArrayList;st.forEach(dt=>{at.append(dt)});const{response:ct}=PeerExchangeRPC.decode(at);return ct?{peerInfos:await Promise.all(ct.peerInfos.map(dt=>dt.enr).filter(isDefined).map(async dt=>({ENR:await EnrDecoder.fromRLP(dt)}))),error:null}:(log$3.error("PeerExchangeRPC message did not contains a `response` field"),{peerInfos:null,error:ProtocolError$1.EMPTY_PAYLOAD})}catch(at){return log$3.error("Failed to decode push reply",at),{peerInfos:null,error:ProtocolError$1.DECODE_FAILED}}}}const log$2=new Logger$1("peer-exchange-discovery"),DEFAULT_PEER_EXCHANGE_REQUEST_NODES=10,DEFAULT_PEER_EXCHANGE_QUERY_INTERVAL_MS=10*1e3,DEFAULT_MAX_RETRIES=3,DEFAULT_PEER_EXCHANGE_TAG_NAME=Tags.PEER_EXCHANGE,DEFAULT_PEER_EXCHANGE_TAG_VALUE=50,DEFAULT_PEER_EXCHANGE_TAG_TTL=1e8;class PeerExchangeDiscovery extends TypedEventEmitter$3{constructor(tt,nt,rt={}){super();Ct(this,"components");Ct(this,"peerExchange");Ct(this,"options");Ct(this,"isStarted");Ct(this,"queryingPeers",new Set);Ct(this,"queryAttempts",new Map);Ct(this,"handleDiscoveredPeer",tt=>{const{protocols:nt,peerId:rt}=tt.detail;!nt.includes(PeerExchangeCodec)||this.queryingPeers.has(rt.toString())||(this.queryingPeers.add(rt.toString()),this.startRecurringQueries(rt).catch(ot=>log$2.error(`Error querying peer ${ot}`)))});Ct(this,"startRecurringQueries",async tt=>{const nt=tt.toString(),{queryInterval:rt=DEFAULT_PEER_EXCHANGE_QUERY_INTERVAL_MS,maxRetries:ot=DEFAULT_MAX_RETRIES}=this.options;log$2.info(`Querying peer: ${nt} (attempt ${this.queryAttempts.get(nt)??1})`),await this.query(tt);const it=this.queryAttempts.get(nt)??1;if(it>ot){this.abortQueriesForPeer(nt);return}setTimeout(()=>{this.queryAttempts.set(nt,it+1),this.startRecurringQueries(tt).catch(st=>{log$2.error(`Error in startRecurringQueries: ${st}`)})},rt*it)});this.components=tt,this.peerExchange=new WakuPeerExchange(tt,nt),this.options=rt,this.isStarted=!1}start(){this.isStarted||(this.dispatchEvent(new CustomEvent("waku:peer-exchange:started",{detail:!0})),log$2.info("Starting peer exchange node discovery, discovering peers"),this.components.events.addEventListener("peer:identify",this.handleDiscoveredPeer))}stop(){this.isStarted&&(log$2.info("Stopping peer exchange node discovery"),this.isStarted=!1,this.queryingPeers.clear(),this.components.events.removeEventListener("peer:identify",this.handleDiscoveredPeer))}get[peerDiscoverySymbol$2](){return!0}get[Symbol.toStringTag](){return"@waku/peer-exchange"}async query(tt){const{error:nt,peerInfos:rt}=await this.peerExchange.query({numPeers:DEFAULT_PEER_EXCHANGE_REQUEST_NODES,peerId:tt});if(nt)return log$2.error("Peer exchange query failed",nt),{error:nt,peerInfos:null};for(const ot of rt){const{ENR:it}=ot;if(!it){log$2.warn("No ENR in peerInfo object, skipping");continue}const{peerId:st,peerInfo:at,shardInfo:ct}=it;if(!st||!at)continue;if(await this.components.peerStore.has(st)){const{hasMultiaddrDiff:dt,hasShardDiff:ht}=await this.checkPeerInfoDiff(at,ct);if(dt||ht){log$2.info(`Peer ${st.toString()} has updated multiaddrs or shardInfo, updating`),dt&&(log$2.info(`Peer ${st.toString()} has updated multiaddrs, updating`),await this.components.peerStore.patch(st,{multiaddrs:at.multiaddrs})),ht&&ct&&(log$2.info(`Peer ${st.toString()} has updated shardInfo, updating`),await this.components.peerStore.merge(st,{metadata:{shardInfo:encodeRelayShard(ct)}}),this.dispatchEvent(new CustomEvent("peer",{detail:{id:st,multiaddrs:at.multiaddrs}})));continue}}await this.components.peerStore.save(st,{tags:{[DEFAULT_PEER_EXCHANGE_TAG_NAME]:{value:this.options.tagValue??DEFAULT_PEER_EXCHANGE_TAG_VALUE,ttl:this.options.tagTTL??DEFAULT_PEER_EXCHANGE_TAG_TTL}},...ct&&{metadata:{shardInfo:encodeRelayShard(ct)}},...at.multiaddrs&&{multiaddrs:at.multiaddrs}}),log$2.info(`Discovered peer: ${st.toString()}`),this.dispatchEvent(new CustomEvent("peer",{detail:{id:st,multiaddrs:at.multiaddrs}}))}return{error:null,peerInfos:rt}}abortQueriesForPeer(tt){log$2.info(`Aborting queries for peer: ${tt}`),this.queryingPeers.delete(tt),this.queryAttempts.delete(tt)}async checkPeerInfoDiff(tt,nt){const{id:rt}=tt,ot=await this.components.peerStore.get(rt),it=ot.addresses.map(dt=>dt.multiaddr.toString()),st=tt.multiaddrs.map(dt=>dt.toString()),at=it.some(dt=>!st.includes(dt));let ct=!1;const lt=ot.metadata.get("shardInfo");if(lt){const dt=decodeRelayShard(lt);(dt||nt)&&(ct=dt.clusterId!==(nt==null?void 0:nt.clusterId)||dt.shards.some(ht=>!(nt!=null&&nt.shards.includes(ht))))}return{hasMultiaddrDiff:at,hasShardDiff:ct}}}function wakuPeerExchangeDiscovery(o){return et=>new PeerExchangeDiscovery(et,o)}const log$1=new Logger$1("peer-exchange-discovery"),DEFAULT_LOCAL_TAG_NAME=Tags.LOCAL,DEFAULT_LOCAL_TAG_VALUE=50,DEFAULT_LOCAL_TAG_TTL=1e8;class LocalPeerCacheDiscovery extends TypedEventEmitter$3{constructor(tt,nt){super();Ct(this,"components");Ct(this,"options");Ct(this,"isStarted");Ct(this,"peers",[]);Ct(this,"handleNewPeers",tt=>{const{peerId:nt,listenAddrs:rt}=tt.detail,ot=getWsMultiaddrFromMultiaddrs(rt),it=this.getPeersFromLocalStorage(),st=it.findIndex(at=>at.id===nt.toString());st>=0?it[st].address=ot.toString():it.push({id:nt.toString(),address:ot.toString()}),this.peers=it,this.savePeersToLocalStorage()});this.components=tt,this.options=nt,this.isStarted=!1,this.peers=this.getPeersFromLocalStorage()}get[Symbol.toStringTag](){return"@waku/local-peer-cache-discovery"}async start(){var tt,nt,rt;if(!this.isStarted){log$1.info("Starting Local Storage Discovery"),this.components.events.addEventListener("peer:identify",this.handleNewPeers);for(const{id:ot,address:it}of this.peers){const st=peerIdFromString$1(ot);await this.components.peerStore.has(st)||(await this.components.peerStore.save(st,{multiaddrs:[multiaddr(it)],tags:{[((tt=this.options)==null?void 0:tt.tagName)??DEFAULT_LOCAL_TAG_NAME]:{value:((nt=this.options)==null?void 0:nt.tagValue)??DEFAULT_LOCAL_TAG_VALUE,ttl:((rt=this.options)==null?void 0:rt.tagTTL)??DEFAULT_LOCAL_TAG_TTL}}}),this.dispatchEvent(new CustomEvent("peer",{detail:{id:st,multiaddrs:[multiaddr(it)]}})))}log$1.info(`Discovered ${this.peers.length} peers`),this.isStarted=!0}}stop(){this.isStarted&&(log$1.info("Stopping Local Storage Discovery"),this.components.events.removeEventListener("peer:identify",this.handleNewPeers),this.isStarted=!1,this.savePeersToLocalStorage())}getPeersFromLocalStorage(){try{const tt=localStorage.getItem("waku:peers");return tt?JSON.parse(tt).filter(isValidStoredPeer):[]}catch(tt){return log$1.error("Error parsing peers from local storage:",tt),[]}}savePeersToLocalStorage(){try{localStorage.setItem("waku:peers",JSON.stringify(this.peers))}catch(tt){log$1.error("Error saving peers to local storage:",tt)}}}function isValidStoredPeer(o){return o&&typeof o=="object"&&typeof o.id=="string"&&typeof o.address=="string"}function wakuLocalPeerCacheDiscovery(){return(o,et)=>new LocalPeerCacheDiscovery(o,et)}function defaultPeerDiscoveries(o){const et=[enrTree.SANDBOX,enrTree.TEST];return[wakuDnsDiscovery(et),wakuLocalPeerCacheDiscovery(),wakuPeerExchangeDiscovery(o)]}const log=new Logger$1("sdk:create");async function defaultLibp2p(o,et,tt){et!=null&&et.hideWebSocketInfo||(console.info("%cIgnore WebSocket connection failures","background: gray; color: white; font-size: x-large"),console.info("%cWaku tries to discover peers and some of them are expected to fail","background: gray; color: white; font-size: x-large"));const nt=o?{metadata:wakuMetadata(o)}:{},rt=(et==null?void 0:et.filterMultiaddrs)===!1?all$1:wss;return createLibp2p({transports:[webSockets({filter:rt})],streamMuxers:[mplex()],connectionEncrypters:[noise()],...et,services:{identify:identify({agentVersion:tt??DefaultUserAgent}),ping:ping({maxInboundStreams:(et==null?void 0:et.pingMaxInboundStreams)??DefaultPingMaxInboundStreams}),...nt,...et==null?void 0:et.services}})}async function createLibp2pAndUpdateOptions(o){const{networkConfig:et}=o,tt=derivePubsubTopicsFromNetworkConfig(et??DefaultNetworkConfig);log.info("Creating Waku node with pubsub topics",tt);const nt=(o==null?void 0:o.libp2p)??{},rt=nt.peerDiscovery??[];return o!=null&&o.defaultBootstrap&&rt.push(...defaultPeerDiscoveries(tt)),o!=null&&o.bootstrapPeers&&rt.push(bootstrap({list:o.bootstrapPeers})),nt.peerDiscovery=rt,{libp2p:await defaultLibp2p(tt,nt,o==null?void 0:o.userAgent),pubsubTopics:tt}}async function createLightNode(o={}){const{libp2p:et,pubsubTopics:tt}=await createLibp2pAndUpdateOptions(o);return new WakuNode(tt,o,et,{store:!0,lightpush:!0,filter:!0})}React.createContext({decoder:void 0,encoder:void 0});const useCreateNode=o=>{const{factory:et,options:tt,protocols:nt=[]}=o,[rt,ot]=React.useState(void 0),[it,st]=React.useState(!0),[at,ct]=React.useState(void 0);return React.useEffect(()=>{let lt=!1;return st(!0),et(tt).then(async dt=>{lt||(await dt.start(),await waitForRemotePeer(dt,nt),ot(dt),st(!1))}).catch(dt=>{st(!1),ct(`Failed at creating node: ${(dt==null?void 0:dt.message)||"no message"}`)}),()=>{lt=!0}},[]),{node:rt,error:at,isLoading:it}},useCreateLightNode=o=>useCreateNode({...o,factory:createLightNode}),WakuContext=React.createContext({node:void 0,isLoading:!1,error:void 0}),useWaku=()=>React.useContext(WakuContext),LightNodeProvider=o=>{const et=useCreateLightNode({options:o.options,protocols:o.protocols});return React.createElement(WakuContext.Provider,{value:et},o.children)};/** + */(function(){var tt=typeof window=="object"?window:{},nt=!tt.HI_BASE32_NO_NODE_JS&&typeof et=="object"&&et.versions&&et.versions.node;nt&&(tt=globalThis);var rt=!tt.HI_BASE32_NO_COMMON_JS&&!0&&o.exports,ot="ABCDEFGHIJKLMNOPQRSTUVWXYZ234567".split(""),it={A:0,B:1,C:2,D:3,E:4,F:5,G:6,H:7,I:8,J:9,K:10,L:11,M:12,N:13,O:14,P:15,Q:16,R:17,S:18,T:19,U:20,V:21,W:22,X:23,Y:24,Z:25,2:26,3:27,4:28,5:29,6:30,7:31},st=[0,0,0,0,0,0,0,0],at=function(gt,xt){xt.length>10&&(xt="..."+xt.substr(-10));var vt=new Error("Decoded data is not valid UTF-8. Maybe try base32.decode.asBytes()? Partial data after reading "+gt+" bytes: "+xt+" <-");throw vt.position=gt,vt},ct=function(gt){for(var xt="",vt=gt.length,bt=0,Et=0,wt,kt;bt191&&wt<=223?(kt=wt&31,Et=1):wt<=239?(kt=wt&15,Et=2):wt<=247?(kt=wt&7,Et=3):at(bt,xt);for(var It=0;It191)&&at(bt,xt),kt<<=6,kt+=wt&63;kt>=55296&&kt<=57343&&at(bt,xt),kt>1114111&&at(bt,xt),kt<=65535?xt+=String.fromCharCode(kt):(kt-=65536,xt+=String.fromCharCode((kt>>10)+55296),xt+=String.fromCharCode((kt&1023)+56320))}return xt},lt=function(gt){if(gt==="")return[];if(!/^[A-Z2-7=]+$/.test(gt))throw new Error("Invalid base32 characters");gt=gt.replace(/=/g,"");for(var xt,vt,bt,Et,wt,kt,It,Rt,Pt=[],jt=0,Ot=gt.length,Bt=0,zt=Ot>>3<<3;Bt>>2)&255,Pt[jt++]=(vt<<6|bt<<1|Et>>>4)&255,Pt[jt++]=(Et<<4|wt>>>1)&255,Pt[jt++]=(wt<<7|kt<<2|It>>>3)&255,Pt[jt++]=(It<<5|Rt)&255;var Ft=Ot-zt;return Ft===2?(xt=it[gt.charAt(Bt++)],vt=it[gt.charAt(Bt++)],Pt[jt++]=(xt<<3|vt>>>2)&255):Ft===4?(xt=it[gt.charAt(Bt++)],vt=it[gt.charAt(Bt++)],bt=it[gt.charAt(Bt++)],Et=it[gt.charAt(Bt++)],Pt[jt++]=(xt<<3|vt>>>2)&255,Pt[jt++]=(vt<<6|bt<<1|Et>>>4)&255):Ft===5?(xt=it[gt.charAt(Bt++)],vt=it[gt.charAt(Bt++)],bt=it[gt.charAt(Bt++)],Et=it[gt.charAt(Bt++)],wt=it[gt.charAt(Bt++)],Pt[jt++]=(xt<<3|vt>>>2)&255,Pt[jt++]=(vt<<6|bt<<1|Et>>>4)&255,Pt[jt++]=(Et<<4|wt>>>1)&255):Ft===7&&(xt=it[gt.charAt(Bt++)],vt=it[gt.charAt(Bt++)],bt=it[gt.charAt(Bt++)],Et=it[gt.charAt(Bt++)],wt=it[gt.charAt(Bt++)],kt=it[gt.charAt(Bt++)],It=it[gt.charAt(Bt++)],Pt[jt++]=(xt<<3|vt>>>2)&255,Pt[jt++]=(vt<<6|bt<<1|Et>>>4)&255,Pt[jt++]=(Et<<4|wt>>>1)&255,Pt[jt++]=(wt<<7|kt<<2|It>>>3)&255),Pt},dt=function(gt){for(var xt,vt,bt,Et,wt,kt="",It=gt.length,Rt=0,Pt=parseInt(It/5)*5;Rt>>3]+ot[(xt<<2|vt>>>6)&31]+ot[vt>>>1&31]+ot[(vt<<4|bt>>>4)&31]+ot[(bt<<1|Et>>>7)&31]+ot[Et>>>2&31]+ot[(Et<<3|wt>>>5)&31]+ot[wt&31];var jt=It-Pt;return jt===1?(xt=gt.charCodeAt(Rt),kt+=ot[xt>>>3]+ot[xt<<2&31]+"======"):jt===2?(xt=gt.charCodeAt(Rt++),vt=gt.charCodeAt(Rt),kt+=ot[xt>>>3]+ot[(xt<<2|vt>>>6)&31]+ot[vt>>>1&31]+ot[vt<<4&31]+"===="):jt===3?(xt=gt.charCodeAt(Rt++),vt=gt.charCodeAt(Rt++),bt=gt.charCodeAt(Rt),kt+=ot[xt>>>3]+ot[(xt<<2|vt>>>6)&31]+ot[vt>>>1&31]+ot[(vt<<4|bt>>>4)&31]+ot[bt<<1&31]+"==="):jt===4&&(xt=gt.charCodeAt(Rt++),vt=gt.charCodeAt(Rt++),bt=gt.charCodeAt(Rt++),Et=gt.charCodeAt(Rt),kt+=ot[xt>>>3]+ot[(xt<<2|vt>>>6)&31]+ot[vt>>>1&31]+ot[(vt<<4|bt>>>4)&31]+ot[(bt<<1|Et>>>7)&31]+ot[Et>>>2&31]+ot[Et<<3&31]+"="),kt},ht=function(gt){var xt,vt,bt,Et,wt,kt,It=!1,Rt="",Pt=0,jt,Ot=0,Bt=gt.length;if(gt==="")return Rt;do{for(st[0]=st[5],st[1]=st[6],st[2]=st[7],jt=Ot;Pt>6,st[jt++]=128|kt&63):kt<55296||kt>=57344?(st[jt++]=224|kt>>12,st[jt++]=128|kt>>6&63,st[jt++]=128|kt&63):(kt=65536+((kt&1023)<<10|gt.charCodeAt(++Pt)&1023),st[jt++]=240|kt>>18,st[jt++]=128|kt>>12&63,st[jt++]=128|kt>>6&63,st[jt++]=128|kt&63);Ot=jt-5,Pt===Bt&&++Pt,Pt>Bt&&jt<6&&(It=!0),xt=st[0],jt>4?(vt=st[1],bt=st[2],Et=st[3],wt=st[4],Rt+=ot[xt>>>3]+ot[(xt<<2|vt>>>6)&31]+ot[vt>>>1&31]+ot[(vt<<4|bt>>>4)&31]+ot[(bt<<1|Et>>>7)&31]+ot[Et>>>2&31]+ot[(Et<<3|wt>>>5)&31]+ot[wt&31]):jt===1?Rt+=ot[xt>>>3]+ot[xt<<2&31]+"======":jt===2?(vt=st[1],Rt+=ot[xt>>>3]+ot[(xt<<2|vt>>>6)&31]+ot[vt>>>1&31]+ot[vt<<4&31]+"===="):jt===3?(vt=st[1],bt=st[2],Rt+=ot[xt>>>3]+ot[(xt<<2|vt>>>6)&31]+ot[vt>>>1&31]+ot[(vt<<4|bt>>>4)&31]+ot[bt<<1&31]+"==="):(vt=st[1],bt=st[2],Et=st[3],Rt+=ot[xt>>>3]+ot[(xt<<2|vt>>>6)&31]+ot[vt>>>1&31]+ot[(vt<<4|bt>>>4)&31]+ot[(bt<<1|Et>>>7)&31]+ot[Et>>>2&31]+ot[Et<<3&31]+"=")}while(!It);return Rt},pt=function(gt){for(var xt,vt,bt,Et,wt,kt="",It=gt.length,Rt=0,Pt=parseInt(It/5)*5;Rt>>3]+ot[(xt<<2|vt>>>6)&31]+ot[vt>>>1&31]+ot[(vt<<4|bt>>>4)&31]+ot[(bt<<1|Et>>>7)&31]+ot[Et>>>2&31]+ot[(Et<<3|wt>>>5)&31]+ot[wt&31];var jt=It-Pt;return jt===1?(xt=gt[Rt],kt+=ot[xt>>>3]+ot[xt<<2&31]+"======"):jt===2?(xt=gt[Rt++],vt=gt[Rt],kt+=ot[xt>>>3]+ot[(xt<<2|vt>>>6)&31]+ot[vt>>>1&31]+ot[vt<<4&31]+"===="):jt===3?(xt=gt[Rt++],vt=gt[Rt++],bt=gt[Rt],kt+=ot[xt>>>3]+ot[(xt<<2|vt>>>6)&31]+ot[vt>>>1&31]+ot[(vt<<4|bt>>>4)&31]+ot[bt<<1&31]+"==="):jt===4&&(xt=gt[Rt++],vt=gt[Rt++],bt=gt[Rt++],Et=gt[Rt],kt+=ot[xt>>>3]+ot[(xt<<2|vt>>>6)&31]+ot[vt>>>1&31]+ot[(vt<<4|bt>>>4)&31]+ot[(bt<<1|Et>>>7)&31]+ot[Et>>>2&31]+ot[Et<<3&31]+"="),kt},mt=function(gt,xt){var vt=typeof gt!="string";return vt&>.constructor===ArrayBuffer&&(gt=new Uint8Array(gt)),vt?pt(gt):xt?dt(gt):ht(gt)},ft=function(gt,xt){if(!xt)return ct(lt(gt));if(gt==="")return"";if(!/^[A-Z2-7=]+$/.test(gt))throw new Error("Invalid base32 characters");var vt,bt,Et,wt,kt,It,Rt,Pt,jt="",Ot=gt.indexOf("=");Ot===-1&&(Ot=gt.length);for(var Bt=0,zt=Ot>>3<<3;Bt>>2)&255)+String.fromCharCode((bt<<6|Et<<1|wt>>>4)&255)+String.fromCharCode((wt<<4|kt>>>1)&255)+String.fromCharCode((kt<<7|It<<2|Rt>>>3)&255)+String.fromCharCode((Rt<<5|Pt)&255);var Ft=Ot-zt;return Ft===2?(vt=it[gt.charAt(Bt++)],bt=it[gt.charAt(Bt++)],jt+=String.fromCharCode((vt<<3|bt>>>2)&255)):Ft===4?(vt=it[gt.charAt(Bt++)],bt=it[gt.charAt(Bt++)],Et=it[gt.charAt(Bt++)],wt=it[gt.charAt(Bt++)],jt+=String.fromCharCode((vt<<3|bt>>>2)&255)+String.fromCharCode((bt<<6|Et<<1|wt>>>4)&255)):Ft===5?(vt=it[gt.charAt(Bt++)],bt=it[gt.charAt(Bt++)],Et=it[gt.charAt(Bt++)],wt=it[gt.charAt(Bt++)],kt=it[gt.charAt(Bt++)],jt+=String.fromCharCode((vt<<3|bt>>>2)&255)+String.fromCharCode((bt<<6|Et<<1|wt>>>4)&255)+String.fromCharCode((wt<<4|kt>>>1)&255)):Ft===7&&(vt=it[gt.charAt(Bt++)],bt=it[gt.charAt(Bt++)],Et=it[gt.charAt(Bt++)],wt=it[gt.charAt(Bt++)],kt=it[gt.charAt(Bt++)],It=it[gt.charAt(Bt++)],Rt=it[gt.charAt(Bt++)],jt+=String.fromCharCode((vt<<3|bt>>>2)&255)+String.fromCharCode((bt<<6|Et<<1|wt>>>4)&255)+String.fromCharCode((wt<<4|kt>>>1)&255)+String.fromCharCode((kt<<7|It<<2|Rt>>>3)&255)),jt},yt={encode:mt,decode:ft};ft.asBytes=lt,rt?o.exports=yt:tt.base32=yt})()})(base32$1);var base32Exports=base32$1.exports;const base32=getDefaultExportFromCjs(base32Exports),Cr=class Cr{static parseAndVerifyRoot(et,tt){if(!et.startsWith(this.ROOT_PREFIX))throw new Error(`ENRTree root entry must start with '${this.ROOT_PREFIX}'`);const nt=Cr.parseRootValues(et),rt=base32.decode.asBytes(tt),ot=et.split(" sig")[0],it=utf8ToBytes$1(ot),st=fromString(nt.signature,"base64url").slice(0,64);if(!verifySignature(st,keccak256(it),new Uint8Array(rt)))throw new Error("Unable to verify ENRTree root signature");return nt.eRoot}static parseRootValues(et){const tt=et.match(/^enrtree-root:v1 e=([^ ]+) l=([^ ]+) seq=(\d+) sig=([^ ]+)$/);if(!Array.isArray(tt))throw new Error("Could not parse ENRTree root entry");tt.shift();const[nt,rt,ot,it]=tt;if(!nt)throw new Error("Could not parse 'e' value from ENRTree root entry");if(!rt)throw new Error("Could not parse 'l' value from ENRTree root entry");if(!ot)throw new Error("Could not parse 'seq' value from ENRTree root entry");if(!it)throw new Error("Could not parse 'sig' value from ENRTree root entry");return{eRoot:nt,lRoot:rt,seq:Number(ot),signature:it}}static parseTree(et){if(!et.startsWith(this.TREE_PREFIX))throw new Error(`ENRTree tree entry must start with '${this.TREE_PREFIX}'`);const tt=et.match(/^enrtree:\/\/([^@]+)@(.+)$/);if(!Array.isArray(tt))throw new Error("Could not parse ENRTree tree entry");tt.shift();const[nt,rt]=tt;if(!nt)throw new Error("Could not parse public key from ENRTree tree entry");if(!rt)throw new Error("Could not parse domain from ENRTree tree entry");return{publicKey:nt,domain:rt}}static parseBranch(et){if(!et.startsWith(this.BRANCH_PREFIX))throw new Error(`ENRTree branch entry must start with '${this.BRANCH_PREFIX}'`);return et.split(this.BRANCH_PREFIX)[1].split(",")}};Ct(Cr,"RECORD_PREFIX",ENR.RECORD_PREFIX),Ct(Cr,"TREE_PREFIX","enrtree:"),Ct(Cr,"BRANCH_PREFIX","enrtree-branch:"),Ct(Cr,"ROOT_PREFIX","enrtree-root:");let ENRTree=Cr;const log$6=new Logger$1("discovery:fetch_nodes");async function fetchNodesUntilCapabilitiesFulfilled(o,et,tt){const nt={relay:o.relay??0,store:o.store??0,filter:o.filter??0,lightPush:o.lightPush??0},rt=nt.relay+nt.store+nt.filter+nt.lightPush,ot={relay:0,store:0,filter:0,lightPush:0};let it=0;const st=[];for(;!isSatisfied(nt,ot)&&it=o.relay&&et.store>=o.store&&et.filter>=o.filter&&et.lightPush>=o.lightPush}function isNewPeer(o,et){if(!o.nodeId)return!1;for(const tt of et)if(o.nodeId===tt.nodeId)return!1;return!0}function addCapabilities(o,et){o.relay&&(et.relay+=1),o.store&&(et.store+=1),o.filter&&(et.filter+=1),o.lightPush&&(et.lightPush+=1)}function helpsSatisfyCapabilities(o,et,tt){if(isSatisfied(et,tt))throw"Internal Error: Waku2 wanted capabilities are already fulfilled";const nt=missingCapabilities(et,tt);return nt.relay&&o.relay||nt.store&&o.store||nt.filter&&o.filter||nt.lightPush&&o.lightPush}function missingCapabilities(o,et){return{relay:et.relaythis._search(ot,it));return log$5.info("retrieved peers: ",st.map(at=>{var ct,lt;return{id:(ct=at.peerId)==null?void 0:ct.toString(),multiaddrs:(lt=at.multiaddrs)==null?void 0:lt.map(dt=>dt.toString())}})),st}async*getNextPeer(et,tt){const nt=Math.floor(Math.random()*et.length),{publicKey:rt,domain:ot}=ENRTree.parseTree(et[nt]),it={domain:ot,publicKey:rt,visits:{}};for await(const st of yieldNodesUntilCapabilitiesFulfilled(tt,this._errorTolerance,()=>this._search(ot,it)))yield st}async _search(et,tt){try{const nt=await this._getTXTRecord(et,tt);tt.visits[et]=!0;let rt,ot;const it=getEntryType(nt);try{switch(it){case ENRTree.ROOT_PREFIX:return rt=ENRTree.parseAndVerifyRoot(nt,tt.publicKey),await this._search(rt,tt);case ENRTree.BRANCH_PREFIX:return ot=ENRTree.parseBranch(nt),rt=selectRandomPath(ot,tt),await this._search(rt,tt);case ENRTree.RECORD_PREFIX:return EnrDecoder.fromString(nt);default:return null}}catch(st){return log$5.error(`Failed to search DNS tree ${it} at subdomain ${et}: ${st}`),null}}catch(nt){return log$5.error(`Failed to retrieve TXT record at subdomain ${et}: ${nt}`),null}}async _getTXTRecord(et,tt){if(this._DNSTreeCache[et])return this._DNSTreeCache[et];const nt=et!==tt.domain?`${et}.${tt.domain}`:tt.domain,rt=await this.dns.resolveTXT(nt);if(!rt.length)throw new Error("Received empty result array while fetching TXT record");if(!rt[0].length)throw new Error("Received empty TXT record");const ot=rt.join("");return this._DNSTreeCache[et]=ot,ot}}function getEntryType(o){return o.startsWith(ENRTree.ROOT_PREFIX)?ENRTree.ROOT_PREFIX:o.startsWith(ENRTree.BRANCH_PREFIX)?ENRTree.BRANCH_PREFIX:o.startsWith(ENRTree.RECORD_PREFIX)?ENRTree.RECORD_PREFIX:""}function selectRandomPath(o,et){const tt={};for(const[rt,ot]of o.entries())et.visits[ot]&&(tt[rt]=!0);if(Object.keys(tt).length===o.length)throw new Error("Unresolvable circular path detected");let nt;do nt=Math.floor(Math.random()*o.length);while(tt[nt]);return o[nt]}const log$4=new Logger$1("peer-discovery-dns");class PeerDiscoveryDns extends TypedEventEmitter$3{constructor(tt,nt){super();Ct(this,"nextPeer");Ct(this,"_started");Ct(this,"_components");Ct(this,"_options");this._started=!1,this._components=tt,this._options=nt;const{enrUrls:rt}=nt;log$4.info("Use following EIP-1459 ENR Tree URLs: ",rt)}async start(){log$4.info("Starting peer discovery via dns"),this._started=!0,await this.findPeers()}async findPeers(){if(!this.nextPeer){let{enrUrls:tt}=this._options;Array.isArray(tt)||(tt=[tt]);const{wantedNodeCapabilityCount:nt}=this._options,rt=await DnsNodeDiscovery.dnsOverHttp();this.nextPeer=rt.getNextPeer.bind(rt,tt,nt)}for await(const tt of this.nextPeer()){if(!this._started)return;const{peerInfo:nt,shardInfo:rt}=tt;if(!nt)continue;const ot={[DEFAULT_BOOTSTRAP_TAG_NAME]:{value:this._options.tagValue??DEFAULT_BOOTSTRAP_TAG_VALUE,ttl:this._options.tagTTL??DEFAULT_BOOTSTRAP_TAG_TTL}};let it=!1;await this._components.peerStore.has(nt.id)?(await this._components.peerStore.get(nt.id)).tags.has(DEFAULT_BOOTSTRAP_TAG_NAME)||(it=!0,await this._components.peerStore.merge(nt.id,{tags:ot})):(it=!0,await this._components.peerStore.save(nt.id,{tags:ot,...rt&&{metadata:{shardInfo:encodeRelayShard(rt)}}})),it&&this.dispatchEvent(new CustomEvent("peer",{detail:nt}))}}stop(){this._started=!1}get[peerDiscoverySymbol$2](){return!0}get[Symbol.toStringTag](){return DNS_DISCOVERY_TAG}}function wakuDnsDiscovery(o,et=DEFAULT_NODE_REQUIREMENTS){return tt=>new PeerDiscoveryDns(tt,{enrUrls:o,wantedNodeCapabilityCount:et})}class PeerExchangeRPC{constructor(et){Ct(this,"proto");this.proto=et}static createRequest(et){const{numPeers:tt}=et;return new PeerExchangeRPC({query:{numPeers:tt},response:void 0})}encode(){return PeerExchangeRPC$1.encode(this.proto)}static decode(et){const tt=PeerExchangeRPC$1.decode(et);return new PeerExchangeRPC(tt)}get query(){return this.proto.query}get response(){return this.proto.response}}const PeerExchangeCodec="/vac/waku/peer-exchange/2.0.0-alpha1",log$3=new Logger$1("peer-exchange");class WakuPeerExchange extends BaseProtocol{constructor(et,tt){super(PeerExchangeCodec,et,log$3,tt)}async query(et){const{numPeers:tt,peerId:nt}=et,rt=PeerExchangeRPC.createRequest({numPeers:BigInt(tt)}),ot=await this.components.peerStore.get(nt);if(!ot)return{peerInfos:null,error:ProtocolError$1.NO_PEER_AVAILABLE};let it;try{it=await this.getStream(ot)}catch(at){return log$3.error("Failed to get stream",at),{peerInfos:null,error:ProtocolError$1.NO_STREAM_AVAILABLE}}const st=await pipe([rt.encode()],encode$5,it,decode$5,async at=>await all$2(at));try{const at=new Uint8ArrayList;st.forEach(dt=>{at.append(dt)});const{response:ct}=PeerExchangeRPC.decode(at);return ct?{peerInfos:await Promise.all(ct.peerInfos.map(dt=>dt.enr).filter(isDefined).map(async dt=>({ENR:await EnrDecoder.fromRLP(dt)}))),error:null}:(log$3.error("PeerExchangeRPC message did not contains a `response` field"),{peerInfos:null,error:ProtocolError$1.EMPTY_PAYLOAD})}catch(at){return log$3.error("Failed to decode push reply",at),{peerInfos:null,error:ProtocolError$1.DECODE_FAILED}}}}const log$2=new Logger$1("peer-exchange-discovery"),DEFAULT_PEER_EXCHANGE_REQUEST_NODES=10,DEFAULT_PEER_EXCHANGE_QUERY_INTERVAL_MS=10*1e3,DEFAULT_MAX_RETRIES=3,DEFAULT_PEER_EXCHANGE_TAG_NAME=Tags.PEER_EXCHANGE,DEFAULT_PEER_EXCHANGE_TAG_VALUE=50,DEFAULT_PEER_EXCHANGE_TAG_TTL=1e8;class PeerExchangeDiscovery extends TypedEventEmitter$3{constructor(tt,nt,rt={}){super();Ct(this,"components");Ct(this,"peerExchange");Ct(this,"options");Ct(this,"isStarted");Ct(this,"queryingPeers",new Set);Ct(this,"queryAttempts",new Map);Ct(this,"handleDiscoveredPeer",tt=>{const{protocols:nt,peerId:rt}=tt.detail;!nt.includes(PeerExchangeCodec)||this.queryingPeers.has(rt.toString())||(this.queryingPeers.add(rt.toString()),this.startRecurringQueries(rt).catch(ot=>log$2.error(`Error querying peer ${ot}`)))});Ct(this,"startRecurringQueries",async tt=>{const nt=tt.toString(),{queryInterval:rt=DEFAULT_PEER_EXCHANGE_QUERY_INTERVAL_MS,maxRetries:ot=DEFAULT_MAX_RETRIES}=this.options;log$2.info(`Querying peer: ${nt} (attempt ${this.queryAttempts.get(nt)??1})`),await this.query(tt);const it=this.queryAttempts.get(nt)??1;if(it>ot){this.abortQueriesForPeer(nt);return}setTimeout(()=>{this.queryAttempts.set(nt,it+1),this.startRecurringQueries(tt).catch(st=>{log$2.error(`Error in startRecurringQueries: ${st}`)})},rt*it)});this.components=tt,this.peerExchange=new WakuPeerExchange(tt,nt),this.options=rt,this.isStarted=!1}start(){this.isStarted||(this.dispatchEvent(new CustomEvent("waku:peer-exchange:started",{detail:!0})),log$2.info("Starting peer exchange node discovery, discovering peers"),this.components.events.addEventListener("peer:identify",this.handleDiscoveredPeer))}stop(){this.isStarted&&(log$2.info("Stopping peer exchange node discovery"),this.isStarted=!1,this.queryingPeers.clear(),this.components.events.removeEventListener("peer:identify",this.handleDiscoveredPeer))}get[peerDiscoverySymbol$2](){return!0}get[Symbol.toStringTag](){return"@waku/peer-exchange"}async query(tt){const{error:nt,peerInfos:rt}=await this.peerExchange.query({numPeers:DEFAULT_PEER_EXCHANGE_REQUEST_NODES,peerId:tt});if(nt)return log$2.error("Peer exchange query failed",nt),{error:nt,peerInfos:null};for(const ot of rt){const{ENR:it}=ot;if(!it){log$2.warn("No ENR in peerInfo object, skipping");continue}const{peerId:st,peerInfo:at,shardInfo:ct}=it;if(!st||!at)continue;if(await this.components.peerStore.has(st)){const{hasMultiaddrDiff:dt,hasShardDiff:ht}=await this.checkPeerInfoDiff(at,ct);if(dt||ht){log$2.info(`Peer ${st.toString()} has updated multiaddrs or shardInfo, updating`),dt&&(log$2.info(`Peer ${st.toString()} has updated multiaddrs, updating`),await this.components.peerStore.patch(st,{multiaddrs:at.multiaddrs})),ht&&ct&&(log$2.info(`Peer ${st.toString()} has updated shardInfo, updating`),await this.components.peerStore.merge(st,{metadata:{shardInfo:encodeRelayShard(ct)}}),this.dispatchEvent(new CustomEvent("peer",{detail:{id:st,multiaddrs:at.multiaddrs}})));continue}}await this.components.peerStore.save(st,{tags:{[DEFAULT_PEER_EXCHANGE_TAG_NAME]:{value:this.options.tagValue??DEFAULT_PEER_EXCHANGE_TAG_VALUE,ttl:this.options.tagTTL??DEFAULT_PEER_EXCHANGE_TAG_TTL}},...ct&&{metadata:{shardInfo:encodeRelayShard(ct)}},...at.multiaddrs&&{multiaddrs:at.multiaddrs}}),log$2.info(`Discovered peer: ${st.toString()}`),this.dispatchEvent(new CustomEvent("peer",{detail:{id:st,multiaddrs:at.multiaddrs}}))}return{error:null,peerInfos:rt}}abortQueriesForPeer(tt){log$2.info(`Aborting queries for peer: ${tt}`),this.queryingPeers.delete(tt),this.queryAttempts.delete(tt)}async checkPeerInfoDiff(tt,nt){const{id:rt}=tt,ot=await this.components.peerStore.get(rt),it=ot.addresses.map(dt=>dt.multiaddr.toString()),st=tt.multiaddrs.map(dt=>dt.toString()),at=it.some(dt=>!st.includes(dt));let ct=!1;const lt=ot.metadata.get("shardInfo");if(lt){const dt=decodeRelayShard(lt);(dt||nt)&&(ct=dt.clusterId!==(nt==null?void 0:nt.clusterId)||dt.shards.some(ht=>!(nt!=null&&nt.shards.includes(ht))))}return{hasMultiaddrDiff:at,hasShardDiff:ct}}}function wakuPeerExchangeDiscovery(o){return et=>new PeerExchangeDiscovery(et,o)}const log$1=new Logger$1("peer-exchange-discovery"),DEFAULT_LOCAL_TAG_NAME=Tags.LOCAL,DEFAULT_LOCAL_TAG_VALUE=50,DEFAULT_LOCAL_TAG_TTL=1e8;class LocalPeerCacheDiscovery extends TypedEventEmitter$3{constructor(tt,nt){super();Ct(this,"components");Ct(this,"options");Ct(this,"isStarted");Ct(this,"peers",[]);Ct(this,"handleNewPeers",tt=>{const{peerId:nt,listenAddrs:rt}=tt.detail,ot=getWsMultiaddrFromMultiaddrs(rt),it=this.getPeersFromLocalStorage(),st=it.findIndex(at=>at.id===nt.toString());st>=0?it[st].address=ot.toString():it.push({id:nt.toString(),address:ot.toString()}),this.peers=it,this.savePeersToLocalStorage()});this.components=tt,this.options=nt,this.isStarted=!1,this.peers=this.getPeersFromLocalStorage()}get[Symbol.toStringTag](){return"@waku/local-peer-cache-discovery"}async start(){var tt,nt,rt;if(!this.isStarted){log$1.info("Starting Local Storage Discovery"),this.components.events.addEventListener("peer:identify",this.handleNewPeers);for(const{id:ot,address:it}of this.peers){const st=peerIdFromString$1(ot);await this.components.peerStore.has(st)||(await this.components.peerStore.save(st,{multiaddrs:[multiaddr(it)],tags:{[((tt=this.options)==null?void 0:tt.tagName)??DEFAULT_LOCAL_TAG_NAME]:{value:((nt=this.options)==null?void 0:nt.tagValue)??DEFAULT_LOCAL_TAG_VALUE,ttl:((rt=this.options)==null?void 0:rt.tagTTL)??DEFAULT_LOCAL_TAG_TTL}}}),this.dispatchEvent(new CustomEvent("peer",{detail:{id:st,multiaddrs:[multiaddr(it)]}})))}log$1.info(`Discovered ${this.peers.length} peers`),this.isStarted=!0}}stop(){this.isStarted&&(log$1.info("Stopping Local Storage Discovery"),this.components.events.removeEventListener("peer:identify",this.handleNewPeers),this.isStarted=!1,this.savePeersToLocalStorage())}getPeersFromLocalStorage(){try{const tt=localStorage.getItem("waku:peers");return tt?JSON.parse(tt).filter(isValidStoredPeer):[]}catch(tt){return log$1.error("Error parsing peers from local storage:",tt),[]}}savePeersToLocalStorage(){try{localStorage.setItem("waku:peers",JSON.stringify(this.peers))}catch(tt){log$1.error("Error saving peers to local storage:",tt)}}}function isValidStoredPeer(o){return o&&typeof o=="object"&&typeof o.id=="string"&&typeof o.address=="string"}function wakuLocalPeerCacheDiscovery(){return(o,et)=>new LocalPeerCacheDiscovery(o,et)}function defaultPeerDiscoveries(o){const et=[enrTree.SANDBOX,enrTree.TEST];return[wakuDnsDiscovery(et),wakuLocalPeerCacheDiscovery(),wakuPeerExchangeDiscovery(o)]}const log=new Logger$1("sdk:create");async function defaultLibp2p(o,et,tt){et!=null&&et.hideWebSocketInfo||(console.info("%cIgnore WebSocket connection failures","background: gray; color: white; font-size: x-large"),console.info("%cWaku tries to discover peers and some of them are expected to fail","background: gray; color: white; font-size: x-large"));const nt=o?{metadata:wakuMetadata(o)}:{},rt=(et==null?void 0:et.filterMultiaddrs)===!1?all$1:wss;return createLibp2p({transports:[webSockets({filter:rt})],streamMuxers:[mplex()],connectionEncrypters:[noise()],...et,services:{identify:identify({agentVersion:tt??DefaultUserAgent}),ping:ping({maxInboundStreams:(et==null?void 0:et.pingMaxInboundStreams)??DefaultPingMaxInboundStreams}),...nt,...et==null?void 0:et.services}})}async function createLibp2pAndUpdateOptions(o){const{networkConfig:et}=o,tt=derivePubsubTopicsFromNetworkConfig(et??DefaultNetworkConfig);log.info("Creating Waku node with pubsub topics",tt);const nt=(o==null?void 0:o.libp2p)??{},rt=nt.peerDiscovery??[];return o!=null&&o.defaultBootstrap&&rt.push(...defaultPeerDiscoveries(tt)),o!=null&&o.bootstrapPeers&&rt.push(bootstrap({list:o.bootstrapPeers})),nt.peerDiscovery=rt,{libp2p:await defaultLibp2p(tt,nt,o==null?void 0:o.userAgent),pubsubTopics:tt}}async function createLightNode(o={}){const{libp2p:et,pubsubTopics:tt}=await createLibp2pAndUpdateOptions(o);return new WakuNode(tt,o,et,{store:!0,lightpush:!0,filter:!0})}React.createContext({decoder:void 0,encoder:void 0});const useCreateNode=o=>{const{factory:et,options:tt,protocols:nt=[]}=o,[rt,ot]=React.useState(void 0),[it,st]=React.useState(!0),[at,ct]=React.useState(void 0);return React.useEffect(()=>{let lt=!1;return st(!0),et(tt).then(async dt=>{lt||(await dt.start(),await waitForRemotePeer(dt,nt),ot(dt),st(!1))}).catch(dt=>{st(!1),ct(`Failed at creating node: ${(dt==null?void 0:dt.message)||"no message"}`)}),()=>{lt=!0}},[]),{node:rt,error:at,isLoading:it}},useCreateLightNode=o=>useCreateNode({...o,factory:createLightNode}),WakuContext=React.createContext({node:void 0,isLoading:!1,error:void 0}),useWaku=()=>React.useContext(WakuContext),LightNodeProvider=o=>{const et=useCreateLightNode({options:o.options,protocols:o.protocols});return React.createElement(WakuContext.Provider,{value:et},o.children)};/** * @license lucide-react v0.453.0 - ISC * * This source code is licensed under the ISC license. @@ -4077,12 +4077,22 @@ https://www.dnscrypt.uk`,country:"United Kingdom",location:{lat:51.4964,long:-.1 * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. + */const CircleCheck=createLucideIcon("CircleCheck",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/** + * @license lucide-react v0.453.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const CircleX=createLucideIcon("CircleX",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]);/** + * @license lucide-react v0.453.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. */const Copy=createLucideIcon("Copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);/** * @license lucide-react v0.453.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. - */const LoaderCircle=createLucideIcon("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]),Header=({wakuStatus:o})=>{const{address:et,isConnected:tt}=useAccount(),{disconnect:nt}=useDisconnect(),{isLoading:rt,error:ot,node:it}=useWaku(),[st,at]=reactExports.useState(0),ct=useLocation(),{data:lt}=useEnsName({address:et});reactExports.useEffect(()=>{if(it){const ht=()=>{at(it.libp2p.getConnections().length)};return ht(),it.libp2p.addEventListener("peer:connect",ht),it.libp2p.addEventListener("peer:disconnect",ht),()=>{it.libp2p.removeEventListener("peer:connect",ht),it.libp2p.removeEventListener("peer:disconnect",ht)}}},[it]);const dt=ht=>{switch(ht){case"success":return"bg-green-500";case"in-progress":return"bg-yellow-500";case"error":return"bg-red-500"}};return jsxRuntimeExports.jsx("header",{className:"sticky top-0 z-50 w-full border-b bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/60",children:jsxRuntimeExports.jsx("div",{className:"container",children:jsxRuntimeExports.jsx("div",{className:"h-14",children:jsxRuntimeExports.jsxs("div",{className:"flex h-14 items-center justify-between gap-4",children:[jsxRuntimeExports.jsxs("nav",{className:"flex items-center gap-2 md:gap-4",children:[jsxRuntimeExports.jsx(Link,{to:"",className:`text-sm font-medium ${ct.pathname===""?"text-foreground":"text-muted-foreground"}`,children:"Home"}),jsxRuntimeExports.jsx(Link,{to:"create",className:`text-sm font-medium ${ct.pathname==="/create"?"text-foreground":"text-muted-foreground"}`,children:"Create"}),jsxRuntimeExports.jsx(Link,{to:"view",className:`text-sm font-medium ${ct.pathname==="/view"?"text-foreground":"text-muted-foreground"}`,children:"View"})]}),jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-2 md:gap-4",children:[jsxRuntimeExports.jsx("div",{className:"hidden md:flex items-center gap-2",children:!rt&&!ot&&jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsxs("div",{className:"flex items-center space-x-1",children:[jsxRuntimeExports.jsx("span",{className:"text-muted-foreground",children:"Filter:"}),jsxRuntimeExports.jsx("div",{className:`w-2 h-2 md:w-3 md:h-3 rounded-full ${dt(o.filter)}`})]}),jsxRuntimeExports.jsxs("div",{className:"flex items-center space-x-1",children:[jsxRuntimeExports.jsx("span",{className:"text-muted-foreground",children:"Store:"}),jsxRuntimeExports.jsx("div",{className:`w-2 h-2 md:w-3 md:h-3 rounded-full ${dt(o.store)}`})]})]})}),jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-2",children:[rt?jsxRuntimeExports.jsx(LoaderCircle,{className:"h-4 w-4 animate-spin"}):ot?jsxRuntimeExports.jsx("span",{className:"text-xs text-red-500",children:"Error"}):jsxRuntimeExports.jsx("div",{className:`w-2 h-2 rounded-full ${st>0?"bg-green-500":"bg-yellow-500"}`}),tt?jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntimeExports.jsx("span",{className:"text-xs md:text-sm text-muted-foreground truncate max-w-[80px] md:max-w-[120px]",children:lt||(et?`${et.slice(0,4)}...${et.slice(-4)}`:"")}),jsxRuntimeExports.jsxs(Button,{variant:"outline",size:"sm",onClick:()=>nt(),children:[jsxRuntimeExports.jsx("span",{className:"md:hidden",children:"×"}),jsxRuntimeExports.jsx("span",{className:"hidden md:inline",children:"Logout"})]})]}):jsxRuntimeExports.jsx(ConnectKitButton,{})]})]})]})})})})},Input=reactExports.forwardRef(({className:o,type:et,...tt},nt)=>jsxRuntimeExports.jsx("input",{type:et,className:cn("flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-base md:text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50","touch-manipulation min-h-[44px] md:min-h-[36px]",o),ref:nt,...tt}));Input.displayName="Input";const Textarea=reactExports.forwardRef(({className:o,...et},tt)=>jsxRuntimeExports.jsx("textarea",{className:cn("flex min-h-[80px] w-full rounded-md border border-input bg-transparent px-3 py-2 text-base md:text-sm shadow-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50","touch-manipulation resize-y",o),ref:tt,...et}));Textarea.displayName="Textarea";var NODES=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],Primitive=NODES.reduce((o,et)=>{const tt=reactExports.forwardRef((nt,rt)=>{const{asChild:ot,...it}=nt,st=ot?Slot:et;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),jsxRuntimeExports.jsx(st,{...it,ref:rt})});return tt.displayName=`Primitive.${et}`,{...o,[et]:tt}},{});function dispatchDiscreteCustomEvent(o,et){o&&reactDomExports.flushSync(()=>o.dispatchEvent(et))}var NAME="Label",Label$1=reactExports.forwardRef((o,et)=>jsxRuntimeExports.jsx(Primitive.label,{...o,ref:et,onMouseDown:tt=>{var rt;tt.target.closest("button, input, select, textarea")||((rt=o.onMouseDown)==null||rt.call(o,tt),!tt.defaultPrevented&&tt.detail>1&&tt.preventDefault())}}));Label$1.displayName=NAME;var Root$3=Label$1;const labelVariants=cva("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),Label=reactExports.forwardRef(({className:o,...et},tt)=>jsxRuntimeExports.jsx(Root$3,{ref:tt,className:cn(labelVariants(),o),...et}));Label.displayName=Root$3.displayName;const Card=reactExports.forwardRef(({className:o,...et},tt)=>jsxRuntimeExports.jsx("div",{ref:tt,className:cn("rounded-lg border bg-card text-card-foreground shadow-sm p-4 md:p-6 w-full max-w-[95vw] mx-auto",o),...et}));Card.displayName="Card";const CardHeader=reactExports.forwardRef(({className:o,...et},tt)=>jsxRuntimeExports.jsx("div",{ref:tt,className:cn("flex flex-col space-y-1.5 p-4 md:p-6",o),...et}));CardHeader.displayName="CardHeader";const CardTitle=reactExports.forwardRef(({className:o,...et},tt)=>jsxRuntimeExports.jsx("h3",{ref:tt,className:cn("font-semibold leading-none tracking-tight",o),...et}));CardTitle.displayName="CardTitle";const CardDescription=reactExports.forwardRef(({className:o,...et},tt)=>jsxRuntimeExports.jsx("p",{ref:tt,className:cn("text-sm text-muted-foreground",o),...et}));CardDescription.displayName="CardDescription";const CardContent=reactExports.forwardRef(({className:o,...et},tt)=>jsxRuntimeExports.jsx("div",{ref:tt,className:cn("p-6 pt-0",o),...et}));CardContent.displayName="CardContent";const CardFooter=reactExports.forwardRef(({className:o,...et},tt)=>jsxRuntimeExports.jsx("div",{ref:tt,className:cn("flex items-center p-6 pt-0",o),...et}));CardFooter.displayName="CardFooter";function composeEventHandlers(o,et,{checkForDefaultPrevented:tt=!0}={}){return function(rt){if(o==null||o(rt),tt===!1||!rt.defaultPrevented)return et==null?void 0:et(rt)}}function createContext2(o,et){const tt=reactExports.createContext(et),nt=ot=>{const{children:it,...st}=ot,at=reactExports.useMemo(()=>st,Object.values(st));return jsxRuntimeExports.jsx(tt.Provider,{value:at,children:it})};nt.displayName=o+"Provider";function rt(ot){const it=reactExports.useContext(tt);if(it)return it;if(et!==void 0)return et;throw new Error(`\`${ot}\` must be used within \`${o}\``)}return[nt,rt]}function createContextScope(o,et=[]){let tt=[];function nt(ot,it){const st=reactExports.createContext(it),at=tt.length;tt=[...tt,it];const ct=dt=>{var gt;const{scope:ht,children:pt,...mt}=dt,ft=((gt=ht==null?void 0:ht[o])==null?void 0:gt[at])||st,yt=reactExports.useMemo(()=>mt,Object.values(mt));return jsxRuntimeExports.jsx(ft.Provider,{value:yt,children:pt})};ct.displayName=ot+"Provider";function lt(dt,ht){var ft;const pt=((ft=ht==null?void 0:ht[o])==null?void 0:ft[at])||st,mt=reactExports.useContext(pt);if(mt)return mt;if(it!==void 0)return it;throw new Error(`\`${dt}\` must be used within \`${ot}\``)}return[ct,lt]}const rt=()=>{const ot=tt.map(it=>reactExports.createContext(it));return function(st){const at=(st==null?void 0:st[o])||ot;return reactExports.useMemo(()=>({[`__scope${o}`]:{...st,[o]:at}}),[st,at])}};return rt.scopeName=o,[nt,composeContextScopes(rt,...et)]}function composeContextScopes(...o){const et=o[0];if(o.length===1)return et;const tt=()=>{const nt=o.map(rt=>({useScope:rt(),scopeName:rt.scopeName}));return function(ot){const it=nt.reduce((st,{useScope:at,scopeName:ct})=>{const dt=at(ot)[`__scope${ct}`];return{...st,...dt}},{});return reactExports.useMemo(()=>({[`__scope${et.scopeName}`]:it}),[it])}};return tt.scopeName=et.scopeName,tt}var useLayoutEffect2=globalThis!=null&&globalThis.document?reactExports.useLayoutEffect:()=>{},useReactId=React$1.useId||(()=>{}),count$1=0;function useId(o){const[et,tt]=reactExports.useState(useReactId());return useLayoutEffect2(()=>{o||tt(nt=>nt??String(count$1++))},[o]),o||(et?`radix-${et}`:"")}function useCallbackRef$1(o){const et=reactExports.useRef(o);return reactExports.useEffect(()=>{et.current=o}),reactExports.useMemo(()=>(...tt)=>{var nt;return(nt=et.current)==null?void 0:nt.call(et,...tt)},[])}function useControllableState({prop:o,defaultProp:et,onChange:tt=()=>{}}){const[nt,rt]=useUncontrolledState({defaultProp:et,onChange:tt}),ot=o!==void 0,it=ot?o:nt,st=useCallbackRef$1(tt),at=reactExports.useCallback(ct=>{if(ot){const dt=typeof ct=="function"?ct(o):ct;dt!==o&&st(dt)}else rt(ct)},[ot,o,rt,st]);return[it,at]}function useUncontrolledState({defaultProp:o,onChange:et}){const tt=reactExports.useState(o),[nt]=tt,rt=reactExports.useRef(nt),ot=useCallbackRef$1(et);return reactExports.useEffect(()=>{rt.current!==nt&&(ot(nt),rt.current=nt)},[nt,rt,ot]),tt}function useEscapeKeydown(o,et=globalThis==null?void 0:globalThis.document){const tt=useCallbackRef$1(o);reactExports.useEffect(()=>{const nt=rt=>{rt.key==="Escape"&&tt(rt)};return et.addEventListener("keydown",nt,{capture:!0}),()=>et.removeEventListener("keydown",nt,{capture:!0})},[tt,et])}var DISMISSABLE_LAYER_NAME="DismissableLayer",CONTEXT_UPDATE="dismissableLayer.update",POINTER_DOWN_OUTSIDE="dismissableLayer.pointerDownOutside",FOCUS_OUTSIDE="dismissableLayer.focusOutside",originalBodyPointerEvents,DismissableLayerContext=reactExports.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),DismissableLayer=reactExports.forwardRef((o,et)=>{const{disableOutsidePointerEvents:tt=!1,onEscapeKeyDown:nt,onPointerDownOutside:rt,onFocusOutside:ot,onInteractOutside:it,onDismiss:st,...at}=o,ct=reactExports.useContext(DismissableLayerContext),[lt,dt]=reactExports.useState(null),ht=(lt==null?void 0:lt.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,pt]=reactExports.useState({}),mt=useComposedRefs(et,kt=>dt(kt)),ft=Array.from(ct.layers),[yt]=[...ct.layersWithOutsidePointerEventsDisabled].slice(-1),gt=ft.indexOf(yt),xt=lt?ft.indexOf(lt):-1,vt=ct.layersWithOutsidePointerEventsDisabled.size>0,bt=xt>=gt,Et=usePointerDownOutside(kt=>{const Tt=kt.target,Rt=[...ct.branches].some(Pt=>Pt.contains(Tt));!bt||Rt||(rt==null||rt(kt),it==null||it(kt),kt.defaultPrevented||st==null||st())},ht),wt=useFocusOutside(kt=>{const Tt=kt.target;[...ct.branches].some(Pt=>Pt.contains(Tt))||(ot==null||ot(kt),it==null||it(kt),kt.defaultPrevented||st==null||st())},ht);return useEscapeKeydown(kt=>{xt===ct.layers.size-1&&(nt==null||nt(kt),!kt.defaultPrevented&&st&&(kt.preventDefault(),st()))},ht),reactExports.useEffect(()=>{if(lt)return tt&&(ct.layersWithOutsidePointerEventsDisabled.size===0&&(originalBodyPointerEvents=ht.body.style.pointerEvents,ht.body.style.pointerEvents="none"),ct.layersWithOutsidePointerEventsDisabled.add(lt)),ct.layers.add(lt),dispatchUpdate(),()=>{tt&&ct.layersWithOutsidePointerEventsDisabled.size===1&&(ht.body.style.pointerEvents=originalBodyPointerEvents)}},[lt,ht,tt,ct]),reactExports.useEffect(()=>()=>{lt&&(ct.layers.delete(lt),ct.layersWithOutsidePointerEventsDisabled.delete(lt),dispatchUpdate())},[lt,ct]),reactExports.useEffect(()=>{const kt=()=>pt({});return document.addEventListener(CONTEXT_UPDATE,kt),()=>document.removeEventListener(CONTEXT_UPDATE,kt)},[]),jsxRuntimeExports.jsx(Primitive.div,{...at,ref:mt,style:{pointerEvents:vt?bt?"auto":"none":void 0,...o.style},onFocusCapture:composeEventHandlers(o.onFocusCapture,wt.onFocusCapture),onBlurCapture:composeEventHandlers(o.onBlurCapture,wt.onBlurCapture),onPointerDownCapture:composeEventHandlers(o.onPointerDownCapture,Et.onPointerDownCapture)})});DismissableLayer.displayName=DISMISSABLE_LAYER_NAME;var BRANCH_NAME="DismissableLayerBranch",DismissableLayerBranch=reactExports.forwardRef((o,et)=>{const tt=reactExports.useContext(DismissableLayerContext),nt=reactExports.useRef(null),rt=useComposedRefs(et,nt);return reactExports.useEffect(()=>{const ot=nt.current;if(ot)return tt.branches.add(ot),()=>{tt.branches.delete(ot)}},[tt.branches]),jsxRuntimeExports.jsx(Primitive.div,{...o,ref:rt})});DismissableLayerBranch.displayName=BRANCH_NAME;function usePointerDownOutside(o,et=globalThis==null?void 0:globalThis.document){const tt=useCallbackRef$1(o),nt=reactExports.useRef(!1),rt=reactExports.useRef(()=>{});return reactExports.useEffect(()=>{const ot=st=>{if(st.target&&!nt.current){let at=function(){handleAndDispatchCustomEvent(POINTER_DOWN_OUTSIDE,tt,ct,{discrete:!0})};const ct={originalEvent:st};st.pointerType==="touch"?(et.removeEventListener("click",rt.current),rt.current=at,et.addEventListener("click",rt.current,{once:!0})):at()}else et.removeEventListener("click",rt.current);nt.current=!1},it=window.setTimeout(()=>{et.addEventListener("pointerdown",ot)},0);return()=>{window.clearTimeout(it),et.removeEventListener("pointerdown",ot),et.removeEventListener("click",rt.current)}},[et,tt]),{onPointerDownCapture:()=>nt.current=!0}}function useFocusOutside(o,et=globalThis==null?void 0:globalThis.document){const tt=useCallbackRef$1(o),nt=reactExports.useRef(!1);return reactExports.useEffect(()=>{const rt=ot=>{ot.target&&!nt.current&&handleAndDispatchCustomEvent(FOCUS_OUTSIDE,tt,{originalEvent:ot},{discrete:!1})};return et.addEventListener("focusin",rt),()=>et.removeEventListener("focusin",rt)},[et,tt]),{onFocusCapture:()=>nt.current=!0,onBlurCapture:()=>nt.current=!1}}function dispatchUpdate(){const o=new CustomEvent(CONTEXT_UPDATE);document.dispatchEvent(o)}function handleAndDispatchCustomEvent(o,et,tt,{discrete:nt}){const rt=tt.originalEvent.target,ot=new CustomEvent(o,{bubbles:!1,cancelable:!0,detail:tt});et&&rt.addEventListener(o,et,{once:!0}),nt?dispatchDiscreteCustomEvent(rt,ot):rt.dispatchEvent(ot)}var AUTOFOCUS_ON_MOUNT="focusScope.autoFocusOnMount",AUTOFOCUS_ON_UNMOUNT="focusScope.autoFocusOnUnmount",EVENT_OPTIONS={bubbles:!1,cancelable:!0},FOCUS_SCOPE_NAME="FocusScope",FocusScope=reactExports.forwardRef((o,et)=>{const{loop:tt=!1,trapped:nt=!1,onMountAutoFocus:rt,onUnmountAutoFocus:ot,...it}=o,[st,at]=reactExports.useState(null),ct=useCallbackRef$1(rt),lt=useCallbackRef$1(ot),dt=reactExports.useRef(null),ht=useComposedRefs(et,ft=>at(ft)),pt=reactExports.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;reactExports.useEffect(()=>{if(nt){let ft=function(vt){if(pt.paused||!st)return;const bt=vt.target;st.contains(bt)?dt.current=bt:focus(dt.current,{select:!0})},yt=function(vt){if(pt.paused||!st)return;const bt=vt.relatedTarget;bt!==null&&(st.contains(bt)||focus(dt.current,{select:!0}))},gt=function(vt){if(document.activeElement===document.body)for(const Et of vt)Et.removedNodes.length>0&&focus(st)};document.addEventListener("focusin",ft),document.addEventListener("focusout",yt);const xt=new MutationObserver(gt);return st&&xt.observe(st,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",ft),document.removeEventListener("focusout",yt),xt.disconnect()}}},[nt,st,pt.paused]),reactExports.useEffect(()=>{if(st){focusScopesStack.add(pt);const ft=document.activeElement;if(!st.contains(ft)){const gt=new CustomEvent(AUTOFOCUS_ON_MOUNT,EVENT_OPTIONS);st.addEventListener(AUTOFOCUS_ON_MOUNT,ct),st.dispatchEvent(gt),gt.defaultPrevented||(focusFirst(removeLinks(getTabbableCandidates(st)),{select:!0}),document.activeElement===ft&&focus(st))}return()=>{st.removeEventListener(AUTOFOCUS_ON_MOUNT,ct),setTimeout(()=>{const gt=new CustomEvent(AUTOFOCUS_ON_UNMOUNT,EVENT_OPTIONS);st.addEventListener(AUTOFOCUS_ON_UNMOUNT,lt),st.dispatchEvent(gt),gt.defaultPrevented||focus(ft??document.body,{select:!0}),st.removeEventListener(AUTOFOCUS_ON_UNMOUNT,lt),focusScopesStack.remove(pt)},0)}}},[st,ct,lt,pt]);const mt=reactExports.useCallback(ft=>{if(!tt&&!nt||pt.paused)return;const yt=ft.key==="Tab"&&!ft.altKey&&!ft.ctrlKey&&!ft.metaKey,gt=document.activeElement;if(yt&>){const xt=ft.currentTarget,[vt,bt]=getTabbableEdges(xt);vt&&bt?!ft.shiftKey&>===bt?(ft.preventDefault(),tt&&focus(vt,{select:!0})):ft.shiftKey&>===vt&&(ft.preventDefault(),tt&&focus(bt,{select:!0})):gt===xt&&ft.preventDefault()}},[tt,nt,pt.paused]);return jsxRuntimeExports.jsx(Primitive.div,{tabIndex:-1,...it,ref:ht,onKeyDown:mt})});FocusScope.displayName=FOCUS_SCOPE_NAME;function focusFirst(o,{select:et=!1}={}){const tt=document.activeElement;for(const nt of o)if(focus(nt,{select:et}),document.activeElement!==tt)return}function getTabbableEdges(o){const et=getTabbableCandidates(o),tt=findVisible(et,o),nt=findVisible(et.reverse(),o);return[tt,nt]}function getTabbableCandidates(o){const et=[],tt=document.createTreeWalker(o,NodeFilter.SHOW_ELEMENT,{acceptNode:nt=>{const rt=nt.tagName==="INPUT"&&nt.type==="hidden";return nt.disabled||nt.hidden||rt?NodeFilter.FILTER_SKIP:nt.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;tt.nextNode();)et.push(tt.currentNode);return et}function findVisible(o,et){for(const tt of o)if(!isHidden(tt,{upTo:et}))return tt}function isHidden(o,{upTo:et}){if(getComputedStyle(o).visibility==="hidden")return!0;for(;o;){if(et!==void 0&&o===et)return!1;if(getComputedStyle(o).display==="none")return!0;o=o.parentElement}return!1}function isSelectableInput(o){return o instanceof HTMLInputElement&&"select"in o}function focus(o,{select:et=!1}={}){if(o&&o.focus){const tt=document.activeElement;o.focus({preventScroll:!0}),o!==tt&&isSelectableInput(o)&&et&&o.select()}}var focusScopesStack=createFocusScopesStack();function createFocusScopesStack(){let o=[];return{add(et){const tt=o[0];et!==tt&&(tt==null||tt.pause()),o=arrayRemove(o,et),o.unshift(et)},remove(et){var tt;o=arrayRemove(o,et),(tt=o[0])==null||tt.resume()}}}function arrayRemove(o,et){const tt=[...o],nt=tt.indexOf(et);return nt!==-1&&tt.splice(nt,1),tt}function removeLinks(o){return o.filter(et=>et.tagName!=="A")}var PORTAL_NAME$1="Portal",Portal$1=reactExports.forwardRef((o,et)=>{var st;const{container:tt,...nt}=o,[rt,ot]=reactExports.useState(!1);useLayoutEffect2(()=>ot(!0),[]);const it=tt||rt&&((st=globalThis==null?void 0:globalThis.document)==null?void 0:st.body);return it?ReactDOM.createPortal(jsxRuntimeExports.jsx(Primitive.div,{...nt,ref:et}),it):null});Portal$1.displayName=PORTAL_NAME$1;function useStateMachine$1(o,et){return reactExports.useReducer((tt,nt)=>et[tt][nt]??tt,o)}var Presence=o=>{const{present:et,children:tt}=o,nt=usePresence(et),rt=typeof tt=="function"?tt({present:nt.isPresent}):reactExports.Children.only(tt),ot=useComposedRefs(nt.ref,getElementRef(rt));return typeof tt=="function"||nt.isPresent?reactExports.cloneElement(rt,{ref:ot}):null};Presence.displayName="Presence";function usePresence(o){const[et,tt]=reactExports.useState(),nt=reactExports.useRef({}),rt=reactExports.useRef(o),ot=reactExports.useRef("none"),it=o?"mounted":"unmounted",[st,at]=useStateMachine$1(it,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return reactExports.useEffect(()=>{const ct=getAnimationName(nt.current);ot.current=st==="mounted"?ct:"none"},[st]),useLayoutEffect2(()=>{const ct=nt.current,lt=rt.current;if(lt!==o){const ht=ot.current,pt=getAnimationName(ct);o?at("MOUNT"):pt==="none"||(ct==null?void 0:ct.display)==="none"?at("UNMOUNT"):at(lt&&ht!==pt?"ANIMATION_OUT":"UNMOUNT"),rt.current=o}},[o,at]),useLayoutEffect2(()=>{if(et){let ct;const lt=et.ownerDocument.defaultView??window,dt=pt=>{const ft=getAnimationName(nt.current).includes(pt.animationName);if(pt.target===et&&ft&&(at("ANIMATION_END"),!rt.current)){const yt=et.style.animationFillMode;et.style.animationFillMode="forwards",ct=lt.setTimeout(()=>{et.style.animationFillMode==="forwards"&&(et.style.animationFillMode=yt)})}},ht=pt=>{pt.target===et&&(ot.current=getAnimationName(nt.current))};return et.addEventListener("animationstart",ht),et.addEventListener("animationcancel",dt),et.addEventListener("animationend",dt),()=>{lt.clearTimeout(ct),et.removeEventListener("animationstart",ht),et.removeEventListener("animationcancel",dt),et.removeEventListener("animationend",dt)}}else at("ANIMATION_END")},[et,at]),{isPresent:["mounted","unmountSuspended"].includes(st),ref:reactExports.useCallback(ct=>{ct&&(nt.current=getComputedStyle(ct)),tt(ct)},[])}}function getAnimationName(o){return(o==null?void 0:o.animationName)||"none"}function getElementRef(o){var nt,rt;let et=(nt=Object.getOwnPropertyDescriptor(o.props,"ref"))==null?void 0:nt.get,tt=et&&"isReactWarning"in et&&et.isReactWarning;return tt?o.ref:(et=(rt=Object.getOwnPropertyDescriptor(o,"ref"))==null?void 0:rt.get,tt=et&&"isReactWarning"in et&&et.isReactWarning,tt?o.props.ref:o.props.ref||o.ref)}var count=0;function useFocusGuards(){reactExports.useEffect(()=>{const o=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",o[0]??createFocusGuard()),document.body.insertAdjacentElement("beforeend",o[1]??createFocusGuard()),count++,()=>{count===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(et=>et.remove()),count--}},[])}function createFocusGuard(){const o=document.createElement("span");return o.setAttribute("data-radix-focus-guard",""),o.tabIndex=0,o.style.outline="none",o.style.opacity="0",o.style.position="fixed",o.style.pointerEvents="none",o}var zeroRightClassName="right-scroll-bar-position",fullWidthClassName="width-before-scroll-bar",noScrollbarsClassName="with-scroll-bars-hidden",removedBarSizeVariable="--removed-body-scroll-bar-size";function assignRef(o,et){return typeof o=="function"?o(et):o&&(o.current=et),o}function useCallbackRef(o,et){var tt=reactExports.useState(function(){return{value:o,callback:et,facade:{get current(){return tt.value},set current(nt){var rt=tt.value;rt!==nt&&(tt.value=nt,tt.callback(nt,rt))}}}})[0];return tt.callback=et,tt.facade}var useIsomorphicLayoutEffect=typeof window<"u"?reactExports.useLayoutEffect:reactExports.useEffect,currentValues=new WeakMap;function useMergeRefs(o,et){var tt=useCallbackRef(null,function(nt){return o.forEach(function(rt){return assignRef(rt,nt)})});return useIsomorphicLayoutEffect(function(){var nt=currentValues.get(tt);if(nt){var rt=new Set(nt),ot=new Set(o),it=tt.current;rt.forEach(function(st){ot.has(st)||assignRef(st,null)}),ot.forEach(function(st){rt.has(st)||assignRef(st,it)})}currentValues.set(tt,o)},[o]),tt}function ItoI(o){return o}function innerCreateMedium(o,et){et===void 0&&(et=ItoI);var tt=[],nt=!1,rt={read:function(){if(nt)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return tt.length?tt[tt.length-1]:o},useMedium:function(ot){var it=et(ot,nt);return tt.push(it),function(){tt=tt.filter(function(st){return st!==it})}},assignSyncMedium:function(ot){for(nt=!0;tt.length;){var it=tt;tt=[],it.forEach(ot)}tt={push:function(st){return ot(st)},filter:function(){return tt}}},assignMedium:function(ot){nt=!0;var it=[];if(tt.length){var st=tt;tt=[],st.forEach(ot),it=tt}var at=function(){var lt=it;it=[],lt.forEach(ot)},ct=function(){return Promise.resolve().then(at)};ct(),tt={push:function(lt){it.push(lt),ct()},filter:function(lt){return it=it.filter(lt),tt}}}};return rt}function createSidecarMedium(o){o===void 0&&(o={});var et=innerCreateMedium(null);return et.options=__assign({async:!0,ssr:!1},o),et}var SideCar$1=function(o){var et=o.sideCar,tt=__rest(o,["sideCar"]);if(!et)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var nt=et.read();if(!nt)throw new Error("Sidecar medium not found");return reactExports.createElement(nt,__assign({},tt))};SideCar$1.isSideCarExport=!0;function exportSidecar(o,et){return o.useMedium(et),SideCar$1}var effectCar=createSidecarMedium(),nothing=function(){},RemoveScroll=reactExports.forwardRef(function(o,et){var tt=reactExports.useRef(null),nt=reactExports.useState({onScrollCapture:nothing,onWheelCapture:nothing,onTouchMoveCapture:nothing}),rt=nt[0],ot=nt[1],it=o.forwardProps,st=o.children,at=o.className,ct=o.removeScrollBar,lt=o.enabled,dt=o.shards,ht=o.sideCar,pt=o.noIsolation,mt=o.inert,ft=o.allowPinchZoom,yt=o.as,gt=yt===void 0?"div":yt,xt=o.gapMode,vt=__rest(o,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noIsolation","inert","allowPinchZoom","as","gapMode"]),bt=ht,Et=useMergeRefs([tt,et]),wt=__assign(__assign({},vt),rt);return reactExports.createElement(reactExports.Fragment,null,lt&&reactExports.createElement(bt,{sideCar:effectCar,removeScrollBar:ct,shards:dt,noIsolation:pt,inert:mt,setCallbacks:ot,allowPinchZoom:!!ft,lockRef:tt,gapMode:xt}),it?reactExports.cloneElement(reactExports.Children.only(st),__assign(__assign({},wt),{ref:Et})):reactExports.createElement(gt,__assign({},wt,{className:at,ref:Et}),st))});RemoveScroll.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};RemoveScroll.classNames={fullWidth:fullWidthClassName,zeroRight:zeroRightClassName};var getNonce=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function makeStyleTag(){if(!document)return null;var o=document.createElement("style");o.type="text/css";var et=getNonce();return et&&o.setAttribute("nonce",et),o}function injectStyles(o,et){o.styleSheet?o.styleSheet.cssText=et:o.appendChild(document.createTextNode(et))}function insertStyleTag(o){var et=document.head||document.getElementsByTagName("head")[0];et.appendChild(o)}var stylesheetSingleton=function(){var o=0,et=null;return{add:function(tt){o==0&&(et=makeStyleTag())&&(injectStyles(et,tt),insertStyleTag(et)),o++},remove:function(){o--,!o&&et&&(et.parentNode&&et.parentNode.removeChild(et),et=null)}}},styleHookSingleton=function(){var o=stylesheetSingleton();return function(et,tt){reactExports.useEffect(function(){return o.add(et),function(){o.remove()}},[et&&tt])}},styleSingleton=function(){var o=styleHookSingleton(),et=function(tt){var nt=tt.styles,rt=tt.dynamic;return o(nt,rt),null};return et},zeroGap={left:0,top:0,right:0,gap:0},parse$2=function(o){return parseInt(o||"",10)||0},getOffset=function(o){var et=window.getComputedStyle(document.body),tt=et[o==="padding"?"paddingLeft":"marginLeft"],nt=et[o==="padding"?"paddingTop":"marginTop"],rt=et[o==="padding"?"paddingRight":"marginRight"];return[parse$2(tt),parse$2(nt),parse$2(rt)]},getGapWidth=function(o){if(o===void 0&&(o="margin"),typeof window>"u")return zeroGap;var et=getOffset(o),tt=document.documentElement.clientWidth,nt=window.innerWidth;return{left:et[0],top:et[1],right:et[2],gap:Math.max(0,nt-tt+et[2]-et[0])}},Style=styleSingleton(),lockAttribute="data-scroll-locked",getStyles=function(o,et,tt,nt){var rt=o.left,ot=o.top,it=o.right,st=o.gap;return tt===void 0&&(tt="margin"),` + */const LoaderCircle=createLucideIcon("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]),Header=({wakuStatus:o})=>{const{address:et,isConnected:tt}=useAccount(),{disconnect:nt}=useDisconnect(),{isLoading:rt,error:ot,node:it}=useWaku(),[st,at]=reactExports.useState(0),ct=useLocation(),{data:lt}=useEnsName({address:et});reactExports.useEffect(()=>{if(it){const ht=()=>{at(it.libp2p.getConnections().length)};return ht(),it.libp2p.addEventListener("peer:connect",ht),it.libp2p.addEventListener("peer:disconnect",ht),()=>{it.libp2p.removeEventListener("peer:connect",ht),it.libp2p.removeEventListener("peer:disconnect",ht)}}},[it]);const dt=ht=>{switch(ht){case"success":return"bg-green-500";case"in-progress":return"bg-yellow-500";case"error":return"bg-red-500"}};return jsxRuntimeExports.jsx("header",{className:"sticky top-0 z-50 w-full border-b bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/60",children:jsxRuntimeExports.jsx("div",{className:"container",children:jsxRuntimeExports.jsx("div",{className:"h-14",children:jsxRuntimeExports.jsxs("div",{className:"flex h-14 items-center justify-between gap-4",children:[jsxRuntimeExports.jsxs("nav",{className:"flex items-center gap-2 md:gap-4",children:[jsxRuntimeExports.jsx(Link,{to:"",className:`text-sm font-medium ${ct.pathname===""?"text-foreground":"text-muted-foreground"}`,children:"Home"}),jsxRuntimeExports.jsx(Link,{to:"create",className:`text-sm font-medium ${ct.pathname==="/create"?"text-foreground":"text-muted-foreground"}`,children:"Create"}),jsxRuntimeExports.jsx(Link,{to:"view",className:`text-sm font-medium ${ct.pathname==="/view"?"text-foreground":"text-muted-foreground"}`,children:"View"})]}),jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-2 md:gap-4",children:[jsxRuntimeExports.jsx("div",{className:"flex items-center gap-2",children:!rt&&!ot&&jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsxs("div",{className:"flex items-center space-x-1",children:[jsxRuntimeExports.jsx("span",{className:"hidden md:inline text-muted-foreground",children:"Filter:"}),jsxRuntimeExports.jsx("div",{className:`w-2 h-2 md:w-3 md:h-3 rounded-full ${dt(o.filter)}`})]}),jsxRuntimeExports.jsxs("div",{className:"flex items-center space-x-1",children:[jsxRuntimeExports.jsx("span",{className:"hidden md:inline text-muted-foreground",children:"Store:"}),jsxRuntimeExports.jsx("div",{className:`w-2 h-2 md:w-3 md:h-3 rounded-full ${dt(o.store)}`})]}),jsxRuntimeExports.jsxs("div",{className:"flex items-center space-x-1",children:[jsxRuntimeExports.jsx("span",{className:"hidden md:inline text-muted-foreground",children:"Peers:"}),rt?jsxRuntimeExports.jsx(LoaderCircle,{className:"h-4 w-4 animate-spin"}):ot?jsxRuntimeExports.jsx("div",{className:"w-2 h-2 md:w-3 md:h-3 rounded-full bg-red-500"}):jsxRuntimeExports.jsx("div",{className:`w-2 h-2 md:w-3 md:h-3 rounded-full ${st>0?"bg-green-500":"bg-yellow-500"}`})]})]})}),jsxRuntimeExports.jsx("div",{className:"flex items-center gap-2",children:tt?jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-2",children:[jsxRuntimeExports.jsx("span",{className:"text-xs md:text-sm text-muted-foreground truncate max-w-[80px] md:max-w-[120px]",children:lt||(et?`${et.slice(0,4)}...${et.slice(-4)}`:"")}),jsxRuntimeExports.jsxs(Button,{variant:"outline",size:"sm",onClick:()=>nt(),children:[jsxRuntimeExports.jsx("span",{className:"md:hidden",children:"×"}),jsxRuntimeExports.jsx("span",{className:"hidden md:inline",children:"Logout"})]})]}):jsxRuntimeExports.jsx(ConnectKitButton,{})})]})]})})})})},Input=reactExports.forwardRef(({className:o,type:et,...tt},nt)=>jsxRuntimeExports.jsx("input",{type:et,className:cn("flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-base md:text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50","touch-manipulation min-h-[44px] md:min-h-[36px]",o),ref:nt,...tt}));Input.displayName="Input";const Textarea=reactExports.forwardRef(({className:o,...et},tt)=>jsxRuntimeExports.jsx("textarea",{className:cn("flex min-h-[80px] w-full rounded-md border border-input bg-transparent px-3 py-2 text-base md:text-sm shadow-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50","touch-manipulation resize-y",o),ref:tt,...et}));Textarea.displayName="Textarea";var NODES=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],Primitive=NODES.reduce((o,et)=>{const tt=reactExports.forwardRef((nt,rt)=>{const{asChild:ot,...it}=nt,st=ot?Slot:et;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),jsxRuntimeExports.jsx(st,{...it,ref:rt})});return tt.displayName=`Primitive.${et}`,{...o,[et]:tt}},{});function dispatchDiscreteCustomEvent(o,et){o&&reactDomExports.flushSync(()=>o.dispatchEvent(et))}var NAME="Label",Label$1=reactExports.forwardRef((o,et)=>jsxRuntimeExports.jsx(Primitive.label,{...o,ref:et,onMouseDown:tt=>{var rt;tt.target.closest("button, input, select, textarea")||((rt=o.onMouseDown)==null||rt.call(o,tt),!tt.defaultPrevented&&tt.detail>1&&tt.preventDefault())}}));Label$1.displayName=NAME;var Root$3=Label$1;const labelVariants=cva("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),Label=reactExports.forwardRef(({className:o,...et},tt)=>jsxRuntimeExports.jsx(Root$3,{ref:tt,className:cn(labelVariants(),o),...et}));Label.displayName=Root$3.displayName;const Card=reactExports.forwardRef(({className:o,...et},tt)=>jsxRuntimeExports.jsx("div",{ref:tt,className:cn("rounded-lg border bg-card text-card-foreground shadow-sm p-4 md:p-6 w-full max-w-[95vw] mx-auto",o),...et}));Card.displayName="Card";const CardHeader=reactExports.forwardRef(({className:o,...et},tt)=>jsxRuntimeExports.jsx("div",{ref:tt,className:cn("flex flex-col space-y-1.5 p-4 md:p-6",o),...et}));CardHeader.displayName="CardHeader";const CardTitle=reactExports.forwardRef(({className:o,...et},tt)=>jsxRuntimeExports.jsx("h3",{ref:tt,className:cn("font-semibold leading-none tracking-tight",o),...et}));CardTitle.displayName="CardTitle";const CardDescription=reactExports.forwardRef(({className:o,...et},tt)=>jsxRuntimeExports.jsx("p",{ref:tt,className:cn("text-sm text-muted-foreground",o),...et}));CardDescription.displayName="CardDescription";const CardContent=reactExports.forwardRef(({className:o,...et},tt)=>jsxRuntimeExports.jsx("div",{ref:tt,className:cn("p-6 pt-0",o),...et}));CardContent.displayName="CardContent";const CardFooter=reactExports.forwardRef(({className:o,...et},tt)=>jsxRuntimeExports.jsx("div",{ref:tt,className:cn("flex items-center p-6 pt-0",o),...et}));CardFooter.displayName="CardFooter";function composeEventHandlers(o,et,{checkForDefaultPrevented:tt=!0}={}){return function(rt){if(o==null||o(rt),tt===!1||!rt.defaultPrevented)return et==null?void 0:et(rt)}}function createContext2(o,et){const tt=reactExports.createContext(et),nt=ot=>{const{children:it,...st}=ot,at=reactExports.useMemo(()=>st,Object.values(st));return jsxRuntimeExports.jsx(tt.Provider,{value:at,children:it})};nt.displayName=o+"Provider";function rt(ot){const it=reactExports.useContext(tt);if(it)return it;if(et!==void 0)return et;throw new Error(`\`${ot}\` must be used within \`${o}\``)}return[nt,rt]}function createContextScope(o,et=[]){let tt=[];function nt(ot,it){const st=reactExports.createContext(it),at=tt.length;tt=[...tt,it];const ct=dt=>{var gt;const{scope:ht,children:pt,...mt}=dt,ft=((gt=ht==null?void 0:ht[o])==null?void 0:gt[at])||st,yt=reactExports.useMemo(()=>mt,Object.values(mt));return jsxRuntimeExports.jsx(ft.Provider,{value:yt,children:pt})};ct.displayName=ot+"Provider";function lt(dt,ht){var ft;const pt=((ft=ht==null?void 0:ht[o])==null?void 0:ft[at])||st,mt=reactExports.useContext(pt);if(mt)return mt;if(it!==void 0)return it;throw new Error(`\`${dt}\` must be used within \`${ot}\``)}return[ct,lt]}const rt=()=>{const ot=tt.map(it=>reactExports.createContext(it));return function(st){const at=(st==null?void 0:st[o])||ot;return reactExports.useMemo(()=>({[`__scope${o}`]:{...st,[o]:at}}),[st,at])}};return rt.scopeName=o,[nt,composeContextScopes(rt,...et)]}function composeContextScopes(...o){const et=o[0];if(o.length===1)return et;const tt=()=>{const nt=o.map(rt=>({useScope:rt(),scopeName:rt.scopeName}));return function(ot){const it=nt.reduce((st,{useScope:at,scopeName:ct})=>{const dt=at(ot)[`__scope${ct}`];return{...st,...dt}},{});return reactExports.useMemo(()=>({[`__scope${et.scopeName}`]:it}),[it])}};return tt.scopeName=et.scopeName,tt}var useLayoutEffect2=globalThis!=null&&globalThis.document?reactExports.useLayoutEffect:()=>{},useReactId=React$1.useId||(()=>{}),count$1=0;function useId(o){const[et,tt]=reactExports.useState(useReactId());return useLayoutEffect2(()=>{o||tt(nt=>nt??String(count$1++))},[o]),o||(et?`radix-${et}`:"")}function useCallbackRef$1(o){const et=reactExports.useRef(o);return reactExports.useEffect(()=>{et.current=o}),reactExports.useMemo(()=>(...tt)=>{var nt;return(nt=et.current)==null?void 0:nt.call(et,...tt)},[])}function useControllableState({prop:o,defaultProp:et,onChange:tt=()=>{}}){const[nt,rt]=useUncontrolledState({defaultProp:et,onChange:tt}),ot=o!==void 0,it=ot?o:nt,st=useCallbackRef$1(tt),at=reactExports.useCallback(ct=>{if(ot){const dt=typeof ct=="function"?ct(o):ct;dt!==o&&st(dt)}else rt(ct)},[ot,o,rt,st]);return[it,at]}function useUncontrolledState({defaultProp:o,onChange:et}){const tt=reactExports.useState(o),[nt]=tt,rt=reactExports.useRef(nt),ot=useCallbackRef$1(et);return reactExports.useEffect(()=>{rt.current!==nt&&(ot(nt),rt.current=nt)},[nt,rt,ot]),tt}function useEscapeKeydown(o,et=globalThis==null?void 0:globalThis.document){const tt=useCallbackRef$1(o);reactExports.useEffect(()=>{const nt=rt=>{rt.key==="Escape"&&tt(rt)};return et.addEventListener("keydown",nt,{capture:!0}),()=>et.removeEventListener("keydown",nt,{capture:!0})},[tt,et])}var DISMISSABLE_LAYER_NAME="DismissableLayer",CONTEXT_UPDATE="dismissableLayer.update",POINTER_DOWN_OUTSIDE="dismissableLayer.pointerDownOutside",FOCUS_OUTSIDE="dismissableLayer.focusOutside",originalBodyPointerEvents,DismissableLayerContext=reactExports.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),DismissableLayer=reactExports.forwardRef((o,et)=>{const{disableOutsidePointerEvents:tt=!1,onEscapeKeyDown:nt,onPointerDownOutside:rt,onFocusOutside:ot,onInteractOutside:it,onDismiss:st,...at}=o,ct=reactExports.useContext(DismissableLayerContext),[lt,dt]=reactExports.useState(null),ht=(lt==null?void 0:lt.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,pt]=reactExports.useState({}),mt=useComposedRefs(et,kt=>dt(kt)),ft=Array.from(ct.layers),[yt]=[...ct.layersWithOutsidePointerEventsDisabled].slice(-1),gt=ft.indexOf(yt),xt=lt?ft.indexOf(lt):-1,vt=ct.layersWithOutsidePointerEventsDisabled.size>0,bt=xt>=gt,Et=usePointerDownOutside(kt=>{const It=kt.target,Rt=[...ct.branches].some(Pt=>Pt.contains(It));!bt||Rt||(rt==null||rt(kt),it==null||it(kt),kt.defaultPrevented||st==null||st())},ht),wt=useFocusOutside(kt=>{const It=kt.target;[...ct.branches].some(Pt=>Pt.contains(It))||(ot==null||ot(kt),it==null||it(kt),kt.defaultPrevented||st==null||st())},ht);return useEscapeKeydown(kt=>{xt===ct.layers.size-1&&(nt==null||nt(kt),!kt.defaultPrevented&&st&&(kt.preventDefault(),st()))},ht),reactExports.useEffect(()=>{if(lt)return tt&&(ct.layersWithOutsidePointerEventsDisabled.size===0&&(originalBodyPointerEvents=ht.body.style.pointerEvents,ht.body.style.pointerEvents="none"),ct.layersWithOutsidePointerEventsDisabled.add(lt)),ct.layers.add(lt),dispatchUpdate(),()=>{tt&&ct.layersWithOutsidePointerEventsDisabled.size===1&&(ht.body.style.pointerEvents=originalBodyPointerEvents)}},[lt,ht,tt,ct]),reactExports.useEffect(()=>()=>{lt&&(ct.layers.delete(lt),ct.layersWithOutsidePointerEventsDisabled.delete(lt),dispatchUpdate())},[lt,ct]),reactExports.useEffect(()=>{const kt=()=>pt({});return document.addEventListener(CONTEXT_UPDATE,kt),()=>document.removeEventListener(CONTEXT_UPDATE,kt)},[]),jsxRuntimeExports.jsx(Primitive.div,{...at,ref:mt,style:{pointerEvents:vt?bt?"auto":"none":void 0,...o.style},onFocusCapture:composeEventHandlers(o.onFocusCapture,wt.onFocusCapture),onBlurCapture:composeEventHandlers(o.onBlurCapture,wt.onBlurCapture),onPointerDownCapture:composeEventHandlers(o.onPointerDownCapture,Et.onPointerDownCapture)})});DismissableLayer.displayName=DISMISSABLE_LAYER_NAME;var BRANCH_NAME="DismissableLayerBranch",DismissableLayerBranch=reactExports.forwardRef((o,et)=>{const tt=reactExports.useContext(DismissableLayerContext),nt=reactExports.useRef(null),rt=useComposedRefs(et,nt);return reactExports.useEffect(()=>{const ot=nt.current;if(ot)return tt.branches.add(ot),()=>{tt.branches.delete(ot)}},[tt.branches]),jsxRuntimeExports.jsx(Primitive.div,{...o,ref:rt})});DismissableLayerBranch.displayName=BRANCH_NAME;function usePointerDownOutside(o,et=globalThis==null?void 0:globalThis.document){const tt=useCallbackRef$1(o),nt=reactExports.useRef(!1),rt=reactExports.useRef(()=>{});return reactExports.useEffect(()=>{const ot=st=>{if(st.target&&!nt.current){let at=function(){handleAndDispatchCustomEvent(POINTER_DOWN_OUTSIDE,tt,ct,{discrete:!0})};const ct={originalEvent:st};st.pointerType==="touch"?(et.removeEventListener("click",rt.current),rt.current=at,et.addEventListener("click",rt.current,{once:!0})):at()}else et.removeEventListener("click",rt.current);nt.current=!1},it=window.setTimeout(()=>{et.addEventListener("pointerdown",ot)},0);return()=>{window.clearTimeout(it),et.removeEventListener("pointerdown",ot),et.removeEventListener("click",rt.current)}},[et,tt]),{onPointerDownCapture:()=>nt.current=!0}}function useFocusOutside(o,et=globalThis==null?void 0:globalThis.document){const tt=useCallbackRef$1(o),nt=reactExports.useRef(!1);return reactExports.useEffect(()=>{const rt=ot=>{ot.target&&!nt.current&&handleAndDispatchCustomEvent(FOCUS_OUTSIDE,tt,{originalEvent:ot},{discrete:!1})};return et.addEventListener("focusin",rt),()=>et.removeEventListener("focusin",rt)},[et,tt]),{onFocusCapture:()=>nt.current=!0,onBlurCapture:()=>nt.current=!1}}function dispatchUpdate(){const o=new CustomEvent(CONTEXT_UPDATE);document.dispatchEvent(o)}function handleAndDispatchCustomEvent(o,et,tt,{discrete:nt}){const rt=tt.originalEvent.target,ot=new CustomEvent(o,{bubbles:!1,cancelable:!0,detail:tt});et&&rt.addEventListener(o,et,{once:!0}),nt?dispatchDiscreteCustomEvent(rt,ot):rt.dispatchEvent(ot)}var AUTOFOCUS_ON_MOUNT="focusScope.autoFocusOnMount",AUTOFOCUS_ON_UNMOUNT="focusScope.autoFocusOnUnmount",EVENT_OPTIONS={bubbles:!1,cancelable:!0},FOCUS_SCOPE_NAME="FocusScope",FocusScope=reactExports.forwardRef((o,et)=>{const{loop:tt=!1,trapped:nt=!1,onMountAutoFocus:rt,onUnmountAutoFocus:ot,...it}=o,[st,at]=reactExports.useState(null),ct=useCallbackRef$1(rt),lt=useCallbackRef$1(ot),dt=reactExports.useRef(null),ht=useComposedRefs(et,ft=>at(ft)),pt=reactExports.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;reactExports.useEffect(()=>{if(nt){let ft=function(vt){if(pt.paused||!st)return;const bt=vt.target;st.contains(bt)?dt.current=bt:focus(dt.current,{select:!0})},yt=function(vt){if(pt.paused||!st)return;const bt=vt.relatedTarget;bt!==null&&(st.contains(bt)||focus(dt.current,{select:!0}))},gt=function(vt){if(document.activeElement===document.body)for(const Et of vt)Et.removedNodes.length>0&&focus(st)};document.addEventListener("focusin",ft),document.addEventListener("focusout",yt);const xt=new MutationObserver(gt);return st&&xt.observe(st,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",ft),document.removeEventListener("focusout",yt),xt.disconnect()}}},[nt,st,pt.paused]),reactExports.useEffect(()=>{if(st){focusScopesStack.add(pt);const ft=document.activeElement;if(!st.contains(ft)){const gt=new CustomEvent(AUTOFOCUS_ON_MOUNT,EVENT_OPTIONS);st.addEventListener(AUTOFOCUS_ON_MOUNT,ct),st.dispatchEvent(gt),gt.defaultPrevented||(focusFirst(removeLinks(getTabbableCandidates(st)),{select:!0}),document.activeElement===ft&&focus(st))}return()=>{st.removeEventListener(AUTOFOCUS_ON_MOUNT,ct),setTimeout(()=>{const gt=new CustomEvent(AUTOFOCUS_ON_UNMOUNT,EVENT_OPTIONS);st.addEventListener(AUTOFOCUS_ON_UNMOUNT,lt),st.dispatchEvent(gt),gt.defaultPrevented||focus(ft??document.body,{select:!0}),st.removeEventListener(AUTOFOCUS_ON_UNMOUNT,lt),focusScopesStack.remove(pt)},0)}}},[st,ct,lt,pt]);const mt=reactExports.useCallback(ft=>{if(!tt&&!nt||pt.paused)return;const yt=ft.key==="Tab"&&!ft.altKey&&!ft.ctrlKey&&!ft.metaKey,gt=document.activeElement;if(yt&>){const xt=ft.currentTarget,[vt,bt]=getTabbableEdges(xt);vt&&bt?!ft.shiftKey&>===bt?(ft.preventDefault(),tt&&focus(vt,{select:!0})):ft.shiftKey&>===vt&&(ft.preventDefault(),tt&&focus(bt,{select:!0})):gt===xt&&ft.preventDefault()}},[tt,nt,pt.paused]);return jsxRuntimeExports.jsx(Primitive.div,{tabIndex:-1,...it,ref:ht,onKeyDown:mt})});FocusScope.displayName=FOCUS_SCOPE_NAME;function focusFirst(o,{select:et=!1}={}){const tt=document.activeElement;for(const nt of o)if(focus(nt,{select:et}),document.activeElement!==tt)return}function getTabbableEdges(o){const et=getTabbableCandidates(o),tt=findVisible(et,o),nt=findVisible(et.reverse(),o);return[tt,nt]}function getTabbableCandidates(o){const et=[],tt=document.createTreeWalker(o,NodeFilter.SHOW_ELEMENT,{acceptNode:nt=>{const rt=nt.tagName==="INPUT"&&nt.type==="hidden";return nt.disabled||nt.hidden||rt?NodeFilter.FILTER_SKIP:nt.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;tt.nextNode();)et.push(tt.currentNode);return et}function findVisible(o,et){for(const tt of o)if(!isHidden(tt,{upTo:et}))return tt}function isHidden(o,{upTo:et}){if(getComputedStyle(o).visibility==="hidden")return!0;for(;o;){if(et!==void 0&&o===et)return!1;if(getComputedStyle(o).display==="none")return!0;o=o.parentElement}return!1}function isSelectableInput(o){return o instanceof HTMLInputElement&&"select"in o}function focus(o,{select:et=!1}={}){if(o&&o.focus){const tt=document.activeElement;o.focus({preventScroll:!0}),o!==tt&&isSelectableInput(o)&&et&&o.select()}}var focusScopesStack=createFocusScopesStack();function createFocusScopesStack(){let o=[];return{add(et){const tt=o[0];et!==tt&&(tt==null||tt.pause()),o=arrayRemove(o,et),o.unshift(et)},remove(et){var tt;o=arrayRemove(o,et),(tt=o[0])==null||tt.resume()}}}function arrayRemove(o,et){const tt=[...o],nt=tt.indexOf(et);return nt!==-1&&tt.splice(nt,1),tt}function removeLinks(o){return o.filter(et=>et.tagName!=="A")}var PORTAL_NAME$1="Portal",Portal$1=reactExports.forwardRef((o,et)=>{var st;const{container:tt,...nt}=o,[rt,ot]=reactExports.useState(!1);useLayoutEffect2(()=>ot(!0),[]);const it=tt||rt&&((st=globalThis==null?void 0:globalThis.document)==null?void 0:st.body);return it?ReactDOM.createPortal(jsxRuntimeExports.jsx(Primitive.div,{...nt,ref:et}),it):null});Portal$1.displayName=PORTAL_NAME$1;function useStateMachine$1(o,et){return reactExports.useReducer((tt,nt)=>et[tt][nt]??tt,o)}var Presence=o=>{const{present:et,children:tt}=o,nt=usePresence(et),rt=typeof tt=="function"?tt({present:nt.isPresent}):reactExports.Children.only(tt),ot=useComposedRefs(nt.ref,getElementRef(rt));return typeof tt=="function"||nt.isPresent?reactExports.cloneElement(rt,{ref:ot}):null};Presence.displayName="Presence";function usePresence(o){const[et,tt]=reactExports.useState(),nt=reactExports.useRef({}),rt=reactExports.useRef(o),ot=reactExports.useRef("none"),it=o?"mounted":"unmounted",[st,at]=useStateMachine$1(it,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return reactExports.useEffect(()=>{const ct=getAnimationName(nt.current);ot.current=st==="mounted"?ct:"none"},[st]),useLayoutEffect2(()=>{const ct=nt.current,lt=rt.current;if(lt!==o){const ht=ot.current,pt=getAnimationName(ct);o?at("MOUNT"):pt==="none"||(ct==null?void 0:ct.display)==="none"?at("UNMOUNT"):at(lt&&ht!==pt?"ANIMATION_OUT":"UNMOUNT"),rt.current=o}},[o,at]),useLayoutEffect2(()=>{if(et){let ct;const lt=et.ownerDocument.defaultView??window,dt=pt=>{const ft=getAnimationName(nt.current).includes(pt.animationName);if(pt.target===et&&ft&&(at("ANIMATION_END"),!rt.current)){const yt=et.style.animationFillMode;et.style.animationFillMode="forwards",ct=lt.setTimeout(()=>{et.style.animationFillMode==="forwards"&&(et.style.animationFillMode=yt)})}},ht=pt=>{pt.target===et&&(ot.current=getAnimationName(nt.current))};return et.addEventListener("animationstart",ht),et.addEventListener("animationcancel",dt),et.addEventListener("animationend",dt),()=>{lt.clearTimeout(ct),et.removeEventListener("animationstart",ht),et.removeEventListener("animationcancel",dt),et.removeEventListener("animationend",dt)}}else at("ANIMATION_END")},[et,at]),{isPresent:["mounted","unmountSuspended"].includes(st),ref:reactExports.useCallback(ct=>{ct&&(nt.current=getComputedStyle(ct)),tt(ct)},[])}}function getAnimationName(o){return(o==null?void 0:o.animationName)||"none"}function getElementRef(o){var nt,rt;let et=(nt=Object.getOwnPropertyDescriptor(o.props,"ref"))==null?void 0:nt.get,tt=et&&"isReactWarning"in et&&et.isReactWarning;return tt?o.ref:(et=(rt=Object.getOwnPropertyDescriptor(o,"ref"))==null?void 0:rt.get,tt=et&&"isReactWarning"in et&&et.isReactWarning,tt?o.props.ref:o.props.ref||o.ref)}var count=0;function useFocusGuards(){reactExports.useEffect(()=>{const o=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",o[0]??createFocusGuard()),document.body.insertAdjacentElement("beforeend",o[1]??createFocusGuard()),count++,()=>{count===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(et=>et.remove()),count--}},[])}function createFocusGuard(){const o=document.createElement("span");return o.setAttribute("data-radix-focus-guard",""),o.tabIndex=0,o.style.outline="none",o.style.opacity="0",o.style.position="fixed",o.style.pointerEvents="none",o}var zeroRightClassName="right-scroll-bar-position",fullWidthClassName="width-before-scroll-bar",noScrollbarsClassName="with-scroll-bars-hidden",removedBarSizeVariable="--removed-body-scroll-bar-size";function assignRef(o,et){return typeof o=="function"?o(et):o&&(o.current=et),o}function useCallbackRef(o,et){var tt=reactExports.useState(function(){return{value:o,callback:et,facade:{get current(){return tt.value},set current(nt){var rt=tt.value;rt!==nt&&(tt.value=nt,tt.callback(nt,rt))}}}})[0];return tt.callback=et,tt.facade}var useIsomorphicLayoutEffect=typeof window<"u"?reactExports.useLayoutEffect:reactExports.useEffect,currentValues=new WeakMap;function useMergeRefs(o,et){var tt=useCallbackRef(null,function(nt){return o.forEach(function(rt){return assignRef(rt,nt)})});return useIsomorphicLayoutEffect(function(){var nt=currentValues.get(tt);if(nt){var rt=new Set(nt),ot=new Set(o),it=tt.current;rt.forEach(function(st){ot.has(st)||assignRef(st,null)}),ot.forEach(function(st){rt.has(st)||assignRef(st,it)})}currentValues.set(tt,o)},[o]),tt}function ItoI(o){return o}function innerCreateMedium(o,et){et===void 0&&(et=ItoI);var tt=[],nt=!1,rt={read:function(){if(nt)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return tt.length?tt[tt.length-1]:o},useMedium:function(ot){var it=et(ot,nt);return tt.push(it),function(){tt=tt.filter(function(st){return st!==it})}},assignSyncMedium:function(ot){for(nt=!0;tt.length;){var it=tt;tt=[],it.forEach(ot)}tt={push:function(st){return ot(st)},filter:function(){return tt}}},assignMedium:function(ot){nt=!0;var it=[];if(tt.length){var st=tt;tt=[],st.forEach(ot),it=tt}var at=function(){var lt=it;it=[],lt.forEach(ot)},ct=function(){return Promise.resolve().then(at)};ct(),tt={push:function(lt){it.push(lt),ct()},filter:function(lt){return it=it.filter(lt),tt}}}};return rt}function createSidecarMedium(o){o===void 0&&(o={});var et=innerCreateMedium(null);return et.options=__assign({async:!0,ssr:!1},o),et}var SideCar$1=function(o){var et=o.sideCar,tt=__rest(o,["sideCar"]);if(!et)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var nt=et.read();if(!nt)throw new Error("Sidecar medium not found");return reactExports.createElement(nt,__assign({},tt))};SideCar$1.isSideCarExport=!0;function exportSidecar(o,et){return o.useMedium(et),SideCar$1}var effectCar=createSidecarMedium(),nothing=function(){},RemoveScroll=reactExports.forwardRef(function(o,et){var tt=reactExports.useRef(null),nt=reactExports.useState({onScrollCapture:nothing,onWheelCapture:nothing,onTouchMoveCapture:nothing}),rt=nt[0],ot=nt[1],it=o.forwardProps,st=o.children,at=o.className,ct=o.removeScrollBar,lt=o.enabled,dt=o.shards,ht=o.sideCar,pt=o.noIsolation,mt=o.inert,ft=o.allowPinchZoom,yt=o.as,gt=yt===void 0?"div":yt,xt=o.gapMode,vt=__rest(o,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noIsolation","inert","allowPinchZoom","as","gapMode"]),bt=ht,Et=useMergeRefs([tt,et]),wt=__assign(__assign({},vt),rt);return reactExports.createElement(reactExports.Fragment,null,lt&&reactExports.createElement(bt,{sideCar:effectCar,removeScrollBar:ct,shards:dt,noIsolation:pt,inert:mt,setCallbacks:ot,allowPinchZoom:!!ft,lockRef:tt,gapMode:xt}),it?reactExports.cloneElement(reactExports.Children.only(st),__assign(__assign({},wt),{ref:Et})):reactExports.createElement(gt,__assign({},wt,{className:at,ref:Et}),st))});RemoveScroll.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};RemoveScroll.classNames={fullWidth:fullWidthClassName,zeroRight:zeroRightClassName};var getNonce=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function makeStyleTag(){if(!document)return null;var o=document.createElement("style");o.type="text/css";var et=getNonce();return et&&o.setAttribute("nonce",et),o}function injectStyles(o,et){o.styleSheet?o.styleSheet.cssText=et:o.appendChild(document.createTextNode(et))}function insertStyleTag(o){var et=document.head||document.getElementsByTagName("head")[0];et.appendChild(o)}var stylesheetSingleton=function(){var o=0,et=null;return{add:function(tt){o==0&&(et=makeStyleTag())&&(injectStyles(et,tt),insertStyleTag(et)),o++},remove:function(){o--,!o&&et&&(et.parentNode&&et.parentNode.removeChild(et),et=null)}}},styleHookSingleton=function(){var o=stylesheetSingleton();return function(et,tt){reactExports.useEffect(function(){return o.add(et),function(){o.remove()}},[et&&tt])}},styleSingleton=function(){var o=styleHookSingleton(),et=function(tt){var nt=tt.styles,rt=tt.dynamic;return o(nt,rt),null};return et},zeroGap={left:0,top:0,right:0,gap:0},parse$2=function(o){return parseInt(o||"",10)||0},getOffset=function(o){var et=window.getComputedStyle(document.body),tt=et[o==="padding"?"paddingLeft":"marginLeft"],nt=et[o==="padding"?"paddingTop":"marginTop"],rt=et[o==="padding"?"paddingRight":"marginRight"];return[parse$2(tt),parse$2(nt),parse$2(rt)]},getGapWidth=function(o){if(o===void 0&&(o="margin"),typeof window>"u")return zeroGap;var et=getOffset(o),tt=document.documentElement.clientWidth,nt=window.innerWidth;return{left:et[0],top:et[1],right:et[2],gap:Math.max(0,nt-tt+et[2]-et[0])}},Style=styleSingleton(),lockAttribute="data-scroll-locked",getStyles=function(o,et,tt,nt){var rt=o.left,ot=o.top,it=o.right,st=o.gap;return tt===void 0&&(tt="margin"),` .`.concat(noScrollbarsClassName,` { overflow: hidden `).concat(nt,`; padding-right: `).concat(st,"px ").concat(nt,`; @@ -4122,11 +4132,11 @@ https://www.dnscrypt.uk`,country:"United Kingdom",location:{lat:51.4964,long:-.1 `)},getCurrentUseCounter=function(){var o=parseInt(document.body.getAttribute(lockAttribute)||"0",10);return isFinite(o)?o:0},useLockAttribute=function(){reactExports.useEffect(function(){return document.body.setAttribute(lockAttribute,(getCurrentUseCounter()+1).toString()),function(){var o=getCurrentUseCounter()-1;o<=0?document.body.removeAttribute(lockAttribute):document.body.setAttribute(lockAttribute,o.toString())}},[])},RemoveScrollBar=function(o){var et=o.noRelative,tt=o.noImportant,nt=o.gapMode,rt=nt===void 0?"margin":nt;useLockAttribute();var ot=reactExports.useMemo(function(){return getGapWidth(rt)},[rt]);return reactExports.createElement(Style,{styles:getStyles(ot,!et,rt,tt?"":"!important")})},passiveSupported=!1;if(typeof window<"u")try{var options=Object.defineProperty({},"passive",{get:function(){return passiveSupported=!0,!0}});window.addEventListener("test",options,options),window.removeEventListener("test",options,options)}catch{passiveSupported=!1}var nonPassive=passiveSupported?{passive:!1}:!1,alwaysContainsScroll=function(o){return o.tagName==="TEXTAREA"},elementCanBeScrolled=function(o,et){if(!(o instanceof Element))return!1;var tt=window.getComputedStyle(o);return tt[et]!=="hidden"&&!(tt.overflowY===tt.overflowX&&!alwaysContainsScroll(o)&&tt[et]==="visible")},elementCouldBeVScrolled=function(o){return elementCanBeScrolled(o,"overflowY")},elementCouldBeHScrolled=function(o){return elementCanBeScrolled(o,"overflowX")},locationCouldBeScrolled=function(o,et){var tt=et.ownerDocument,nt=et;do{typeof ShadowRoot<"u"&&nt instanceof ShadowRoot&&(nt=nt.host);var rt=elementCouldBeScrolled(o,nt);if(rt){var ot=getScrollVariables(o,nt),it=ot[1],st=ot[2];if(it>st)return!0}nt=nt.parentNode}while(nt&&nt!==tt.body);return!1},getVScrollVariables=function(o){var et=o.scrollTop,tt=o.scrollHeight,nt=o.clientHeight;return[et,tt,nt]},getHScrollVariables=function(o){var et=o.scrollLeft,tt=o.scrollWidth,nt=o.clientWidth;return[et,tt,nt]},elementCouldBeScrolled=function(o,et){return o==="v"?elementCouldBeVScrolled(et):elementCouldBeHScrolled(et)},getScrollVariables=function(o,et){return o==="v"?getVScrollVariables(et):getHScrollVariables(et)},getDirectionFactor=function(o,et){return o==="h"&&et==="rtl"?-1:1},handleScroll=function(o,et,tt,nt,rt){var ot=getDirectionFactor(o,window.getComputedStyle(et).direction),it=ot*nt,st=tt.target,at=et.contains(st),ct=!1,lt=it>0,dt=0,ht=0;do{var pt=getScrollVariables(o,st),mt=pt[0],ft=pt[1],yt=pt[2],gt=ft-yt-ot*mt;(mt||gt)&&elementCouldBeScrolled(o,st)&&(dt+=gt,ht+=mt),st instanceof ShadowRoot?st=st.host:st=st.parentNode}while(!at&&st!==document.body||at&&(et.contains(st)||et===st));return(lt&&(Math.abs(dt)<1||!rt)||!lt&&(Math.abs(ht)<1||!rt))&&(ct=!0),ct},getTouchXY=function(o){return"changedTouches"in o?[o.changedTouches[0].clientX,o.changedTouches[0].clientY]:[0,0]},getDeltaXY=function(o){return[o.deltaX,o.deltaY]},extractRef=function(o){return o&&"current"in o?o.current:o},deltaCompare=function(o,et){return o[0]===et[0]&&o[1]===et[1]},generateStyle=function(o){return` .block-interactivity-`.concat(o,` {pointer-events: none;} .allow-interactivity-`).concat(o,` {pointer-events: all;} -`)},idCounter=0,lockStack=[];function RemoveScrollSideCar(o){var et=reactExports.useRef([]),tt=reactExports.useRef([0,0]),nt=reactExports.useRef(),rt=reactExports.useState(idCounter++)[0],ot=reactExports.useState(styleSingleton)[0],it=reactExports.useRef(o);reactExports.useEffect(function(){it.current=o},[o]),reactExports.useEffect(function(){if(o.inert){document.body.classList.add("block-interactivity-".concat(rt));var ft=__spreadArray([o.lockRef.current],(o.shards||[]).map(extractRef),!0).filter(Boolean);return ft.forEach(function(yt){return yt.classList.add("allow-interactivity-".concat(rt))}),function(){document.body.classList.remove("block-interactivity-".concat(rt)),ft.forEach(function(yt){return yt.classList.remove("allow-interactivity-".concat(rt))})}}},[o.inert,o.lockRef.current,o.shards]);var st=reactExports.useCallback(function(ft,yt){if("touches"in ft&&ft.touches.length===2||ft.type==="wheel"&&ft.ctrlKey)return!it.current.allowPinchZoom;var gt=getTouchXY(ft),xt=tt.current,vt="deltaX"in ft?ft.deltaX:xt[0]-gt[0],bt="deltaY"in ft?ft.deltaY:xt[1]-gt[1],Et,wt=ft.target,kt=Math.abs(vt)>Math.abs(bt)?"h":"v";if("touches"in ft&&kt==="h"&&wt.type==="range")return!1;var Tt=locationCouldBeScrolled(kt,wt);if(!Tt)return!0;if(Tt?Et=kt:(Et=kt==="v"?"h":"v",Tt=locationCouldBeScrolled(kt,wt)),!Tt)return!1;if(!nt.current&&"changedTouches"in ft&&(vt||bt)&&(nt.current=Et),!Et)return!0;var Rt=nt.current||Et;return handleScroll(Rt,yt,ft,Rt==="h"?vt:bt,!0)},[]),at=reactExports.useCallback(function(ft){var yt=ft;if(!(!lockStack.length||lockStack[lockStack.length-1]!==ot)){var gt="deltaY"in yt?getDeltaXY(yt):getTouchXY(yt),xt=et.current.filter(function(Et){return Et.name===yt.type&&(Et.target===yt.target||yt.target===Et.shadowParent)&&deltaCompare(Et.delta,gt)})[0];if(xt&&xt.should){yt.cancelable&&yt.preventDefault();return}if(!xt){var vt=(it.current.shards||[]).map(extractRef).filter(Boolean).filter(function(Et){return Et.contains(yt.target)}),bt=vt.length>0?st(yt,vt[0]):!it.current.noIsolation;bt&&yt.cancelable&&yt.preventDefault()}}},[]),ct=reactExports.useCallback(function(ft,yt,gt,xt){var vt={name:ft,delta:yt,target:gt,should:xt,shadowParent:getOutermostShadowParent(gt)};et.current.push(vt),setTimeout(function(){et.current=et.current.filter(function(bt){return bt!==vt})},1)},[]),lt=reactExports.useCallback(function(ft){tt.current=getTouchXY(ft),nt.current=void 0},[]),dt=reactExports.useCallback(function(ft){ct(ft.type,getDeltaXY(ft),ft.target,st(ft,o.lockRef.current))},[]),ht=reactExports.useCallback(function(ft){ct(ft.type,getTouchXY(ft),ft.target,st(ft,o.lockRef.current))},[]);reactExports.useEffect(function(){return lockStack.push(ot),o.setCallbacks({onScrollCapture:dt,onWheelCapture:dt,onTouchMoveCapture:ht}),document.addEventListener("wheel",at,nonPassive),document.addEventListener("touchmove",at,nonPassive),document.addEventListener("touchstart",lt,nonPassive),function(){lockStack=lockStack.filter(function(ft){return ft!==ot}),document.removeEventListener("wheel",at,nonPassive),document.removeEventListener("touchmove",at,nonPassive),document.removeEventListener("touchstart",lt,nonPassive)}},[]);var pt=o.removeScrollBar,mt=o.inert;return reactExports.createElement(reactExports.Fragment,null,mt?reactExports.createElement(ot,{styles:generateStyle(rt)}):null,pt?reactExports.createElement(RemoveScrollBar,{gapMode:o.gapMode}):null)}function getOutermostShadowParent(o){for(var et=null;o!==null;)o instanceof ShadowRoot&&(et=o.host,o=o.host),o=o.parentNode;return et}const SideCar=exportSidecar(effectCar,RemoveScrollSideCar);var ReactRemoveScroll=reactExports.forwardRef(function(o,et){return reactExports.createElement(RemoveScroll,__assign({},o,{ref:et,sideCar:SideCar}))});ReactRemoveScroll.classNames=RemoveScroll.classNames;var getDefaultParent=function(o){if(typeof document>"u")return null;var et=Array.isArray(o)?o[0]:o;return et.ownerDocument.body},counterMap=new WeakMap,uncontrolledNodes=new WeakMap,markerMap={},lockCount=0,unwrapHost=function(o){return o&&(o.host||unwrapHost(o.parentNode))},correctTargets=function(o,et){return et.map(function(tt){if(o.contains(tt))return tt;var nt=unwrapHost(tt);return nt&&o.contains(nt)?nt:(console.error("aria-hidden",tt,"in not contained inside",o,". Doing nothing"),null)}).filter(function(tt){return!!tt})},applyAttributeToOthers=function(o,et,tt,nt){var rt=correctTargets(et,Array.isArray(o)?o:[o]);markerMap[tt]||(markerMap[tt]=new WeakMap);var ot=markerMap[tt],it=[],st=new Set,at=new Set(rt),ct=function(dt){!dt||st.has(dt)||(st.add(dt),ct(dt.parentNode))};rt.forEach(ct);var lt=function(dt){!dt||at.has(dt)||Array.prototype.forEach.call(dt.children,function(ht){if(st.has(ht))lt(ht);else try{var pt=ht.getAttribute(nt),mt=pt!==null&&pt!=="false",ft=(counterMap.get(ht)||0)+1,yt=(ot.get(ht)||0)+1;counterMap.set(ht,ft),ot.set(ht,yt),it.push(ht),ft===1&&mt&&uncontrolledNodes.set(ht,!0),yt===1&&ht.setAttribute(tt,"true"),mt||ht.setAttribute(nt,"true")}catch(gt){console.error("aria-hidden: cannot operate on ",ht,gt)}})};return lt(et),st.clear(),lockCount++,function(){it.forEach(function(dt){var ht=counterMap.get(dt)-1,pt=ot.get(dt)-1;counterMap.set(dt,ht),ot.set(dt,pt),ht||(uncontrolledNodes.has(dt)||dt.removeAttribute(nt),uncontrolledNodes.delete(dt)),pt||dt.removeAttribute(tt)}),lockCount--,lockCount||(counterMap=new WeakMap,counterMap=new WeakMap,uncontrolledNodes=new WeakMap,markerMap={})}},hideOthers=function(o,et,tt){tt===void 0&&(tt="data-aria-hidden");var nt=Array.from(Array.isArray(o)?o:[o]),rt=getDefaultParent(o);return rt?(nt.push.apply(nt,Array.from(rt.querySelectorAll("[aria-live]"))),applyAttributeToOthers(nt,rt,tt,"aria-hidden")):function(){return null}},DIALOG_NAME="Dialog",[createDialogContext,createDialogScope]=createContextScope(DIALOG_NAME),[DialogProvider,useDialogContext]=createDialogContext(DIALOG_NAME),Dialog$1=o=>{const{__scopeDialog:et,children:tt,open:nt,defaultOpen:rt,onOpenChange:ot,modal:it=!0}=o,st=reactExports.useRef(null),at=reactExports.useRef(null),[ct=!1,lt]=useControllableState({prop:nt,defaultProp:rt,onChange:ot});return jsxRuntimeExports.jsx(DialogProvider,{scope:et,triggerRef:st,contentRef:at,contentId:useId(),titleId:useId(),descriptionId:useId(),open:ct,onOpenChange:lt,onOpenToggle:reactExports.useCallback(()=>lt(dt=>!dt),[lt]),modal:it,children:tt})};Dialog$1.displayName=DIALOG_NAME;var TRIGGER_NAME="DialogTrigger",DialogTrigger$1=reactExports.forwardRef((o,et)=>{const{__scopeDialog:tt,...nt}=o,rt=useDialogContext(TRIGGER_NAME,tt),ot=useComposedRefs(et,rt.triggerRef);return jsxRuntimeExports.jsx(Primitive.button,{type:"button","aria-haspopup":"dialog","aria-expanded":rt.open,"aria-controls":rt.contentId,"data-state":getState(rt.open),...nt,ref:ot,onClick:composeEventHandlers(o.onClick,rt.onOpenToggle)})});DialogTrigger$1.displayName=TRIGGER_NAME;var PORTAL_NAME="DialogPortal",[PortalProvider,usePortalContext]=createDialogContext(PORTAL_NAME,{forceMount:void 0}),DialogPortal$1=o=>{const{__scopeDialog:et,forceMount:tt,children:nt,container:rt}=o,ot=useDialogContext(PORTAL_NAME,et);return jsxRuntimeExports.jsx(PortalProvider,{scope:et,forceMount:tt,children:reactExports.Children.map(nt,it=>jsxRuntimeExports.jsx(Presence,{present:tt||ot.open,children:jsxRuntimeExports.jsx(Portal$1,{asChild:!0,container:rt,children:it})}))})};DialogPortal$1.displayName=PORTAL_NAME;var OVERLAY_NAME="DialogOverlay",DialogOverlay$1=reactExports.forwardRef((o,et)=>{const tt=usePortalContext(OVERLAY_NAME,o.__scopeDialog),{forceMount:nt=tt.forceMount,...rt}=o,ot=useDialogContext(OVERLAY_NAME,o.__scopeDialog);return ot.modal?jsxRuntimeExports.jsx(Presence,{present:nt||ot.open,children:jsxRuntimeExports.jsx(DialogOverlayImpl,{...rt,ref:et})}):null});DialogOverlay$1.displayName=OVERLAY_NAME;var DialogOverlayImpl=reactExports.forwardRef((o,et)=>{const{__scopeDialog:tt,...nt}=o,rt=useDialogContext(OVERLAY_NAME,tt);return jsxRuntimeExports.jsx(ReactRemoveScroll,{as:Slot,allowPinchZoom:!0,shards:[rt.contentRef],children:jsxRuntimeExports.jsx(Primitive.div,{"data-state":getState(rt.open),...nt,ref:et,style:{pointerEvents:"auto",...nt.style}})})}),CONTENT_NAME="DialogContent",DialogContent$1=reactExports.forwardRef((o,et)=>{const tt=usePortalContext(CONTENT_NAME,o.__scopeDialog),{forceMount:nt=tt.forceMount,...rt}=o,ot=useDialogContext(CONTENT_NAME,o.__scopeDialog);return jsxRuntimeExports.jsx(Presence,{present:nt||ot.open,children:ot.modal?jsxRuntimeExports.jsx(DialogContentModal,{...rt,ref:et}):jsxRuntimeExports.jsx(DialogContentNonModal,{...rt,ref:et})})});DialogContent$1.displayName=CONTENT_NAME;var DialogContentModal=reactExports.forwardRef((o,et)=>{const tt=useDialogContext(CONTENT_NAME,o.__scopeDialog),nt=reactExports.useRef(null),rt=useComposedRefs(et,tt.contentRef,nt);return reactExports.useEffect(()=>{const ot=nt.current;if(ot)return hideOthers(ot)},[]),jsxRuntimeExports.jsx(DialogContentImpl,{...o,ref:rt,trapFocus:tt.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:composeEventHandlers(o.onCloseAutoFocus,ot=>{var it;ot.preventDefault(),(it=tt.triggerRef.current)==null||it.focus()}),onPointerDownOutside:composeEventHandlers(o.onPointerDownOutside,ot=>{const it=ot.detail.originalEvent,st=it.button===0&&it.ctrlKey===!0;(it.button===2||st)&&ot.preventDefault()}),onFocusOutside:composeEventHandlers(o.onFocusOutside,ot=>ot.preventDefault())})}),DialogContentNonModal=reactExports.forwardRef((o,et)=>{const tt=useDialogContext(CONTENT_NAME,o.__scopeDialog),nt=reactExports.useRef(!1),rt=reactExports.useRef(!1);return jsxRuntimeExports.jsx(DialogContentImpl,{...o,ref:et,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:ot=>{var it,st;(it=o.onCloseAutoFocus)==null||it.call(o,ot),ot.defaultPrevented||(nt.current||(st=tt.triggerRef.current)==null||st.focus(),ot.preventDefault()),nt.current=!1,rt.current=!1},onInteractOutside:ot=>{var at,ct;(at=o.onInteractOutside)==null||at.call(o,ot),ot.defaultPrevented||(nt.current=!0,ot.detail.originalEvent.type==="pointerdown"&&(rt.current=!0));const it=ot.target;((ct=tt.triggerRef.current)==null?void 0:ct.contains(it))&&ot.preventDefault(),ot.detail.originalEvent.type==="focusin"&&rt.current&&ot.preventDefault()}})}),DialogContentImpl=reactExports.forwardRef((o,et)=>{const{__scopeDialog:tt,trapFocus:nt,onOpenAutoFocus:rt,onCloseAutoFocus:ot,...it}=o,st=useDialogContext(CONTENT_NAME,tt),at=reactExports.useRef(null),ct=useComposedRefs(et,at);return useFocusGuards(),jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(FocusScope,{asChild:!0,loop:!0,trapped:nt,onMountAutoFocus:rt,onUnmountAutoFocus:ot,children:jsxRuntimeExports.jsx(DismissableLayer,{role:"dialog",id:st.contentId,"aria-describedby":st.descriptionId,"aria-labelledby":st.titleId,"data-state":getState(st.open),...it,ref:ct,onDismiss:()=>st.onOpenChange(!1)})}),jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(TitleWarning,{titleId:st.titleId}),jsxRuntimeExports.jsx(DescriptionWarning,{contentRef:at,descriptionId:st.descriptionId})]})]})}),TITLE_NAME="DialogTitle",DialogTitle$1=reactExports.forwardRef((o,et)=>{const{__scopeDialog:tt,...nt}=o,rt=useDialogContext(TITLE_NAME,tt);return jsxRuntimeExports.jsx(Primitive.h2,{id:rt.titleId,...nt,ref:et})});DialogTitle$1.displayName=TITLE_NAME;var DESCRIPTION_NAME="DialogDescription",DialogDescription$1=reactExports.forwardRef((o,et)=>{const{__scopeDialog:tt,...nt}=o,rt=useDialogContext(DESCRIPTION_NAME,tt);return jsxRuntimeExports.jsx(Primitive.p,{id:rt.descriptionId,...nt,ref:et})});DialogDescription$1.displayName=DESCRIPTION_NAME;var CLOSE_NAME="DialogClose",DialogClose=reactExports.forwardRef((o,et)=>{const{__scopeDialog:tt,...nt}=o,rt=useDialogContext(CLOSE_NAME,tt);return jsxRuntimeExports.jsx(Primitive.button,{type:"button",...nt,ref:et,onClick:composeEventHandlers(o.onClick,()=>rt.onOpenChange(!1))})});DialogClose.displayName=CLOSE_NAME;function getState(o){return o?"open":"closed"}var TITLE_WARNING_NAME="DialogTitleWarning",[WarningProvider,useWarningContext]=createContext2(TITLE_WARNING_NAME,{contentName:CONTENT_NAME,titleName:TITLE_NAME,docsSlug:"dialog"}),TitleWarning=({titleId:o})=>{const et=useWarningContext(TITLE_WARNING_NAME),tt=`\`${et.contentName}\` requires a \`${et.titleName}\` for the component to be accessible for screen reader users. +`)},idCounter=0,lockStack=[];function RemoveScrollSideCar(o){var et=reactExports.useRef([]),tt=reactExports.useRef([0,0]),nt=reactExports.useRef(),rt=reactExports.useState(idCounter++)[0],ot=reactExports.useState(styleSingleton)[0],it=reactExports.useRef(o);reactExports.useEffect(function(){it.current=o},[o]),reactExports.useEffect(function(){if(o.inert){document.body.classList.add("block-interactivity-".concat(rt));var ft=__spreadArray([o.lockRef.current],(o.shards||[]).map(extractRef),!0).filter(Boolean);return ft.forEach(function(yt){return yt.classList.add("allow-interactivity-".concat(rt))}),function(){document.body.classList.remove("block-interactivity-".concat(rt)),ft.forEach(function(yt){return yt.classList.remove("allow-interactivity-".concat(rt))})}}},[o.inert,o.lockRef.current,o.shards]);var st=reactExports.useCallback(function(ft,yt){if("touches"in ft&&ft.touches.length===2||ft.type==="wheel"&&ft.ctrlKey)return!it.current.allowPinchZoom;var gt=getTouchXY(ft),xt=tt.current,vt="deltaX"in ft?ft.deltaX:xt[0]-gt[0],bt="deltaY"in ft?ft.deltaY:xt[1]-gt[1],Et,wt=ft.target,kt=Math.abs(vt)>Math.abs(bt)?"h":"v";if("touches"in ft&&kt==="h"&&wt.type==="range")return!1;var It=locationCouldBeScrolled(kt,wt);if(!It)return!0;if(It?Et=kt:(Et=kt==="v"?"h":"v",It=locationCouldBeScrolled(kt,wt)),!It)return!1;if(!nt.current&&"changedTouches"in ft&&(vt||bt)&&(nt.current=Et),!Et)return!0;var Rt=nt.current||Et;return handleScroll(Rt,yt,ft,Rt==="h"?vt:bt,!0)},[]),at=reactExports.useCallback(function(ft){var yt=ft;if(!(!lockStack.length||lockStack[lockStack.length-1]!==ot)){var gt="deltaY"in yt?getDeltaXY(yt):getTouchXY(yt),xt=et.current.filter(function(Et){return Et.name===yt.type&&(Et.target===yt.target||yt.target===Et.shadowParent)&&deltaCompare(Et.delta,gt)})[0];if(xt&&xt.should){yt.cancelable&&yt.preventDefault();return}if(!xt){var vt=(it.current.shards||[]).map(extractRef).filter(Boolean).filter(function(Et){return Et.contains(yt.target)}),bt=vt.length>0?st(yt,vt[0]):!it.current.noIsolation;bt&&yt.cancelable&&yt.preventDefault()}}},[]),ct=reactExports.useCallback(function(ft,yt,gt,xt){var vt={name:ft,delta:yt,target:gt,should:xt,shadowParent:getOutermostShadowParent(gt)};et.current.push(vt),setTimeout(function(){et.current=et.current.filter(function(bt){return bt!==vt})},1)},[]),lt=reactExports.useCallback(function(ft){tt.current=getTouchXY(ft),nt.current=void 0},[]),dt=reactExports.useCallback(function(ft){ct(ft.type,getDeltaXY(ft),ft.target,st(ft,o.lockRef.current))},[]),ht=reactExports.useCallback(function(ft){ct(ft.type,getTouchXY(ft),ft.target,st(ft,o.lockRef.current))},[]);reactExports.useEffect(function(){return lockStack.push(ot),o.setCallbacks({onScrollCapture:dt,onWheelCapture:dt,onTouchMoveCapture:ht}),document.addEventListener("wheel",at,nonPassive),document.addEventListener("touchmove",at,nonPassive),document.addEventListener("touchstart",lt,nonPassive),function(){lockStack=lockStack.filter(function(ft){return ft!==ot}),document.removeEventListener("wheel",at,nonPassive),document.removeEventListener("touchmove",at,nonPassive),document.removeEventListener("touchstart",lt,nonPassive)}},[]);var pt=o.removeScrollBar,mt=o.inert;return reactExports.createElement(reactExports.Fragment,null,mt?reactExports.createElement(ot,{styles:generateStyle(rt)}):null,pt?reactExports.createElement(RemoveScrollBar,{gapMode:o.gapMode}):null)}function getOutermostShadowParent(o){for(var et=null;o!==null;)o instanceof ShadowRoot&&(et=o.host,o=o.host),o=o.parentNode;return et}const SideCar=exportSidecar(effectCar,RemoveScrollSideCar);var ReactRemoveScroll=reactExports.forwardRef(function(o,et){return reactExports.createElement(RemoveScroll,__assign({},o,{ref:et,sideCar:SideCar}))});ReactRemoveScroll.classNames=RemoveScroll.classNames;var getDefaultParent=function(o){if(typeof document>"u")return null;var et=Array.isArray(o)?o[0]:o;return et.ownerDocument.body},counterMap=new WeakMap,uncontrolledNodes=new WeakMap,markerMap={},lockCount=0,unwrapHost=function(o){return o&&(o.host||unwrapHost(o.parentNode))},correctTargets=function(o,et){return et.map(function(tt){if(o.contains(tt))return tt;var nt=unwrapHost(tt);return nt&&o.contains(nt)?nt:(console.error("aria-hidden",tt,"in not contained inside",o,". Doing nothing"),null)}).filter(function(tt){return!!tt})},applyAttributeToOthers=function(o,et,tt,nt){var rt=correctTargets(et,Array.isArray(o)?o:[o]);markerMap[tt]||(markerMap[tt]=new WeakMap);var ot=markerMap[tt],it=[],st=new Set,at=new Set(rt),ct=function(dt){!dt||st.has(dt)||(st.add(dt),ct(dt.parentNode))};rt.forEach(ct);var lt=function(dt){!dt||at.has(dt)||Array.prototype.forEach.call(dt.children,function(ht){if(st.has(ht))lt(ht);else try{var pt=ht.getAttribute(nt),mt=pt!==null&&pt!=="false",ft=(counterMap.get(ht)||0)+1,yt=(ot.get(ht)||0)+1;counterMap.set(ht,ft),ot.set(ht,yt),it.push(ht),ft===1&&mt&&uncontrolledNodes.set(ht,!0),yt===1&&ht.setAttribute(tt,"true"),mt||ht.setAttribute(nt,"true")}catch(gt){console.error("aria-hidden: cannot operate on ",ht,gt)}})};return lt(et),st.clear(),lockCount++,function(){it.forEach(function(dt){var ht=counterMap.get(dt)-1,pt=ot.get(dt)-1;counterMap.set(dt,ht),ot.set(dt,pt),ht||(uncontrolledNodes.has(dt)||dt.removeAttribute(nt),uncontrolledNodes.delete(dt)),pt||dt.removeAttribute(tt)}),lockCount--,lockCount||(counterMap=new WeakMap,counterMap=new WeakMap,uncontrolledNodes=new WeakMap,markerMap={})}},hideOthers=function(o,et,tt){tt===void 0&&(tt="data-aria-hidden");var nt=Array.from(Array.isArray(o)?o:[o]),rt=getDefaultParent(o);return rt?(nt.push.apply(nt,Array.from(rt.querySelectorAll("[aria-live]"))),applyAttributeToOthers(nt,rt,tt,"aria-hidden")):function(){return null}},DIALOG_NAME="Dialog",[createDialogContext,createDialogScope]=createContextScope(DIALOG_NAME),[DialogProvider,useDialogContext]=createDialogContext(DIALOG_NAME),Dialog$1=o=>{const{__scopeDialog:et,children:tt,open:nt,defaultOpen:rt,onOpenChange:ot,modal:it=!0}=o,st=reactExports.useRef(null),at=reactExports.useRef(null),[ct=!1,lt]=useControllableState({prop:nt,defaultProp:rt,onChange:ot});return jsxRuntimeExports.jsx(DialogProvider,{scope:et,triggerRef:st,contentRef:at,contentId:useId(),titleId:useId(),descriptionId:useId(),open:ct,onOpenChange:lt,onOpenToggle:reactExports.useCallback(()=>lt(dt=>!dt),[lt]),modal:it,children:tt})};Dialog$1.displayName=DIALOG_NAME;var TRIGGER_NAME="DialogTrigger",DialogTrigger$1=reactExports.forwardRef((o,et)=>{const{__scopeDialog:tt,...nt}=o,rt=useDialogContext(TRIGGER_NAME,tt),ot=useComposedRefs(et,rt.triggerRef);return jsxRuntimeExports.jsx(Primitive.button,{type:"button","aria-haspopup":"dialog","aria-expanded":rt.open,"aria-controls":rt.contentId,"data-state":getState(rt.open),...nt,ref:ot,onClick:composeEventHandlers(o.onClick,rt.onOpenToggle)})});DialogTrigger$1.displayName=TRIGGER_NAME;var PORTAL_NAME="DialogPortal",[PortalProvider,usePortalContext]=createDialogContext(PORTAL_NAME,{forceMount:void 0}),DialogPortal$1=o=>{const{__scopeDialog:et,forceMount:tt,children:nt,container:rt}=o,ot=useDialogContext(PORTAL_NAME,et);return jsxRuntimeExports.jsx(PortalProvider,{scope:et,forceMount:tt,children:reactExports.Children.map(nt,it=>jsxRuntimeExports.jsx(Presence,{present:tt||ot.open,children:jsxRuntimeExports.jsx(Portal$1,{asChild:!0,container:rt,children:it})}))})};DialogPortal$1.displayName=PORTAL_NAME;var OVERLAY_NAME="DialogOverlay",DialogOverlay$1=reactExports.forwardRef((o,et)=>{const tt=usePortalContext(OVERLAY_NAME,o.__scopeDialog),{forceMount:nt=tt.forceMount,...rt}=o,ot=useDialogContext(OVERLAY_NAME,o.__scopeDialog);return ot.modal?jsxRuntimeExports.jsx(Presence,{present:nt||ot.open,children:jsxRuntimeExports.jsx(DialogOverlayImpl,{...rt,ref:et})}):null});DialogOverlay$1.displayName=OVERLAY_NAME;var DialogOverlayImpl=reactExports.forwardRef((o,et)=>{const{__scopeDialog:tt,...nt}=o,rt=useDialogContext(OVERLAY_NAME,tt);return jsxRuntimeExports.jsx(ReactRemoveScroll,{as:Slot,allowPinchZoom:!0,shards:[rt.contentRef],children:jsxRuntimeExports.jsx(Primitive.div,{"data-state":getState(rt.open),...nt,ref:et,style:{pointerEvents:"auto",...nt.style}})})}),CONTENT_NAME="DialogContent",DialogContent$1=reactExports.forwardRef((o,et)=>{const tt=usePortalContext(CONTENT_NAME,o.__scopeDialog),{forceMount:nt=tt.forceMount,...rt}=o,ot=useDialogContext(CONTENT_NAME,o.__scopeDialog);return jsxRuntimeExports.jsx(Presence,{present:nt||ot.open,children:ot.modal?jsxRuntimeExports.jsx(DialogContentModal,{...rt,ref:et}):jsxRuntimeExports.jsx(DialogContentNonModal,{...rt,ref:et})})});DialogContent$1.displayName=CONTENT_NAME;var DialogContentModal=reactExports.forwardRef((o,et)=>{const tt=useDialogContext(CONTENT_NAME,o.__scopeDialog),nt=reactExports.useRef(null),rt=useComposedRefs(et,tt.contentRef,nt);return reactExports.useEffect(()=>{const ot=nt.current;if(ot)return hideOthers(ot)},[]),jsxRuntimeExports.jsx(DialogContentImpl,{...o,ref:rt,trapFocus:tt.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:composeEventHandlers(o.onCloseAutoFocus,ot=>{var it;ot.preventDefault(),(it=tt.triggerRef.current)==null||it.focus()}),onPointerDownOutside:composeEventHandlers(o.onPointerDownOutside,ot=>{const it=ot.detail.originalEvent,st=it.button===0&&it.ctrlKey===!0;(it.button===2||st)&&ot.preventDefault()}),onFocusOutside:composeEventHandlers(o.onFocusOutside,ot=>ot.preventDefault())})}),DialogContentNonModal=reactExports.forwardRef((o,et)=>{const tt=useDialogContext(CONTENT_NAME,o.__scopeDialog),nt=reactExports.useRef(!1),rt=reactExports.useRef(!1);return jsxRuntimeExports.jsx(DialogContentImpl,{...o,ref:et,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:ot=>{var it,st;(it=o.onCloseAutoFocus)==null||it.call(o,ot),ot.defaultPrevented||(nt.current||(st=tt.triggerRef.current)==null||st.focus(),ot.preventDefault()),nt.current=!1,rt.current=!1},onInteractOutside:ot=>{var at,ct;(at=o.onInteractOutside)==null||at.call(o,ot),ot.defaultPrevented||(nt.current=!0,ot.detail.originalEvent.type==="pointerdown"&&(rt.current=!0));const it=ot.target;((ct=tt.triggerRef.current)==null?void 0:ct.contains(it))&&ot.preventDefault(),ot.detail.originalEvent.type==="focusin"&&rt.current&&ot.preventDefault()}})}),DialogContentImpl=reactExports.forwardRef((o,et)=>{const{__scopeDialog:tt,trapFocus:nt,onOpenAutoFocus:rt,onCloseAutoFocus:ot,...it}=o,st=useDialogContext(CONTENT_NAME,tt),at=reactExports.useRef(null),ct=useComposedRefs(et,at);return useFocusGuards(),jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(FocusScope,{asChild:!0,loop:!0,trapped:nt,onMountAutoFocus:rt,onUnmountAutoFocus:ot,children:jsxRuntimeExports.jsx(DismissableLayer,{role:"dialog",id:st.contentId,"aria-describedby":st.descriptionId,"aria-labelledby":st.titleId,"data-state":getState(st.open),...it,ref:ct,onDismiss:()=>st.onOpenChange(!1)})}),jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(TitleWarning,{titleId:st.titleId}),jsxRuntimeExports.jsx(DescriptionWarning,{contentRef:at,descriptionId:st.descriptionId})]})]})}),TITLE_NAME="DialogTitle",DialogTitle$1=reactExports.forwardRef((o,et)=>{const{__scopeDialog:tt,...nt}=o,rt=useDialogContext(TITLE_NAME,tt);return jsxRuntimeExports.jsx(Primitive.h2,{id:rt.titleId,...nt,ref:et})});DialogTitle$1.displayName=TITLE_NAME;var DESCRIPTION_NAME="DialogDescription",DialogDescription$1=reactExports.forwardRef((o,et)=>{const{__scopeDialog:tt,...nt}=o,rt=useDialogContext(DESCRIPTION_NAME,tt);return jsxRuntimeExports.jsx(Primitive.p,{id:rt.descriptionId,...nt,ref:et})});DialogDescription$1.displayName=DESCRIPTION_NAME;var CLOSE_NAME="DialogClose",DialogClose=reactExports.forwardRef((o,et)=>{const{__scopeDialog:tt,...nt}=o,rt=useDialogContext(CLOSE_NAME,tt);return jsxRuntimeExports.jsx(Primitive.button,{type:"button",...nt,ref:et,onClick:composeEventHandlers(o.onClick,()=>rt.onOpenChange(!1))})});DialogClose.displayName=CLOSE_NAME;function getState(o){return o?"open":"closed"}var TITLE_WARNING_NAME="DialogTitleWarning",[WarningProvider,useWarningContext]=createContext2(TITLE_WARNING_NAME,{contentName:CONTENT_NAME,titleName:TITLE_NAME,docsSlug:"dialog"}),TitleWarning=({titleId:o})=>{const et=useWarningContext(TITLE_WARNING_NAME),tt=`\`${et.contentName}\` requires a \`${et.titleName}\` for the component to be accessible for screen reader users. If you want to hide the \`${et.titleName}\`, you can wrap it with our VisuallyHidden component. -For more information, see https://radix-ui.com/primitives/docs/components/${et.docsSlug}`;return reactExports.useEffect(()=>{o&&(document.getElementById(o)||console.error(tt))},[tt,o]),null},DESCRIPTION_WARNING_NAME="DialogDescriptionWarning",DescriptionWarning=({contentRef:o,descriptionId:et})=>{const nt=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${useWarningContext(DESCRIPTION_WARNING_NAME).contentName}}.`;return reactExports.useEffect(()=>{var ot;const rt=(ot=o.current)==null?void 0:ot.getAttribute("aria-describedby");et&&rt&&(document.getElementById(et)||console.warn(nt))},[nt,o,et]),null},Root$2=Dialog$1,Trigger=DialogTrigger$1,Portal=DialogPortal$1,Overlay=DialogOverlay$1,Content=DialogContent$1,Title=DialogTitle$1,Description=DialogDescription$1;const Dialog=Root$2,DialogTrigger=Trigger,DialogPortal=Portal,DialogOverlay=reactExports.forwardRef(({className:o,...et},tt)=>jsxRuntimeExports.jsx(Overlay,{ref:tt,className:cn("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",o),...et}));DialogOverlay.displayName=Overlay.displayName;const DialogContent=reactExports.forwardRef(({className:o,...et},tt)=>jsxRuntimeExports.jsxs(DialogPortal,{children:[jsxRuntimeExports.jsx(DialogOverlay,{}),jsxRuntimeExports.jsx(Content,{ref:tt,className:cn("fixed left-[50%] top-[50%] z-50 grid w-full translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200","rounded-lg","max-h-[85vh] overflow-y-auto",o),...et})]}));DialogContent.displayName=Content.displayName;const DialogHeader=({className:o,...et})=>jsxRuntimeExports.jsx("div",{className:cn("flex flex-col space-y-1.5 text-center sm:text-left",o),...et});DialogHeader.displayName="DialogHeader";const DialogFooter=({className:o,...et})=>jsxRuntimeExports.jsx("div",{className:cn("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",o),...et});DialogFooter.displayName="DialogFooter";const DialogTitle=reactExports.forwardRef(({className:o,...et},tt)=>jsxRuntimeExports.jsx(Title,{ref:tt,className:cn("text-lg font-semibold leading-none tracking-tight",o),...et}));DialogTitle.displayName=Title.displayName;const DialogDescription=reactExports.forwardRef(({className:o,...et},tt)=>jsxRuntimeExports.jsx(Description,{ref:tt,className:cn("text-sm text-muted-foreground",o),...et}));DialogDescription.displayName=Description.displayName;var __defProp=Object.defineProperty,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(o,et,tt)=>et in o?__defProp(o,et,{enumerable:!0,configurable:!0,writable:!0,value:tt}):o[et]=tt,__spreadValues=(o,et)=>{for(var tt in et||(et={}))__hasOwnProp.call(et,tt)&&__defNormalProp(o,tt,et[tt]);if(__getOwnPropSymbols)for(var tt of __getOwnPropSymbols(et))__propIsEnum.call(et,tt)&&__defNormalProp(o,tt,et[tt]);return o},__objRest=(o,et)=>{var tt={};for(var nt in o)__hasOwnProp.call(o,nt)&&et.indexOf(nt)<0&&(tt[nt]=o[nt]);if(o!=null&&__getOwnPropSymbols)for(var nt of __getOwnPropSymbols(o))et.indexOf(nt)<0&&__propIsEnum.call(o,nt)&&(tt[nt]=o[nt]);return tt};/** +For more information, see https://radix-ui.com/primitives/docs/components/${et.docsSlug}`;return reactExports.useEffect(()=>{o&&(document.getElementById(o)||console.error(tt))},[tt,o]),null},DESCRIPTION_WARNING_NAME="DialogDescriptionWarning",DescriptionWarning=({contentRef:o,descriptionId:et})=>{const nt=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${useWarningContext(DESCRIPTION_WARNING_NAME).contentName}}.`;return reactExports.useEffect(()=>{var ot;const rt=(ot=o.current)==null?void 0:ot.getAttribute("aria-describedby");et&&rt&&(document.getElementById(et)||console.warn(nt))},[nt,o,et]),null},Root$2=Dialog$1,Trigger=DialogTrigger$1,Portal=DialogPortal$1,Overlay=DialogOverlay$1,Content=DialogContent$1,Title=DialogTitle$1,Description=DialogDescription$1;const Dialog=Root$2,DialogTrigger=Trigger,DialogPortal=Portal,DialogOverlay=reactExports.forwardRef(({className:o,...et},tt)=>jsxRuntimeExports.jsx(Overlay,{ref:tt,className:cn("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",o),...et}));DialogOverlay.displayName=Overlay.displayName;const DialogContent=reactExports.forwardRef(({className:o,...et},tt)=>jsxRuntimeExports.jsxs(DialogPortal,{children:[jsxRuntimeExports.jsx(DialogOverlay,{}),jsxRuntimeExports.jsx(Content,{ref:tt,className:cn("fixed z-50 border bg-background shadow-lg duration-200","p-4 md:p-6","w-full md:w-[calc(100%-2rem)] md:max-w-lg","focus:outline-none focus-visible:ring-2 focus-visible:ring-accent","bottom-0 rounded-t-lg md:rounded-lg","md:left-[50%] md:top-[50%] md:translate-x-[-50%] md:translate-y-[-50%]",o),...et})]}));DialogContent.displayName=Content.displayName;const DialogHeader=({className:o,...et})=>jsxRuntimeExports.jsx("div",{className:cn("flex flex-col space-y-1.5 text-center sm:text-left",o),...et});DialogHeader.displayName="DialogHeader";const DialogFooter=({className:o,...et})=>jsxRuntimeExports.jsx("div",{className:cn("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",o),...et});DialogFooter.displayName="DialogFooter";const DialogTitle=reactExports.forwardRef(({className:o,...et},tt)=>jsxRuntimeExports.jsx(Title,{ref:tt,className:cn("text-lg font-semibold leading-none tracking-tight",o),...et}));DialogTitle.displayName=Title.displayName;const DialogDescription=reactExports.forwardRef(({className:o,...et},tt)=>jsxRuntimeExports.jsx(Description,{ref:tt,className:cn("text-sm text-muted-foreground",o),...et}));DialogDescription.displayName=Description.displayName;var __defProp=Object.defineProperty,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(o,et,tt)=>et in o?__defProp(o,et,{enumerable:!0,configurable:!0,writable:!0,value:tt}):o[et]=tt,__spreadValues=(o,et)=>{for(var tt in et||(et={}))__hasOwnProp.call(et,tt)&&__defNormalProp(o,tt,et[tt]);if(__getOwnPropSymbols)for(var tt of __getOwnPropSymbols(et))__propIsEnum.call(et,tt)&&__defNormalProp(o,tt,et[tt]);return o},__objRest=(o,et)=>{var tt={};for(var nt in o)__hasOwnProp.call(o,nt)&&et.indexOf(nt)<0&&(tt[nt]=o[nt]);if(o!=null&&__getOwnPropSymbols)for(var nt of __getOwnPropSymbols(o))et.indexOf(nt)<0&&__propIsEnum.call(o,nt)&&(tt[nt]=o[nt]);return tt};/** * @license QR Code generator library (TypeScript) * Copyright (c) Project Nayuki. * SPDX-License-Identifier: MIT @@ -4134,29 +4144,23 @@ For more information, see https://radix-ui.com/primitives/docs/components/${et.d * @license qrcode.react * Copyright (c) Paul O'Shannessy * SPDX-License-Identifier: ISC - */var ERROR_LEVEL_MAP={L:qrcodegen_default.QrCode.Ecc.LOW,M:qrcodegen_default.QrCode.Ecc.MEDIUM,Q:qrcodegen_default.QrCode.Ecc.QUARTILE,H:qrcodegen_default.QrCode.Ecc.HIGH},DEFAULT_SIZE=128,DEFAULT_LEVEL="L",DEFAULT_BGCOLOR="#FFFFFF",DEFAULT_FGCOLOR="#000000",DEFAULT_INCLUDEMARGIN=!1,DEFAULT_MINVERSION=1,SPEC_MARGIN_SIZE=4,DEFAULT_MARGIN_SIZE=0,DEFAULT_IMG_SCALE=.1;function generatePath(o,et=0){const tt=[];return o.forEach(function(nt,rt){let ot=null;nt.forEach(function(it,st){if(!it&&ot!==null){tt.push(`M${ot+et} ${rt+et}h${st-ot}v1H${ot+et}z`),ot=null;return}if(st===nt.length-1){if(!it)return;ot===null?tt.push(`M${st+et},${rt+et} h1v1H${st+et}z`):tt.push(`M${ot+et},${rt+et} h${st+1-ot}v1H${ot+et}z`);return}it&&ot===null&&(ot=st)})}),tt.join("")}function excavateModules(o,et){return o.slice().map((tt,nt)=>nt=et.y+et.h?tt:tt.map((rt,ot)=>ot=et.x+et.w?rt:!1))}function getImageSettings(o,et,tt,nt){if(nt==null)return null;const rt=o.length+tt*2,ot=Math.floor(et*DEFAULT_IMG_SCALE),it=rt/et,st=(nt.width||ot)*it,at=(nt.height||ot)*it,ct=nt.x==null?o.length/2-st/2:nt.x*it,lt=nt.y==null?o.length/2-at/2:nt.y*it,dt=nt.opacity==null?1:nt.opacity;let ht=null;if(nt.excavate){let mt=Math.floor(ct),ft=Math.floor(lt),yt=Math.ceil(st+ct-mt),gt=Math.ceil(at+lt-ft);ht={x:mt,y:ft,w:yt,h:gt}}const pt=nt.crossOrigin;return{x:ct,y:lt,h:at,w:st,excavation:ht,opacity:dt,crossOrigin:pt}}function getMarginSize(o,et){return et!=null?Math.max(Math.floor(et),0):o?SPEC_MARGIN_SIZE:DEFAULT_MARGIN_SIZE}function useQRCode({value:o,level:et,minVersion:tt,includeMargin:nt,marginSize:rt,imageSettings:ot,size:it,boostLevel:st}){let at=React.useMemo(()=>{const mt=(Array.isArray(o)?o:[o]).reduce((ft,yt)=>(ft.push(...qrcodegen_default.QrSegment.makeSegments(yt)),ft),[]);return qrcodegen_default.QrCode.encodeSegments(mt,ERROR_LEVEL_MAP[et],tt,void 0,void 0,st)},[o,et,tt,st]);const{cells:ct,margin:lt,numCells:dt,calculatedImageSettings:ht}=React.useMemo(()=>{let pt=at.getModules();const mt=getMarginSize(nt,rt),ft=pt.length+mt*2,yt=getImageSettings(pt,it,mt,ot);return{cells:pt,margin:mt,numCells:ft,calculatedImageSettings:yt}},[at,it,ot,nt,rt]);return{qrcode:at,margin:lt,cells:ct,numCells:dt,calculatedImageSettings:ht}}var SUPPORTS_PATH2D=function(){try{new Path2D().addPath(new Path2D)}catch{return!1}return!0}(),QRCodeCanvas=React.forwardRef(function(et,tt){const nt=et,{value:rt,size:ot=DEFAULT_SIZE,level:it=DEFAULT_LEVEL,bgColor:st=DEFAULT_BGCOLOR,fgColor:at=DEFAULT_FGCOLOR,includeMargin:ct=DEFAULT_INCLUDEMARGIN,minVersion:lt=DEFAULT_MINVERSION,boostLevel:dt,marginSize:ht,imageSettings:pt}=nt,ft=__objRest(nt,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","marginSize","imageSettings"]),{style:yt}=ft,gt=__objRest(ft,["style"]),xt=pt==null?void 0:pt.src,vt=React.useRef(null),bt=React.useRef(null),Et=React.useCallback(zt=>{vt.current=zt,typeof tt=="function"?tt(zt):tt&&(tt.current=zt)},[tt]),[wt,kt]=React.useState(!1),{margin:Tt,cells:Rt,numCells:Pt,calculatedImageSettings:$t}=useQRCode({value:rt,level:it,minVersion:lt,boostLevel:dt,includeMargin:ct,marginSize:ht,imageSettings:pt,size:ot});React.useEffect(()=>{if(vt.current!=null){const zt=vt.current,Ft=zt.getContext("2d");if(!Ft)return;let Yt=Rt;const Ht=bt.current,Ut=$t!=null&&Ht!==null&&Ht.complete&&Ht.naturalHeight!==0&&Ht.naturalWidth!==0;Ut&&$t.excavation!=null&&(Yt=excavateModules(Rt,$t.excavation));const qt=window.devicePixelRatio||1;zt.height=zt.width=ot*qt;const Lt=ot/Pt*qt;Ft.scale(Lt,Lt),Ft.fillStyle=st,Ft.fillRect(0,0,Pt,Pt),Ft.fillStyle=at,SUPPORTS_PATH2D?Ft.fill(new Path2D(generatePath(Yt,Tt))):Rt.forEach(function(Zt,Qt){Zt.forEach(function(Nt,Gt){Nt&&Ft.fillRect(Gt+Tt,Qt+Tt,1,1)})}),$t&&(Ft.globalAlpha=$t.opacity),Ut&&Ft.drawImage(Ht,$t.x+Tt,$t.y+Tt,$t.w,$t.h)}}),React.useEffect(()=>{kt(!1)},[xt]);const Ot=__spreadValues({height:ot,width:ot},yt);let Bt=null;return xt!=null&&(Bt=React.createElement("img",{src:xt,key:xt,style:{display:"none"},onLoad:()=>{kt(!0)},ref:bt,crossOrigin:$t==null?void 0:$t.crossOrigin})),React.createElement(React.Fragment,null,React.createElement("canvas",__spreadValues({style:Ot,height:ot,width:ot,ref:Et,role:"img"},gt)),Bt)});QRCodeCanvas.displayName="QRCodeCanvas";var QRCodeSVG=React.forwardRef(function(et,tt){const nt=et,{value:rt,size:ot=DEFAULT_SIZE,level:it=DEFAULT_LEVEL,bgColor:st=DEFAULT_BGCOLOR,fgColor:at=DEFAULT_FGCOLOR,includeMargin:ct=DEFAULT_INCLUDEMARGIN,minVersion:lt=DEFAULT_MINVERSION,boostLevel:dt,title:ht,marginSize:pt,imageSettings:mt}=nt,ft=__objRest(nt,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","title","marginSize","imageSettings"]),{margin:yt,cells:gt,numCells:xt,calculatedImageSettings:vt}=useQRCode({value:rt,level:it,minVersion:lt,boostLevel:dt,includeMargin:ct,marginSize:pt,imageSettings:mt,size:ot});let bt=gt,Et=null;mt!=null&&vt!=null&&(vt.excavation!=null&&(bt=excavateModules(gt,vt.excavation)),Et=React.createElement("image",{href:mt.src,height:vt.h,width:vt.w,x:vt.x+yt,y:vt.y+yt,preserveAspectRatio:"none",opacity:vt.opacity,crossOrigin:vt.crossOrigin}));const wt=generatePath(bt,yt);return React.createElement("svg",__spreadValues({height:ot,width:ot,viewBox:`0 0 ${xt} ${xt}`,ref:tt,role:"img"},ft),!!ht&&React.createElement("title",null,ht),React.createElement("path",{fill:st,d:`M0,0 h${xt}v${xt}H0z`,shapeRendering:"crispEdges"}),React.createElement("path",{fill:at,d:wt,shapeRendering:"crispEdges"}),Et)});QRCodeSVG.displayName="QRCodeSVG";const QRCode=({text:o,width:et=256,height:tt=256})=>{const[nt,rt]=reactExports.useState(!1),ot=window.innerWidth<640,it=async()=>{await navigator.clipboard.writeText(o),rt(!0),setTimeout(()=>rt(!1),2e3)};return jsxRuntimeExports.jsxs("div",{className:"flex flex-col items-center space-y-4",children:[jsxRuntimeExports.jsx(QRCodeSVG,{value:o,size:ot?Math.min(et*.8,window.innerWidth-64):Math.min(et,tt)}),jsxRuntimeExports.jsxs("div",{className:"flex items-center space-x-2 w-full max-w-[300px]",children:[jsxRuntimeExports.jsx("input",{type:"text",value:o,readOnly:!0,className:"flex-1 px-3 py-2 text-xs sm:text-sm border rounded-md bg-muted truncate"}),jsxRuntimeExports.jsx(Button,{variant:"outline",size:"icon",onClick:it,className:"shrink-0",children:nt?jsxRuntimeExports.jsx(Check,{className:"h-4 w-4"}):jsxRuntimeExports.jsx(Copy,{className:"h-4 w-4"})})]})]})};var byteToHex=[];for(var i=0;i<256;++i)byteToHex.push((i+256).toString(16).slice(1));function unsafeStringify(o,et=0){return(byteToHex[o[et+0]]+byteToHex[o[et+1]]+byteToHex[o[et+2]]+byteToHex[o[et+3]]+"-"+byteToHex[o[et+4]]+byteToHex[o[et+5]]+"-"+byteToHex[o[et+6]]+byteToHex[o[et+7]]+"-"+byteToHex[o[et+8]]+byteToHex[o[et+9]]+"-"+byteToHex[o[et+10]]+byteToHex[o[et+11]]+byteToHex[o[et+12]]+byteToHex[o[et+13]]+byteToHex[o[et+14]]+byteToHex[o[et+15]]).toLowerCase()}var getRandomValues,rnds8=new Uint8Array(16);function rng(){if(!getRandomValues&&(getRandomValues=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!getRandomValues))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return getRandomValues(rnds8)}var randomUUID=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto);const native={randomUUID};function v4(o,et,tt){if(native.randomUUID&&!et&&!o)return native.randomUUID();o=o||{};var nt=o.random||(o.rng||rng)();return nt[6]=nt[6]&15|64,nt[8]=nt[8]&63|128,unsafeStringify(nt)}var src={exports:{}},indexLight={exports:{}},indexMinimal={},minimal={},aspromise=asPromise$1;function asPromise$1(o,et){for(var tt=new Array(arguments.length-1),nt=0,rt=2,ot=!0;rt1&&st.charAt(at)==="=";)++ct;return Math.ceil(st.length*3)/4-ct};for(var tt=new Array(64),nt=new Array(123),rt=0;rt<64;)nt[tt[rt]=rt<26?rt+65:rt<52?rt+71:rt<62?rt-4:rt-59|43]=rt++;et.encode=function(st,at,ct){for(var lt=null,dt=[],ht=0,pt=0,mt;at>2],mt=(ft&3)<<4,pt=1;break;case 1:dt[ht++]=tt[mt|ft>>4],mt=(ft&15)<<2,pt=2;break;case 2:dt[ht++]=tt[mt|ft>>6],dt[ht++]=tt[ft&63],pt=0;break}ht>8191&&((lt||(lt=[])).push(String.fromCharCode.apply(String,dt)),ht=0)}return pt&&(dt[ht++]=tt[mt],dt[ht++]=61,pt===1&&(dt[ht++]=61)),lt?(ht&<.push(String.fromCharCode.apply(String,dt.slice(0,ht))),lt.join("")):String.fromCharCode.apply(String,dt.slice(0,ht))};var ot="invalid encoding";et.decode=function(st,at,ct){for(var lt=ct,dt=0,ht,pt=0;pt1)break;if((mt=nt[mt])===void 0)throw Error(ot);switch(dt){case 0:ht=mt,dt=1;break;case 1:at[ct++]=ht<<2|(mt&48)>>4,ht=mt,dt=2;break;case 2:at[ct++]=(ht&15)<<4|(mt&60)>>2,ht=mt,dt=3;break;case 3:at[ct++]=(ht&3)<<6|mt,dt=0;break}}if(dt===1)throw Error(ot);return ct-lt},et.test=function(st){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(st)}})(base64$1);var eventemitter=EventEmitter;function EventEmitter(){this._listeners={}}EventEmitter.prototype.on=function(et,tt,nt){return(this._listeners[et]||(this._listeners[et]=[])).push({fn:tt,ctx:nt||this}),this};EventEmitter.prototype.off=function(et,tt){if(et===void 0)this._listeners={};else if(tt===void 0)this._listeners[et]=[];else for(var nt=this._listeners[et],rt=0;rt0?0:2147483648,ot,it);else if(isNaN(rt))nt(2143289344,ot,it);else if(rt>34028234663852886e22)nt((st<<31|2139095040)>>>0,ot,it);else if(rt<11754943508222875e-54)nt((st<<31|Math.round(rt/1401298464324817e-60))>>>0,ot,it);else{var at=Math.floor(Math.log(rt)/Math.LN2),ct=Math.round(rt*Math.pow(2,-at)*8388608)&8388607;nt((st<<31|at+127<<23|ct)>>>0,ot,it)}}o.writeFloatLE=et.bind(null,writeUintLE),o.writeFloatBE=et.bind(null,writeUintBE);function tt(nt,rt,ot){var it=nt(rt,ot),st=(it>>31)*2+1,at=it>>>23&255,ct=it&8388607;return at===255?ct?NaN:st*(1/0):at===0?st*1401298464324817e-60*ct:st*Math.pow(2,at-150)*(ct+8388608)}o.readFloatLE=tt.bind(null,readUintLE),o.readFloatBE=tt.bind(null,readUintBE)}(),typeof Float64Array<"u"?function(){var et=new Float64Array([-0]),tt=new Uint8Array(et.buffer),nt=tt[7]===128;function rt(at,ct,lt){et[0]=at,ct[lt]=tt[0],ct[lt+1]=tt[1],ct[lt+2]=tt[2],ct[lt+3]=tt[3],ct[lt+4]=tt[4],ct[lt+5]=tt[5],ct[lt+6]=tt[6],ct[lt+7]=tt[7]}function ot(at,ct,lt){et[0]=at,ct[lt]=tt[7],ct[lt+1]=tt[6],ct[lt+2]=tt[5],ct[lt+3]=tt[4],ct[lt+4]=tt[3],ct[lt+5]=tt[2],ct[lt+6]=tt[1],ct[lt+7]=tt[0]}o.writeDoubleLE=nt?rt:ot,o.writeDoubleBE=nt?ot:rt;function it(at,ct){return tt[0]=at[ct],tt[1]=at[ct+1],tt[2]=at[ct+2],tt[3]=at[ct+3],tt[4]=at[ct+4],tt[5]=at[ct+5],tt[6]=at[ct+6],tt[7]=at[ct+7],et[0]}function st(at,ct){return tt[7]=at[ct],tt[6]=at[ct+1],tt[5]=at[ct+2],tt[4]=at[ct+3],tt[3]=at[ct+4],tt[2]=at[ct+5],tt[1]=at[ct+6],tt[0]=at[ct+7],et[0]}o.readDoubleLE=nt?it:st,o.readDoubleBE=nt?st:it}():function(){function et(nt,rt,ot,it,st,at){var ct=it<0?1:0;if(ct&&(it=-it),it===0)nt(0,st,at+rt),nt(1/it>0?0:2147483648,st,at+ot);else if(isNaN(it))nt(0,st,at+rt),nt(2146959360,st,at+ot);else if(it>17976931348623157e292)nt(0,st,at+rt),nt((ct<<31|2146435072)>>>0,st,at+ot);else{var lt;if(it<22250738585072014e-324)lt=it/5e-324,nt(lt>>>0,st,at+rt),nt((ct<<31|lt/4294967296)>>>0,st,at+ot);else{var dt=Math.floor(Math.log(it)/Math.LN2);dt===1024&&(dt=1023),lt=it*Math.pow(2,-dt),nt(lt*4503599627370496>>>0,st,at+rt),nt((ct<<31|dt+1023<<20|lt*1048576&1048575)>>>0,st,at+ot)}}}o.writeDoubleLE=et.bind(null,writeUintLE,0,4),o.writeDoubleBE=et.bind(null,writeUintBE,4,0);function tt(nt,rt,ot,it,st){var at=nt(it,st+rt),ct=nt(it,st+ot),lt=(ct>>31)*2+1,dt=ct>>>20&2047,ht=4294967296*(ct&1048575)+at;return dt===2047?ht?NaN:lt*(1/0):dt===0?lt*5e-324*ht:lt*Math.pow(2,dt-1075)*(ht+4503599627370496)}o.readDoubleLE=tt.bind(null,readUintLE,0,4),o.readDoubleBE=tt.bind(null,readUintBE,4,0)}(),o}function writeUintLE(o,et,tt){et[tt]=o&255,et[tt+1]=o>>>8&255,et[tt+2]=o>>>16&255,et[tt+3]=o>>>24}function writeUintBE(o,et,tt){et[tt]=o>>>24,et[tt+1]=o>>>16&255,et[tt+2]=o>>>8&255,et[tt+3]=o&255}function readUintLE(o,et){return(o[et]|o[et+1]<<8|o[et+2]<<16|o[et+3]<<24)>>>0}function readUintBE(o,et){return(o[et]<<24|o[et+1]<<16|o[et+2]<<8|o[et+3])>>>0}var inquire_1=inquire$1;function inquire$1(moduleName){try{var mod=eval("quire".replace(/^/,"re"))(moduleName);if(mod&&(mod.length||Object.keys(mod).length))return mod}catch(o){}return null}var utf8$2={};(function(o){var et=o;et.length=function(nt){for(var rt=0,ot=0,it=0;it191&<<224?at[ct++]=(lt&31)<<6|nt[rt++]&63:lt>239&<<365?(lt=((lt&7)<<18|(nt[rt++]&63)<<12|(nt[rt++]&63)<<6|nt[rt++]&63)-65536,at[ct++]=55296+(lt>>10),at[ct++]=56320+(lt&1023)):at[ct++]=(lt&15)<<12|(nt[rt++]&63)<<6|nt[rt++]&63,ct>8191&&((st||(st=[])).push(String.fromCharCode.apply(String,at)),ct=0);return st?(ct&&st.push(String.fromCharCode.apply(String,at.slice(0,ct))),st.join("")):String.fromCharCode.apply(String,at.slice(0,ct))},et.write=function(nt,rt,ot){for(var it=ot,st,at,ct=0;ct>6|192,rt[ot++]=st&63|128):(st&64512)===55296&&((at=nt.charCodeAt(ct+1))&64512)===56320?(st=65536+((st&1023)<<10)+(at&1023),++ct,rt[ot++]=st>>18|240,rt[ot++]=st>>12&63|128,rt[ot++]=st>>6&63|128,rt[ot++]=st&63|128):(rt[ot++]=st>>12|224,rt[ot++]=st>>6&63|128,rt[ot++]=st&63|128);return ot-it}})(utf8$2);var pool_1=pool;function pool(o,et,tt){var nt=tt||8192,rt=nt>>>1,ot=null,it=nt;return function(at){if(at<1||at>rt)return o(at);it+at>nt&&(ot=o(nt),it=0);var ct=et.call(ot,it,it+=at);return it&7&&(it=(it|7)+1),ct}}var longbits,hasRequiredLongbits;function requireLongbits(){if(hasRequiredLongbits)return longbits;hasRequiredLongbits=1,longbits=et;var o=requireMinimal();function et(ot,it){this.lo=ot>>>0,this.hi=it>>>0}var tt=et.zero=new et(0,0);tt.toNumber=function(){return 0},tt.zzEncode=tt.zzDecode=function(){return this},tt.length=function(){return 1};var nt=et.zeroHash="\0\0\0\0\0\0\0\0";et.fromNumber=function(it){if(it===0)return tt;var st=it<0;st&&(it=-it);var at=it>>>0,ct=(it-at)/4294967296>>>0;return st&&(ct=~ct>>>0,at=~at>>>0,++at>4294967295&&(at=0,++ct>4294967295&&(ct=0))),new et(at,ct)},et.from=function(it){if(typeof it=="number")return et.fromNumber(it);if(o.isString(it))if(o.Long)it=o.Long.fromString(it);else return et.fromNumber(parseInt(it,10));return it.low||it.high?new et(it.low>>>0,it.high>>>0):tt},et.prototype.toNumber=function(it){if(!it&&this.hi>>>31){var st=~this.lo+1>>>0,at=~this.hi>>>0;return st||(at=at+1>>>0),-(st+at*4294967296)}return this.lo+this.hi*4294967296},et.prototype.toLong=function(it){return o.Long?new o.Long(this.lo|0,this.hi|0,!!it):{low:this.lo|0,high:this.hi|0,unsigned:!!it}};var rt=String.prototype.charCodeAt;return et.fromHash=function(it){return it===nt?tt:new et((rt.call(it,0)|rt.call(it,1)<<8|rt.call(it,2)<<16|rt.call(it,3)<<24)>>>0,(rt.call(it,4)|rt.call(it,5)<<8|rt.call(it,6)<<16|rt.call(it,7)<<24)>>>0)},et.prototype.toHash=function(){return String.fromCharCode(this.lo&255,this.lo>>>8&255,this.lo>>>16&255,this.lo>>>24,this.hi&255,this.hi>>>8&255,this.hi>>>16&255,this.hi>>>24)},et.prototype.zzEncode=function(){var it=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^it)>>>0,this.lo=(this.lo<<1^it)>>>0,this},et.prototype.zzDecode=function(){var it=-(this.lo&1);return this.lo=((this.lo>>>1|this.hi<<31)^it)>>>0,this.hi=(this.hi>>>1^it)>>>0,this},et.prototype.length=function(){var it=this.lo,st=(this.lo>>>28|this.hi<<4)>>>0,at=this.hi>>>24;return at===0?st===0?it<16384?it<128?1:2:it<2097152?3:4:st<16384?st<128?5:6:st<2097152?7:8:at<128?9:10},longbits}var hasRequiredMinimal;function requireMinimal(){return hasRequiredMinimal||(hasRequiredMinimal=1,function(o){var et=o;et.asPromise=aspromise,et.base64=base64$1,et.EventEmitter=eventemitter,et.float=float,et.inquire=inquire_1,et.utf8=utf8$2,et.pool=pool_1,et.LongBits=requireLongbits(),et.isNode=!!(typeof globalThis<"u"&&globalThis&&globalThis.process&&globalThis.process.versions&&globalThis.process.versions.node),et.global=et.isNode&&globalThis||typeof window<"u"&&window||typeof self<"u"&&self||commonjsGlobal,et.emptyArray=Object.freeze?Object.freeze([]):[],et.emptyObject=Object.freeze?Object.freeze({}):{},et.isInteger=Number.isInteger||function(ot){return typeof ot=="number"&&isFinite(ot)&&Math.floor(ot)===ot},et.isString=function(ot){return typeof ot=="string"||ot instanceof String},et.isObject=function(ot){return ot&&typeof ot=="object"},et.isset=et.isSet=function(ot,it){var st=ot[it];return st!=null&&ot.hasOwnProperty(it)?typeof st!="object"||(Array.isArray(st)?st.length:Object.keys(st).length)>0:!1},et.Buffer=function(){try{var rt=et.inquire("buffer").Buffer;return rt.prototype.utf8Write?rt:null}catch{return null}}(),et._Buffer_from=null,et._Buffer_allocUnsafe=null,et.newBuffer=function(ot){return typeof ot=="number"?et.Buffer?et._Buffer_allocUnsafe(ot):new et.Array(ot):et.Buffer?et._Buffer_from(ot):typeof Uint8Array>"u"?ot:new Uint8Array(ot)},et.Array=typeof Uint8Array<"u"?Uint8Array:Array,et.Long=et.global.dcodeIO&&et.global.dcodeIO.Long||et.global.Long||et.inquire("long"),et.key2Re=/^true|false|0|1$/,et.key32Re=/^-?(?:0|[1-9][0-9]*)$/,et.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/,et.longToHash=function(ot){return ot?et.LongBits.from(ot).toHash():et.LongBits.zeroHash},et.longFromHash=function(ot,it){var st=et.LongBits.fromHash(ot);return et.Long?et.Long.fromBits(st.lo,st.hi,it):st.toNumber(!!it)};function tt(rt,ot,it){for(var st=Object.keys(ot),at=0;at-1;--ct)if(it[at[ct]]===1&&this[at[ct]]!==void 0&&this[at[ct]]!==null)return at[ct]}},et.oneOfSetter=function(ot){return function(it){for(var st=0;st127;)et[tt++]=o&127|128,o>>>=7;et[tt]=o}function VarintOp(o,et){this.len=o,this.next=void 0,this.val=et}VarintOp.prototype=Object.create(Op.prototype);VarintOp.prototype.fn=writeVarint32;Writer$1.prototype.uint32=function o(et){return this.len+=(this.tail=this.tail.next=new VarintOp((et=et>>>0)<128?1:et<16384?2:et<2097152?3:et<268435456?4:5,et)).len,this};Writer$1.prototype.int32=function o(et){return et<0?this._push(writeVarint64,10,LongBits$1.fromNumber(et)):this.uint32(et)};Writer$1.prototype.sint32=function o(et){return this.uint32((et<<1^et>>31)>>>0)};function writeVarint64(o,et,tt){for(;o.hi;)et[tt++]=o.lo&127|128,o.lo=(o.lo>>>7|o.hi<<25)>>>0,o.hi>>>=7;for(;o.lo>127;)et[tt++]=o.lo&127|128,o.lo=o.lo>>>7;et[tt++]=o.lo}Writer$1.prototype.uint64=function o(et){var tt=LongBits$1.from(et);return this._push(writeVarint64,tt.length(),tt)};Writer$1.prototype.int64=Writer$1.prototype.uint64;Writer$1.prototype.sint64=function o(et){var tt=LongBits$1.from(et).zzEncode();return this._push(writeVarint64,tt.length(),tt)};Writer$1.prototype.bool=function o(et){return this._push(writeByte,1,et?1:0)};function writeFixed32(o,et,tt){et[tt]=o&255,et[tt+1]=o>>>8&255,et[tt+2]=o>>>16&255,et[tt+3]=o>>>24}Writer$1.prototype.fixed32=function o(et){return this._push(writeFixed32,4,et>>>0)};Writer$1.prototype.sfixed32=Writer$1.prototype.fixed32;Writer$1.prototype.fixed64=function o(et){var tt=LongBits$1.from(et);return this._push(writeFixed32,4,tt.lo)._push(writeFixed32,4,tt.hi)};Writer$1.prototype.sfixed64=Writer$1.prototype.fixed64;Writer$1.prototype.float=function o(et){return this._push(util$7.float.writeFloatLE,4,et)};Writer$1.prototype.double=function o(et){return this._push(util$7.float.writeDoubleLE,8,et)};var writeBytes=util$7.Array.prototype.set?function o(et,tt,nt){tt.set(et,nt)}:function o(et,tt,nt){for(var rt=0;rt>>0;if(!tt)return this._push(writeByte,1,0);if(util$7.isString(et)){var nt=Writer$1.alloc(tt=base64.length(et));base64.decode(et,nt,0),et=nt}return this.uint32(tt)._push(writeBytes,tt,et)};Writer$1.prototype.string=function o(et){var tt=utf8$1.length(et);return tt?this.uint32(tt)._push(utf8$1.write,tt,et):this._push(writeByte,1,0)};Writer$1.prototype.fork=function o(){return this.states=new State(this),this.head=this.tail=new Op(noop,0,0),this.len=0,this};Writer$1.prototype.reset=function o(){return this.states?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new Op(noop,0,0),this.len=0),this};Writer$1.prototype.ldelim=function o(){var et=this.head,tt=this.tail,nt=this.len;return this.reset().uint32(nt),nt&&(this.tail.next=et.next,this.tail=tt,this.len+=nt),this};Writer$1.prototype.finish=function o(){for(var et=this.head.next,tt=this.constructor.alloc(this.len),nt=0;et;)et.fn(et.val,tt,nt),nt+=et.len,et=et.next;return tt};Writer$1._configure=function(o){BufferWriter$1=o,Writer$1.create=create$2(),BufferWriter$1._configure()};var writer_buffer=BufferWriter,Writer=writer;(BufferWriter.prototype=Object.create(Writer.prototype)).constructor=BufferWriter;var util$6=requireMinimal();function BufferWriter(){Writer.call(this)}BufferWriter._configure=function(){BufferWriter.alloc=util$6._Buffer_allocUnsafe,BufferWriter.writeBytesBuffer=util$6.Buffer&&util$6.Buffer.prototype instanceof Uint8Array&&util$6.Buffer.prototype.set.name==="set"?function(et,tt,nt){tt.set(et,nt)}:function(et,tt,nt){if(et.copy)et.copy(tt,nt,0,et.length);else for(var rt=0;rt>>0;return this.uint32(tt),tt&&this._push(BufferWriter.writeBytesBuffer,tt,et),this};function writeStringBuffer(o,et,tt){o.length<40?util$6.utf8.write(o,et,tt):et.utf8Write?et.utf8Write(o,tt):et.write(o,tt)}BufferWriter.prototype.string=function o(et){var tt=util$6.Buffer.byteLength(et);return this.uint32(tt),tt&&this._push(writeStringBuffer,tt,et),this};BufferWriter._configure();var reader=Reader$1,util$5=requireMinimal(),BufferReader$1,LongBits=util$5.LongBits,utf8=util$5.utf8;function indexOutOfRange(o,et){return RangeError("index out of range: "+o.pos+" + "+(et||1)+" > "+o.len)}function Reader$1(o){this.buf=o,this.pos=0,this.len=o.length}var create_array=typeof Uint8Array<"u"?function o(et){if(et instanceof Uint8Array||Array.isArray(et))return new Reader$1(et);throw Error("illegal buffer")}:function o(et){if(Array.isArray(et))return new Reader$1(et);throw Error("illegal buffer")},create$1=function o(){return util$5.Buffer?function(tt){return(Reader$1.create=function(rt){return util$5.Buffer.isBuffer(rt)?new BufferReader$1(rt):create_array(rt)})(tt)}:create_array};Reader$1.create=create$1();Reader$1.prototype._slice=util$5.Array.prototype.subarray||util$5.Array.prototype.slice;Reader$1.prototype.uint32=function o(){var et=4294967295;return function(){if(et=(this.buf[this.pos]&127)>>>0,this.buf[this.pos++]<128||(et=(et|(this.buf[this.pos]&127)<<7)>>>0,this.buf[this.pos++]<128)||(et=(et|(this.buf[this.pos]&127)<<14)>>>0,this.buf[this.pos++]<128)||(et=(et|(this.buf[this.pos]&127)<<21)>>>0,this.buf[this.pos++]<128)||(et=(et|(this.buf[this.pos]&15)<<28)>>>0,this.buf[this.pos++]<128))return et;if((this.pos+=5)>this.len)throw this.pos=this.len,indexOutOfRange(this,10);return et}}();Reader$1.prototype.int32=function o(){return this.uint32()|0};Reader$1.prototype.sint32=function o(){var et=this.uint32();return et>>>1^-(et&1)|0};function readLongVarint(){var o=new LongBits(0,0),et=0;if(this.len-this.pos>4){for(;et<4;++et)if(o.lo=(o.lo|(this.buf[this.pos]&127)<>>0,this.buf[this.pos++]<128)return o;if(o.lo=(o.lo|(this.buf[this.pos]&127)<<28)>>>0,o.hi=(o.hi|(this.buf[this.pos]&127)>>4)>>>0,this.buf[this.pos++]<128)return o;et=0}else{for(;et<3;++et){if(this.pos>=this.len)throw indexOutOfRange(this);if(o.lo=(o.lo|(this.buf[this.pos]&127)<>>0,this.buf[this.pos++]<128)return o}return o.lo=(o.lo|(this.buf[this.pos++]&127)<>>0,o}if(this.len-this.pos>4){for(;et<5;++et)if(o.hi=(o.hi|(this.buf[this.pos]&127)<>>0,this.buf[this.pos++]<128)return o}else for(;et<5;++et){if(this.pos>=this.len)throw indexOutOfRange(this);if(o.hi=(o.hi|(this.buf[this.pos]&127)<>>0,this.buf[this.pos++]<128)return o}throw Error("invalid varint encoding")}Reader$1.prototype.bool=function o(){return this.uint32()!==0};function readFixed32_end(o,et){return(o[et-4]|o[et-3]<<8|o[et-2]<<16|o[et-1]<<24)>>>0}Reader$1.prototype.fixed32=function o(){if(this.pos+4>this.len)throw indexOutOfRange(this,4);return readFixed32_end(this.buf,this.pos+=4)};Reader$1.prototype.sfixed32=function o(){if(this.pos+4>this.len)throw indexOutOfRange(this,4);return readFixed32_end(this.buf,this.pos+=4)|0};function readFixed64(){if(this.pos+8>this.len)throw indexOutOfRange(this,8);return new LongBits(readFixed32_end(this.buf,this.pos+=4),readFixed32_end(this.buf,this.pos+=4))}Reader$1.prototype.float=function o(){if(this.pos+4>this.len)throw indexOutOfRange(this,4);var et=util$5.float.readFloatLE(this.buf,this.pos);return this.pos+=4,et};Reader$1.prototype.double=function o(){if(this.pos+8>this.len)throw indexOutOfRange(this,4);var et=util$5.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,et};Reader$1.prototype.bytes=function o(){var et=this.uint32(),tt=this.pos,nt=this.pos+et;if(nt>this.len)throw indexOutOfRange(this,et);if(this.pos+=et,Array.isArray(this.buf))return this.buf.slice(tt,nt);if(tt===nt){var rt=util$5.Buffer;return rt?rt.alloc(0):new this.buf.constructor(0)}return this._slice.call(this.buf,tt,nt)};Reader$1.prototype.string=function o(){var et=this.bytes();return utf8.read(et,0,et.length)};Reader$1.prototype.skip=function o(et){if(typeof et=="number"){if(this.pos+et>this.len)throw indexOutOfRange(this,et);this.pos+=et}else do if(this.pos>=this.len)throw indexOutOfRange(this);while(this.buf[this.pos++]&128);return this};Reader$1.prototype.skipType=function(o){switch(o){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;(o=this.uint32()&7)!==4;)this.skipType(o);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+o+" at offset "+this.pos)}return this};Reader$1._configure=function(o){BufferReader$1=o,Reader$1.create=create$1(),BufferReader$1._configure();var et=util$5.Long?"toLong":"toNumber";util$5.merge(Reader$1.prototype,{int64:function(){return readLongVarint.call(this)[et](!1)},uint64:function(){return readLongVarint.call(this)[et](!0)},sint64:function(){return readLongVarint.call(this).zzDecode()[et](!1)},fixed64:function(){return readFixed64.call(this)[et](!0)},sfixed64:function(){return readFixed64.call(this)[et](!1)}})};var reader_buffer=BufferReader,Reader=reader;(BufferReader.prototype=Object.create(Reader.prototype)).constructor=BufferReader;var util$4=requireMinimal();function BufferReader(o){Reader.call(this,o)}BufferReader._configure=function(){util$4.Buffer&&(BufferReader.prototype._slice=util$4.Buffer.prototype.slice)};BufferReader.prototype.string=function o(){var et=this.uint32();return this.buf.utf8Slice?this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+et,this.len)):this.buf.toString("utf-8",this.pos,this.pos=Math.min(this.pos+et,this.len))};BufferReader._configure();var rpc={},service$1=Service$1,util$3=requireMinimal();(Service$1.prototype=Object.create(util$3.EventEmitter.prototype)).constructor=Service$1;function Service$1(o,et,tt){if(typeof o!="function")throw TypeError("rpcImpl must be a function");util$3.EventEmitter.call(this),this.rpcImpl=o,this.requestDelimited=!!et,this.responseDelimited=!!tt}Service$1.prototype.rpcCall=function o(et,tt,nt,rt,ot){if(!rt)throw TypeError("request must be specified");var it=this;if(!ot)return util$3.asPromise(o,it,et,tt,nt,rt);if(!it.rpcImpl){setTimeout(function(){ot(Error("already ended"))},0);return}try{return it.rpcImpl(et,tt[it.requestDelimited?"encodeDelimited":"encode"](rt).finish(),function(at,ct){if(at)return it.emit("error",at,et),ot(at);if(ct===null){it.end(!0);return}if(!(ct instanceof nt))try{ct=nt[it.responseDelimited?"decodeDelimited":"decode"](ct)}catch(lt){return it.emit("error",lt,et),ot(lt)}return it.emit("data",ct,et),ot(null,ct)})}catch(st){it.emit("error",st,et),setTimeout(function(){ot(st)},0);return}};Service$1.prototype.end=function o(et){return this.rpcImpl&&(et||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this};(function(o){var et=o;et.Service=service$1})(rpc);var roots={};(function(o){var et=o;et.build="minimal",et.Writer=writer,et.BufferWriter=writer_buffer,et.Reader=reader,et.BufferReader=reader_buffer,et.util=requireMinimal(),et.rpc=rpc,et.roots=roots,et.configure=tt;function tt(){et.util._configure(),et.Writer._configure(et.BufferWriter),et.Reader._configure(et.BufferReader)}tt()})(indexMinimal);var util$2={exports:{}},codegen_1=codegen;function codegen(o,et){typeof o=="string"&&(et=o,o=void 0);var tt=[];function nt(ot){if(typeof ot!="string"){var it=rt();if(codegen.verbose&&console.log("codegen: "+it),it="return "+it,ot){for(var st=Object.keys(ot),at=new Array(st.length+1),ct=new Array(st.length),lt=0;ltnt=et.y+et.h?tt:tt.map((rt,ot)=>ot=et.x+et.w?rt:!1))}function getImageSettings(o,et,tt,nt){if(nt==null)return null;const rt=o.length+tt*2,ot=Math.floor(et*DEFAULT_IMG_SCALE),it=rt/et,st=(nt.width||ot)*it,at=(nt.height||ot)*it,ct=nt.x==null?o.length/2-st/2:nt.x*it,lt=nt.y==null?o.length/2-at/2:nt.y*it,dt=nt.opacity==null?1:nt.opacity;let ht=null;if(nt.excavate){let mt=Math.floor(ct),ft=Math.floor(lt),yt=Math.ceil(st+ct-mt),gt=Math.ceil(at+lt-ft);ht={x:mt,y:ft,w:yt,h:gt}}const pt=nt.crossOrigin;return{x:ct,y:lt,h:at,w:st,excavation:ht,opacity:dt,crossOrigin:pt}}function getMarginSize(o,et){return et!=null?Math.max(Math.floor(et),0):o?SPEC_MARGIN_SIZE:DEFAULT_MARGIN_SIZE}function useQRCode({value:o,level:et,minVersion:tt,includeMargin:nt,marginSize:rt,imageSettings:ot,size:it,boostLevel:st}){let at=React.useMemo(()=>{const mt=(Array.isArray(o)?o:[o]).reduce((ft,yt)=>(ft.push(...qrcodegen_default.QrSegment.makeSegments(yt)),ft),[]);return qrcodegen_default.QrCode.encodeSegments(mt,ERROR_LEVEL_MAP[et],tt,void 0,void 0,st)},[o,et,tt,st]);const{cells:ct,margin:lt,numCells:dt,calculatedImageSettings:ht}=React.useMemo(()=>{let pt=at.getModules();const mt=getMarginSize(nt,rt),ft=pt.length+mt*2,yt=getImageSettings(pt,it,mt,ot);return{cells:pt,margin:mt,numCells:ft,calculatedImageSettings:yt}},[at,it,ot,nt,rt]);return{qrcode:at,margin:lt,cells:ct,numCells:dt,calculatedImageSettings:ht}}var SUPPORTS_PATH2D=function(){try{new Path2D().addPath(new Path2D)}catch{return!1}return!0}(),QRCodeCanvas=React.forwardRef(function(et,tt){const nt=et,{value:rt,size:ot=DEFAULT_SIZE,level:it=DEFAULT_LEVEL,bgColor:st=DEFAULT_BGCOLOR,fgColor:at=DEFAULT_FGCOLOR,includeMargin:ct=DEFAULT_INCLUDEMARGIN,minVersion:lt=DEFAULT_MINVERSION,boostLevel:dt,marginSize:ht,imageSettings:pt}=nt,ft=__objRest(nt,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","marginSize","imageSettings"]),{style:yt}=ft,gt=__objRest(ft,["style"]),xt=pt==null?void 0:pt.src,vt=React.useRef(null),bt=React.useRef(null),Et=React.useCallback(zt=>{vt.current=zt,typeof tt=="function"?tt(zt):tt&&(tt.current=zt)},[tt]),[wt,kt]=React.useState(!1),{margin:It,cells:Rt,numCells:Pt,calculatedImageSettings:jt}=useQRCode({value:rt,level:it,minVersion:lt,boostLevel:dt,includeMargin:ct,marginSize:ht,imageSettings:pt,size:ot});React.useEffect(()=>{if(vt.current!=null){const zt=vt.current,Ft=zt.getContext("2d");if(!Ft)return;let Yt=Rt;const Ht=bt.current,Ut=jt!=null&&Ht!==null&&Ht.complete&&Ht.naturalHeight!==0&&Ht.naturalWidth!==0;Ut&&jt.excavation!=null&&(Yt=excavateModules(Rt,jt.excavation));const qt=window.devicePixelRatio||1;zt.height=zt.width=ot*qt;const Lt=ot/Pt*qt;Ft.scale(Lt,Lt),Ft.fillStyle=st,Ft.fillRect(0,0,Pt,Pt),Ft.fillStyle=at,SUPPORTS_PATH2D?Ft.fill(new Path2D(generatePath(Yt,It))):Rt.forEach(function(Zt,Qt){Zt.forEach(function(Nt,Gt){Nt&&Ft.fillRect(Gt+It,Qt+It,1,1)})}),jt&&(Ft.globalAlpha=jt.opacity),Ut&&Ft.drawImage(Ht,jt.x+It,jt.y+It,jt.w,jt.h)}}),React.useEffect(()=>{kt(!1)},[xt]);const Ot=__spreadValues({height:ot,width:ot},yt);let Bt=null;return xt!=null&&(Bt=React.createElement("img",{src:xt,key:xt,style:{display:"none"},onLoad:()=>{kt(!0)},ref:bt,crossOrigin:jt==null?void 0:jt.crossOrigin})),React.createElement(React.Fragment,null,React.createElement("canvas",__spreadValues({style:Ot,height:ot,width:ot,ref:Et,role:"img"},gt)),Bt)});QRCodeCanvas.displayName="QRCodeCanvas";var QRCodeSVG=React.forwardRef(function(et,tt){const nt=et,{value:rt,size:ot=DEFAULT_SIZE,level:it=DEFAULT_LEVEL,bgColor:st=DEFAULT_BGCOLOR,fgColor:at=DEFAULT_FGCOLOR,includeMargin:ct=DEFAULT_INCLUDEMARGIN,minVersion:lt=DEFAULT_MINVERSION,boostLevel:dt,title:ht,marginSize:pt,imageSettings:mt}=nt,ft=__objRest(nt,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","title","marginSize","imageSettings"]),{margin:yt,cells:gt,numCells:xt,calculatedImageSettings:vt}=useQRCode({value:rt,level:it,minVersion:lt,boostLevel:dt,includeMargin:ct,marginSize:pt,imageSettings:mt,size:ot});let bt=gt,Et=null;mt!=null&&vt!=null&&(vt.excavation!=null&&(bt=excavateModules(gt,vt.excavation)),Et=React.createElement("image",{href:mt.src,height:vt.h,width:vt.w,x:vt.x+yt,y:vt.y+yt,preserveAspectRatio:"none",opacity:vt.opacity,crossOrigin:vt.crossOrigin}));const wt=generatePath(bt,yt);return React.createElement("svg",__spreadValues({height:ot,width:ot,viewBox:`0 0 ${xt} ${xt}`,ref:tt,role:"img"},ft),!!ht&&React.createElement("title",null,ht),React.createElement("path",{fill:st,d:`M0,0 h${xt}v${xt}H0z`,shapeRendering:"crispEdges"}),React.createElement("path",{fill:at,d:wt,shapeRendering:"crispEdges"}),Et)});QRCodeSVG.displayName="QRCodeSVG";const QRCode=({text:o,width:et=256,height:tt=256,showCopyButton:nt="both",title:rt,description:ot})=>{const[it,st]=reactExports.useState(!1),[at,ct]=reactExports.useState(!1),[lt,dt]=reactExports.useState(Math.min(et,tt));reactExports.useEffect(()=>{const mt=()=>{ct(window.innerWidth<640),dt(window.innerWidth<640?Math.min(window.innerWidth-80,200):Math.min(et,tt))};return mt(),window.addEventListener("resize",mt),()=>window.removeEventListener("resize",mt)},[et,tt]);const ht=async()=>{await navigator.clipboard.writeText(o),st(!0),setTimeout(()=>st(!1),2e3)},pt=async()=>{if(navigator.share)try{await navigator.share({title:rt||"Share Chain",text:ot||"Sign this chain",url:o})}catch(mt){mt instanceof Error&&mt.name!=="AbortError"&&console.error("Error sharing:",mt)}else ht()};return jsxRuntimeExports.jsxs("div",{className:"flex flex-col items-center w-full space-y-4",children:[jsxRuntimeExports.jsx("div",{className:"flex justify-center w-full",children:jsxRuntimeExports.jsx(QRCodeSVG,{value:o,size:lt,className:"max-w-full"})}),nt!=="text"&&jsxRuntimeExports.jsxs("div",{className:"flex items-center space-x-2 w-full",children:[jsxRuntimeExports.jsx("input",{type:"text",value:o,readOnly:!0,className:"flex-1 px-3 py-2 text-xs sm:text-sm border rounded-md bg-muted truncate"}),jsxRuntimeExports.jsx(Button,{variant:"outline",size:"icon",onClick:ht,className:"shrink-0",children:it?jsxRuntimeExports.jsx(Check,{className:"h-4 w-4"}):jsxRuntimeExports.jsx(Copy,{className:"h-4 w-4"})})]}),nt==="text"&&jsxRuntimeExports.jsx(Button,{onClick:at&&"share"in navigator?pt:ht,variant:"secondary",className:"w-full sm:w-auto",children:at&&"share"in navigator?"Share":it?"Copied!":"Copy Link"})]})};var byteToHex=[];for(var i=0;i<256;++i)byteToHex.push((i+256).toString(16).slice(1));function unsafeStringify(o,et=0){return(byteToHex[o[et+0]]+byteToHex[o[et+1]]+byteToHex[o[et+2]]+byteToHex[o[et+3]]+"-"+byteToHex[o[et+4]]+byteToHex[o[et+5]]+"-"+byteToHex[o[et+6]]+byteToHex[o[et+7]]+"-"+byteToHex[o[et+8]]+byteToHex[o[et+9]]+"-"+byteToHex[o[et+10]]+byteToHex[o[et+11]]+byteToHex[o[et+12]]+byteToHex[o[et+13]]+byteToHex[o[et+14]]+byteToHex[o[et+15]]).toLowerCase()}var getRandomValues,rnds8=new Uint8Array(16);function rng(){if(!getRandomValues&&(getRandomValues=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!getRandomValues))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return getRandomValues(rnds8)}var randomUUID=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto);const native={randomUUID};function v4(o,et,tt){if(native.randomUUID&&!et&&!o)return native.randomUUID();o=o||{};var nt=o.random||(o.rng||rng)();return nt[6]=nt[6]&15|64,nt[8]=nt[8]&63|128,unsafeStringify(nt)}var src={exports:{}},indexLight={exports:{}},indexMinimal={},minimal={},aspromise=asPromise$1;function asPromise$1(o,et){for(var tt=new Array(arguments.length-1),nt=0,rt=2,ot=!0;rt1&&st.charAt(at)==="=";)++ct;return Math.ceil(st.length*3)/4-ct};for(var tt=new Array(64),nt=new Array(123),rt=0;rt<64;)nt[tt[rt]=rt<26?rt+65:rt<52?rt+71:rt<62?rt-4:rt-59|43]=rt++;et.encode=function(st,at,ct){for(var lt=null,dt=[],ht=0,pt=0,mt;at>2],mt=(ft&3)<<4,pt=1;break;case 1:dt[ht++]=tt[mt|ft>>4],mt=(ft&15)<<2,pt=2;break;case 2:dt[ht++]=tt[mt|ft>>6],dt[ht++]=tt[ft&63],pt=0;break}ht>8191&&((lt||(lt=[])).push(String.fromCharCode.apply(String,dt)),ht=0)}return pt&&(dt[ht++]=tt[mt],dt[ht++]=61,pt===1&&(dt[ht++]=61)),lt?(ht&<.push(String.fromCharCode.apply(String,dt.slice(0,ht))),lt.join("")):String.fromCharCode.apply(String,dt.slice(0,ht))};var ot="invalid encoding";et.decode=function(st,at,ct){for(var lt=ct,dt=0,ht,pt=0;pt1)break;if((mt=nt[mt])===void 0)throw Error(ot);switch(dt){case 0:ht=mt,dt=1;break;case 1:at[ct++]=ht<<2|(mt&48)>>4,ht=mt,dt=2;break;case 2:at[ct++]=(ht&15)<<4|(mt&60)>>2,ht=mt,dt=3;break;case 3:at[ct++]=(ht&3)<<6|mt,dt=0;break}}if(dt===1)throw Error(ot);return ct-lt},et.test=function(st){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(st)}})(base64$1);var eventemitter=EventEmitter;function EventEmitter(){this._listeners={}}EventEmitter.prototype.on=function(et,tt,nt){return(this._listeners[et]||(this._listeners[et]=[])).push({fn:tt,ctx:nt||this}),this};EventEmitter.prototype.off=function(et,tt){if(et===void 0)this._listeners={};else if(tt===void 0)this._listeners[et]=[];else for(var nt=this._listeners[et],rt=0;rt0?0:2147483648,ot,it);else if(isNaN(rt))nt(2143289344,ot,it);else if(rt>34028234663852886e22)nt((st<<31|2139095040)>>>0,ot,it);else if(rt<11754943508222875e-54)nt((st<<31|Math.round(rt/1401298464324817e-60))>>>0,ot,it);else{var at=Math.floor(Math.log(rt)/Math.LN2),ct=Math.round(rt*Math.pow(2,-at)*8388608)&8388607;nt((st<<31|at+127<<23|ct)>>>0,ot,it)}}o.writeFloatLE=et.bind(null,writeUintLE),o.writeFloatBE=et.bind(null,writeUintBE);function tt(nt,rt,ot){var it=nt(rt,ot),st=(it>>31)*2+1,at=it>>>23&255,ct=it&8388607;return at===255?ct?NaN:st*(1/0):at===0?st*1401298464324817e-60*ct:st*Math.pow(2,at-150)*(ct+8388608)}o.readFloatLE=tt.bind(null,readUintLE),o.readFloatBE=tt.bind(null,readUintBE)}(),typeof Float64Array<"u"?function(){var et=new Float64Array([-0]),tt=new Uint8Array(et.buffer),nt=tt[7]===128;function rt(at,ct,lt){et[0]=at,ct[lt]=tt[0],ct[lt+1]=tt[1],ct[lt+2]=tt[2],ct[lt+3]=tt[3],ct[lt+4]=tt[4],ct[lt+5]=tt[5],ct[lt+6]=tt[6],ct[lt+7]=tt[7]}function ot(at,ct,lt){et[0]=at,ct[lt]=tt[7],ct[lt+1]=tt[6],ct[lt+2]=tt[5],ct[lt+3]=tt[4],ct[lt+4]=tt[3],ct[lt+5]=tt[2],ct[lt+6]=tt[1],ct[lt+7]=tt[0]}o.writeDoubleLE=nt?rt:ot,o.writeDoubleBE=nt?ot:rt;function it(at,ct){return tt[0]=at[ct],tt[1]=at[ct+1],tt[2]=at[ct+2],tt[3]=at[ct+3],tt[4]=at[ct+4],tt[5]=at[ct+5],tt[6]=at[ct+6],tt[7]=at[ct+7],et[0]}function st(at,ct){return tt[7]=at[ct],tt[6]=at[ct+1],tt[5]=at[ct+2],tt[4]=at[ct+3],tt[3]=at[ct+4],tt[2]=at[ct+5],tt[1]=at[ct+6],tt[0]=at[ct+7],et[0]}o.readDoubleLE=nt?it:st,o.readDoubleBE=nt?st:it}():function(){function et(nt,rt,ot,it,st,at){var ct=it<0?1:0;if(ct&&(it=-it),it===0)nt(0,st,at+rt),nt(1/it>0?0:2147483648,st,at+ot);else if(isNaN(it))nt(0,st,at+rt),nt(2146959360,st,at+ot);else if(it>17976931348623157e292)nt(0,st,at+rt),nt((ct<<31|2146435072)>>>0,st,at+ot);else{var lt;if(it<22250738585072014e-324)lt=it/5e-324,nt(lt>>>0,st,at+rt),nt((ct<<31|lt/4294967296)>>>0,st,at+ot);else{var dt=Math.floor(Math.log(it)/Math.LN2);dt===1024&&(dt=1023),lt=it*Math.pow(2,-dt),nt(lt*4503599627370496>>>0,st,at+rt),nt((ct<<31|dt+1023<<20|lt*1048576&1048575)>>>0,st,at+ot)}}}o.writeDoubleLE=et.bind(null,writeUintLE,0,4),o.writeDoubleBE=et.bind(null,writeUintBE,4,0);function tt(nt,rt,ot,it,st){var at=nt(it,st+rt),ct=nt(it,st+ot),lt=(ct>>31)*2+1,dt=ct>>>20&2047,ht=4294967296*(ct&1048575)+at;return dt===2047?ht?NaN:lt*(1/0):dt===0?lt*5e-324*ht:lt*Math.pow(2,dt-1075)*(ht+4503599627370496)}o.readDoubleLE=tt.bind(null,readUintLE,0,4),o.readDoubleBE=tt.bind(null,readUintBE,4,0)}(),o}function writeUintLE(o,et,tt){et[tt]=o&255,et[tt+1]=o>>>8&255,et[tt+2]=o>>>16&255,et[tt+3]=o>>>24}function writeUintBE(o,et,tt){et[tt]=o>>>24,et[tt+1]=o>>>16&255,et[tt+2]=o>>>8&255,et[tt+3]=o&255}function readUintLE(o,et){return(o[et]|o[et+1]<<8|o[et+2]<<16|o[et+3]<<24)>>>0}function readUintBE(o,et){return(o[et]<<24|o[et+1]<<16|o[et+2]<<8|o[et+3])>>>0}var inquire_1=inquire$1;function inquire$1(moduleName){try{var mod=eval("quire".replace(/^/,"re"))(moduleName);if(mod&&(mod.length||Object.keys(mod).length))return mod}catch(o){}return null}var utf8$2={};(function(o){var et=o;et.length=function(nt){for(var rt=0,ot=0,it=0;it191&<<224?at[ct++]=(lt&31)<<6|nt[rt++]&63:lt>239&<<365?(lt=((lt&7)<<18|(nt[rt++]&63)<<12|(nt[rt++]&63)<<6|nt[rt++]&63)-65536,at[ct++]=55296+(lt>>10),at[ct++]=56320+(lt&1023)):at[ct++]=(lt&15)<<12|(nt[rt++]&63)<<6|nt[rt++]&63,ct>8191&&((st||(st=[])).push(String.fromCharCode.apply(String,at)),ct=0);return st?(ct&&st.push(String.fromCharCode.apply(String,at.slice(0,ct))),st.join("")):String.fromCharCode.apply(String,at.slice(0,ct))},et.write=function(nt,rt,ot){for(var it=ot,st,at,ct=0;ct>6|192,rt[ot++]=st&63|128):(st&64512)===55296&&((at=nt.charCodeAt(ct+1))&64512)===56320?(st=65536+((st&1023)<<10)+(at&1023),++ct,rt[ot++]=st>>18|240,rt[ot++]=st>>12&63|128,rt[ot++]=st>>6&63|128,rt[ot++]=st&63|128):(rt[ot++]=st>>12|224,rt[ot++]=st>>6&63|128,rt[ot++]=st&63|128);return ot-it}})(utf8$2);var pool_1=pool;function pool(o,et,tt){var nt=tt||8192,rt=nt>>>1,ot=null,it=nt;return function(at){if(at<1||at>rt)return o(at);it+at>nt&&(ot=o(nt),it=0);var ct=et.call(ot,it,it+=at);return it&7&&(it=(it|7)+1),ct}}var longbits,hasRequiredLongbits;function requireLongbits(){if(hasRequiredLongbits)return longbits;hasRequiredLongbits=1,longbits=et;var o=requireMinimal();function et(ot,it){this.lo=ot>>>0,this.hi=it>>>0}var tt=et.zero=new et(0,0);tt.toNumber=function(){return 0},tt.zzEncode=tt.zzDecode=function(){return this},tt.length=function(){return 1};var nt=et.zeroHash="\0\0\0\0\0\0\0\0";et.fromNumber=function(it){if(it===0)return tt;var st=it<0;st&&(it=-it);var at=it>>>0,ct=(it-at)/4294967296>>>0;return st&&(ct=~ct>>>0,at=~at>>>0,++at>4294967295&&(at=0,++ct>4294967295&&(ct=0))),new et(at,ct)},et.from=function(it){if(typeof it=="number")return et.fromNumber(it);if(o.isString(it))if(o.Long)it=o.Long.fromString(it);else return et.fromNumber(parseInt(it,10));return it.low||it.high?new et(it.low>>>0,it.high>>>0):tt},et.prototype.toNumber=function(it){if(!it&&this.hi>>>31){var st=~this.lo+1>>>0,at=~this.hi>>>0;return st||(at=at+1>>>0),-(st+at*4294967296)}return this.lo+this.hi*4294967296},et.prototype.toLong=function(it){return o.Long?new o.Long(this.lo|0,this.hi|0,!!it):{low:this.lo|0,high:this.hi|0,unsigned:!!it}};var rt=String.prototype.charCodeAt;return et.fromHash=function(it){return it===nt?tt:new et((rt.call(it,0)|rt.call(it,1)<<8|rt.call(it,2)<<16|rt.call(it,3)<<24)>>>0,(rt.call(it,4)|rt.call(it,5)<<8|rt.call(it,6)<<16|rt.call(it,7)<<24)>>>0)},et.prototype.toHash=function(){return String.fromCharCode(this.lo&255,this.lo>>>8&255,this.lo>>>16&255,this.lo>>>24,this.hi&255,this.hi>>>8&255,this.hi>>>16&255,this.hi>>>24)},et.prototype.zzEncode=function(){var it=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^it)>>>0,this.lo=(this.lo<<1^it)>>>0,this},et.prototype.zzDecode=function(){var it=-(this.lo&1);return this.lo=((this.lo>>>1|this.hi<<31)^it)>>>0,this.hi=(this.hi>>>1^it)>>>0,this},et.prototype.length=function(){var it=this.lo,st=(this.lo>>>28|this.hi<<4)>>>0,at=this.hi>>>24;return at===0?st===0?it<16384?it<128?1:2:it<2097152?3:4:st<16384?st<128?5:6:st<2097152?7:8:at<128?9:10},longbits}var hasRequiredMinimal;function requireMinimal(){return hasRequiredMinimal||(hasRequiredMinimal=1,function(o){var et=o;et.asPromise=aspromise,et.base64=base64$1,et.EventEmitter=eventemitter,et.float=float,et.inquire=inquire_1,et.utf8=utf8$2,et.pool=pool_1,et.LongBits=requireLongbits(),et.isNode=!!(typeof globalThis<"u"&&globalThis&&globalThis.process&&globalThis.process.versions&&globalThis.process.versions.node),et.global=et.isNode&&globalThis||typeof window<"u"&&window||typeof self<"u"&&self||commonjsGlobal,et.emptyArray=Object.freeze?Object.freeze([]):[],et.emptyObject=Object.freeze?Object.freeze({}):{},et.isInteger=Number.isInteger||function(ot){return typeof ot=="number"&&isFinite(ot)&&Math.floor(ot)===ot},et.isString=function(ot){return typeof ot=="string"||ot instanceof String},et.isObject=function(ot){return ot&&typeof ot=="object"},et.isset=et.isSet=function(ot,it){var st=ot[it];return st!=null&&ot.hasOwnProperty(it)?typeof st!="object"||(Array.isArray(st)?st.length:Object.keys(st).length)>0:!1},et.Buffer=function(){try{var rt=et.inquire("buffer").Buffer;return rt.prototype.utf8Write?rt:null}catch{return null}}(),et._Buffer_from=null,et._Buffer_allocUnsafe=null,et.newBuffer=function(ot){return typeof ot=="number"?et.Buffer?et._Buffer_allocUnsafe(ot):new et.Array(ot):et.Buffer?et._Buffer_from(ot):typeof Uint8Array>"u"?ot:new Uint8Array(ot)},et.Array=typeof Uint8Array<"u"?Uint8Array:Array,et.Long=et.global.dcodeIO&&et.global.dcodeIO.Long||et.global.Long||et.inquire("long"),et.key2Re=/^true|false|0|1$/,et.key32Re=/^-?(?:0|[1-9][0-9]*)$/,et.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/,et.longToHash=function(ot){return ot?et.LongBits.from(ot).toHash():et.LongBits.zeroHash},et.longFromHash=function(ot,it){var st=et.LongBits.fromHash(ot);return et.Long?et.Long.fromBits(st.lo,st.hi,it):st.toNumber(!!it)};function tt(rt,ot,it){for(var st=Object.keys(ot),at=0;at-1;--ct)if(it[at[ct]]===1&&this[at[ct]]!==void 0&&this[at[ct]]!==null)return at[ct]}},et.oneOfSetter=function(ot){return function(it){for(var st=0;st127;)et[tt++]=o&127|128,o>>>=7;et[tt]=o}function VarintOp(o,et){this.len=o,this.next=void 0,this.val=et}VarintOp.prototype=Object.create(Op.prototype);VarintOp.prototype.fn=writeVarint32;Writer$1.prototype.uint32=function o(et){return this.len+=(this.tail=this.tail.next=new VarintOp((et=et>>>0)<128?1:et<16384?2:et<2097152?3:et<268435456?4:5,et)).len,this};Writer$1.prototype.int32=function o(et){return et<0?this._push(writeVarint64,10,LongBits$1.fromNumber(et)):this.uint32(et)};Writer$1.prototype.sint32=function o(et){return this.uint32((et<<1^et>>31)>>>0)};function writeVarint64(o,et,tt){for(;o.hi;)et[tt++]=o.lo&127|128,o.lo=(o.lo>>>7|o.hi<<25)>>>0,o.hi>>>=7;for(;o.lo>127;)et[tt++]=o.lo&127|128,o.lo=o.lo>>>7;et[tt++]=o.lo}Writer$1.prototype.uint64=function o(et){var tt=LongBits$1.from(et);return this._push(writeVarint64,tt.length(),tt)};Writer$1.prototype.int64=Writer$1.prototype.uint64;Writer$1.prototype.sint64=function o(et){var tt=LongBits$1.from(et).zzEncode();return this._push(writeVarint64,tt.length(),tt)};Writer$1.prototype.bool=function o(et){return this._push(writeByte,1,et?1:0)};function writeFixed32(o,et,tt){et[tt]=o&255,et[tt+1]=o>>>8&255,et[tt+2]=o>>>16&255,et[tt+3]=o>>>24}Writer$1.prototype.fixed32=function o(et){return this._push(writeFixed32,4,et>>>0)};Writer$1.prototype.sfixed32=Writer$1.prototype.fixed32;Writer$1.prototype.fixed64=function o(et){var tt=LongBits$1.from(et);return this._push(writeFixed32,4,tt.lo)._push(writeFixed32,4,tt.hi)};Writer$1.prototype.sfixed64=Writer$1.prototype.fixed64;Writer$1.prototype.float=function o(et){return this._push(util$7.float.writeFloatLE,4,et)};Writer$1.prototype.double=function o(et){return this._push(util$7.float.writeDoubleLE,8,et)};var writeBytes=util$7.Array.prototype.set?function o(et,tt,nt){tt.set(et,nt)}:function o(et,tt,nt){for(var rt=0;rt>>0;if(!tt)return this._push(writeByte,1,0);if(util$7.isString(et)){var nt=Writer$1.alloc(tt=base64.length(et));base64.decode(et,nt,0),et=nt}return this.uint32(tt)._push(writeBytes,tt,et)};Writer$1.prototype.string=function o(et){var tt=utf8$1.length(et);return tt?this.uint32(tt)._push(utf8$1.write,tt,et):this._push(writeByte,1,0)};Writer$1.prototype.fork=function o(){return this.states=new State(this),this.head=this.tail=new Op(noop,0,0),this.len=0,this};Writer$1.prototype.reset=function o(){return this.states?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new Op(noop,0,0),this.len=0),this};Writer$1.prototype.ldelim=function o(){var et=this.head,tt=this.tail,nt=this.len;return this.reset().uint32(nt),nt&&(this.tail.next=et.next,this.tail=tt,this.len+=nt),this};Writer$1.prototype.finish=function o(){for(var et=this.head.next,tt=this.constructor.alloc(this.len),nt=0;et;)et.fn(et.val,tt,nt),nt+=et.len,et=et.next;return tt};Writer$1._configure=function(o){BufferWriter$1=o,Writer$1.create=create$2(),BufferWriter$1._configure()};var writer_buffer=BufferWriter,Writer=writer;(BufferWriter.prototype=Object.create(Writer.prototype)).constructor=BufferWriter;var util$6=requireMinimal();function BufferWriter(){Writer.call(this)}BufferWriter._configure=function(){BufferWriter.alloc=util$6._Buffer_allocUnsafe,BufferWriter.writeBytesBuffer=util$6.Buffer&&util$6.Buffer.prototype instanceof Uint8Array&&util$6.Buffer.prototype.set.name==="set"?function(et,tt,nt){tt.set(et,nt)}:function(et,tt,nt){if(et.copy)et.copy(tt,nt,0,et.length);else for(var rt=0;rt>>0;return this.uint32(tt),tt&&this._push(BufferWriter.writeBytesBuffer,tt,et),this};function writeStringBuffer(o,et,tt){o.length<40?util$6.utf8.write(o,et,tt):et.utf8Write?et.utf8Write(o,tt):et.write(o,tt)}BufferWriter.prototype.string=function o(et){var tt=util$6.Buffer.byteLength(et);return this.uint32(tt),tt&&this._push(writeStringBuffer,tt,et),this};BufferWriter._configure();var reader=Reader$1,util$5=requireMinimal(),BufferReader$1,LongBits=util$5.LongBits,utf8=util$5.utf8;function indexOutOfRange(o,et){return RangeError("index out of range: "+o.pos+" + "+(et||1)+" > "+o.len)}function Reader$1(o){this.buf=o,this.pos=0,this.len=o.length}var create_array=typeof Uint8Array<"u"?function o(et){if(et instanceof Uint8Array||Array.isArray(et))return new Reader$1(et);throw Error("illegal buffer")}:function o(et){if(Array.isArray(et))return new Reader$1(et);throw Error("illegal buffer")},create$1=function o(){return util$5.Buffer?function(tt){return(Reader$1.create=function(rt){return util$5.Buffer.isBuffer(rt)?new BufferReader$1(rt):create_array(rt)})(tt)}:create_array};Reader$1.create=create$1();Reader$1.prototype._slice=util$5.Array.prototype.subarray||util$5.Array.prototype.slice;Reader$1.prototype.uint32=function o(){var et=4294967295;return function(){if(et=(this.buf[this.pos]&127)>>>0,this.buf[this.pos++]<128||(et=(et|(this.buf[this.pos]&127)<<7)>>>0,this.buf[this.pos++]<128)||(et=(et|(this.buf[this.pos]&127)<<14)>>>0,this.buf[this.pos++]<128)||(et=(et|(this.buf[this.pos]&127)<<21)>>>0,this.buf[this.pos++]<128)||(et=(et|(this.buf[this.pos]&15)<<28)>>>0,this.buf[this.pos++]<128))return et;if((this.pos+=5)>this.len)throw this.pos=this.len,indexOutOfRange(this,10);return et}}();Reader$1.prototype.int32=function o(){return this.uint32()|0};Reader$1.prototype.sint32=function o(){var et=this.uint32();return et>>>1^-(et&1)|0};function readLongVarint(){var o=new LongBits(0,0),et=0;if(this.len-this.pos>4){for(;et<4;++et)if(o.lo=(o.lo|(this.buf[this.pos]&127)<>>0,this.buf[this.pos++]<128)return o;if(o.lo=(o.lo|(this.buf[this.pos]&127)<<28)>>>0,o.hi=(o.hi|(this.buf[this.pos]&127)>>4)>>>0,this.buf[this.pos++]<128)return o;et=0}else{for(;et<3;++et){if(this.pos>=this.len)throw indexOutOfRange(this);if(o.lo=(o.lo|(this.buf[this.pos]&127)<>>0,this.buf[this.pos++]<128)return o}return o.lo=(o.lo|(this.buf[this.pos++]&127)<>>0,o}if(this.len-this.pos>4){for(;et<5;++et)if(o.hi=(o.hi|(this.buf[this.pos]&127)<>>0,this.buf[this.pos++]<128)return o}else for(;et<5;++et){if(this.pos>=this.len)throw indexOutOfRange(this);if(o.hi=(o.hi|(this.buf[this.pos]&127)<>>0,this.buf[this.pos++]<128)return o}throw Error("invalid varint encoding")}Reader$1.prototype.bool=function o(){return this.uint32()!==0};function readFixed32_end(o,et){return(o[et-4]|o[et-3]<<8|o[et-2]<<16|o[et-1]<<24)>>>0}Reader$1.prototype.fixed32=function o(){if(this.pos+4>this.len)throw indexOutOfRange(this,4);return readFixed32_end(this.buf,this.pos+=4)};Reader$1.prototype.sfixed32=function o(){if(this.pos+4>this.len)throw indexOutOfRange(this,4);return readFixed32_end(this.buf,this.pos+=4)|0};function readFixed64(){if(this.pos+8>this.len)throw indexOutOfRange(this,8);return new LongBits(readFixed32_end(this.buf,this.pos+=4),readFixed32_end(this.buf,this.pos+=4))}Reader$1.prototype.float=function o(){if(this.pos+4>this.len)throw indexOutOfRange(this,4);var et=util$5.float.readFloatLE(this.buf,this.pos);return this.pos+=4,et};Reader$1.prototype.double=function o(){if(this.pos+8>this.len)throw indexOutOfRange(this,4);var et=util$5.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,et};Reader$1.prototype.bytes=function o(){var et=this.uint32(),tt=this.pos,nt=this.pos+et;if(nt>this.len)throw indexOutOfRange(this,et);if(this.pos+=et,Array.isArray(this.buf))return this.buf.slice(tt,nt);if(tt===nt){var rt=util$5.Buffer;return rt?rt.alloc(0):new this.buf.constructor(0)}return this._slice.call(this.buf,tt,nt)};Reader$1.prototype.string=function o(){var et=this.bytes();return utf8.read(et,0,et.length)};Reader$1.prototype.skip=function o(et){if(typeof et=="number"){if(this.pos+et>this.len)throw indexOutOfRange(this,et);this.pos+=et}else do if(this.pos>=this.len)throw indexOutOfRange(this);while(this.buf[this.pos++]&128);return this};Reader$1.prototype.skipType=function(o){switch(o){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;(o=this.uint32()&7)!==4;)this.skipType(o);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+o+" at offset "+this.pos)}return this};Reader$1._configure=function(o){BufferReader$1=o,Reader$1.create=create$1(),BufferReader$1._configure();var et=util$5.Long?"toLong":"toNumber";util$5.merge(Reader$1.prototype,{int64:function(){return readLongVarint.call(this)[et](!1)},uint64:function(){return readLongVarint.call(this)[et](!0)},sint64:function(){return readLongVarint.call(this).zzDecode()[et](!1)},fixed64:function(){return readFixed64.call(this)[et](!0)},sfixed64:function(){return readFixed64.call(this)[et](!1)}})};var reader_buffer=BufferReader,Reader=reader;(BufferReader.prototype=Object.create(Reader.prototype)).constructor=BufferReader;var util$4=requireMinimal();function BufferReader(o){Reader.call(this,o)}BufferReader._configure=function(){util$4.Buffer&&(BufferReader.prototype._slice=util$4.Buffer.prototype.slice)};BufferReader.prototype.string=function o(){var et=this.uint32();return this.buf.utf8Slice?this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+et,this.len)):this.buf.toString("utf-8",this.pos,this.pos=Math.min(this.pos+et,this.len))};BufferReader._configure();var rpc={},service$1=Service$1,util$3=requireMinimal();(Service$1.prototype=Object.create(util$3.EventEmitter.prototype)).constructor=Service$1;function Service$1(o,et,tt){if(typeof o!="function")throw TypeError("rpcImpl must be a function");util$3.EventEmitter.call(this),this.rpcImpl=o,this.requestDelimited=!!et,this.responseDelimited=!!tt}Service$1.prototype.rpcCall=function o(et,tt,nt,rt,ot){if(!rt)throw TypeError("request must be specified");var it=this;if(!ot)return util$3.asPromise(o,it,et,tt,nt,rt);if(!it.rpcImpl){setTimeout(function(){ot(Error("already ended"))},0);return}try{return it.rpcImpl(et,tt[it.requestDelimited?"encodeDelimited":"encode"](rt).finish(),function(at,ct){if(at)return it.emit("error",at,et),ot(at);if(ct===null){it.end(!0);return}if(!(ct instanceof nt))try{ct=nt[it.responseDelimited?"decodeDelimited":"decode"](ct)}catch(lt){return it.emit("error",lt,et),ot(lt)}return it.emit("data",ct,et),ot(null,ct)})}catch(st){it.emit("error",st,et),setTimeout(function(){ot(st)},0);return}};Service$1.prototype.end=function o(et){return this.rpcImpl&&(et||this.rpcImpl(null,null,null),this.rpcImpl=null,this.emit("end").off()),this};(function(o){var et=o;et.Service=service$1})(rpc);var roots={};(function(o){var et=o;et.build="minimal",et.Writer=writer,et.BufferWriter=writer_buffer,et.Reader=reader,et.BufferReader=reader_buffer,et.util=requireMinimal(),et.rpc=rpc,et.roots=roots,et.configure=tt;function tt(){et.util._configure(),et.Writer._configure(et.BufferWriter),et.Reader._configure(et.BufferReader)}tt()})(indexMinimal);var util$2={exports:{}},codegen_1=codegen;function codegen(o,et){typeof o=="string"&&(et=o,o=void 0);var tt=[];function nt(ot){if(typeof ot!="string"){var it=rt();if(codegen.verbose&&console.log("codegen: "+it),it="return "+it,ot){for(var st=Object.keys(ot),at=new Array(st.length+1),ct=new Array(st.length),lt=0;lt0&&it[ct-1]!==".."?it.splice(--ct,2):st?it.splice(ct,1):++ct:it[ct]==="."?it.splice(ct,1):++ct;return at+it.join("/")};et.resolve=function(ot,it,st){return st||(it=nt(it)),tt(it)?it:(st||(ot=nt(ot)),(ot=ot.replace(/(?:\/|^)[^/]+$/,"")).length?nt(ot+"/"+it):it)}})(path);var types$2={},hasRequiredTypes;function requireTypes(){return hasRequiredTypes||(hasRequiredTypes=1,function(o){var et=o,tt=requireUtil(),nt=["double","float","int32","uint32","sint32","fixed32","sfixed32","int64","uint64","sint64","fixed64","sfixed64","bool","string","bytes"];function rt(ot,it){var st=0,at={};for(it|=0;st-1&&this.oneof.splice(st,1),it.partOf=null,this},nt.prototype.onAdd=function(it){o.prototype.onAdd.call(this,it);for(var st=this,at=0;atht)return!0}return!1},at.isReservedName=function(dt,ht){if(dt){for(var pt=0;pt0;){var mt=dt.shift();if(pt.nested&&pt.nested[mt]){if(pt=pt.nested[mt],!(pt instanceof at))throw Error("path conflicts with non-namespace objects")}else pt.add(pt=new at(mt))}return ht&&pt.addJSON(ht),pt},at.prototype.resolveAll=function(){for(var dt=this.nestedArray,ht=0;ht-1)return mt}else if(mt instanceof at&&(mt=mt.lookup(dt.slice(1),ht,!0)))return mt}else for(var ft=0;ft>>3){");for(var st=0;st>>3){")("case 1: k=r.%s(); break",at.keyType)("case 2:"),et.basic[ct]===void 0?it("value=types[%i].decode(r,r.uint32())",st):it("value=r.%s()",ct),it("break")("default:")("r.skipType(tag2&7)")("break")("}")("}"),et.long[at.keyType]!==void 0?it('%s[typeof k==="object"?util.longToHash(k):k]=value',lt):it("%s[k]=value",lt)):at.repeated?(it("if(!(%s&&%s.length))",lt,lt)("%s=[]",lt),et.packed[ct]!==void 0&&it("if((t&7)===2){")("var c2=r.uint32()+r.pos")("while(r.pos>>0",ct,ct);break;case"int32":case"sint32":case"sfixed32":it("m%s=d%s|0",ct,ct);break;case"uint64":mt=!0;case"int64":case"sint64":case"fixed64":case"sfixed64":it("if(util.Long)")("(m%s=util.Long.fromValue(d%s)).unsigned=%j",ct,ct,mt)('else if(typeof d%s==="string")',ct)("m%s=parseInt(d%s,10)",ct,ct)('else if(typeof d%s==="number")',ct)("m%s=d%s",ct,ct)('else if(typeof d%s==="object")',ct)("m%s=new util.LongBits(d%s.low>>>0,d%s.high>>>0).toNumber(%s)",ct,ct,ct,mt?"true":"");break;case"bytes":it('if(typeof d%s==="string")',ct)("util.base64.decode(d%s,m%s=util.newBuffer(util.base64.length(d%s)),0)",ct,ct,ct)("else if(d%s.length >= 0)",ct)("m%s=d%s",ct,ct);break;case"string":it("m%s=String(d%s)",ct,ct);break;case"bool":it("m%s=Boolean(d%s)",ct,ct);break}}return it}et.fromObject=function(st){var at=st.fieldsArray,ct=nt.codegen(["d"],st.name+"$fromObject")("if(d instanceof this.ctor)")("return d");if(!at.length)return ct("return new this.ctor");ct("var m=new this.ctor");for(var lt=0;lt>>0,m%s.high>>>0).toNumber(%s):m%s",ct,ct,ct,ct,lt?"true":"",ct);break;case"bytes":it("d%s=o.bytes===String?util.base64.encode(m%s,0,m%s.length):o.bytes===Array?Array.prototype.slice.call(m%s):m%s",ct,ct,ct,ct,ct);break;default:it("d%s=m%s",ct,ct);break}}return it}et.toObject=function(st){var at=st.fieldsArray.slice().sort(nt.compareFieldsById);if(!at.length)return nt.codegen()("return {}");for(var ct=nt.codegen(["m","o"],st.name+"$toObject")("if(!o)")("o={}")("var d={}"),lt=[],dt=[],ht=[],pt=0;pt-1){var $t=Rt.substring(Pt);if($t in st)return $t}return null}function bt(Rt,Pt){try{if(rt.isString(Pt)&&Pt.charAt(0)==="{"&&(Pt=JSON.parse(Pt)),!rt.isString(Pt))yt.setOptions(Pt.options).addJSON(Pt.nested);else{it.filename=Rt;var $t=it(Pt,yt,mt),Ot,Bt=0;if($t.imports)for(;Bt<$t.imports.length;++Bt)(Ot=vt($t.imports[Bt])||yt.resolvePath(Rt,$t.imports[Bt]))&&Et(Ot);if($t.weakImports)for(Bt=0;Bt<$t.weakImports.length;++Bt)(Ot=vt($t.weakImports[Bt])||yt.resolvePath(Rt,$t.weakImports[Bt]))&&Et(Ot,!0)}}catch(zt){xt(zt)}!gt&&!wt&&xt(null,yt)}function Et(Rt,Pt){if(Rt=vt(Rt)||Rt,!(yt.files.indexOf(Rt)>-1)){if(yt.files.push(Rt),Rt in st){gt?bt(Rt,st[Rt]):(++wt,setTimeout(function(){--wt,bt(Rt,st[Rt])}));return}if(gt){var $t;try{$t=rt.fs.readFileSync(Rt).toString("utf8")}catch(Ot){Pt||xt(Ot);return}bt(Rt,$t)}else++wt,yt.fetch(Rt,function(Ot,Bt){if(--wt,!!ft){if(Ot){Pt?wt||xt(null,yt):xt(Ot);return}bt(Rt,Bt)}})}}var wt=0;rt.isString(pt)&&(pt=[pt]);for(var kt=0,Tt;kt-1&&this.deferred.splice(mt,1)}}else if(pt instanceof tt)lt.test(pt.name)&&delete pt.parent[pt.name];else if(pt instanceof o){for(var ft=0;ft0)pt[yt]=ht(pt[yt]||{},mt,ft);else{var gt=pt[yt];gt&&(ft=[].concat(gt).concat(ft)),pt[yt]=ft}return pt}if(typeof ct!="object")throw TypeError("dst must be an object");if(!lt)throw TypeError("path must be specified");return lt=lt.split("."),ht(ct,lt,dt)},Object.defineProperty(o,"decorateRoot",{get:function(){return et.decorated||(et.decorated=new(requireRoot()))}}),util$2.exports}var object,hasRequiredObject;function requireObject(){if(hasRequiredObject)return object;hasRequiredObject=1,object=tt,tt.className="ReflectionObject";var o=requireUtil(),et;function tt(nt,rt){if(!o.isString(nt))throw TypeError("name must be a string");if(rt&&!o.isObject(rt))throw TypeError("options must be an object");this.options=rt,this.parsedOptions=null,this.name=nt,this.parent=null,this.resolved=!1,this.comment=null,this.filename=null}return Object.defineProperties(tt.prototype,{root:{get:function(){for(var nt=this;nt.parent!==null;)nt=nt.parent;return nt}},fullName:{get:function(){for(var nt=[this.name],rt=this.parent;rt;)nt.unshift(rt.name),rt=rt.parent;return nt.join(".")}}}),tt.prototype.toJSON=function(){throw Error()},tt.prototype.onAdd=function(rt){this.parent&&this.parent!==rt&&this.parent.remove(this),this.parent=rt,this.resolved=!1;var ot=rt.root;ot instanceof et&&ot._handleAdd(this)},tt.prototype.onRemove=function(rt){var ot=rt.root;ot instanceof et&&ot._handleRemove(this),this.parent=null,this.resolved=!1},tt.prototype.resolve=function(){return this.resolved?this:(this.root instanceof et&&(this.resolved=!0),this)},tt.prototype.getOption=function(rt){if(this.options)return this.options[rt]},tt.prototype.setOption=function(rt,ot,it){return(!it||!this.options||this.options[rt]===void 0)&&((this.options||(this.options={}))[rt]=ot),this},tt.prototype.setParsedOption=function(rt,ot,it){this.parsedOptions||(this.parsedOptions=[]);var st=this.parsedOptions;if(it){var at=st.find(function(dt){return Object.prototype.hasOwnProperty.call(dt,rt)});if(at){var ct=at[rt];o.setProperty(ct,it,ot)}else at={},at[rt]=o.setProperty({},it,ot),st.push(at)}else{var lt={};lt[rt]=ot,st.push(lt)}return this},tt.prototype.setOptions=function(rt,ot){if(rt)for(var it=Object.keys(rt),st=0;st>>0,(it.id<<3|4)>>>0):ot("types[%i].encode(%s,w.uint32(%i).fork()).ldelim()",st,at,(it.id<<3|2)>>>0)}function rt(ot){for(var it=tt.codegen(["m","w"],ot.name+"$encode")("if(!w)")("w=Writer.create()"),st,at,ct=ot.fieldsArray.slice().sort(tt.compareFieldsById),st=0;st>>0,8|et.mapKey[lt.keyType],lt.keyType),pt===void 0?it("types[%i].encode(%s[ks[i]],w.uint32(18).fork()).ldelim().ldelim()",dt,at):it(".uint32(%i).%s(%s[ks[i]]).ldelim()",16|pt,ht,at),it("}")("}")):lt.repeated?(it("if(%s!=null&&%s.length){",at,at),lt.packed&&et.packed[ht]!==void 0?it("w.uint32(%i).fork()",(lt.id<<3|2)>>>0)("for(var i=0;i<%s.length;++i)",at)("w.%s(%s[i])",ht,at)("w.ldelim()"):(it("for(var i=0;i<%s.length;++i)",at),pt===void 0?nt(it,lt,dt,at+"[i]"):it("w.uint32(%i).%s(%s[i])",(lt.id<<3|pt)>>>0,ht,at)),it("}")):(lt.optional&&it("if(%s!=null&&Object.hasOwnProperty.call(m,%j))",at,lt.name),pt===void 0?nt(it,lt,dt,at):it("w.uint32(%i).%s(%s)",(lt.id<<3|pt)>>>0,ht,at))}return it("return w")}return encoder_1}var protobuf$2=indexLight.exports=indexMinimal;protobuf$2.build="light";function load(o,et,tt){return typeof et=="function"?(tt=et,et=new protobuf$2.Root):et||(et=new protobuf$2.Root),et.load(o,tt)}protobuf$2.load=load;function loadSync(o,et){return et||(et=new protobuf$2.Root),et.loadSync(o)}protobuf$2.loadSync=loadSync;protobuf$2.encoder=requireEncoder();protobuf$2.decoder=requireDecoder();protobuf$2.verifier=requireVerifier();protobuf$2.converter=requireConverter();protobuf$2.ReflectionObject=requireObject();protobuf$2.Namespace=requireNamespace();protobuf$2.Root=requireRoot();protobuf$2.Enum=require_enum();protobuf$2.Type=requireType();protobuf$2.Field=requireField();protobuf$2.OneOf=requireOneof();protobuf$2.MapField=requireMapfield();protobuf$2.Service=requireService();protobuf$2.Method=requireMethod();protobuf$2.Message=message;protobuf$2.wrappers=wrappers;protobuf$2.types=requireTypes();protobuf$2.util=requireUtil();protobuf$2.ReflectionObject._configure(protobuf$2.Root);protobuf$2.Namespace._configure(protobuf$2.Type,protobuf$2.Service,protobuf$2.Enum);protobuf$2.Root._configure(protobuf$2.Type);protobuf$2.Field._configure(protobuf$2.Type);var indexLightExports=indexLight.exports,tokenize_1=tokenize$1,delimRe=/[\s{}=;:[\],'"()<>]/g,stringDoubleRe=/(?:"([^"\\]*(?:\\.[^"\\]*)*)")/g,stringSingleRe=/(?:'([^'\\]*(?:\\.[^'\\]*)*)')/g,setCommentRe=/^ *[*/]+ */,setCommentAltRe=/^\s*\*?\/*/,setCommentSplitRe=/\n/g,whitespaceRe=/\s/,unescapeRe=/\\(.?)/g,unescapeMap={0:"\0",r:"\r",n:` -`,t:" "};function unescape$1(o){return o.replace(unescapeRe,function(et,tt){switch(tt){case"\\":case"":return tt;default:return unescapeMap[tt]||""}})}tokenize$1.unescape=unescape$1;function tokenize$1(o,et){o=o.toString();var tt=0,nt=o.length,rt=1,ot=0,it={},st=[],at=null;function ct(bt){return Error("illegal "+bt+" (line "+rt+")")}function lt(){var bt=at==="'"?stringSingleRe:stringDoubleRe;bt.lastIndex=tt-1;var Et=bt.exec(o);if(!Et)throw ct("string");return tt=bt.lastIndex,yt(at),at=null,unescape$1(Et[1])}function dt(bt){return o.charAt(bt)}function ht(bt,Et,wt){var kt={type:o.charAt(bt++),lineEmpty:!1,leading:wt},Tt;et?Tt=2:Tt=3;var Rt=bt-Tt,Pt;do if(--Rt<0||(Pt=o.charAt(Rt))===` -`){kt.lineEmpty=!0;break}while(Pt===" "||Pt===" ");for(var $t=o.substring(bt,Et).split(setCommentSplitRe),Ot=0;Ot<$t.length;++Ot)$t[Ot]=$t[Ot].replace(et?setCommentAltRe:setCommentRe,"").trim();kt.text=$t.join(` +}`}return nt.toString=rt,nt}codegen.verbose=!1;var fetch_1=fetch$1,asPromise=aspromise,inquire=inquire_1,fs=inquire("fs");function fetch$1(o,et,tt){return typeof et=="function"?(tt=et,et={}):et||(et={}),tt?!et.xhr&&fs&&fs.readFile?fs.readFile(o,function(rt,ot){return rt&&typeof XMLHttpRequest<"u"?fetch$1.xhr(o,et,tt):rt?tt(rt):tt(null,et.binary?ot:ot.toString("utf8"))}):fetch$1.xhr(o,et,tt):asPromise(fetch$1,this,o,et)}fetch$1.xhr=function o(et,tt,nt){var rt=new XMLHttpRequest;rt.onreadystatechange=function(){if(rt.readyState===4){if(rt.status!==0&&rt.status!==200)return nt(Error("status "+rt.status));if(tt.binary){var it=rt.response;if(!it){it=[];for(var st=0;st0&&it[ct-1]!==".."?it.splice(--ct,2):st?it.splice(ct,1):++ct:it[ct]==="."?it.splice(ct,1):++ct;return at+it.join("/")};et.resolve=function(ot,it,st){return st||(it=nt(it)),tt(it)?it:(st||(ot=nt(ot)),(ot=ot.replace(/(?:\/|^)[^/]+$/,"")).length?nt(ot+"/"+it):it)}})(path);var types$2={},hasRequiredTypes;function requireTypes(){return hasRequiredTypes||(hasRequiredTypes=1,function(o){var et=o,tt=requireUtil(),nt=["double","float","int32","uint32","sint32","fixed32","sfixed32","int64","uint64","sint64","fixed64","sfixed64","bool","string","bytes"];function rt(ot,it){var st=0,at={};for(it|=0;st-1&&this.oneof.splice(st,1),it.partOf=null,this},nt.prototype.onAdd=function(it){o.prototype.onAdd.call(this,it);for(var st=this,at=0;atht)return!0}return!1},at.isReservedName=function(dt,ht){if(dt){for(var pt=0;pt0;){var mt=dt.shift();if(pt.nested&&pt.nested[mt]){if(pt=pt.nested[mt],!(pt instanceof at))throw Error("path conflicts with non-namespace objects")}else pt.add(pt=new at(mt))}return ht&&pt.addJSON(ht),pt},at.prototype.resolveAll=function(){for(var dt=this.nestedArray,ht=0;ht-1)return mt}else if(mt instanceof at&&(mt=mt.lookup(dt.slice(1),ht,!0)))return mt}else for(var ft=0;ft>>3){");for(var st=0;st>>3){")("case 1: k=r.%s(); break",at.keyType)("case 2:"),et.basic[ct]===void 0?it("value=types[%i].decode(r,r.uint32())",st):it("value=r.%s()",ct),it("break")("default:")("r.skipType(tag2&7)")("break")("}")("}"),et.long[at.keyType]!==void 0?it('%s[typeof k==="object"?util.longToHash(k):k]=value',lt):it("%s[k]=value",lt)):at.repeated?(it("if(!(%s&&%s.length))",lt,lt)("%s=[]",lt),et.packed[ct]!==void 0&&it("if((t&7)===2){")("var c2=r.uint32()+r.pos")("while(r.pos>>0",ct,ct);break;case"int32":case"sint32":case"sfixed32":it("m%s=d%s|0",ct,ct);break;case"uint64":mt=!0;case"int64":case"sint64":case"fixed64":case"sfixed64":it("if(util.Long)")("(m%s=util.Long.fromValue(d%s)).unsigned=%j",ct,ct,mt)('else if(typeof d%s==="string")',ct)("m%s=parseInt(d%s,10)",ct,ct)('else if(typeof d%s==="number")',ct)("m%s=d%s",ct,ct)('else if(typeof d%s==="object")',ct)("m%s=new util.LongBits(d%s.low>>>0,d%s.high>>>0).toNumber(%s)",ct,ct,ct,mt?"true":"");break;case"bytes":it('if(typeof d%s==="string")',ct)("util.base64.decode(d%s,m%s=util.newBuffer(util.base64.length(d%s)),0)",ct,ct,ct)("else if(d%s.length >= 0)",ct)("m%s=d%s",ct,ct);break;case"string":it("m%s=String(d%s)",ct,ct);break;case"bool":it("m%s=Boolean(d%s)",ct,ct);break}}return it}et.fromObject=function(st){var at=st.fieldsArray,ct=nt.codegen(["d"],st.name+"$fromObject")("if(d instanceof this.ctor)")("return d");if(!at.length)return ct("return new this.ctor");ct("var m=new this.ctor");for(var lt=0;lt>>0,m%s.high>>>0).toNumber(%s):m%s",ct,ct,ct,ct,lt?"true":"",ct);break;case"bytes":it("d%s=o.bytes===String?util.base64.encode(m%s,0,m%s.length):o.bytes===Array?Array.prototype.slice.call(m%s):m%s",ct,ct,ct,ct,ct);break;default:it("d%s=m%s",ct,ct);break}}return it}et.toObject=function(st){var at=st.fieldsArray.slice().sort(nt.compareFieldsById);if(!at.length)return nt.codegen()("return {}");for(var ct=nt.codegen(["m","o"],st.name+"$toObject")("if(!o)")("o={}")("var d={}"),lt=[],dt=[],ht=[],pt=0;pt-1){var jt=Rt.substring(Pt);if(jt in st)return jt}return null}function bt(Rt,Pt){try{if(rt.isString(Pt)&&Pt.charAt(0)==="{"&&(Pt=JSON.parse(Pt)),!rt.isString(Pt))yt.setOptions(Pt.options).addJSON(Pt.nested);else{it.filename=Rt;var jt=it(Pt,yt,mt),Ot,Bt=0;if(jt.imports)for(;Bt-1)){if(yt.files.push(Rt),Rt in st){gt?bt(Rt,st[Rt]):(++wt,setTimeout(function(){--wt,bt(Rt,st[Rt])}));return}if(gt){var jt;try{jt=rt.fs.readFileSync(Rt).toString("utf8")}catch(Ot){Pt||xt(Ot);return}bt(Rt,jt)}else++wt,yt.fetch(Rt,function(Ot,Bt){if(--wt,!!ft){if(Ot){Pt?wt||xt(null,yt):xt(Ot);return}bt(Rt,Bt)}})}}var wt=0;rt.isString(pt)&&(pt=[pt]);for(var kt=0,It;kt-1&&this.deferred.splice(mt,1)}}else if(pt instanceof tt)lt.test(pt.name)&&delete pt.parent[pt.name];else if(pt instanceof o){for(var ft=0;ft0)pt[yt]=ht(pt[yt]||{},mt,ft);else{var gt=pt[yt];gt&&(ft=[].concat(gt).concat(ft)),pt[yt]=ft}return pt}if(typeof ct!="object")throw TypeError("dst must be an object");if(!lt)throw TypeError("path must be specified");return lt=lt.split("."),ht(ct,lt,dt)},Object.defineProperty(o,"decorateRoot",{get:function(){return et.decorated||(et.decorated=new(requireRoot()))}}),util$2.exports}var object,hasRequiredObject;function requireObject(){if(hasRequiredObject)return object;hasRequiredObject=1,object=tt,tt.className="ReflectionObject";var o=requireUtil(),et;function tt(nt,rt){if(!o.isString(nt))throw TypeError("name must be a string");if(rt&&!o.isObject(rt))throw TypeError("options must be an object");this.options=rt,this.parsedOptions=null,this.name=nt,this.parent=null,this.resolved=!1,this.comment=null,this.filename=null}return Object.defineProperties(tt.prototype,{root:{get:function(){for(var nt=this;nt.parent!==null;)nt=nt.parent;return nt}},fullName:{get:function(){for(var nt=[this.name],rt=this.parent;rt;)nt.unshift(rt.name),rt=rt.parent;return nt.join(".")}}}),tt.prototype.toJSON=function(){throw Error()},tt.prototype.onAdd=function(rt){this.parent&&this.parent!==rt&&this.parent.remove(this),this.parent=rt,this.resolved=!1;var ot=rt.root;ot instanceof et&&ot._handleAdd(this)},tt.prototype.onRemove=function(rt){var ot=rt.root;ot instanceof et&&ot._handleRemove(this),this.parent=null,this.resolved=!1},tt.prototype.resolve=function(){return this.resolved?this:(this.root instanceof et&&(this.resolved=!0),this)},tt.prototype.getOption=function(rt){if(this.options)return this.options[rt]},tt.prototype.setOption=function(rt,ot,it){return(!it||!this.options||this.options[rt]===void 0)&&((this.options||(this.options={}))[rt]=ot),this},tt.prototype.setParsedOption=function(rt,ot,it){this.parsedOptions||(this.parsedOptions=[]);var st=this.parsedOptions;if(it){var at=st.find(function(dt){return Object.prototype.hasOwnProperty.call(dt,rt)});if(at){var ct=at[rt];o.setProperty(ct,it,ot)}else at={},at[rt]=o.setProperty({},it,ot),st.push(at)}else{var lt={};lt[rt]=ot,st.push(lt)}return this},tt.prototype.setOptions=function(rt,ot){if(rt)for(var it=Object.keys(rt),st=0;st>>0,(it.id<<3|4)>>>0):ot("types[%i].encode(%s,w.uint32(%i).fork()).ldelim()",st,at,(it.id<<3|2)>>>0)}function rt(ot){for(var it=tt.codegen(["m","w"],ot.name+"$encode")("if(!w)")("w=Writer.create()"),st,at,ct=ot.fieldsArray.slice().sort(tt.compareFieldsById),st=0;st>>0,8|et.mapKey[lt.keyType],lt.keyType),pt===void 0?it("types[%i].encode(%s[ks[i]],w.uint32(18).fork()).ldelim().ldelim()",dt,at):it(".uint32(%i).%s(%s[ks[i]]).ldelim()",16|pt,ht,at),it("}")("}")):lt.repeated?(it("if(%s!=null&&%s.length){",at,at),lt.packed&&et.packed[ht]!==void 0?it("w.uint32(%i).fork()",(lt.id<<3|2)>>>0)("for(var i=0;i<%s.length;++i)",at)("w.%s(%s[i])",ht,at)("w.ldelim()"):(it("for(var i=0;i<%s.length;++i)",at),pt===void 0?nt(it,lt,dt,at+"[i]"):it("w.uint32(%i).%s(%s[i])",(lt.id<<3|pt)>>>0,ht,at)),it("}")):(lt.optional&&it("if(%s!=null&&Object.hasOwnProperty.call(m,%j))",at,lt.name),pt===void 0?nt(it,lt,dt,at):it("w.uint32(%i).%s(%s)",(lt.id<<3|pt)>>>0,ht,at))}return it("return w")}return encoder_1}var protobuf$2=indexLight.exports=indexMinimal;protobuf$2.build="light";function load(o,et,tt){return typeof et=="function"?(tt=et,et=new protobuf$2.Root):et||(et=new protobuf$2.Root),et.load(o,tt)}protobuf$2.load=load;function loadSync(o,et){return et||(et=new protobuf$2.Root),et.loadSync(o)}protobuf$2.loadSync=loadSync;protobuf$2.encoder=requireEncoder();protobuf$2.decoder=requireDecoder();protobuf$2.verifier=requireVerifier();protobuf$2.converter=requireConverter();protobuf$2.ReflectionObject=requireObject();protobuf$2.Namespace=requireNamespace();protobuf$2.Root=requireRoot();protobuf$2.Enum=require_enum();protobuf$2.Type=requireType();protobuf$2.Field=requireField();protobuf$2.OneOf=requireOneof();protobuf$2.MapField=requireMapfield();protobuf$2.Service=requireService();protobuf$2.Method=requireMethod();protobuf$2.Message=message;protobuf$2.wrappers=wrappers;protobuf$2.types=requireTypes();protobuf$2.util=requireUtil();protobuf$2.ReflectionObject._configure(protobuf$2.Root);protobuf$2.Namespace._configure(protobuf$2.Type,protobuf$2.Service,protobuf$2.Enum);protobuf$2.Root._configure(protobuf$2.Type);protobuf$2.Field._configure(protobuf$2.Type);var indexLightExports=indexLight.exports,tokenize_1=tokenize$1,delimRe=/[\s{}=;:[\],'"()<>]/g,stringDoubleRe=/(?:"([^"\\]*(?:\\.[^"\\]*)*)")/g,stringSingleRe=/(?:'([^'\\]*(?:\\.[^'\\]*)*)')/g,setCommentRe=/^ *[*/]+ */,setCommentAltRe=/^\s*\*?\/*/,setCommentSplitRe=/\n/g,whitespaceRe=/\s/,unescapeRe=/\\(.?)/g,unescapeMap={0:"\0",r:"\r",n:` +`,t:" "};function unescape$1(o){return o.replace(unescapeRe,function(et,tt){switch(tt){case"\\":case"":return tt;default:return unescapeMap[tt]||""}})}tokenize$1.unescape=unescape$1;function tokenize$1(o,et){o=o.toString();var tt=0,nt=o.length,rt=1,ot=0,it={},st=[],at=null;function ct(bt){return Error("illegal "+bt+" (line "+rt+")")}function lt(){var bt=at==="'"?stringSingleRe:stringDoubleRe;bt.lastIndex=tt-1;var Et=bt.exec(o);if(!Et)throw ct("string");return tt=bt.lastIndex,yt(at),at=null,unescape$1(Et[1])}function dt(bt){return o.charAt(bt)}function ht(bt,Et,wt){var kt={type:o.charAt(bt++),lineEmpty:!1,leading:wt},It;et?It=2:It=3;var Rt=bt-It,Pt;do if(--Rt<0||(Pt=o.charAt(Rt))===` +`){kt.lineEmpty=!0;break}while(Pt===" "||Pt===" ");for(var jt=o.substring(bt,Et).split(setCommentSplitRe),Ot=0;Ot0)return st.shift();if(at)return lt();var bt,Et,wt,kt,Tt,Rt=tt===0;do{if(tt===nt)return null;for(bt=!1;whitespaceRe.test(wt=dt(tt));)if(wt===` -`&&(Rt=!0,++rt),++tt===nt)return null;if(dt(tt)==="/"){if(++tt===nt)throw ct("comment");if(dt(tt)==="/")if(et){if(kt=tt,Tt=!1,pt(tt-1)){Tt=!0;do if(tt=mt(tt),tt===nt||(tt++,!Rt))break;while(pt(tt))}else tt=Math.min(nt,mt(tt)+1);Tt&&(ht(kt,tt,Rt),Rt=!0),rt++,bt=!0}else{for(Tt=dt(kt=tt+1)==="/";dt(++tt)!==` -`;)if(tt===nt)return null;++tt,Tt&&(ht(kt,tt-1,Rt),Rt=!0),++rt,bt=!0}else if((wt=dt(tt))==="*"){kt=tt+1,Tt=et||dt(kt)==="*";do{if(wt===` -`&&++rt,++tt===nt)throw ct("comment");Et=wt,wt=dt(tt)}while(Et!=="*"||wt!=="/");++tt,Tt&&(ht(kt,tt-2,Rt),Rt=!0),bt=!0}else return"/"}}while(bt);var Pt=tt;delimRe.lastIndex=0;var $t=delimRe.test(dt(Pt++));if(!$t)for(;Pt");var Dt=ot();if(!nameRe$1.test(Dt))throw xt(Dt,"name");at("=");var Vt=new MapField(gt(Dt),kt(ot()),tn,_t);Ot(Vt,function(an){if(an==="option")Lt(Vt,an),at(";");else throw xt(an)},function(){Gt(Vt)}),Jt.add(Vt)}function Ht(Jt,tn){if(!nameRe$1.test(tn=ot()))throw xt(tn,"name");var _t=new OneOf(gt(tn));Ot(_t,function(Vt){Vt==="option"?(Lt(_t,Vt),at(";")):(it(Vt),zt(_t,"optional"))}),Jt.add(_t)}function Ut(Jt,tn){if(!nameRe$1.test(tn=ot()))throw xt(tn,"name");var _t=new Enum(tn);Ot(_t,function(Vt){switch(Vt){case"option":Lt(_t,Vt),at(";");break;case"reserved":Et(_t.reserved||(_t.reserved=[]),!0);break;default:qt(_t,Vt)}}),Jt.add(_t)}function qt(Jt,tn){if(!nameRe$1.test(tn))throw xt(tn,"name");at("=");var _t=kt(ot(),!0),Dt={options:void 0};Dt.setOption=function(Vt,en){this.options===void 0&&(this.options={}),this.options[Vt]=en},Ot(Dt,function(en){if(en==="option")Lt(Dt,en),at(";");else throw xt(en)},function(){Gt(Dt)}),Jt.add(tn,_t,Dt.comment,Dt.options)}function Lt(Jt,tn){var _t=at("(",!0);if(!typeRefRe.test(tn=ot()))throw xt(tn,"name");var Dt=tn,Vt=Dt,en;_t&&(at(")"),Dt="("+Dt+")",Vt=Dt,tn=st(),fqTypeRefRe.test(tn)&&(en=tn.slice(1),Dt+=tn,ot())),at("=");var an=Zt(Jt,Dt);Nt(Jt,Vt,an,en)}function Zt(Jt,tn){if(at("{",!0)){for(var _t={};!at("}",!0);){if(!nameRe$1.test(Xt=ot()))throw xt(Xt,"name");if(Xt===null)throw xt(Xt,"end of input");var Dt,Vt=Xt;if(at(":",!0),st()==="{")Dt=Zt(Jt,tn+"."+Xt);else if(st()==="["){Dt=[];var en;if(at("[",!0)){do en=bt(),Dt.push(en);while(at(",",!0));at("]"),typeof en<"u"&&Qt(Jt,tn+"."+Xt,en)}}else Dt=bt(),Qt(Jt,tn+"."+Xt,Dt);var an=_t[Vt];an&&(Dt=[].concat(an).concat(Dt)),_t[Vt]=Dt,at(",",!0),at(";",!0)}return _t}var dn=bt();return Qt(Jt,tn,dn),dn}function Qt(Jt,tn,_t){Jt.setOption&&Jt.setOption(tn,_t)}function Nt(Jt,tn,_t,Dt){Jt.setParsedOption&&Jt.setParsedOption(tn,_t,Dt)}function Gt(Jt){if(at("[",!0)){do Lt(Jt,"option");while(at(",",!0));at("]")}return Jt}function nn(Jt,tn){if(!nameRe$1.test(tn=ot()))throw xt(tn,"service name");var _t=new Service(tn);Ot(_t,function(Vt){if(!$t(_t,Vt))if(Vt==="rpc")Wt(_t,Vt);else throw xt(Vt)}),Jt.add(_t)}function Wt(Jt,tn){var _t=ct(),Dt=tn;if(!nameRe$1.test(tn=ot()))throw xt(tn,"name");var Vt=tn,en,an,dn,ln;if(at("("),at("stream",!0)&&(an=!0),!typeRefRe.test(tn=ot())||(en=tn,at(")"),at("returns"),at("("),at("stream",!0)&&(ln=!0),!typeRefRe.test(tn=ot())))throw xt(tn);dn=tn,at(")");var pn=new Method(Vt,Dt,en,dn,an,ln);pn.comment=_t,Ot(pn,function(mn){if(mn==="option")Lt(pn,mn),at(";");else throw xt(mn)}),Jt.add(pn)}function hn(Jt,tn){if(!typeRefRe.test(tn=ot()))throw xt(tn,"reference");var _t=tn;Ot(null,function(Vt){switch(Vt){case"required":case"repeated":zt(Jt,Vt,_t);break;case"optional":ft?zt(Jt,"proto3_optional",_t):zt(Jt,"optional",_t);break;default:if(!ft||!typeRefRe.test(Vt))throw xt(Vt);it(Vt),zt(Jt,"optional",_t);break}})}for(var Xt;(Xt=ot())!==null;)switch(Xt){case"package":if(!lt)throw xt(Xt);Tt();break;case"import":if(!lt)throw xt(Xt);Rt();break;case"syntax":if(!lt)throw xt(Xt);Pt();break;case"option":Lt(yt,Xt),at(";");break;default:if($t(yt,Xt)){lt=!1;continue}throw xt(Xt)}return parse$1.filename=null,{package:dt,imports:ht,weakImports:pt,syntax:mt,root:et}}var common_1=common,commonRe=/\/|\./;function common(o,et){commonRe.test(o)||(o="google/protobuf/"+o+".proto",et={nested:{google:{nested:{protobuf:{nested:et}}}}}),common[o]=et}common("any",{Any:{fields:{type_url:{type:"string",id:1},value:{type:"bytes",id:2}}}});var timeType;common("duration",{Duration:timeType={fields:{seconds:{type:"int64",id:1},nanos:{type:"int32",id:2}}}});common("timestamp",{Timestamp:timeType});common("empty",{Empty:{fields:{}}});common("struct",{Struct:{fields:{fields:{keyType:"string",type:"Value",id:1}}},Value:{oneofs:{kind:{oneof:["nullValue","numberValue","stringValue","boolValue","structValue","listValue"]}},fields:{nullValue:{type:"NullValue",id:1},numberValue:{type:"double",id:2},stringValue:{type:"string",id:3},boolValue:{type:"bool",id:4},structValue:{type:"Struct",id:5},listValue:{type:"ListValue",id:6}}},NullValue:{values:{NULL_VALUE:0}},ListValue:{fields:{values:{rule:"repeated",type:"Value",id:1}}}});common("wrappers",{DoubleValue:{fields:{value:{type:"double",id:1}}},FloatValue:{fields:{value:{type:"float",id:1}}},Int64Value:{fields:{value:{type:"int64",id:1}}},UInt64Value:{fields:{value:{type:"uint64",id:1}}},Int32Value:{fields:{value:{type:"int32",id:1}}},UInt32Value:{fields:{value:{type:"uint32",id:1}}},BoolValue:{fields:{value:{type:"bool",id:1}}},StringValue:{fields:{value:{type:"string",id:1}}},BytesValue:{fields:{value:{type:"bytes",id:1}}}});common("field_mask",{FieldMask:{fields:{paths:{rule:"repeated",type:"string",id:1}}}});common.get=function o(et){return common[et]||null};var protobuf$1=src.exports=indexLightExports;protobuf$1.build="full";protobuf$1.tokenize=tokenize_1;protobuf$1.parse=parse_1;protobuf$1.common=common_1;protobuf$1.Root._configure(protobuf$1.Type,protobuf$1.parse,protobuf$1.common);var srcExports=src.exports,protobufjs=srcExports;const protobuf=getDefaultExportFromCjs(protobufjs),contentTopic="/buddybook-dogfood/1/chain/proto",encoder=createEncoder({contentTopic,ephemeral:!1}),decoder=createDecoder(contentTopic),block=new protobuf.Type("block").add(new protobuf.Field("chainUUID",1,"string")).add(new protobuf.Field("blockUUID",2,"string")).add(new protobuf.Field("title",3,"string")).add(new protobuf.Field("description",4,"string")).add(new protobuf.Field("signedMessage",5,"string")).add(new protobuf.Field("timestamp",6,"uint64")).add(new protobuf.Field("signatures",7,"string","repeated")).add(new protobuf.Field("parentBlockUUID",8,"string"));function createMessage({chainUUID:o,blockUUID:et,title:tt,description:nt,signedMessage:rt,timestamp:ot,signatures:it,parentBlockUUID:st}){const at=block.create({chainUUID:o,blockUUID:et,title:tt,description:nt,signedMessage:rt,timestamp:ot,signatures:it.map(lt=>JSON.stringify(lt)),parentBlockUUID:st});return{payload:block.encode(at).finish()}}async function*getMessagesFromStore(o){console.time("getMessagesFromStore");for await(const et of o.store.queryGenerator([decoder])){const tt=await Promise.all(et);for(const nt of tt){if(console.log(nt),!(nt!=null&&nt.payload))continue;const rt=block.decode(nt.payload);rt.signatures=rt.signatures.map(ot=>JSON.parse(ot)),yield rt}}console.timeEnd("getMessagesFromStore")}async function subscribeToFilter(o,et){const{error:tt,subscription:nt,results:rt}=await o.filter.subscribe([decoder],ot=>{if(console.log("message received from filter",ot),ot.payload){const it=block.decode(ot.payload);it.signatures=it.signatures.map(st=>JSON.parse(st)),et(it)}},{forceUseAllPeers:!1});if(console.log("results",rt),tt&&console.log("Error subscribing to filter",tt),!nt||tt||rt.successes.length===0||rt.failures.length>0)throw new Error("Failed to subscribe to filter")}function useWalletPrompt(){const{isConnected:o}=useAccount(),{connect:et,connectors:tt}=useConnect$1();return{ensureWalletConnected:async()=>{if(!o)try{const rt=tt[0];return rt&&await et({connector:rt}),await new Promise(ot=>setTimeout(ot,1e3)),!0}catch(rt){return console.error("Error connecting wallet:",rt),!1}return!0}}}const DEFAULT_FORM_DATA={title:"Devcon24 DeFi Dynamo",description:"A revolutionary blockchain for Devcon 24, focusing on scalable DeFi solutions and cross-chain interoperability.",uuid:v4()},ChainCreationForm=()=>{const[o,et]=reactExports.useState(DEFAULT_FORM_DATA),[tt,nt]=reactExports.useState({}),[rt,ot]=reactExports.useState(!1),[it,st]=reactExports.useState(!1),[at,ct]=reactExports.useState(!1),[lt,dt]=reactExports.useState(null),[ht,pt]=reactExports.useState(null),[mt,ft]=reactExports.useState(null),{node:yt}=useWaku(),{address:gt}=useAccount(),{signMessage:xt}=useSignMessage({mutation:{async onSuccess(Rt){if(!gt||!yt)return;pt(Rt);const Pt=v4();ft(Pt);const $t=createMessage({chainUUID:o.uuid,blockUUID:Pt,title:o.title,description:o.description,signedMessage:Rt,timestamp:Date.now(),signatures:[{address:gt,signature:Rt}],parentBlockUUID:null});await(yt==null?void 0:yt.lightPush.send(encoder,$t)),ct(!0),st(!1)},onError(Rt){console.error("Error signing message:",Rt),st(!1),dt("Error signing message. Please try again.")}}}),{ensureWalletConnected:vt}=useWalletPrompt(),bt=Rt=>{const{name:Pt,value:$t}=Rt.target;et(Ot=>({...Ot,[Pt]:$t})),tt[Pt]&&nt(Ot=>({...Ot,[Pt]:void 0}))},Et=()=>{const Rt={};return o.title.trim()||(Rt.title="Title is required"),o.description.trim()||(Rt.description="Description is required"),nt(Rt),Object.keys(Rt).length===0},wt=Rt=>{Rt.preventDefault(),vt()&&Et()&&ot(!0)},kt=async()=>{st(!0),dt(null);const Rt=`Create Chain: +`;)Et++;return Et}function ft(){if(st.length>0)return st.shift();if(at)return lt();var bt,Et,wt,kt,It,Rt=tt===0;do{if(tt===nt)return null;for(bt=!1;whitespaceRe.test(wt=dt(tt));)if(wt===` +`&&(Rt=!0,++rt),++tt===nt)return null;if(dt(tt)==="/"){if(++tt===nt)throw ct("comment");if(dt(tt)==="/")if(et){if(kt=tt,It=!1,pt(tt-1)){It=!0;do if(tt=mt(tt),tt===nt||(tt++,!Rt))break;while(pt(tt))}else tt=Math.min(nt,mt(tt)+1);It&&(ht(kt,tt,Rt),Rt=!0),rt++,bt=!0}else{for(It=dt(kt=tt+1)==="/";dt(++tt)!==` +`;)if(tt===nt)return null;++tt,It&&(ht(kt,tt-1,Rt),Rt=!0),++rt,bt=!0}else if((wt=dt(tt))==="*"){kt=tt+1,It=et||dt(kt)==="*";do{if(wt===` +`&&++rt,++tt===nt)throw ct("comment");Et=wt,wt=dt(tt)}while(Et!=="*"||wt!=="/");++tt,It&&(ht(kt,tt-2,Rt),Rt=!0),bt=!0}else return"/"}}while(bt);var Pt=tt;delimRe.lastIndex=0;var jt=delimRe.test(dt(Pt++));if(!jt)for(;Pt");var Dt=ot();if(!nameRe$1.test(Dt))throw xt(Dt,"name");at("=");var Vt=new MapField(gt(Dt),kt(ot()),tn,_t);Ot(Vt,function(an){if(an==="option")Lt(Vt,an),at(";");else throw xt(an)},function(){Gt(Vt)}),Jt.add(Vt)}function Ht(Jt,tn){if(!nameRe$1.test(tn=ot()))throw xt(tn,"name");var _t=new OneOf(gt(tn));Ot(_t,function(Vt){Vt==="option"?(Lt(_t,Vt),at(";")):(it(Vt),zt(_t,"optional"))}),Jt.add(_t)}function Ut(Jt,tn){if(!nameRe$1.test(tn=ot()))throw xt(tn,"name");var _t=new Enum(tn);Ot(_t,function(Vt){switch(Vt){case"option":Lt(_t,Vt),at(";");break;case"reserved":Et(_t.reserved||(_t.reserved=[]),!0);break;default:qt(_t,Vt)}}),Jt.add(_t)}function qt(Jt,tn){if(!nameRe$1.test(tn))throw xt(tn,"name");at("=");var _t=kt(ot(),!0),Dt={options:void 0};Dt.setOption=function(Vt,en){this.options===void 0&&(this.options={}),this.options[Vt]=en},Ot(Dt,function(en){if(en==="option")Lt(Dt,en),at(";");else throw xt(en)},function(){Gt(Dt)}),Jt.add(tn,_t,Dt.comment,Dt.options)}function Lt(Jt,tn){var _t=at("(",!0);if(!typeRefRe.test(tn=ot()))throw xt(tn,"name");var Dt=tn,Vt=Dt,en;_t&&(at(")"),Dt="("+Dt+")",Vt=Dt,tn=st(),fqTypeRefRe.test(tn)&&(en=tn.slice(1),Dt+=tn,ot())),at("=");var an=Zt(Jt,Dt);Nt(Jt,Vt,an,en)}function Zt(Jt,tn){if(at("{",!0)){for(var _t={};!at("}",!0);){if(!nameRe$1.test(Xt=ot()))throw xt(Xt,"name");if(Xt===null)throw xt(Xt,"end of input");var Dt,Vt=Xt;if(at(":",!0),st()==="{")Dt=Zt(Jt,tn+"."+Xt);else if(st()==="["){Dt=[];var en;if(at("[",!0)){do en=bt(),Dt.push(en);while(at(",",!0));at("]"),typeof en<"u"&&Qt(Jt,tn+"."+Xt,en)}}else Dt=bt(),Qt(Jt,tn+"."+Xt,Dt);var an=_t[Vt];an&&(Dt=[].concat(an).concat(Dt)),_t[Vt]=Dt,at(",",!0),at(";",!0)}return _t}var dn=bt();return Qt(Jt,tn,dn),dn}function Qt(Jt,tn,_t){Jt.setOption&&Jt.setOption(tn,_t)}function Nt(Jt,tn,_t,Dt){Jt.setParsedOption&&Jt.setParsedOption(tn,_t,Dt)}function Gt(Jt){if(at("[",!0)){do Lt(Jt,"option");while(at(",",!0));at("]")}return Jt}function nn(Jt,tn){if(!nameRe$1.test(tn=ot()))throw xt(tn,"service name");var _t=new Service(tn);Ot(_t,function(Vt){if(!jt(_t,Vt))if(Vt==="rpc")Wt(_t,Vt);else throw xt(Vt)}),Jt.add(_t)}function Wt(Jt,tn){var _t=ct(),Dt=tn;if(!nameRe$1.test(tn=ot()))throw xt(tn,"name");var Vt=tn,en,an,dn,ln;if(at("("),at("stream",!0)&&(an=!0),!typeRefRe.test(tn=ot())||(en=tn,at(")"),at("returns"),at("("),at("stream",!0)&&(ln=!0),!typeRefRe.test(tn=ot())))throw xt(tn);dn=tn,at(")");var pn=new Method(Vt,Dt,en,dn,an,ln);pn.comment=_t,Ot(pn,function(mn){if(mn==="option")Lt(pn,mn),at(";");else throw xt(mn)}),Jt.add(pn)}function hn(Jt,tn){if(!typeRefRe.test(tn=ot()))throw xt(tn,"reference");var _t=tn;Ot(null,function(Vt){switch(Vt){case"required":case"repeated":zt(Jt,Vt,_t);break;case"optional":ft?zt(Jt,"proto3_optional",_t):zt(Jt,"optional",_t);break;default:if(!ft||!typeRefRe.test(Vt))throw xt(Vt);it(Vt),zt(Jt,"optional",_t);break}})}for(var Xt;(Xt=ot())!==null;)switch(Xt){case"package":if(!lt)throw xt(Xt);It();break;case"import":if(!lt)throw xt(Xt);Rt();break;case"syntax":if(!lt)throw xt(Xt);Pt();break;case"option":Lt(yt,Xt),at(";");break;default:if(jt(yt,Xt)){lt=!1;continue}throw xt(Xt)}return parse$1.filename=null,{package:dt,imports:ht,weakImports:pt,syntax:mt,root:et}}var common_1=common,commonRe=/\/|\./;function common(o,et){commonRe.test(o)||(o="google/protobuf/"+o+".proto",et={nested:{google:{nested:{protobuf:{nested:et}}}}}),common[o]=et}common("any",{Any:{fields:{type_url:{type:"string",id:1},value:{type:"bytes",id:2}}}});var timeType;common("duration",{Duration:timeType={fields:{seconds:{type:"int64",id:1},nanos:{type:"int32",id:2}}}});common("timestamp",{Timestamp:timeType});common("empty",{Empty:{fields:{}}});common("struct",{Struct:{fields:{fields:{keyType:"string",type:"Value",id:1}}},Value:{oneofs:{kind:{oneof:["nullValue","numberValue","stringValue","boolValue","structValue","listValue"]}},fields:{nullValue:{type:"NullValue",id:1},numberValue:{type:"double",id:2},stringValue:{type:"string",id:3},boolValue:{type:"bool",id:4},structValue:{type:"Struct",id:5},listValue:{type:"ListValue",id:6}}},NullValue:{values:{NULL_VALUE:0}},ListValue:{fields:{values:{rule:"repeated",type:"Value",id:1}}}});common("wrappers",{DoubleValue:{fields:{value:{type:"double",id:1}}},FloatValue:{fields:{value:{type:"float",id:1}}},Int64Value:{fields:{value:{type:"int64",id:1}}},UInt64Value:{fields:{value:{type:"uint64",id:1}}},Int32Value:{fields:{value:{type:"int32",id:1}}},UInt32Value:{fields:{value:{type:"uint32",id:1}}},BoolValue:{fields:{value:{type:"bool",id:1}}},StringValue:{fields:{value:{type:"string",id:1}}},BytesValue:{fields:{value:{type:"bytes",id:1}}}});common("field_mask",{FieldMask:{fields:{paths:{rule:"repeated",type:"string",id:1}}}});common.get=function o(et){return common[et]||null};var protobuf$1=src.exports=indexLightExports;protobuf$1.build="full";protobuf$1.tokenize=tokenize_1;protobuf$1.parse=parse_1;protobuf$1.common=common_1;protobuf$1.Root._configure(protobuf$1.Type,protobuf$1.parse,protobuf$1.common);var srcExports=src.exports,protobufjs=srcExports;const protobuf=getDefaultExportFromCjs(protobufjs),WAKU_NODE_OPTIONS={defaultBootstrap:!0},contentTopic="/buddybook-devcon/1/chain/proto",encoder=createEncoder({contentTopic,ephemeral:!1}),decoder=createDecoder(contentTopic),block=new protobuf.Type("block").add(new protobuf.Field("chainUUID",1,"string")).add(new protobuf.Field("blockUUID",2,"string")).add(new protobuf.Field("title",3,"string")).add(new protobuf.Field("description",4,"string")).add(new protobuf.Field("signedMessage",5,"string")).add(new protobuf.Field("timestamp",6,"uint64")).add(new protobuf.Field("signatures",7,"string","repeated")).add(new protobuf.Field("parentBlockUUID",8,"string"));function createMessage({chainUUID:o,blockUUID:et,title:tt,description:nt,signedMessage:rt,timestamp:ot,signatures:it,parentBlockUUID:st}){const at=block.create({chainUUID:o,blockUUID:et,title:tt,description:nt,signedMessage:rt,timestamp:ot,signatures:it.map(lt=>JSON.stringify(lt)),parentBlockUUID:st});return{payload:block.encode(at).finish()}}async function*getMessagesFromStore(o){console.time("getMessagesFromStore");try{for await(const et of o.store.queryGenerator([decoder])){const tt=await Promise.all(et);for(const nt of tt){if(!(nt!=null&&nt.payload))continue;const rt=block.decode(nt.payload);rt.signatures=rt.signatures.map(ot=>JSON.parse(ot)),yield rt}}}finally{console.timeEnd("getMessagesFromStore")}}async function subscribeToFilter(o,et){const{error:tt,subscription:nt,results:rt}=await o.filter.subscribe([decoder],ot=>{if(console.log("message received from filter",ot),ot.payload){const it=block.decode(ot.payload);it.signatures=it.signatures.map(st=>JSON.parse(st)),et(it)}});if(console.log("results",rt),tt&&console.log("Error subscribing to filter",tt),!nt||tt||rt.successes.length===0||rt.failures.length>0)throw new Error("Failed to subscribe to filter")}function useWalletPrompt(){const{isConnected:o}=useAccount(),{connect:et,connectors:tt}=useConnect$1();return{ensureWalletConnected:async()=>{if(!o)try{const rt=tt[0];if(rt)return/iPad|iPhone|iPod/.test(navigator.userAgent)&&(window.location.href="metamask:///",await new Promise(it=>setTimeout(it,1e3))),await et({connector:rt}),await new Promise(it=>setTimeout(it,1e3)),!0}catch(rt){return console.error("Error connecting wallet:",rt),typeof window.ethereum>"u"&&window.open("https://metamask.io/download/","_blank"),!1}return!0}}}const DEFAULT_FORM_DATA={title:"Devcon24 DeFi Dynamo",description:"A revolutionary blockchain for Devcon 24, focusing on scalable DeFi solutions and cross-chain interoperability.",uuid:v4()},ChainCreationForm=()=>{const[o,et]=reactExports.useState(DEFAULT_FORM_DATA),[tt,nt]=reactExports.useState({}),[rt,ot]=reactExports.useState(!1),[it,st]=reactExports.useState(!1),[at,ct]=reactExports.useState(!1),[lt,dt]=reactExports.useState(null),[ht,pt]=reactExports.useState(null),[mt,ft]=reactExports.useState(null),{node:yt}=useWaku(),{address:gt}=useAccount(),{signMessage:xt}=useSignMessage({mutation:{async onSuccess(Rt){if(!gt||!yt)return;pt(Rt);const Pt=v4();ft(Pt);const jt=createMessage({chainUUID:o.uuid,blockUUID:Pt,title:o.title,description:o.description,signedMessage:Rt,timestamp:Date.now(),signatures:[{address:gt,signature:Rt}],parentBlockUUID:null});await(yt==null?void 0:yt.lightPush.send(encoder,jt)),ct(!0),st(!1)},onError(Rt){console.error("Error signing message:",Rt),st(!1),dt("Error signing message. Please try again.")}}}),{ensureWalletConnected:vt}=useWalletPrompt(),bt=Rt=>{const{name:Pt,value:jt}=Rt.target;et(Ot=>({...Ot,[Pt]:jt})),tt[Pt]&&nt(Ot=>({...Ot,[Pt]:void 0}))},Et=()=>{const Rt={};return o.title.trim()||(Rt.title="Title is required"),o.description.trim()||(Rt.description="Description is required"),nt(Rt),Object.keys(Rt).length===0},wt=Rt=>{Rt.preventDefault(),vt()&&Et()&&ot(!0)},kt=async()=>{st(!0),dt(null);const Rt=`Create Chain: Chain UUID: ${o.uuid} Title: ${o.title} Description: ${o.description} Timestamp: ${new Date().getTime()} - Signed by: ${gt}`;xt({message:Rt})},Tt=()=>{ot(!1),ct(!1),st(!1),dt(null),ft(null)};return jsxRuntimeExports.jsxs(Card,{className:"w-full max-w-2xl mx-auto",children:[jsxRuntimeExports.jsx(CardHeader,{children:jsxRuntimeExports.jsx(CardTitle,{children:"Create a New Chain"})}),jsxRuntimeExports.jsx(CardContent,{children:jsxRuntimeExports.jsxs("form",{onSubmit:wt,className:"space-y-6",children:[jsxRuntimeExports.jsxs("div",{className:"space-y-2",children:[jsxRuntimeExports.jsx(Label,{htmlFor:"title",children:"Chain Title"}),jsxRuntimeExports.jsx(Input,{type:"text",id:"title",name:"title",value:o.title,onChange:bt,maxLength:50,className:"text-base sm:text-sm"}),tt.title&&jsxRuntimeExports.jsx("p",{className:"text-sm text-destructive",children:tt.title})]}),jsxRuntimeExports.jsxs("div",{className:"space-y-2",children:[jsxRuntimeExports.jsx(Label,{htmlFor:"description",children:"Chain Description"}),jsxRuntimeExports.jsx(Textarea,{id:"description",name:"description",value:o.description,onChange:bt,maxLength:500,className:"min-h-[100px] text-base sm:text-sm"}),tt.description&&jsxRuntimeExports.jsx("p",{className:"text-sm text-destructive",children:tt.description})]}),jsxRuntimeExports.jsx(Button,{type:"submit",className:"w-full py-6 text-base sm:py-2 sm:text-sm",children:"Create Chain"})]})}),jsxRuntimeExports.jsx(Dialog,{open:rt,onOpenChange:Tt,children:jsxRuntimeExports.jsxs(DialogContent,{className:"sm:max-w-md",children:[jsxRuntimeExports.jsx(DialogHeader,{children:jsxRuntimeExports.jsx(DialogTitle,{children:at?"Chain Created":"Chain Preview"})}),at?jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:ht&&mt&&jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:jsxRuntimeExports.jsxs("div",{className:"flex flex-col items-center space-y-4",children:[jsxRuntimeExports.jsx(QRCode,{text:`${window.location.origin}/sign/${o.uuid}/${mt}`,width:200,height:200}),jsxRuntimeExports.jsx("p",{className:"text-sm text-center break-all",children:`${window.location.origin}/sign/${o.uuid}/${mt}`}),jsxRuntimeExports.jsx(Button,{onClick:()=>navigator.clipboard.writeText(`${window.location.origin}/sign/${o.uuid}/${mt}`),variant:"outline",children:"Copy Link"})]})})}):jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsxs("div",{className:"space-y-4",children:[jsxRuntimeExports.jsx("h4",{className:"text-xl font-semibold",children:o.title}),jsxRuntimeExports.jsx("p",{className:"text-muted-foreground",children:o.description}),lt&&jsxRuntimeExports.jsx("p",{className:"text-sm text-destructive",children:lt})]}),jsxRuntimeExports.jsxs(DialogFooter,{className:"sm:justify-start",children:[jsxRuntimeExports.jsx(Button,{type:"button",variant:"secondary",onClick:Tt,children:"Edit"}),jsxRuntimeExports.jsx(Button,{type:"button",onClick:kt,disabled:it,children:it?jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(LoaderCircle,{className:"mr-2 h-4 w-4 animate-spin"}),"Signing..."]}):"Sign"})]})]})]})})]})},SignChain=({block:o,chainsData:et,onSuccess:tt})=>{const[nt,rt]=reactExports.useState(!1),[ot,it]=reactExports.useState(!1),[st,at]=reactExports.useState(null),[ct,lt]=reactExports.useState(!1),{address:dt}=useAccount(),{data:ht}=useEnsName({address:dt}),{node:pt}=useWaku(),{ensureWalletConnected:mt}=useWalletPrompt();reactExports.useEffect(()=>{if(dt){const gt=vt=>{if(vt.signatures.some(wt=>wt.address.toLowerCase()===dt.toLowerCase()))return!0;const bt=et.find(wt=>wt.blockUUID===vt.parentBlockUUID);return bt&>(bt)?!0:et.filter(wt=>wt.parentBlockUUID===vt.blockUUID).some(wt=>gt(wt))},xt=gt(o);lt(xt)}},[dt,o,et]);const{signMessage:ft}=useSignMessage({mutation:{onMutate(){at(null),it(!0)},async onSuccess(gt){if(!(!dt||!pt))try{if(o.signatures.some(wt=>wt.address.toLowerCase()===dt.toLowerCase())){at("You have already signed this chain.");return}const xt={chainUUID:o.chainUUID,blockUUID:v4(),title:o.title,description:o.description,signedMessage:gt,timestamp:Date.now(),signatures:[{address:dt,signature:gt}],parentBlockUUID:o.blockUUID},vt=createMessage(xt),{failures:bt,successes:Et}=await pt.lightPush.send(encoder,vt);if(bt.length>0||Et.length===0)throw new Error("Failed to send message to Waku network");tt(xt),rt(!1)}catch(xt){console.error("Error creating new block:",xt),at("Failed to create new block. Please try again.")}},onError(gt){console.error("Error signing message:",gt),at("Error signing message. Please try again. If using a mobile wallet, please ensure your wallet app is open.")},onSettled(){it(!1)}}}),yt=async()=>{try{if(!dt&&!await mt())return;if(ct){at("You have already signed this chain.");return}const gt=`Sign Block: -Chain UUID: ${o.chainUUID} -Block UUID: ${o.blockUUID} -Title: ${o.title} -Description: ${o.description} -Timestamp: ${new Date().getTime()} -Parent Block UUID: ${o.parentBlockUUID} -Signed by: ${ht||dt}`;ft({message:gt})}catch(gt){console.error("Error in sign flow:",gt),at("Failed to initiate signing. Please try again."),it(!1)}};return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(Button,{onClick:()=>rt(!0),disabled:ct,children:ct?"Already Signed":dt?"Sign Chain":"Connect Wallet"}),jsxRuntimeExports.jsx(Dialog,{open:nt,onOpenChange:rt,children:jsxRuntimeExports.jsxs(DialogContent,{className:"sm:max-w-md",children:[jsxRuntimeExports.jsxs(DialogHeader,{children:[jsxRuntimeExports.jsx(DialogTitle,{children:"Sign Chain"}),jsxRuntimeExports.jsx(DialogDescription,{children:ct?"You have already signed this chain.":"Review the block details and sign to add your signature to the chain."})]}),jsxRuntimeExports.jsxs("div",{className:"flex flex-col space-y-4",children:[jsxRuntimeExports.jsxs("div",{className:"space-y-2",children:[jsxRuntimeExports.jsx("h4",{className:"font-medium",children:"Block Details"}),jsxRuntimeExports.jsx("p",{className:"text-sm text-muted-foreground",children:o.title}),jsxRuntimeExports.jsx("p",{className:"text-sm text-muted-foreground",children:o.description})]}),jsxRuntimeExports.jsx(QRCode,{text:`${window.location.origin}/sign/${o.chainUUID}/${o.blockUUID}`})]}),st&&jsxRuntimeExports.jsx("p",{className:"text-sm text-destructive",children:st}),jsxRuntimeExports.jsxs(DialogFooter,{children:[jsxRuntimeExports.jsx(Button,{variant:"secondary",onClick:()=>rt(!1),children:"Cancel"}),jsxRuntimeExports.jsx(Button,{onClick:yt,disabled:ot||ct,children:ot?jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(LoaderCircle,{className:"mr-2 h-4 w-4 animate-spin"}),"Signing..."]}):ct?"Already Signed":dt?"Sign":"Connect Wallet"})]})]})})]})},ChainList=({chainsData:o,onChainUpdate:et,isLoading:tt})=>{const nt=it=>{et(it)},rt=(it,st=0)=>{const at=o.filter(dt=>dt.parentBlockUUID===it.blockUUID),ct=it.signatures.length+at.reduce((dt,ht)=>dt+ht.signatures.length,0),lt=`${window.location.origin}/sign/${it.chainUUID??it.blockUUID}/${it.blockUUID}`;return jsxRuntimeExports.jsxs("li",{className:"mb-4",children:[jsxRuntimeExports.jsxs("div",{className:"flex items-start",children:[jsxRuntimeExports.jsx("div",{className:"mr-4 mt-2",children:st>0&&jsxRuntimeExports.jsx("div",{className:"w-6 h-6 border-l-2 border-b-2 border-gray-300"})}),st===0?jsxRuntimeExports.jsxs(Card,{className:"flex-grow",children:[jsxRuntimeExports.jsx(CardHeader,{children:jsxRuntimeExports.jsx(CardTitle,{children:it.title})}),jsxRuntimeExports.jsxs(CardContent,{children:[jsxRuntimeExports.jsx("p",{children:it.description}),jsxRuntimeExports.jsxs("div",{className:"flex flex-col space-y-2 mt-2",children:[jsxRuntimeExports.jsx("p",{className:"text-sm text-muted-foreground",children:jsxRuntimeExports.jsx(SignerName,{address:it.signatures[0].address,prefix:"Created by"})}),jsxRuntimeExports.jsxs("p",{className:"text-sm text-muted-foreground",children:["Created at: ",new Date(it.timestamp).toLocaleString()]}),jsxRuntimeExports.jsxs("p",{className:"text-sm text-muted-foreground",children:["Total Signatures: ",ct]}),jsxRuntimeExports.jsxs("p",{className:"text-sm text-muted-foreground",children:["Block UUID: ",it.blockUUID]})]}),jsxRuntimeExports.jsxs("div",{className:"mt-2 space-x-2",children:[jsxRuntimeExports.jsx(SignChain,{block:it,chainsData:o,onSuccess:nt}),jsxRuntimeExports.jsxs(Dialog,{children:[jsxRuntimeExports.jsx(DialogTrigger,{asChild:!0,children:jsxRuntimeExports.jsx(Button,{variant:"outline",children:"Share"})}),jsxRuntimeExports.jsxs(DialogContent,{className:"sm:max-w-md",children:[jsxRuntimeExports.jsxs(DialogHeader,{children:[jsxRuntimeExports.jsx(DialogTitle,{children:"Share this Chain"}),jsxRuntimeExports.jsx(DialogDescription,{children:"Share this chain with others to collect their signatures."})]}),jsxRuntimeExports.jsxs("div",{className:"flex flex-col items-center space-y-4",children:[jsxRuntimeExports.jsx(QRCode,{text:lt,width:200,height:200}),jsxRuntimeExports.jsx("p",{className:"text-sm text-center break-all",children:lt}),jsxRuntimeExports.jsx(Button,{onClick:()=>navigator.clipboard.writeText(lt),variant:"outline",children:"Copy Link"})]})]})]})]})]})]}):jsxRuntimeExports.jsx("div",{className:"flex-grow",children:jsxRuntimeExports.jsx("p",{className:"text-sm",children:jsxRuntimeExports.jsx(SignerName,{address:it.signatures[0].address,prefix:"Signed by"})})})]}),at.length>0&&jsxRuntimeExports.jsx("ul",{className:"ml-8 mt-2",children:at.map(dt=>rt(dt,st+1))})]},`${it.blockUUID}-${st}`)},ot=o.filter(it=>!it.parentBlockUUID);return jsxRuntimeExports.jsxs(Card,{className:"w-full max-w-4xl mx-auto",children:[jsxRuntimeExports.jsx(CardHeader,{children:jsxRuntimeExports.jsxs(CardTitle,{children:["Existing Chains",tt&&jsxRuntimeExports.jsxs("span",{className:"ml-2 inline-flex items-center text-muted-foreground text-sm font-normal",children:[jsxRuntimeExports.jsx(LoaderCircle,{className:"h-4 w-4 animate-spin mr-2"}),"Loading more chains..."]})]})}),jsxRuntimeExports.jsx(CardContent,{children:ot.length===0&&!tt?jsxRuntimeExports.jsx("p",{children:"No chains found."}):jsxRuntimeExports.jsx("ul",{className:"space-y-4",children:ot.map(it=>rt(it,0))})})]})},SignerName=({address:o,prefix:et})=>{const{data:tt}=useEnsName({address:o});return jsxRuntimeExports.jsxs("span",{className:"text-sm",children:[et&&`${et}: `,tt||`${o.slice(0,6)}...${o.slice(-4)}`]})};var DirectionContext=reactExports.createContext(void 0);function useDirection(o){const et=reactExports.useContext(DirectionContext);return o||et||"ltr"}function clamp(o,[et,tt]){return Math.min(tt,Math.max(et,o))}function useStateMachine(o,et){return reactExports.useReducer((tt,nt)=>et[tt][nt]??tt,o)}var SCROLL_AREA_NAME="ScrollArea",[createScrollAreaContext,createScrollAreaScope]=createContextScope(SCROLL_AREA_NAME),[ScrollAreaProvider,useScrollAreaContext]=createScrollAreaContext(SCROLL_AREA_NAME),ScrollArea$1=reactExports.forwardRef((o,et)=>{const{__scopeScrollArea:tt,type:nt="hover",dir:rt,scrollHideDelay:ot=600,...it}=o,[st,at]=reactExports.useState(null),[ct,lt]=reactExports.useState(null),[dt,ht]=reactExports.useState(null),[pt,mt]=reactExports.useState(null),[ft,yt]=reactExports.useState(null),[gt,xt]=reactExports.useState(0),[vt,bt]=reactExports.useState(0),[Et,wt]=reactExports.useState(!1),[kt,Tt]=reactExports.useState(!1),Rt=useComposedRefs(et,$t=>at($t)),Pt=useDirection(rt);return jsxRuntimeExports.jsx(ScrollAreaProvider,{scope:tt,type:nt,dir:Pt,scrollHideDelay:ot,scrollArea:st,viewport:ct,onViewportChange:lt,content:dt,onContentChange:ht,scrollbarX:pt,onScrollbarXChange:mt,scrollbarXEnabled:Et,onScrollbarXEnabledChange:wt,scrollbarY:ft,onScrollbarYChange:yt,scrollbarYEnabled:kt,onScrollbarYEnabledChange:Tt,onCornerWidthChange:xt,onCornerHeightChange:bt,children:jsxRuntimeExports.jsx(Primitive.div,{dir:Pt,...it,ref:Rt,style:{position:"relative","--radix-scroll-area-corner-width":gt+"px","--radix-scroll-area-corner-height":vt+"px",...o.style}})})});ScrollArea$1.displayName=SCROLL_AREA_NAME;var VIEWPORT_NAME="ScrollAreaViewport",ScrollAreaViewport=reactExports.forwardRef((o,et)=>{const{__scopeScrollArea:tt,children:nt,asChild:rt,nonce:ot,...it}=o,st=useScrollAreaContext(VIEWPORT_NAME,tt),at=reactExports.useRef(null),ct=useComposedRefs(et,at,st.onViewportChange);return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx("style",{dangerouslySetInnerHTML:{__html:` + Signed by: ${gt}`;xt({message:Rt})},It=()=>{ot(!1),ct(!1),st(!1),dt(null),ft(null)};return jsxRuntimeExports.jsxs(Card,{className:"w-full max-w-2xl mx-auto",children:[jsxRuntimeExports.jsx(CardHeader,{children:jsxRuntimeExports.jsx(CardTitle,{children:"Create a New Chain"})}),jsxRuntimeExports.jsx(CardContent,{children:jsxRuntimeExports.jsxs("form",{onSubmit:wt,className:"space-y-6",children:[jsxRuntimeExports.jsxs("div",{className:"space-y-2",children:[jsxRuntimeExports.jsx(Label,{htmlFor:"title",children:"Chain Title"}),jsxRuntimeExports.jsx(Input,{type:"text",id:"title",name:"title",value:o.title,onChange:bt,maxLength:50,className:"text-base sm:text-sm"}),tt.title&&jsxRuntimeExports.jsx("p",{className:"text-sm text-destructive",children:tt.title})]}),jsxRuntimeExports.jsxs("div",{className:"space-y-2",children:[jsxRuntimeExports.jsx(Label,{htmlFor:"description",children:"Chain Description"}),jsxRuntimeExports.jsx(Textarea,{id:"description",name:"description",value:o.description,onChange:bt,maxLength:500,className:"min-h-[100px] text-base sm:text-sm"}),tt.description&&jsxRuntimeExports.jsx("p",{className:"text-sm text-destructive",children:tt.description})]}),jsxRuntimeExports.jsx(Button,{type:"submit",className:"w-full py-6 text-base sm:py-2 sm:text-sm",children:"Create Chain"})]})}),jsxRuntimeExports.jsx(Dialog,{open:rt,onOpenChange:It,children:jsxRuntimeExports.jsxs(DialogContent,{className:"sm:max-w-md",children:[jsxRuntimeExports.jsx(DialogHeader,{children:jsxRuntimeExports.jsx(DialogTitle,{children:at?"Chain Created":"Chain Preview"})}),at?jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:ht&&mt&&jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment,{children:jsxRuntimeExports.jsxs("div",{className:"flex flex-col items-center space-y-4",children:[jsxRuntimeExports.jsx(QRCode,{text:`${window.location.origin}/sign/${o.uuid}/${mt}`,width:200,height:200}),jsxRuntimeExports.jsx("p",{className:"text-sm text-center break-all",children:`${window.location.origin}/sign/${o.uuid}/${mt}`}),jsxRuntimeExports.jsx(Button,{onClick:()=>navigator.clipboard.writeText(`${window.location.origin}/sign/${o.uuid}/${mt}`),variant:"outline",children:"Copy Link"})]})})}):jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsxs("div",{className:"space-y-4",children:[jsxRuntimeExports.jsx("h4",{className:"text-xl font-semibold",children:o.title}),jsxRuntimeExports.jsx("p",{className:"text-muted-foreground",children:o.description}),lt&&jsxRuntimeExports.jsx("p",{className:"text-sm text-destructive",children:lt})]}),jsxRuntimeExports.jsxs(DialogFooter,{className:"sm:justify-start",children:[jsxRuntimeExports.jsx(Button,{type:"button",variant:"secondary",onClick:It,children:"Edit"}),jsxRuntimeExports.jsx(Button,{type:"button",onClick:kt,disabled:it,children:it?jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(LoaderCircle,{className:"mr-2 h-4 w-4 animate-spin"}),"Signing..."]}):"Sign"})]})]})]})})]})},SignChain=({block:o,chainsData:et,onSuccess:tt})=>{const[nt,rt]=reactExports.useState(!1),[ot,it]=reactExports.useState(!1),[st,at]=reactExports.useState(null),[ct,lt]=reactExports.useState(!1),[dt,ht]=reactExports.useState(!1),{address:pt}=useAccount(),{data:mt}=useEnsName({address:pt}),{node:ft}=useWaku(),{ensureWalletConnected:yt}=useWalletPrompt(),gt=(wt,kt)=>{var Rt;if(kt.has(wt.blockUUID))return!1;if(kt.add(wt.blockUUID),(Rt=wt.signatures)!=null&&Rt.some(Pt=>{var jt;return((jt=Pt==null?void 0:Pt.address)==null?void 0:jt.toLowerCase())===(pt==null?void 0:pt.toLowerCase())}))return!0;const It=et.find(Pt=>Pt.blockUUID===wt.parentBlockUUID);return It&>(It,kt)?!0:et.filter(Pt=>Pt.parentBlockUUID===wt.blockUUID).some(Pt=>gt(Pt,kt))};reactExports.useEffect(()=>{if(pt)try{lt(gt(o,new Set))}catch(wt){console.error("Error in signature check:",wt),lt(!1)}},[pt,o,et]);const{signMessage:xt}=useSignMessage({mutation:{onMutate(){at(null),it(!0)},async onSuccess(wt){if(!(!pt||!ft))try{if(o.signatures.some(jt=>jt.address.toLowerCase()===pt.toLowerCase())){at("You have already signed this chain.");return}const kt={chainUUID:o.chainUUID,blockUUID:v4(),title:o.title,description:o.description,signedMessage:wt,timestamp:Date.now(),signatures:[{address:pt,signature:wt}],parentBlockUUID:o.blockUUID},It=createMessage(kt),{failures:Rt,successes:Pt}=await ft.lightPush.send(encoder,It);if(Rt.length>0||Pt.length===0)throw new Error("Failed to send message to Waku network");tt(kt),rt(!1)}catch(kt){console.error("Error creating new block:",kt),at("Failed to create new block. Please try again.")}},onError(wt){console.error("Error signing message:",wt),at("Error signing message. Please try again. If using a mobile wallet, please ensure your wallet app is open.")},onSettled(){it(!1)}}}),vt=async()=>{try{if(!pt&&(ht(!0),!await yt())){at("Please ensure your wallet is connected and the app is open.");return}if(ct){at("You have already signed this chain.");return}if(/iPhone|iPad|iPod|Android/i.test(navigator.userAgent)&&typeof window.ethereum>"u"){at("Please ensure your wallet app is installed and open before signing."),window.location.href="metamask:///";return}const kt=["Sign Block:",`Chain UUID: ${o.chainUUID}`,`Block UUID: ${o.blockUUID}`,`Title: ${o.title}`,`Description: ${o.description}`,`Timestamp: ${new Date().getTime()}`,`Parent Block UUID: ${o.parentBlockUUID}`,`Signed by: ${mt||pt}`].join(` +`);xt({message:kt})}catch(wt){console.error("Error in sign flow:",wt),at("Failed to initiate signing. Please ensure your wallet app is open and try again."),it(!1)}finally{ht(!1)}},bt=()=>ot?"Signing...":dt?"Connecting...":ct?"Already Signed":pt?"Sign":"Connect Wallet",Et=ot||dt;return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx(Button,{onClick:()=>rt(!0),disabled:ct,children:ct?"Already Signed":pt?"Sign Chain":"Connect Wallet"}),jsxRuntimeExports.jsx(Dialog,{open:nt,onOpenChange:rt,children:jsxRuntimeExports.jsxs(DialogContent,{className:"sm:max-w-md",children:[jsxRuntimeExports.jsxs(DialogHeader,{children:[jsxRuntimeExports.jsx(DialogTitle,{children:"Sign Chain"}),jsxRuntimeExports.jsx(DialogDescription,{children:ct?"You have already signed this chain.":"Review the block details and sign to add your signature to the chain."})]}),jsxRuntimeExports.jsxs("div",{className:"flex flex-col space-y-4",children:[jsxRuntimeExports.jsxs("div",{className:"space-y-2",children:[jsxRuntimeExports.jsx("h4",{className:"font-medium",children:"Block Details"}),jsxRuntimeExports.jsx("p",{className:"text-sm text-muted-foreground",children:o.title}),jsxRuntimeExports.jsx("p",{className:"text-sm text-muted-foreground",children:o.description})]}),jsxRuntimeExports.jsx(QRCode,{text:`${window.location.origin}/sign/${o.chainUUID}/${o.blockUUID}`})]}),(st||dt)&&jsxRuntimeExports.jsxs("div",{className:"space-y-2",children:[st&&jsxRuntimeExports.jsx("p",{className:"text-sm text-destructive",children:st}),dt&&jsxRuntimeExports.jsxs("div",{className:"rounded-md bg-blue-50 p-4",children:[jsxRuntimeExports.jsx("p",{className:"text-sm text-blue-700",children:"Attempting to connect to your wallet..."}),jsxRuntimeExports.jsx("p",{className:"text-xs text-blue-600 mt-1",children:"If your wallet doesn't open automatically, please open it manually to approve the connection."})]})]}),jsxRuntimeExports.jsxs(DialogFooter,{children:[jsxRuntimeExports.jsx(Button,{variant:"secondary",onClick:()=>rt(!1),children:"Cancel"}),jsxRuntimeExports.jsxs(Button,{onClick:vt,disabled:ot||ct||dt,children:[Et&&jsxRuntimeExports.jsx(LoaderCircle,{className:"mr-2 h-4 w-4 animate-spin"}),bt()]})]})]})})]})},ChainList=({chainsData:o,onChainUpdate:et,isLoading:tt})=>{const nt=it=>{et(it)},rt=(it,st=0)=>{const at=o.filter(dt=>dt.parentBlockUUID===it.blockUUID),ct=it.signatures.length+at.reduce((dt,ht)=>dt+ht.signatures.length,0),lt=`${window.location.origin}/sign/${it.chainUUID??it.blockUUID}/${it.blockUUID}`;return jsxRuntimeExports.jsxs("li",{className:"mb-4",children:[jsxRuntimeExports.jsxs("div",{className:"flex items-start",children:[jsxRuntimeExports.jsx("div",{className:"mr-4 mt-2",children:st>0&&jsxRuntimeExports.jsx("div",{className:"w-6 h-6 border-l-2 border-b-2 border-gray-300"})}),st===0?jsxRuntimeExports.jsxs(Card,{className:"flex-grow",children:[jsxRuntimeExports.jsx(CardHeader,{children:jsxRuntimeExports.jsx(CardTitle,{children:it.title})}),jsxRuntimeExports.jsxs(CardContent,{children:[jsxRuntimeExports.jsx("p",{children:it.description}),jsxRuntimeExports.jsxs("div",{className:"flex flex-col space-y-2 mt-2",children:[jsxRuntimeExports.jsx("p",{className:"text-sm text-muted-foreground",children:jsxRuntimeExports.jsx(SignerName,{address:it.signatures[0].address,prefix:"Created by"})}),jsxRuntimeExports.jsxs("p",{className:"text-sm text-muted-foreground",children:["Created at: ",new Date(it.timestamp).toLocaleString()]}),jsxRuntimeExports.jsxs("p",{className:"text-sm text-muted-foreground",children:["Total Signatures: ",ct]}),jsxRuntimeExports.jsxs("p",{className:"text-sm text-muted-foreground",children:["Block UUID: ",it.blockUUID]})]}),jsxRuntimeExports.jsxs("div",{className:"mt-2 space-x-2",children:[jsxRuntimeExports.jsx(SignChain,{block:it,chainsData:o,onSuccess:nt}),jsxRuntimeExports.jsxs(Dialog,{children:[jsxRuntimeExports.jsx(DialogTrigger,{asChild:!0,children:jsxRuntimeExports.jsx(Button,{variant:"outline",children:"Share"})}),jsxRuntimeExports.jsxs(DialogContent,{className:"flex flex-col gap-4",children:[jsxRuntimeExports.jsxs(DialogHeader,{children:[jsxRuntimeExports.jsx(DialogTitle,{children:"Share Chain"}),jsxRuntimeExports.jsx(DialogDescription,{children:"Share this chain with others to collect their signatures."})]}),jsxRuntimeExports.jsx("div",{className:"flex flex-col items-center gap-4",children:jsxRuntimeExports.jsx(QRCode,{text:lt,width:180,height:180,showCopyButton:"text",title:it.title,description:`Sign this chain: ${it.title}`})})]})]})]})]})]}):jsxRuntimeExports.jsx("div",{className:"flex-grow",children:jsxRuntimeExports.jsx("p",{className:"text-sm",children:jsxRuntimeExports.jsx(SignerName,{address:it.signatures[0].address,prefix:"Signed by"})})})]}),at.length>0&&jsxRuntimeExports.jsx("ul",{className:"ml-8 mt-2",children:at.map(dt=>rt(dt,st+1))})]},`${it.blockUUID}-${st}`)},ot=o.filter(it=>!it.parentBlockUUID);return jsxRuntimeExports.jsxs(Card,{className:"w-full max-w-4xl mx-auto",children:[jsxRuntimeExports.jsx(CardHeader,{children:jsxRuntimeExports.jsxs(CardTitle,{children:["Existing Chains",tt&&jsxRuntimeExports.jsxs("span",{className:"ml-2 inline-flex items-center text-muted-foreground text-sm font-normal",children:[jsxRuntimeExports.jsx(LoaderCircle,{className:"h-4 w-4 animate-spin mr-2"}),"Loading more chains..."]})]})}),jsxRuntimeExports.jsx(CardContent,{children:ot.length===0&&!tt?jsxRuntimeExports.jsx("p",{children:"No chains found."}):jsxRuntimeExports.jsx("ul",{className:"space-y-4",children:ot.map(it=>rt(it,0))})})]})},SignerName=({address:o,prefix:et})=>{const{data:tt}=useEnsName({address:o});return jsxRuntimeExports.jsxs("span",{className:"text-sm",children:[et&&`${et}: `,tt||`${o.slice(0,6)}...${o.slice(-4)}`]})};var DirectionContext=reactExports.createContext(void 0);function useDirection(o){const et=reactExports.useContext(DirectionContext);return o||et||"ltr"}function clamp(o,[et,tt]){return Math.min(tt,Math.max(et,o))}function useStateMachine(o,et){return reactExports.useReducer((tt,nt)=>et[tt][nt]??tt,o)}var SCROLL_AREA_NAME="ScrollArea",[createScrollAreaContext,createScrollAreaScope]=createContextScope(SCROLL_AREA_NAME),[ScrollAreaProvider,useScrollAreaContext]=createScrollAreaContext(SCROLL_AREA_NAME),ScrollArea$1=reactExports.forwardRef((o,et)=>{const{__scopeScrollArea:tt,type:nt="hover",dir:rt,scrollHideDelay:ot=600,...it}=o,[st,at]=reactExports.useState(null),[ct,lt]=reactExports.useState(null),[dt,ht]=reactExports.useState(null),[pt,mt]=reactExports.useState(null),[ft,yt]=reactExports.useState(null),[gt,xt]=reactExports.useState(0),[vt,bt]=reactExports.useState(0),[Et,wt]=reactExports.useState(!1),[kt,It]=reactExports.useState(!1),Rt=useComposedRefs(et,jt=>at(jt)),Pt=useDirection(rt);return jsxRuntimeExports.jsx(ScrollAreaProvider,{scope:tt,type:nt,dir:Pt,scrollHideDelay:ot,scrollArea:st,viewport:ct,onViewportChange:lt,content:dt,onContentChange:ht,scrollbarX:pt,onScrollbarXChange:mt,scrollbarXEnabled:Et,onScrollbarXEnabledChange:wt,scrollbarY:ft,onScrollbarYChange:yt,scrollbarYEnabled:kt,onScrollbarYEnabledChange:It,onCornerWidthChange:xt,onCornerHeightChange:bt,children:jsxRuntimeExports.jsx(Primitive.div,{dir:Pt,...it,ref:Rt,style:{position:"relative","--radix-scroll-area-corner-width":gt+"px","--radix-scroll-area-corner-height":vt+"px",...o.style}})})});ScrollArea$1.displayName=SCROLL_AREA_NAME;var VIEWPORT_NAME="ScrollAreaViewport",ScrollAreaViewport=reactExports.forwardRef((o,et)=>{const{__scopeScrollArea:tt,children:nt,asChild:rt,nonce:ot,...it}=o,st=useScrollAreaContext(VIEWPORT_NAME,tt),at=reactExports.useRef(null),ct=useComposedRefs(et,at,st.onViewportChange);return jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment,{children:[jsxRuntimeExports.jsx("style",{dangerouslySetInnerHTML:{__html:` [data-radix-scroll-area-viewport] { scrollbar-width: none; -ms-overflow-style: none; @@ -4173,7 +4177,7 @@ Signed by: ${ht||dt}`;ft({message:gt})}catch(gt){console.error("Error in sign fl :where([data-radix-scroll-area-content]) { flex-grow: 1; } -`},nonce:ot}),jsxRuntimeExports.jsx(Primitive.div,{"data-radix-scroll-area-viewport":"",...it,asChild:rt,ref:ct,style:{overflowX:st.scrollbarXEnabled?"scroll":"hidden",overflowY:st.scrollbarYEnabled?"scroll":"hidden",...o.style},children:getSubtree({asChild:rt,children:nt},lt=>jsxRuntimeExports.jsx("div",{"data-radix-scroll-area-content":"",ref:st.onContentChange,style:{minWidth:st.scrollbarXEnabled?"fit-content":void 0},children:lt}))})]})});ScrollAreaViewport.displayName=VIEWPORT_NAME;var SCROLLBAR_NAME="ScrollAreaScrollbar",ScrollAreaScrollbar=reactExports.forwardRef((o,et)=>{const{forceMount:tt,...nt}=o,rt=useScrollAreaContext(SCROLLBAR_NAME,o.__scopeScrollArea),{onScrollbarXEnabledChange:ot,onScrollbarYEnabledChange:it}=rt,st=o.orientation==="horizontal";return reactExports.useEffect(()=>(st?ot(!0):it(!0),()=>{st?ot(!1):it(!1)}),[st,ot,it]),rt.type==="hover"?jsxRuntimeExports.jsx(ScrollAreaScrollbarHover,{...nt,ref:et,forceMount:tt}):rt.type==="scroll"?jsxRuntimeExports.jsx(ScrollAreaScrollbarScroll,{...nt,ref:et,forceMount:tt}):rt.type==="auto"?jsxRuntimeExports.jsx(ScrollAreaScrollbarAuto,{...nt,ref:et,forceMount:tt}):rt.type==="always"?jsxRuntimeExports.jsx(ScrollAreaScrollbarVisible,{...nt,ref:et}):null});ScrollAreaScrollbar.displayName=SCROLLBAR_NAME;var ScrollAreaScrollbarHover=reactExports.forwardRef((o,et)=>{const{forceMount:tt,...nt}=o,rt=useScrollAreaContext(SCROLLBAR_NAME,o.__scopeScrollArea),[ot,it]=reactExports.useState(!1);return reactExports.useEffect(()=>{const st=rt.scrollArea;let at=0;if(st){const ct=()=>{window.clearTimeout(at),it(!0)},lt=()=>{at=window.setTimeout(()=>it(!1),rt.scrollHideDelay)};return st.addEventListener("pointerenter",ct),st.addEventListener("pointerleave",lt),()=>{window.clearTimeout(at),st.removeEventListener("pointerenter",ct),st.removeEventListener("pointerleave",lt)}}},[rt.scrollArea,rt.scrollHideDelay]),jsxRuntimeExports.jsx(Presence,{present:tt||ot,children:jsxRuntimeExports.jsx(ScrollAreaScrollbarAuto,{"data-state":ot?"visible":"hidden",...nt,ref:et})})}),ScrollAreaScrollbarScroll=reactExports.forwardRef((o,et)=>{const{forceMount:tt,...nt}=o,rt=useScrollAreaContext(SCROLLBAR_NAME,o.__scopeScrollArea),ot=o.orientation==="horizontal",it=useDebounceCallback(()=>at("SCROLL_END"),100),[st,at]=useStateMachine("hidden",{hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}});return reactExports.useEffect(()=>{if(st==="idle"){const ct=window.setTimeout(()=>at("HIDE"),rt.scrollHideDelay);return()=>window.clearTimeout(ct)}},[st,rt.scrollHideDelay,at]),reactExports.useEffect(()=>{const ct=rt.viewport,lt=ot?"scrollLeft":"scrollTop";if(ct){let dt=ct[lt];const ht=()=>{const pt=ct[lt];dt!==pt&&(at("SCROLL"),it()),dt=pt};return ct.addEventListener("scroll",ht),()=>ct.removeEventListener("scroll",ht)}},[rt.viewport,ot,at,it]),jsxRuntimeExports.jsx(Presence,{present:tt||st!=="hidden",children:jsxRuntimeExports.jsx(ScrollAreaScrollbarVisible,{"data-state":st==="hidden"?"hidden":"visible",...nt,ref:et,onPointerEnter:composeEventHandlers(o.onPointerEnter,()=>at("POINTER_ENTER")),onPointerLeave:composeEventHandlers(o.onPointerLeave,()=>at("POINTER_LEAVE"))})})}),ScrollAreaScrollbarAuto=reactExports.forwardRef((o,et)=>{const tt=useScrollAreaContext(SCROLLBAR_NAME,o.__scopeScrollArea),{forceMount:nt,...rt}=o,[ot,it]=reactExports.useState(!1),st=o.orientation==="horizontal",at=useDebounceCallback(()=>{if(tt.viewport){const ct=tt.viewport.offsetWidth{const{orientation:tt="vertical",...nt}=o,rt=useScrollAreaContext(SCROLLBAR_NAME,o.__scopeScrollArea),ot=reactExports.useRef(null),it=reactExports.useRef(0),[st,at]=reactExports.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),ct=getThumbRatio(st.viewport,st.content),lt={...nt,sizes:st,onSizesChange:at,hasThumb:ct>0&&ct<1,onThumbChange:ht=>ot.current=ht,onThumbPointerUp:()=>it.current=0,onThumbPointerDown:ht=>it.current=ht};function dt(ht,pt){return getScrollPositionFromPointer(ht,it.current,st,pt)}return tt==="horizontal"?jsxRuntimeExports.jsx(ScrollAreaScrollbarX,{...lt,ref:et,onThumbPositionChange:()=>{if(rt.viewport&&ot.current){const ht=rt.viewport.scrollLeft,pt=getThumbOffsetFromScroll(ht,st,rt.dir);ot.current.style.transform=`translate3d(${pt}px, 0, 0)`}},onWheelScroll:ht=>{rt.viewport&&(rt.viewport.scrollLeft=ht)},onDragScroll:ht=>{rt.viewport&&(rt.viewport.scrollLeft=dt(ht,rt.dir))}}):tt==="vertical"?jsxRuntimeExports.jsx(ScrollAreaScrollbarY,{...lt,ref:et,onThumbPositionChange:()=>{if(rt.viewport&&ot.current){const ht=rt.viewport.scrollTop,pt=getThumbOffsetFromScroll(ht,st);ot.current.style.transform=`translate3d(0, ${pt}px, 0)`}},onWheelScroll:ht=>{rt.viewport&&(rt.viewport.scrollTop=ht)},onDragScroll:ht=>{rt.viewport&&(rt.viewport.scrollTop=dt(ht))}}):null}),ScrollAreaScrollbarX=reactExports.forwardRef((o,et)=>{const{sizes:tt,onSizesChange:nt,...rt}=o,ot=useScrollAreaContext(SCROLLBAR_NAME,o.__scopeScrollArea),[it,st]=reactExports.useState(),at=reactExports.useRef(null),ct=useComposedRefs(et,at,ot.onScrollbarXChange);return reactExports.useEffect(()=>{at.current&&st(getComputedStyle(at.current))},[at]),jsxRuntimeExports.jsx(ScrollAreaScrollbarImpl,{"data-orientation":"horizontal",...rt,ref:ct,sizes:tt,style:{bottom:0,left:ot.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:ot.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":getThumbSize(tt)+"px",...o.style},onThumbPointerDown:lt=>o.onThumbPointerDown(lt.x),onDragScroll:lt=>o.onDragScroll(lt.x),onWheelScroll:(lt,dt)=>{if(ot.viewport){const ht=ot.viewport.scrollLeft+lt.deltaX;o.onWheelScroll(ht),isScrollingWithinScrollbarBounds(ht,dt)&<.preventDefault()}},onResize:()=>{at.current&&ot.viewport&&it&&nt({content:ot.viewport.scrollWidth,viewport:ot.viewport.offsetWidth,scrollbar:{size:at.current.clientWidth,paddingStart:toInt(it.paddingLeft),paddingEnd:toInt(it.paddingRight)}})}})}),ScrollAreaScrollbarY=reactExports.forwardRef((o,et)=>{const{sizes:tt,onSizesChange:nt,...rt}=o,ot=useScrollAreaContext(SCROLLBAR_NAME,o.__scopeScrollArea),[it,st]=reactExports.useState(),at=reactExports.useRef(null),ct=useComposedRefs(et,at,ot.onScrollbarYChange);return reactExports.useEffect(()=>{at.current&&st(getComputedStyle(at.current))},[at]),jsxRuntimeExports.jsx(ScrollAreaScrollbarImpl,{"data-orientation":"vertical",...rt,ref:ct,sizes:tt,style:{top:0,right:ot.dir==="ltr"?0:void 0,left:ot.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":getThumbSize(tt)+"px",...o.style},onThumbPointerDown:lt=>o.onThumbPointerDown(lt.y),onDragScroll:lt=>o.onDragScroll(lt.y),onWheelScroll:(lt,dt)=>{if(ot.viewport){const ht=ot.viewport.scrollTop+lt.deltaY;o.onWheelScroll(ht),isScrollingWithinScrollbarBounds(ht,dt)&<.preventDefault()}},onResize:()=>{at.current&&ot.viewport&&it&&nt({content:ot.viewport.scrollHeight,viewport:ot.viewport.offsetHeight,scrollbar:{size:at.current.clientHeight,paddingStart:toInt(it.paddingTop),paddingEnd:toInt(it.paddingBottom)}})}})}),[ScrollbarProvider,useScrollbarContext]=createScrollAreaContext(SCROLLBAR_NAME),ScrollAreaScrollbarImpl=reactExports.forwardRef((o,et)=>{const{__scopeScrollArea:tt,sizes:nt,hasThumb:rt,onThumbChange:ot,onThumbPointerUp:it,onThumbPointerDown:st,onThumbPositionChange:at,onDragScroll:ct,onWheelScroll:lt,onResize:dt,...ht}=o,pt=useScrollAreaContext(SCROLLBAR_NAME,tt),[mt,ft]=reactExports.useState(null),yt=useComposedRefs(et,Rt=>ft(Rt)),gt=reactExports.useRef(null),xt=reactExports.useRef(""),vt=pt.viewport,bt=nt.content-nt.viewport,Et=useCallbackRef$1(lt),wt=useCallbackRef$1(at),kt=useDebounceCallback(dt,10);function Tt(Rt){if(gt.current){const Pt=Rt.clientX-gt.current.left,$t=Rt.clientY-gt.current.top;ct({x:Pt,y:$t})}}return reactExports.useEffect(()=>{const Rt=Pt=>{const $t=Pt.target;(mt==null?void 0:mt.contains($t))&&Et(Pt,bt)};return document.addEventListener("wheel",Rt,{passive:!1}),()=>document.removeEventListener("wheel",Rt,{passive:!1})},[vt,mt,bt,Et]),reactExports.useEffect(wt,[nt,wt]),useResizeObserver(mt,kt),useResizeObserver(pt.content,kt),jsxRuntimeExports.jsx(ScrollbarProvider,{scope:tt,scrollbar:mt,hasThumb:rt,onThumbChange:useCallbackRef$1(ot),onThumbPointerUp:useCallbackRef$1(it),onThumbPositionChange:wt,onThumbPointerDown:useCallbackRef$1(st),children:jsxRuntimeExports.jsx(Primitive.div,{...ht,ref:yt,style:{position:"absolute",...ht.style},onPointerDown:composeEventHandlers(o.onPointerDown,Rt=>{Rt.button===0&&(Rt.target.setPointerCapture(Rt.pointerId),gt.current=mt.getBoundingClientRect(),xt.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",pt.viewport&&(pt.viewport.style.scrollBehavior="auto"),Tt(Rt))}),onPointerMove:composeEventHandlers(o.onPointerMove,Tt),onPointerUp:composeEventHandlers(o.onPointerUp,Rt=>{const Pt=Rt.target;Pt.hasPointerCapture(Rt.pointerId)&&Pt.releasePointerCapture(Rt.pointerId),document.body.style.webkitUserSelect=xt.current,pt.viewport&&(pt.viewport.style.scrollBehavior=""),gt.current=null})})})}),THUMB_NAME="ScrollAreaThumb",ScrollAreaThumb=reactExports.forwardRef((o,et)=>{const{forceMount:tt,...nt}=o,rt=useScrollbarContext(THUMB_NAME,o.__scopeScrollArea);return jsxRuntimeExports.jsx(Presence,{present:tt||rt.hasThumb,children:jsxRuntimeExports.jsx(ScrollAreaThumbImpl,{ref:et,...nt})})}),ScrollAreaThumbImpl=reactExports.forwardRef((o,et)=>{const{__scopeScrollArea:tt,style:nt,...rt}=o,ot=useScrollAreaContext(THUMB_NAME,tt),it=useScrollbarContext(THUMB_NAME,tt),{onThumbPositionChange:st}=it,at=useComposedRefs(et,dt=>it.onThumbChange(dt)),ct=reactExports.useRef(),lt=useDebounceCallback(()=>{ct.current&&(ct.current(),ct.current=void 0)},100);return reactExports.useEffect(()=>{const dt=ot.viewport;if(dt){const ht=()=>{if(lt(),!ct.current){const pt=addUnlinkedScrollListener(dt,st);ct.current=pt,st()}};return st(),dt.addEventListener("scroll",ht),()=>dt.removeEventListener("scroll",ht)}},[ot.viewport,lt,st]),jsxRuntimeExports.jsx(Primitive.div,{"data-state":it.hasThumb?"visible":"hidden",...rt,ref:at,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...nt},onPointerDownCapture:composeEventHandlers(o.onPointerDownCapture,dt=>{const pt=dt.target.getBoundingClientRect(),mt=dt.clientX-pt.left,ft=dt.clientY-pt.top;it.onThumbPointerDown({x:mt,y:ft})}),onPointerUp:composeEventHandlers(o.onPointerUp,it.onThumbPointerUp)})});ScrollAreaThumb.displayName=THUMB_NAME;var CORNER_NAME="ScrollAreaCorner",ScrollAreaCorner=reactExports.forwardRef((o,et)=>{const tt=useScrollAreaContext(CORNER_NAME,o.__scopeScrollArea),nt=!!(tt.scrollbarX&&tt.scrollbarY);return tt.type!=="scroll"&&nt?jsxRuntimeExports.jsx(ScrollAreaCornerImpl,{...o,ref:et}):null});ScrollAreaCorner.displayName=CORNER_NAME;var ScrollAreaCornerImpl=reactExports.forwardRef((o,et)=>{const{__scopeScrollArea:tt,...nt}=o,rt=useScrollAreaContext(CORNER_NAME,tt),[ot,it]=reactExports.useState(0),[st,at]=reactExports.useState(0),ct=!!(ot&&st);return useResizeObserver(rt.scrollbarX,()=>{var dt;const lt=((dt=rt.scrollbarX)==null?void 0:dt.offsetHeight)||0;rt.onCornerHeightChange(lt),at(lt)}),useResizeObserver(rt.scrollbarY,()=>{var dt;const lt=((dt=rt.scrollbarY)==null?void 0:dt.offsetWidth)||0;rt.onCornerWidthChange(lt),it(lt)}),ct?jsxRuntimeExports.jsx(Primitive.div,{...nt,ref:et,style:{width:ot,height:st,position:"absolute",right:rt.dir==="ltr"?0:void 0,left:rt.dir==="rtl"?0:void 0,bottom:0,...o.style}}):null});function toInt(o){return o?parseInt(o,10):0}function getThumbRatio(o,et){const tt=o/et;return isNaN(tt)?0:tt}function getThumbSize(o){const et=getThumbRatio(o.viewport,o.content),tt=o.scrollbar.paddingStart+o.scrollbar.paddingEnd,nt=(o.scrollbar.size-tt)*et;return Math.max(nt,18)}function getScrollPositionFromPointer(o,et,tt,nt="ltr"){const rt=getThumbSize(tt),ot=rt/2,it=et||ot,st=rt-it,at=tt.scrollbar.paddingStart+it,ct=tt.scrollbar.size-tt.scrollbar.paddingEnd-st,lt=tt.content-tt.viewport,dt=nt==="ltr"?[0,lt]:[lt*-1,0];return linearScale([at,ct],dt)(o)}function getThumbOffsetFromScroll(o,et,tt="ltr"){const nt=getThumbSize(et),rt=et.scrollbar.paddingStart+et.scrollbar.paddingEnd,ot=et.scrollbar.size-rt,it=et.content-et.viewport,st=ot-nt,at=tt==="ltr"?[0,it]:[it*-1,0],ct=clamp(o,at);return linearScale([0,it],[0,st])(ct)}function linearScale(o,et){return tt=>{if(o[0]===o[1]||et[0]===et[1])return et[0];const nt=(et[1]-et[0])/(o[1]-o[0]);return et[0]+nt*(tt-o[0])}}function isScrollingWithinScrollbarBounds(o,et){return o>0&&o{})=>{let tt={left:o.scrollLeft,top:o.scrollTop},nt=0;return function rt(){const ot={left:o.scrollLeft,top:o.scrollTop},it=tt.left!==ot.left,st=tt.top!==ot.top;(it||st)&&et(),tt=ot,nt=window.requestAnimationFrame(rt)}(),()=>window.cancelAnimationFrame(nt)};function useDebounceCallback(o,et){const tt=useCallbackRef$1(o),nt=reactExports.useRef(0);return reactExports.useEffect(()=>()=>window.clearTimeout(nt.current),[]),reactExports.useCallback(()=>{window.clearTimeout(nt.current),nt.current=window.setTimeout(tt,et)},[tt,et])}function useResizeObserver(o,et){const tt=useCallbackRef$1(et);useLayoutEffect2(()=>{let nt=0;if(o){const rt=new ResizeObserver(()=>{cancelAnimationFrame(nt),nt=window.requestAnimationFrame(tt)});return rt.observe(o),()=>{window.cancelAnimationFrame(nt),rt.unobserve(o)}}},[o,tt])}function getSubtree(o,et){const{asChild:tt,children:nt}=o;if(!tt)return typeof et=="function"?et(nt):et;const rt=reactExports.Children.only(nt);return reactExports.cloneElement(rt,{children:typeof et=="function"?et(rt.props.children):et})}var Root=ScrollArea$1,Viewport=ScrollAreaViewport,Corner=ScrollAreaCorner;const ScrollArea=reactExports.forwardRef(({className:o,children:et,...tt},nt)=>jsxRuntimeExports.jsxs(Root,{ref:nt,className:cn("relative overflow-hidden",o),...tt,children:[jsxRuntimeExports.jsx(Viewport,{className:"h-full w-full rounded-[inherit]",children:et}),jsxRuntimeExports.jsx(ScrollBar,{}),jsxRuntimeExports.jsx(Corner,{})]}));ScrollArea.displayName=Root.displayName;const ScrollBar=reactExports.forwardRef(({className:o,orientation:et="vertical",...tt},nt)=>jsxRuntimeExports.jsx(ScrollAreaScrollbar,{ref:nt,orientation:et,className:cn("flex touch-none select-none transition-colors",et==="vertical"&&"h-full w-2.5 border-l border-l-transparent p-[1px]",et==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent p-[1px]",o),...tt,children:jsxRuntimeExports.jsx(ScrollAreaThumb,{className:"relative flex-1 rounded-full bg-border"})}));ScrollBar.displayName=ScrollAreaScrollbar.displayName;const privacyPolicy=` +`},nonce:ot}),jsxRuntimeExports.jsx(Primitive.div,{"data-radix-scroll-area-viewport":"",...it,asChild:rt,ref:ct,style:{overflowX:st.scrollbarXEnabled?"scroll":"hidden",overflowY:st.scrollbarYEnabled?"scroll":"hidden",...o.style},children:getSubtree({asChild:rt,children:nt},lt=>jsxRuntimeExports.jsx("div",{"data-radix-scroll-area-content":"",ref:st.onContentChange,style:{minWidth:st.scrollbarXEnabled?"fit-content":void 0},children:lt}))})]})});ScrollAreaViewport.displayName=VIEWPORT_NAME;var SCROLLBAR_NAME="ScrollAreaScrollbar",ScrollAreaScrollbar=reactExports.forwardRef((o,et)=>{const{forceMount:tt,...nt}=o,rt=useScrollAreaContext(SCROLLBAR_NAME,o.__scopeScrollArea),{onScrollbarXEnabledChange:ot,onScrollbarYEnabledChange:it}=rt,st=o.orientation==="horizontal";return reactExports.useEffect(()=>(st?ot(!0):it(!0),()=>{st?ot(!1):it(!1)}),[st,ot,it]),rt.type==="hover"?jsxRuntimeExports.jsx(ScrollAreaScrollbarHover,{...nt,ref:et,forceMount:tt}):rt.type==="scroll"?jsxRuntimeExports.jsx(ScrollAreaScrollbarScroll,{...nt,ref:et,forceMount:tt}):rt.type==="auto"?jsxRuntimeExports.jsx(ScrollAreaScrollbarAuto,{...nt,ref:et,forceMount:tt}):rt.type==="always"?jsxRuntimeExports.jsx(ScrollAreaScrollbarVisible,{...nt,ref:et}):null});ScrollAreaScrollbar.displayName=SCROLLBAR_NAME;var ScrollAreaScrollbarHover=reactExports.forwardRef((o,et)=>{const{forceMount:tt,...nt}=o,rt=useScrollAreaContext(SCROLLBAR_NAME,o.__scopeScrollArea),[ot,it]=reactExports.useState(!1);return reactExports.useEffect(()=>{const st=rt.scrollArea;let at=0;if(st){const ct=()=>{window.clearTimeout(at),it(!0)},lt=()=>{at=window.setTimeout(()=>it(!1),rt.scrollHideDelay)};return st.addEventListener("pointerenter",ct),st.addEventListener("pointerleave",lt),()=>{window.clearTimeout(at),st.removeEventListener("pointerenter",ct),st.removeEventListener("pointerleave",lt)}}},[rt.scrollArea,rt.scrollHideDelay]),jsxRuntimeExports.jsx(Presence,{present:tt||ot,children:jsxRuntimeExports.jsx(ScrollAreaScrollbarAuto,{"data-state":ot?"visible":"hidden",...nt,ref:et})})}),ScrollAreaScrollbarScroll=reactExports.forwardRef((o,et)=>{const{forceMount:tt,...nt}=o,rt=useScrollAreaContext(SCROLLBAR_NAME,o.__scopeScrollArea),ot=o.orientation==="horizontal",it=useDebounceCallback(()=>at("SCROLL_END"),100),[st,at]=useStateMachine("hidden",{hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}});return reactExports.useEffect(()=>{if(st==="idle"){const ct=window.setTimeout(()=>at("HIDE"),rt.scrollHideDelay);return()=>window.clearTimeout(ct)}},[st,rt.scrollHideDelay,at]),reactExports.useEffect(()=>{const ct=rt.viewport,lt=ot?"scrollLeft":"scrollTop";if(ct){let dt=ct[lt];const ht=()=>{const pt=ct[lt];dt!==pt&&(at("SCROLL"),it()),dt=pt};return ct.addEventListener("scroll",ht),()=>ct.removeEventListener("scroll",ht)}},[rt.viewport,ot,at,it]),jsxRuntimeExports.jsx(Presence,{present:tt||st!=="hidden",children:jsxRuntimeExports.jsx(ScrollAreaScrollbarVisible,{"data-state":st==="hidden"?"hidden":"visible",...nt,ref:et,onPointerEnter:composeEventHandlers(o.onPointerEnter,()=>at("POINTER_ENTER")),onPointerLeave:composeEventHandlers(o.onPointerLeave,()=>at("POINTER_LEAVE"))})})}),ScrollAreaScrollbarAuto=reactExports.forwardRef((o,et)=>{const tt=useScrollAreaContext(SCROLLBAR_NAME,o.__scopeScrollArea),{forceMount:nt,...rt}=o,[ot,it]=reactExports.useState(!1),st=o.orientation==="horizontal",at=useDebounceCallback(()=>{if(tt.viewport){const ct=tt.viewport.offsetWidth{const{orientation:tt="vertical",...nt}=o,rt=useScrollAreaContext(SCROLLBAR_NAME,o.__scopeScrollArea),ot=reactExports.useRef(null),it=reactExports.useRef(0),[st,at]=reactExports.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),ct=getThumbRatio(st.viewport,st.content),lt={...nt,sizes:st,onSizesChange:at,hasThumb:ct>0&&ct<1,onThumbChange:ht=>ot.current=ht,onThumbPointerUp:()=>it.current=0,onThumbPointerDown:ht=>it.current=ht};function dt(ht,pt){return getScrollPositionFromPointer(ht,it.current,st,pt)}return tt==="horizontal"?jsxRuntimeExports.jsx(ScrollAreaScrollbarX,{...lt,ref:et,onThumbPositionChange:()=>{if(rt.viewport&&ot.current){const ht=rt.viewport.scrollLeft,pt=getThumbOffsetFromScroll(ht,st,rt.dir);ot.current.style.transform=`translate3d(${pt}px, 0, 0)`}},onWheelScroll:ht=>{rt.viewport&&(rt.viewport.scrollLeft=ht)},onDragScroll:ht=>{rt.viewport&&(rt.viewport.scrollLeft=dt(ht,rt.dir))}}):tt==="vertical"?jsxRuntimeExports.jsx(ScrollAreaScrollbarY,{...lt,ref:et,onThumbPositionChange:()=>{if(rt.viewport&&ot.current){const ht=rt.viewport.scrollTop,pt=getThumbOffsetFromScroll(ht,st);ot.current.style.transform=`translate3d(0, ${pt}px, 0)`}},onWheelScroll:ht=>{rt.viewport&&(rt.viewport.scrollTop=ht)},onDragScroll:ht=>{rt.viewport&&(rt.viewport.scrollTop=dt(ht))}}):null}),ScrollAreaScrollbarX=reactExports.forwardRef((o,et)=>{const{sizes:tt,onSizesChange:nt,...rt}=o,ot=useScrollAreaContext(SCROLLBAR_NAME,o.__scopeScrollArea),[it,st]=reactExports.useState(),at=reactExports.useRef(null),ct=useComposedRefs(et,at,ot.onScrollbarXChange);return reactExports.useEffect(()=>{at.current&&st(getComputedStyle(at.current))},[at]),jsxRuntimeExports.jsx(ScrollAreaScrollbarImpl,{"data-orientation":"horizontal",...rt,ref:ct,sizes:tt,style:{bottom:0,left:ot.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:ot.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":getThumbSize(tt)+"px",...o.style},onThumbPointerDown:lt=>o.onThumbPointerDown(lt.x),onDragScroll:lt=>o.onDragScroll(lt.x),onWheelScroll:(lt,dt)=>{if(ot.viewport){const ht=ot.viewport.scrollLeft+lt.deltaX;o.onWheelScroll(ht),isScrollingWithinScrollbarBounds(ht,dt)&<.preventDefault()}},onResize:()=>{at.current&&ot.viewport&&it&&nt({content:ot.viewport.scrollWidth,viewport:ot.viewport.offsetWidth,scrollbar:{size:at.current.clientWidth,paddingStart:toInt(it.paddingLeft),paddingEnd:toInt(it.paddingRight)}})}})}),ScrollAreaScrollbarY=reactExports.forwardRef((o,et)=>{const{sizes:tt,onSizesChange:nt,...rt}=o,ot=useScrollAreaContext(SCROLLBAR_NAME,o.__scopeScrollArea),[it,st]=reactExports.useState(),at=reactExports.useRef(null),ct=useComposedRefs(et,at,ot.onScrollbarYChange);return reactExports.useEffect(()=>{at.current&&st(getComputedStyle(at.current))},[at]),jsxRuntimeExports.jsx(ScrollAreaScrollbarImpl,{"data-orientation":"vertical",...rt,ref:ct,sizes:tt,style:{top:0,right:ot.dir==="ltr"?0:void 0,left:ot.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":getThumbSize(tt)+"px",...o.style},onThumbPointerDown:lt=>o.onThumbPointerDown(lt.y),onDragScroll:lt=>o.onDragScroll(lt.y),onWheelScroll:(lt,dt)=>{if(ot.viewport){const ht=ot.viewport.scrollTop+lt.deltaY;o.onWheelScroll(ht),isScrollingWithinScrollbarBounds(ht,dt)&<.preventDefault()}},onResize:()=>{at.current&&ot.viewport&&it&&nt({content:ot.viewport.scrollHeight,viewport:ot.viewport.offsetHeight,scrollbar:{size:at.current.clientHeight,paddingStart:toInt(it.paddingTop),paddingEnd:toInt(it.paddingBottom)}})}})}),[ScrollbarProvider,useScrollbarContext]=createScrollAreaContext(SCROLLBAR_NAME),ScrollAreaScrollbarImpl=reactExports.forwardRef((o,et)=>{const{__scopeScrollArea:tt,sizes:nt,hasThumb:rt,onThumbChange:ot,onThumbPointerUp:it,onThumbPointerDown:st,onThumbPositionChange:at,onDragScroll:ct,onWheelScroll:lt,onResize:dt,...ht}=o,pt=useScrollAreaContext(SCROLLBAR_NAME,tt),[mt,ft]=reactExports.useState(null),yt=useComposedRefs(et,Rt=>ft(Rt)),gt=reactExports.useRef(null),xt=reactExports.useRef(""),vt=pt.viewport,bt=nt.content-nt.viewport,Et=useCallbackRef$1(lt),wt=useCallbackRef$1(at),kt=useDebounceCallback(dt,10);function It(Rt){if(gt.current){const Pt=Rt.clientX-gt.current.left,jt=Rt.clientY-gt.current.top;ct({x:Pt,y:jt})}}return reactExports.useEffect(()=>{const Rt=Pt=>{const jt=Pt.target;(mt==null?void 0:mt.contains(jt))&&Et(Pt,bt)};return document.addEventListener("wheel",Rt,{passive:!1}),()=>document.removeEventListener("wheel",Rt,{passive:!1})},[vt,mt,bt,Et]),reactExports.useEffect(wt,[nt,wt]),useResizeObserver(mt,kt),useResizeObserver(pt.content,kt),jsxRuntimeExports.jsx(ScrollbarProvider,{scope:tt,scrollbar:mt,hasThumb:rt,onThumbChange:useCallbackRef$1(ot),onThumbPointerUp:useCallbackRef$1(it),onThumbPositionChange:wt,onThumbPointerDown:useCallbackRef$1(st),children:jsxRuntimeExports.jsx(Primitive.div,{...ht,ref:yt,style:{position:"absolute",...ht.style},onPointerDown:composeEventHandlers(o.onPointerDown,Rt=>{Rt.button===0&&(Rt.target.setPointerCapture(Rt.pointerId),gt.current=mt.getBoundingClientRect(),xt.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",pt.viewport&&(pt.viewport.style.scrollBehavior="auto"),It(Rt))}),onPointerMove:composeEventHandlers(o.onPointerMove,It),onPointerUp:composeEventHandlers(o.onPointerUp,Rt=>{const Pt=Rt.target;Pt.hasPointerCapture(Rt.pointerId)&&Pt.releasePointerCapture(Rt.pointerId),document.body.style.webkitUserSelect=xt.current,pt.viewport&&(pt.viewport.style.scrollBehavior=""),gt.current=null})})})}),THUMB_NAME="ScrollAreaThumb",ScrollAreaThumb=reactExports.forwardRef((o,et)=>{const{forceMount:tt,...nt}=o,rt=useScrollbarContext(THUMB_NAME,o.__scopeScrollArea);return jsxRuntimeExports.jsx(Presence,{present:tt||rt.hasThumb,children:jsxRuntimeExports.jsx(ScrollAreaThumbImpl,{ref:et,...nt})})}),ScrollAreaThumbImpl=reactExports.forwardRef((o,et)=>{const{__scopeScrollArea:tt,style:nt,...rt}=o,ot=useScrollAreaContext(THUMB_NAME,tt),it=useScrollbarContext(THUMB_NAME,tt),{onThumbPositionChange:st}=it,at=useComposedRefs(et,dt=>it.onThumbChange(dt)),ct=reactExports.useRef(),lt=useDebounceCallback(()=>{ct.current&&(ct.current(),ct.current=void 0)},100);return reactExports.useEffect(()=>{const dt=ot.viewport;if(dt){const ht=()=>{if(lt(),!ct.current){const pt=addUnlinkedScrollListener(dt,st);ct.current=pt,st()}};return st(),dt.addEventListener("scroll",ht),()=>dt.removeEventListener("scroll",ht)}},[ot.viewport,lt,st]),jsxRuntimeExports.jsx(Primitive.div,{"data-state":it.hasThumb?"visible":"hidden",...rt,ref:at,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...nt},onPointerDownCapture:composeEventHandlers(o.onPointerDownCapture,dt=>{const pt=dt.target.getBoundingClientRect(),mt=dt.clientX-pt.left,ft=dt.clientY-pt.top;it.onThumbPointerDown({x:mt,y:ft})}),onPointerUp:composeEventHandlers(o.onPointerUp,it.onThumbPointerUp)})});ScrollAreaThumb.displayName=THUMB_NAME;var CORNER_NAME="ScrollAreaCorner",ScrollAreaCorner=reactExports.forwardRef((o,et)=>{const tt=useScrollAreaContext(CORNER_NAME,o.__scopeScrollArea),nt=!!(tt.scrollbarX&&tt.scrollbarY);return tt.type!=="scroll"&&nt?jsxRuntimeExports.jsx(ScrollAreaCornerImpl,{...o,ref:et}):null});ScrollAreaCorner.displayName=CORNER_NAME;var ScrollAreaCornerImpl=reactExports.forwardRef((o,et)=>{const{__scopeScrollArea:tt,...nt}=o,rt=useScrollAreaContext(CORNER_NAME,tt),[ot,it]=reactExports.useState(0),[st,at]=reactExports.useState(0),ct=!!(ot&&st);return useResizeObserver(rt.scrollbarX,()=>{var dt;const lt=((dt=rt.scrollbarX)==null?void 0:dt.offsetHeight)||0;rt.onCornerHeightChange(lt),at(lt)}),useResizeObserver(rt.scrollbarY,()=>{var dt;const lt=((dt=rt.scrollbarY)==null?void 0:dt.offsetWidth)||0;rt.onCornerWidthChange(lt),it(lt)}),ct?jsxRuntimeExports.jsx(Primitive.div,{...nt,ref:et,style:{width:ot,height:st,position:"absolute",right:rt.dir==="ltr"?0:void 0,left:rt.dir==="rtl"?0:void 0,bottom:0,...o.style}}):null});function toInt(o){return o?parseInt(o,10):0}function getThumbRatio(o,et){const tt=o/et;return isNaN(tt)?0:tt}function getThumbSize(o){const et=getThumbRatio(o.viewport,o.content),tt=o.scrollbar.paddingStart+o.scrollbar.paddingEnd,nt=(o.scrollbar.size-tt)*et;return Math.max(nt,18)}function getScrollPositionFromPointer(o,et,tt,nt="ltr"){const rt=getThumbSize(tt),ot=rt/2,it=et||ot,st=rt-it,at=tt.scrollbar.paddingStart+it,ct=tt.scrollbar.size-tt.scrollbar.paddingEnd-st,lt=tt.content-tt.viewport,dt=nt==="ltr"?[0,lt]:[lt*-1,0];return linearScale([at,ct],dt)(o)}function getThumbOffsetFromScroll(o,et,tt="ltr"){const nt=getThumbSize(et),rt=et.scrollbar.paddingStart+et.scrollbar.paddingEnd,ot=et.scrollbar.size-rt,it=et.content-et.viewport,st=ot-nt,at=tt==="ltr"?[0,it]:[it*-1,0],ct=clamp(o,at);return linearScale([0,it],[0,st])(ct)}function linearScale(o,et){return tt=>{if(o[0]===o[1]||et[0]===et[1])return et[0];const nt=(et[1]-et[0])/(o[1]-o[0]);return et[0]+nt*(tt-o[0])}}function isScrollingWithinScrollbarBounds(o,et){return o>0&&o{})=>{let tt={left:o.scrollLeft,top:o.scrollTop},nt=0;return function rt(){const ot={left:o.scrollLeft,top:o.scrollTop},it=tt.left!==ot.left,st=tt.top!==ot.top;(it||st)&&et(),tt=ot,nt=window.requestAnimationFrame(rt)}(),()=>window.cancelAnimationFrame(nt)};function useDebounceCallback(o,et){const tt=useCallbackRef$1(o),nt=reactExports.useRef(0);return reactExports.useEffect(()=>()=>window.clearTimeout(nt.current),[]),reactExports.useCallback(()=>{window.clearTimeout(nt.current),nt.current=window.setTimeout(tt,et)},[tt,et])}function useResizeObserver(o,et){const tt=useCallbackRef$1(et);useLayoutEffect2(()=>{let nt=0;if(o){const rt=new ResizeObserver(()=>{cancelAnimationFrame(nt),nt=window.requestAnimationFrame(tt)});return rt.observe(o),()=>{window.cancelAnimationFrame(nt),rt.unobserve(o)}}},[o,tt])}function getSubtree(o,et){const{asChild:tt,children:nt}=o;if(!tt)return typeof et=="function"?et(nt):et;const rt=reactExports.Children.only(nt);return reactExports.cloneElement(rt,{children:typeof et=="function"?et(rt.props.children):et})}var Root=ScrollArea$1,Viewport=ScrollAreaViewport,Corner=ScrollAreaCorner;const ScrollArea=reactExports.forwardRef(({className:o,children:et,...tt},nt)=>jsxRuntimeExports.jsxs(Root,{ref:nt,className:cn("relative overflow-hidden",o),...tt,children:[jsxRuntimeExports.jsx(Viewport,{className:"h-full w-full rounded-[inherit]",children:et}),jsxRuntimeExports.jsx(ScrollBar,{}),jsxRuntimeExports.jsx(Corner,{})]}));ScrollArea.displayName=Root.displayName;const ScrollBar=reactExports.forwardRef(({className:o,orientation:et="vertical",...tt},nt)=>jsxRuntimeExports.jsx(ScrollAreaScrollbar,{ref:nt,orientation:et,className:cn("flex touch-none select-none transition-colors",et==="vertical"&&"h-full w-2.5 border-l border-l-transparent p-[1px]",et==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent p-[1px]",o),...tt,children:jsxRuntimeExports.jsx(ScrollAreaThumb,{className:"relative flex-1 rounded-full bg-border"})}));ScrollBar.displayName=ScrollAreaScrollbar.displayName;const privacyPolicy=` # Waku - Dogfooding Website *Last updated: 22 August 2024* @@ -4257,9 +4261,9 @@ To the extent that you have any questions about the Privacy Policy, please conta This document is licensed under CC-BY-SA. `;function ok$1(){}function unreachable(){}function stringify$1(o,et){const tt={};return(o[o.length-1]===""?[...o,""]:o).join((tt.padRight?" ":"")+","+(tt.padLeft===!1?"":" ")).trim()}const nameRe=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,nameReJsx=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,emptyOptions$2={};function name(o,et){return(emptyOptions$2.jsx?nameReJsx:nameRe).test(o)}const re=/[ \t\n\f\r]/g;function whitespace(o){return typeof o=="object"?o.type==="text"?empty$1(o.value):!1:empty$1(o)}function empty$1(o){return o.replace(re,"")===""}class Schema{constructor(et,tt,nt){this.property=et,this.normal=tt,nt&&(this.space=nt)}}Schema.prototype.property={};Schema.prototype.normal={};Schema.prototype.space=null;function merge(o,et){const tt={},nt={};let rt=-1;for(;++rt4&&tt.slice(0,4)==="data"&&valid.test(et)){if(et.charAt(4)==="-"){const ot=et.slice(5).replace(dash,camelcase);nt="data"+ot.charAt(0).toUpperCase()+ot.slice(1)}else{const ot=et.slice(4);if(!dash.test(ot)){let it=ot.replace(cap$1,kebab);it.charAt(0)!=="-"&&(it="-"+it),et="data"+it}}rt=DefinedInfo}return new rt(nt,et)}function kebab(o){return"-"+o.toLowerCase()}function camelcase(o){return o.charAt(1).toUpperCase()}const hastToReact={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},html$1=merge([xml,xlink,xmlns,aria,html$2],"html"),svg=merge([xml,xlink,xmlns,aria,svg$1],"svg");function stringify(o){return o.join(" ").trim()}var cjs={},COMMENT_REGEX=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,NEWLINE_REGEX=/\n/g,WHITESPACE_REGEX=/^\s*/,PROPERTY_REGEX=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,COLON_REGEX=/^:\s*/,VALUE_REGEX=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,SEMICOLON_REGEX=/^[;\s]*/,TRIM_REGEX=/^\s+|\s+$/g,NEWLINE=` -`,FORWARD_SLASH="/",ASTERISK="*",EMPTY_STRING="",TYPE_COMMENT="comment",TYPE_DECLARATION="declaration",inlineStyleParser=function(o,et){if(typeof o!="string")throw new TypeError("First argument must be a string");if(!o)return[];et=et||{};var tt=1,nt=1;function rt(mt){var ft=mt.match(NEWLINE_REGEX);ft&&(tt+=ft.length);var yt=mt.lastIndexOf(NEWLINE);nt=~yt?mt.length-yt:nt+mt.length}function ot(){var mt={line:tt,column:nt};return function(ft){return ft.position=new it(mt),ct(),ft}}function it(mt){this.start=mt,this.end={line:tt,column:nt},this.source=et.source}it.prototype.content=o;function st(mt){var ft=new Error(et.source+":"+tt+":"+nt+": "+mt);if(ft.reason=mt,ft.filename=et.source,ft.line=tt,ft.column=nt,ft.source=o,!et.silent)throw ft}function at(mt){var ft=mt.exec(o);if(ft){var yt=ft[0];return rt(yt),o=o.slice(yt.length),ft}}function ct(){at(WHITESPACE_REGEX)}function lt(mt){var ft;for(mt=mt||[];ft=dt();)ft!==!1&&mt.push(ft);return mt}function dt(){var mt=ot();if(!(FORWARD_SLASH!=o.charAt(0)||ASTERISK!=o.charAt(1))){for(var ft=2;EMPTY_STRING!=o.charAt(ft)&&(ASTERISK!=o.charAt(ft)||FORWARD_SLASH!=o.charAt(ft+1));)++ft;if(ft+=2,EMPTY_STRING===o.charAt(ft-1))return st("End of comment missing");var yt=o.slice(2,ft-2);return nt+=2,rt(yt),o=o.slice(ft),nt+=2,mt({type:TYPE_COMMENT,comment:yt})}}function ht(){var mt=ot(),ft=at(PROPERTY_REGEX);if(ft){if(dt(),!at(COLON_REGEX))return st("property missing ':'");var yt=at(VALUE_REGEX),gt=mt({type:TYPE_DECLARATION,property:trim(ft[0].replace(COMMENT_REGEX,EMPTY_STRING)),value:yt?trim(yt[0].replace(COMMENT_REGEX,EMPTY_STRING)):EMPTY_STRING});return at(SEMICOLON_REGEX),gt}}function pt(){var mt=[];lt(mt);for(var ft;ft=ht();)ft!==!1&&(mt.push(ft),lt(mt));return mt}return ct(),pt()};function trim(o){return o?o.replace(TRIM_REGEX,EMPTY_STRING):EMPTY_STRING}var __importDefault=commonjsGlobal&&commonjsGlobal.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(cjs,"__esModule",{value:!0});var _default=cjs.default=StyleToObject,inline_style_parser_1=__importDefault(inlineStyleParser);function StyleToObject(o,et){var tt=null;if(!o||typeof o!="string")return tt;var nt=(0,inline_style_parser_1.default)(o),rt=typeof et=="function";return nt.forEach(function(ot){if(ot.type==="declaration"){var it=ot.property,st=ot.value;rt?et(it,st,ot):st&&(tt=tt||{},tt[it]=st)}}),tt}const styleToObject=_default.default||_default,pointEnd=point$2("end"),pointStart=point$2("start");function point$2(o){return et;function et(tt){const nt=tt&&tt.position&&tt.position[o]||{};if(typeof nt.line=="number"&&nt.line>0&&typeof nt.column=="number"&&nt.column>0)return{line:nt.line,column:nt.column,offset:typeof nt.offset=="number"&&nt.offset>-1?nt.offset:void 0}}}function position$1(o){const et=pointStart(o),tt=pointEnd(o);if(et&&tt)return{start:et,end:tt}}function stringifyPosition(o){return!o||typeof o!="object"?"":"position"in o||"type"in o?position(o.position):"start"in o||"end"in o?position(o):"line"in o||"column"in o?point$1(o):""}function point$1(o){return index(o&&o.line)+":"+index(o&&o.column)}function position(o){return point$1(o&&o.start)+"-"+point$1(o&&o.end)}function index(o){return o&&typeof o=="number"?o:1}class VFileMessage extends Error{constructor(et,tt,nt){super(),typeof tt=="string"&&(nt=tt,tt=void 0);let rt="",ot={},it=!1;if(tt&&("line"in tt&&"column"in tt?ot={place:tt}:"start"in tt&&"end"in tt?ot={place:tt}:"type"in tt?ot={ancestors:[tt],place:tt.position}:ot={...tt}),typeof et=="string"?rt=et:!ot.cause&&et&&(it=!0,rt=et.message,ot.cause=et),!ot.ruleId&&!ot.source&&typeof nt=="string"){const at=nt.indexOf(":");at===-1?ot.ruleId=nt:(ot.source=nt.slice(0,at),ot.ruleId=nt.slice(at+1))}if(!ot.place&&ot.ancestors&&ot.ancestors){const at=ot.ancestors[ot.ancestors.length-1];at&&(ot.place=at.position)}const st=ot.place&&"start"in ot.place?ot.place.start:ot.place;this.ancestors=ot.ancestors||void 0,this.cause=ot.cause||void 0,this.column=st?st.column:void 0,this.fatal=void 0,this.file,this.message=rt,this.line=st?st.line:void 0,this.name=stringifyPosition(ot.place)||"1:1",this.place=ot.place||void 0,this.reason=this.message,this.ruleId=ot.ruleId||void 0,this.source=ot.source||void 0,this.stack=it&&ot.cause&&typeof ot.cause.stack=="string"?ot.cause.stack:"",this.actual,this.expected,this.note,this.url}}VFileMessage.prototype.file="";VFileMessage.prototype.name="";VFileMessage.prototype.reason="";VFileMessage.prototype.message="";VFileMessage.prototype.stack="";VFileMessage.prototype.column=void 0;VFileMessage.prototype.line=void 0;VFileMessage.prototype.ancestors=void 0;VFileMessage.prototype.cause=void 0;VFileMessage.prototype.fatal=void 0;VFileMessage.prototype.place=void 0;VFileMessage.prototype.ruleId=void 0;VFileMessage.prototype.source=void 0;const own$3={}.hasOwnProperty,emptyMap=new Map,cap=/[A-Z]/g,dashSomething=/-([a-z])/g,tableElements=new Set(["table","tbody","thead","tfoot","tr"]),tableCellElement=new Set(["td","th"]),docs="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function toJsxRuntime(o,et){if(!et||et.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const tt=et.filePath||void 0;let nt;if(et.development){if(typeof et.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");nt=developmentCreate(tt,et.jsxDEV)}else{if(typeof et.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof et.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");nt=productionCreate(tt,et.jsx,et.jsxs)}const rt={Fragment:et.Fragment,ancestors:[],components:et.components||{},create:nt,elementAttributeNameCase:et.elementAttributeNameCase||"react",evaluater:et.createEvaluater?et.createEvaluater():void 0,filePath:tt,ignoreInvalidStyle:et.ignoreInvalidStyle||!1,passKeys:et.passKeys!==!1,passNode:et.passNode||!1,schema:et.space==="svg"?svg:html$1,stylePropertyNameCase:et.stylePropertyNameCase||"dom",tableCellAlignToStyle:et.tableCellAlignToStyle!==!1},ot=one$1(rt,o,void 0);return ot&&typeof ot!="string"?ot:rt.create(o,rt.Fragment,{children:ot||void 0},void 0)}function one$1(o,et,tt){if(et.type==="element")return element$1(o,et,tt);if(et.type==="mdxFlowExpression"||et.type==="mdxTextExpression")return mdxExpression(o,et);if(et.type==="mdxJsxFlowElement"||et.type==="mdxJsxTextElement")return mdxJsxElement(o,et,tt);if(et.type==="mdxjsEsm")return mdxEsm(o,et);if(et.type==="root")return root$1(o,et,tt);if(et.type==="text")return text$3(o,et)}function element$1(o,et,tt){const nt=o.schema;let rt=nt;et.tagName.toLowerCase()==="svg"&&nt.space==="html"&&(rt=svg,o.schema=rt),o.ancestors.push(et);const ot=findComponentFromName(o,et.tagName,!1),it=createElementProps(o,et);let st=createChildren(o,et);return tableElements.has(et.tagName)&&(st=st.filter(function(at){return typeof at=="string"?!whitespace(at):!0})),addNode(o,it,ot,et),addChildren(it,st),o.ancestors.pop(),o.schema=nt,o.create(et,ot,it,tt)}function mdxExpression(o,et){if(et.data&&et.data.estree&&o.evaluater){const nt=et.data.estree.body[0];return nt.type,o.evaluater.evaluateExpression(nt.expression)}crashEstree(o,et.position)}function mdxEsm(o,et){if(et.data&&et.data.estree&&o.evaluater)return o.evaluater.evaluateProgram(et.data.estree);crashEstree(o,et.position)}function mdxJsxElement(o,et,tt){const nt=o.schema;let rt=nt;et.name==="svg"&&nt.space==="html"&&(rt=svg,o.schema=rt),o.ancestors.push(et);const ot=et.name===null?o.Fragment:findComponentFromName(o,et.name,!0),it=createJsxElementProps(o,et),st=createChildren(o,et);return addNode(o,it,ot,et),addChildren(it,st),o.ancestors.pop(),o.schema=nt,o.create(et,ot,it,tt)}function root$1(o,et,tt){const nt={};return addChildren(nt,createChildren(o,et)),o.create(et,o.Fragment,nt,tt)}function text$3(o,et){return et.value}function addNode(o,et,tt,nt){typeof tt!="string"&&tt!==o.Fragment&&o.passNode&&(et.node=nt)}function addChildren(o,et){if(et.length>0){const tt=et.length>1?et:et[0];tt&&(o.children=tt)}}function productionCreate(o,et,tt){return nt;function nt(rt,ot,it,st){const ct=Array.isArray(it.children)?tt:et;return st?ct(ot,it,st):ct(ot,it)}}function developmentCreate(o,et){return tt;function tt(nt,rt,ot,it){const st=Array.isArray(ot.children),at=pointStart(nt);return et(rt,ot,it,st,{columnNumber:at?at.column-1:void 0,fileName:o,lineNumber:at?at.line:void 0},void 0)}}function createElementProps(o,et){const tt={};let nt,rt;for(rt in et.properties)if(rt!=="children"&&own$3.call(et.properties,rt)){const ot=createProperty(o,rt,et.properties[rt]);if(ot){const[it,st]=ot;o.tableCellAlignToStyle&&it==="align"&&typeof st=="string"&&tableCellElement.has(et.tagName)?nt=st:tt[it]=st}}if(nt){const ot=tt.style||(tt.style={});ot[o.stylePropertyNameCase==="css"?"text-align":"textAlign"]=nt}return tt}function createJsxElementProps(o,et){const tt={};for(const nt of et.attributes)if(nt.type==="mdxJsxExpressionAttribute")if(nt.data&&nt.data.estree&&o.evaluater){const ot=nt.data.estree.body[0];ot.type;const it=ot.expression;it.type;const st=it.properties[0];st.type,Object.assign(tt,o.evaluater.evaluateExpression(st.argument))}else crashEstree(o,et.position);else{const rt=nt.name;let ot;if(nt.value&&typeof nt.value=="object")if(nt.value.data&&nt.value.data.estree&&o.evaluater){const st=nt.value.data.estree.body[0];st.type,ot=o.evaluater.evaluateExpression(st.expression)}else crashEstree(o,et.position);else ot=nt.value===null?!0:nt.value;tt[rt]=ot}return tt}function createChildren(o,et){const tt=[];let nt=-1;const rt=o.passKeys?new Map:emptyMap;for(;++ntrt?0:rt+et:et=et>rt?rt:et,tt=tt>0?tt:0,nt.length<1e4)it=Array.from(nt),it.unshift(et,tt),o.splice(...it);else for(tt&&o.splice(et,tt);ot0?(splice(o,o.length,0,et),o):et}const hasOwnProperty={}.hasOwnProperty;function combineExtensions(o){const et={};let tt=-1;for(;++tt13&&tt<32||tt>126&&tt<160||tt>55295&&tt<57344||tt>64975&&tt<65008||(tt&65535)===65535||(tt&65535)===65534||tt>1114111?"�":String.fromCodePoint(tt)}function normalizeIdentifier(o){return o.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const asciiAlpha=regexCheck(/[A-Za-z]/),asciiAlphanumeric=regexCheck(/[\dA-Za-z]/),asciiAtext=regexCheck(/[#-'*+\--9=?A-Z^-~]/);function asciiControl(o){return o!==null&&(o<32||o===127)}const asciiDigit=regexCheck(/\d/),asciiHexDigit=regexCheck(/[\dA-Fa-f]/),asciiPunctuation=regexCheck(/[!-/:-@[-`{-~]/);function markdownLineEnding(o){return o!==null&&o<-2}function markdownLineEndingOrSpace(o){return o!==null&&(o<0||o===32)}function markdownSpace(o){return o===-2||o===-1||o===32}const unicodePunctuation=regexCheck(new RegExp("\\p{P}|\\p{S}","u")),unicodeWhitespace=regexCheck(/\s/);function regexCheck(o){return et;function et(tt){return tt!==null&&tt>-1&&o.test(String.fromCharCode(tt))}}function normalizeUri(o){const et=[];let tt=-1,nt=0,rt=0;for(;++tt55295&&ot<57344){const st=o.charCodeAt(tt+1);ot<56320&&st>56319&&st<57344?(it=String.fromCharCode(ot,st),rt=1):it="�"}else it=String.fromCharCode(ot);it&&(et.push(o.slice(nt,tt),encodeURIComponent(it)),nt=tt+rt+1,it=""),rt&&(tt+=rt,rt=0)}return et.join("")+o.slice(nt)}function factorySpace(o,et,tt,nt){const rt=nt?nt-1:Number.POSITIVE_INFINITY;let ot=0;return it;function it(at){return markdownSpace(at)?(o.enter(tt),st(at)):et(at)}function st(at){return markdownSpace(at)&&ot++it))return;const kt=et.events.length;let Tt=kt,Rt,Pt;for(;Tt--;)if(et.events[Tt][0]==="exit"&&et.events[Tt][1].type==="chunkFlow"){if(Rt){Pt=et.events[Tt][1].end;break}Rt=!0}for(gt(nt),wt=kt;wtvt;){const Et=tt[bt];et.containerState=Et[1],Et[0].exit.call(et,o)}tt.length=vt}function xt(){rt.write([null]),ot=void 0,rt=void 0,et.containerState._closeFlow=void 0}}function tokenizeContainer(o,et,tt){return factorySpace(o,o.attempt(this.parser.constructs.document,et,tt),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function classifyCharacter(o){if(o===null||markdownLineEndingOrSpace(o)||unicodeWhitespace(o))return 1;if(unicodePunctuation(o))return 2}function resolveAll(o,et,tt){const nt=[];let rt=-1;for(;++rt1&&o[tt][1].end.offset-o[tt][1].start.offset>1?2:1;const dt=Object.assign({},o[nt][1].end),ht=Object.assign({},o[tt][1].start);movePoint(dt,-at),movePoint(ht,at),it={type:at>1?"strongSequence":"emphasisSequence",start:dt,end:Object.assign({},o[nt][1].end)},st={type:at>1?"strongSequence":"emphasisSequence",start:Object.assign({},o[tt][1].start),end:ht},ot={type:at>1?"strongText":"emphasisText",start:Object.assign({},o[nt][1].end),end:Object.assign({},o[tt][1].start)},rt={type:at>1?"strong":"emphasis",start:Object.assign({},it.start),end:Object.assign({},st.end)},o[nt][1].end=Object.assign({},it.start),o[tt][1].start=Object.assign({},st.end),ct=[],o[nt][1].end.offset-o[nt][1].start.offset&&(ct=push(ct,[["enter",o[nt][1],et],["exit",o[nt][1],et]])),ct=push(ct,[["enter",rt,et],["enter",it,et],["exit",it,et],["enter",ot,et]]),ct=push(ct,resolveAll(et.parser.constructs.insideSpan.null,o.slice(nt+1,tt),et)),ct=push(ct,[["exit",ot,et],["enter",st,et],["exit",st,et],["exit",rt,et]]),o[tt][1].end.offset-o[tt][1].start.offset?(lt=2,ct=push(ct,[["enter",o[tt][1],et],["exit",o[tt][1],et]])):lt=0,splice(o,nt-1,tt-nt+3,ct),tt=nt+ct.length-lt-2;break}}for(tt=-1;++tt0&&markdownSpace(wt)?factorySpace(o,xt,"linePrefix",ot+1)(wt):xt(wt)}function xt(wt){return wt===null||markdownLineEnding(wt)?o.check(nonLazyContinuation,ft,bt)(wt):(o.enter("codeFlowValue"),vt(wt))}function vt(wt){return wt===null||markdownLineEnding(wt)?(o.exit("codeFlowValue"),xt(wt)):(o.consume(wt),vt)}function bt(wt){return o.exit("codeFenced"),et(wt)}function Et(wt,kt,Tt){let Rt=0;return Pt;function Pt(Ft){return wt.enter("lineEnding"),wt.consume(Ft),wt.exit("lineEnding"),$t}function $t(Ft){return wt.enter("codeFencedFence"),markdownSpace(Ft)?factorySpace(wt,Ot,"linePrefix",nt.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(Ft):Ot(Ft)}function Ot(Ft){return Ft===st?(wt.enter("codeFencedFenceSequence"),Bt(Ft)):Tt(Ft)}function Bt(Ft){return Ft===st?(Rt++,wt.consume(Ft),Bt):Rt>=it?(wt.exit("codeFencedFenceSequence"),markdownSpace(Ft)?factorySpace(wt,zt,"whitespace")(Ft):zt(Ft)):Tt(Ft)}function zt(Ft){return Ft===null||markdownLineEnding(Ft)?(wt.exit("codeFencedFence"),kt(Ft)):Tt(Ft)}}}function tokenizeNonLazyContinuation(o,et,tt){const nt=this;return rt;function rt(it){return it===null?tt(it):(o.enter("lineEnding"),o.consume(it),o.exit("lineEnding"),ot)}function ot(it){return nt.parser.lazy[nt.now().line]?tt(it):et(it)}}const codeIndented={name:"codeIndented",tokenize:tokenizeCodeIndented},furtherStart={tokenize:tokenizeFurtherStart,partial:!0};function tokenizeCodeIndented(o,et,tt){const nt=this;return rt;function rt(ct){return o.enter("codeIndented"),factorySpace(o,ot,"linePrefix",5)(ct)}function ot(ct){const lt=nt.events[nt.events.length-1];return lt&<[1].type==="linePrefix"&<[2].sliceSerialize(lt[1],!0).length>=4?it(ct):tt(ct)}function it(ct){return ct===null?at(ct):markdownLineEnding(ct)?o.attempt(furtherStart,it,at)(ct):(o.enter("codeFlowValue"),st(ct))}function st(ct){return ct===null||markdownLineEnding(ct)?(o.exit("codeFlowValue"),it(ct)):(o.consume(ct),st)}function at(ct){return o.exit("codeIndented"),et(ct)}}function tokenizeFurtherStart(o,et,tt){const nt=this;return rt;function rt(it){return nt.parser.lazy[nt.now().line]?tt(it):markdownLineEnding(it)?(o.enter("lineEnding"),o.consume(it),o.exit("lineEnding"),rt):factorySpace(o,ot,"linePrefix",5)(it)}function ot(it){const st=nt.events[nt.events.length-1];return st&&st[1].type==="linePrefix"&&st[2].sliceSerialize(st[1],!0).length>=4?et(it):markdownLineEnding(it)?rt(it):tt(it)}}const codeText={name:"codeText",tokenize:tokenizeCodeText,resolve:resolveCodeText,previous};function resolveCodeText(o){let et=o.length-4,tt=3,nt,rt;if((o[tt][1].type==="lineEnding"||o[tt][1].type==="space")&&(o[et][1].type==="lineEnding"||o[et][1].type==="space")){for(nt=tt;++nt=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+et+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return etthis.left.length?this.right.slice(this.right.length-nt+this.left.length,this.right.length-et+this.left.length).reverse():this.left.slice(et).concat(this.right.slice(this.right.length-nt+this.left.length).reverse())}splice(et,tt,nt){const rt=tt||0;this.setCursor(Math.trunc(et));const ot=this.right.splice(this.right.length-rt,Number.POSITIVE_INFINITY);return nt&&chunkedPush(this.left,nt),ot.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(et){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(et)}pushMany(et){this.setCursor(Number.POSITIVE_INFINITY),chunkedPush(this.left,et)}unshift(et){this.setCursor(0),this.right.push(et)}unshiftMany(et){this.setCursor(0),chunkedPush(this.right,et.reverse())}setCursor(et){if(!(et===this.left.length||et>this.left.length&&this.right.length===0||et<0&&this.left.length===0))if(et=4?et(it):o.interrupt(nt.parser.constructs.flow,tt,et)(it)}}function factoryDestination(o,et,tt,nt,rt,ot,it,st,at){const ct=at||Number.POSITIVE_INFINITY;let lt=0;return dt;function dt(gt){return gt===60?(o.enter(nt),o.enter(rt),o.enter(ot),o.consume(gt),o.exit(ot),ht):gt===null||gt===32||gt===41||asciiControl(gt)?tt(gt):(o.enter(nt),o.enter(it),o.enter(st),o.enter("chunkString",{contentType:"string"}),ft(gt))}function ht(gt){return gt===62?(o.enter(ot),o.consume(gt),o.exit(ot),o.exit(rt),o.exit(nt),et):(o.enter(st),o.enter("chunkString",{contentType:"string"}),pt(gt))}function pt(gt){return gt===62?(o.exit("chunkString"),o.exit(st),ht(gt)):gt===null||gt===60||markdownLineEnding(gt)?tt(gt):(o.consume(gt),gt===92?mt:pt)}function mt(gt){return gt===60||gt===62||gt===92?(o.consume(gt),pt):pt(gt)}function ft(gt){return!lt&&(gt===null||gt===41||markdownLineEndingOrSpace(gt))?(o.exit("chunkString"),o.exit(st),o.exit(it),o.exit(nt),et(gt)):lt999||pt===null||pt===91||pt===93&&!at||pt===94&&!st&&"_hiddenFootnoteSupport"in it.parser.constructs?tt(pt):pt===93?(o.exit(ot),o.enter(rt),o.consume(pt),o.exit(rt),o.exit(nt),et):markdownLineEnding(pt)?(o.enter("lineEnding"),o.consume(pt),o.exit("lineEnding"),lt):(o.enter("chunkString",{contentType:"string"}),dt(pt))}function dt(pt){return pt===null||pt===91||pt===93||markdownLineEnding(pt)||st++>999?(o.exit("chunkString"),lt(pt)):(o.consume(pt),at||(at=!markdownSpace(pt)),pt===92?ht:dt)}function ht(pt){return pt===91||pt===92||pt===93?(o.consume(pt),st++,dt):dt(pt)}}function factoryTitle(o,et,tt,nt,rt,ot){let it;return st;function st(ht){return ht===34||ht===39||ht===40?(o.enter(nt),o.enter(rt),o.consume(ht),o.exit(rt),it=ht===40?41:ht,at):tt(ht)}function at(ht){return ht===it?(o.enter(rt),o.consume(ht),o.exit(rt),o.exit(nt),et):(o.enter(ot),ct(ht))}function ct(ht){return ht===it?(o.exit(ot),at(it)):ht===null?tt(ht):markdownLineEnding(ht)?(o.enter("lineEnding"),o.consume(ht),o.exit("lineEnding"),factorySpace(o,ct,"linePrefix")):(o.enter("chunkString",{contentType:"string"}),lt(ht))}function lt(ht){return ht===it||ht===null||markdownLineEnding(ht)?(o.exit("chunkString"),ct(ht)):(o.consume(ht),ht===92?dt:lt)}function dt(ht){return ht===it||ht===92?(o.consume(ht),lt):lt(ht)}}function factoryWhitespace(o,et){let tt;return nt;function nt(rt){return markdownLineEnding(rt)?(o.enter("lineEnding"),o.consume(rt),o.exit("lineEnding"),tt=!0,nt):markdownSpace(rt)?factorySpace(o,nt,tt?"linePrefix":"lineSuffix")(rt):et(rt)}}const definition={name:"definition",tokenize:tokenizeDefinition},titleBefore={tokenize:tokenizeTitleBefore,partial:!0};function tokenizeDefinition(o,et,tt){const nt=this;let rt;return ot;function ot(pt){return o.enter("definition"),it(pt)}function it(pt){return factoryLabel.call(nt,o,st,tt,"definitionLabel","definitionLabelMarker","definitionLabelString")(pt)}function st(pt){return rt=normalizeIdentifier(nt.sliceSerialize(nt.events[nt.events.length-1][1]).slice(1,-1)),pt===58?(o.enter("definitionMarker"),o.consume(pt),o.exit("definitionMarker"),at):tt(pt)}function at(pt){return markdownLineEndingOrSpace(pt)?factoryWhitespace(o,ct)(pt):ct(pt)}function ct(pt){return factoryDestination(o,lt,tt,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(pt)}function lt(pt){return o.attempt(titleBefore,dt,dt)(pt)}function dt(pt){return markdownSpace(pt)?factorySpace(o,ht,"whitespace")(pt):ht(pt)}function ht(pt){return pt===null||markdownLineEnding(pt)?(o.exit("definition"),nt.parser.defined.push(rt),et(pt)):tt(pt)}}function tokenizeTitleBefore(o,et,tt){return nt;function nt(st){return markdownLineEndingOrSpace(st)?factoryWhitespace(o,rt)(st):tt(st)}function rt(st){return factoryTitle(o,ot,tt,"definitionTitle","definitionTitleMarker","definitionTitleString")(st)}function ot(st){return markdownSpace(st)?factorySpace(o,it,"whitespace")(st):it(st)}function it(st){return st===null||markdownLineEnding(st)?et(st):tt(st)}}const hardBreakEscape={name:"hardBreakEscape",tokenize:tokenizeHardBreakEscape};function tokenizeHardBreakEscape(o,et,tt){return nt;function nt(ot){return o.enter("hardBreakEscape"),o.consume(ot),rt}function rt(ot){return markdownLineEnding(ot)?(o.exit("hardBreakEscape"),et(ot)):tt(ot)}}const headingAtx={name:"headingAtx",tokenize:tokenizeHeadingAtx,resolve:resolveHeadingAtx};function resolveHeadingAtx(o,et){let tt=o.length-2,nt=3,rt,ot;return o[nt][1].type==="whitespace"&&(nt+=2),tt-2>nt&&o[tt][1].type==="whitespace"&&(tt-=2),o[tt][1].type==="atxHeadingSequence"&&(nt===tt-1||tt-4>nt&&o[tt-2][1].type==="whitespace")&&(tt-=nt+1===tt?2:4),tt>nt&&(rt={type:"atxHeadingText",start:o[nt][1].start,end:o[tt][1].end},ot={type:"chunkText",start:o[nt][1].start,end:o[tt][1].end,contentType:"text"},splice(o,nt,tt-nt+1,[["enter",rt,et],["enter",ot,et],["exit",ot,et],["exit",rt,et]])),o}function tokenizeHeadingAtx(o,et,tt){let nt=0;return rt;function rt(lt){return o.enter("atxHeading"),ot(lt)}function ot(lt){return o.enter("atxHeadingSequence"),it(lt)}function it(lt){return lt===35&&nt++<6?(o.consume(lt),it):lt===null||markdownLineEndingOrSpace(lt)?(o.exit("atxHeadingSequence"),st(lt)):tt(lt)}function st(lt){return lt===35?(o.enter("atxHeadingSequence"),at(lt)):lt===null||markdownLineEnding(lt)?(o.exit("atxHeading"),et(lt)):markdownSpace(lt)?factorySpace(o,st,"whitespace")(lt):(o.enter("atxHeadingText"),ct(lt))}function at(lt){return lt===35?(o.consume(lt),at):(o.exit("atxHeadingSequence"),st(lt))}function ct(lt){return lt===null||lt===35||markdownLineEndingOrSpace(lt)?(o.exit("atxHeadingText"),st(lt)):(o.consume(lt),ct)}}const htmlBlockNames=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],htmlRawNames=["pre","script","style","textarea"],htmlFlow={name:"htmlFlow",tokenize:tokenizeHtmlFlow,resolveTo:resolveToHtmlFlow,concrete:!0},blankLineBefore={tokenize:tokenizeBlankLineBefore,partial:!0},nonLazyContinuationStart={tokenize:tokenizeNonLazyContinuationStart,partial:!0};function resolveToHtmlFlow(o){let et=o.length;for(;et--&&!(o[et][0]==="enter"&&o[et][1].type==="htmlFlow"););return et>1&&o[et-2][1].type==="linePrefix"&&(o[et][1].start=o[et-2][1].start,o[et+1][1].start=o[et-2][1].start,o.splice(et-2,2)),o}function tokenizeHtmlFlow(o,et,tt){const nt=this;let rt,ot,it,st,at;return ct;function ct(Nt){return lt(Nt)}function lt(Nt){return o.enter("htmlFlow"),o.enter("htmlFlowData"),o.consume(Nt),dt}function dt(Nt){return Nt===33?(o.consume(Nt),ht):Nt===47?(o.consume(Nt),ot=!0,ft):Nt===63?(o.consume(Nt),rt=3,nt.interrupt?et:Lt):asciiAlpha(Nt)?(o.consume(Nt),it=String.fromCharCode(Nt),yt):tt(Nt)}function ht(Nt){return Nt===45?(o.consume(Nt),rt=2,pt):Nt===91?(o.consume(Nt),rt=5,st=0,mt):asciiAlpha(Nt)?(o.consume(Nt),rt=4,nt.interrupt?et:Lt):tt(Nt)}function pt(Nt){return Nt===45?(o.consume(Nt),nt.interrupt?et:Lt):tt(Nt)}function mt(Nt){const Gt="CDATA[";return Nt===Gt.charCodeAt(st++)?(o.consume(Nt),st===Gt.length?nt.interrupt?et:Ot:mt):tt(Nt)}function ft(Nt){return asciiAlpha(Nt)?(o.consume(Nt),it=String.fromCharCode(Nt),yt):tt(Nt)}function yt(Nt){if(Nt===null||Nt===47||Nt===62||markdownLineEndingOrSpace(Nt)){const Gt=Nt===47,nn=it.toLowerCase();return!Gt&&!ot&&htmlRawNames.includes(nn)?(rt=1,nt.interrupt?et(Nt):Ot(Nt)):htmlBlockNames.includes(it.toLowerCase())?(rt=6,Gt?(o.consume(Nt),gt):nt.interrupt?et(Nt):Ot(Nt)):(rt=7,nt.interrupt&&!nt.parser.lazy[nt.now().line]?tt(Nt):ot?xt(Nt):vt(Nt))}return Nt===45||asciiAlphanumeric(Nt)?(o.consume(Nt),it+=String.fromCharCode(Nt),yt):tt(Nt)}function gt(Nt){return Nt===62?(o.consume(Nt),nt.interrupt?et:Ot):tt(Nt)}function xt(Nt){return markdownSpace(Nt)?(o.consume(Nt),xt):Pt(Nt)}function vt(Nt){return Nt===47?(o.consume(Nt),Pt):Nt===58||Nt===95||asciiAlpha(Nt)?(o.consume(Nt),bt):markdownSpace(Nt)?(o.consume(Nt),vt):Pt(Nt)}function bt(Nt){return Nt===45||Nt===46||Nt===58||Nt===95||asciiAlphanumeric(Nt)?(o.consume(Nt),bt):Et(Nt)}function Et(Nt){return Nt===61?(o.consume(Nt),wt):markdownSpace(Nt)?(o.consume(Nt),Et):vt(Nt)}function wt(Nt){return Nt===null||Nt===60||Nt===61||Nt===62||Nt===96?tt(Nt):Nt===34||Nt===39?(o.consume(Nt),at=Nt,kt):markdownSpace(Nt)?(o.consume(Nt),wt):Tt(Nt)}function kt(Nt){return Nt===at?(o.consume(Nt),at=null,Rt):Nt===null||markdownLineEnding(Nt)?tt(Nt):(o.consume(Nt),kt)}function Tt(Nt){return Nt===null||Nt===34||Nt===39||Nt===47||Nt===60||Nt===61||Nt===62||Nt===96||markdownLineEndingOrSpace(Nt)?Et(Nt):(o.consume(Nt),Tt)}function Rt(Nt){return Nt===47||Nt===62||markdownSpace(Nt)?vt(Nt):tt(Nt)}function Pt(Nt){return Nt===62?(o.consume(Nt),$t):tt(Nt)}function $t(Nt){return Nt===null||markdownLineEnding(Nt)?Ot(Nt):markdownSpace(Nt)?(o.consume(Nt),$t):tt(Nt)}function Ot(Nt){return Nt===45&&rt===2?(o.consume(Nt),Yt):Nt===60&&rt===1?(o.consume(Nt),Ht):Nt===62&&rt===4?(o.consume(Nt),Zt):Nt===63&&rt===3?(o.consume(Nt),Lt):Nt===93&&rt===5?(o.consume(Nt),qt):markdownLineEnding(Nt)&&(rt===6||rt===7)?(o.exit("htmlFlowData"),o.check(blankLineBefore,Qt,Bt)(Nt)):Nt===null||markdownLineEnding(Nt)?(o.exit("htmlFlowData"),Bt(Nt)):(o.consume(Nt),Ot)}function Bt(Nt){return o.check(nonLazyContinuationStart,zt,Qt)(Nt)}function zt(Nt){return o.enter("lineEnding"),o.consume(Nt),o.exit("lineEnding"),Ft}function Ft(Nt){return Nt===null||markdownLineEnding(Nt)?Bt(Nt):(o.enter("htmlFlowData"),Ot(Nt))}function Yt(Nt){return Nt===45?(o.consume(Nt),Lt):Ot(Nt)}function Ht(Nt){return Nt===47?(o.consume(Nt),it="",Ut):Ot(Nt)}function Ut(Nt){if(Nt===62){const Gt=it.toLowerCase();return htmlRawNames.includes(Gt)?(o.consume(Nt),Zt):Ot(Nt)}return asciiAlpha(Nt)&&it.length<8?(o.consume(Nt),it+=String.fromCharCode(Nt),Ut):Ot(Nt)}function qt(Nt){return Nt===93?(o.consume(Nt),Lt):Ot(Nt)}function Lt(Nt){return Nt===62?(o.consume(Nt),Zt):Nt===45&&rt===2?(o.consume(Nt),Lt):Ot(Nt)}function Zt(Nt){return Nt===null||markdownLineEnding(Nt)?(o.exit("htmlFlowData"),Qt(Nt)):(o.consume(Nt),Zt)}function Qt(Nt){return o.exit("htmlFlow"),et(Nt)}}function tokenizeNonLazyContinuationStart(o,et,tt){const nt=this;return rt;function rt(it){return markdownLineEnding(it)?(o.enter("lineEnding"),o.consume(it),o.exit("lineEnding"),ot):tt(it)}function ot(it){return nt.parser.lazy[nt.now().line]?tt(it):et(it)}}function tokenizeBlankLineBefore(o,et,tt){return nt;function nt(rt){return o.enter("lineEnding"),o.consume(rt),o.exit("lineEnding"),o.attempt(blankLine,et,tt)}}const htmlText={name:"htmlText",tokenize:tokenizeHtmlText};function tokenizeHtmlText(o,et,tt){const nt=this;let rt,ot,it;return st;function st(Lt){return o.enter("htmlText"),o.enter("htmlTextData"),o.consume(Lt),at}function at(Lt){return Lt===33?(o.consume(Lt),ct):Lt===47?(o.consume(Lt),Et):Lt===63?(o.consume(Lt),vt):asciiAlpha(Lt)?(o.consume(Lt),Tt):tt(Lt)}function ct(Lt){return Lt===45?(o.consume(Lt),lt):Lt===91?(o.consume(Lt),ot=0,mt):asciiAlpha(Lt)?(o.consume(Lt),xt):tt(Lt)}function lt(Lt){return Lt===45?(o.consume(Lt),pt):tt(Lt)}function dt(Lt){return Lt===null?tt(Lt):Lt===45?(o.consume(Lt),ht):markdownLineEnding(Lt)?(it=dt,Ht(Lt)):(o.consume(Lt),dt)}function ht(Lt){return Lt===45?(o.consume(Lt),pt):dt(Lt)}function pt(Lt){return Lt===62?Yt(Lt):Lt===45?ht(Lt):dt(Lt)}function mt(Lt){const Zt="CDATA[";return Lt===Zt.charCodeAt(ot++)?(o.consume(Lt),ot===Zt.length?ft:mt):tt(Lt)}function ft(Lt){return Lt===null?tt(Lt):Lt===93?(o.consume(Lt),yt):markdownLineEnding(Lt)?(it=ft,Ht(Lt)):(o.consume(Lt),ft)}function yt(Lt){return Lt===93?(o.consume(Lt),gt):ft(Lt)}function gt(Lt){return Lt===62?Yt(Lt):Lt===93?(o.consume(Lt),gt):ft(Lt)}function xt(Lt){return Lt===null||Lt===62?Yt(Lt):markdownLineEnding(Lt)?(it=xt,Ht(Lt)):(o.consume(Lt),xt)}function vt(Lt){return Lt===null?tt(Lt):Lt===63?(o.consume(Lt),bt):markdownLineEnding(Lt)?(it=vt,Ht(Lt)):(o.consume(Lt),vt)}function bt(Lt){return Lt===62?Yt(Lt):vt(Lt)}function Et(Lt){return asciiAlpha(Lt)?(o.consume(Lt),wt):tt(Lt)}function wt(Lt){return Lt===45||asciiAlphanumeric(Lt)?(o.consume(Lt),wt):kt(Lt)}function kt(Lt){return markdownLineEnding(Lt)?(it=kt,Ht(Lt)):markdownSpace(Lt)?(o.consume(Lt),kt):Yt(Lt)}function Tt(Lt){return Lt===45||asciiAlphanumeric(Lt)?(o.consume(Lt),Tt):Lt===47||Lt===62||markdownLineEndingOrSpace(Lt)?Rt(Lt):tt(Lt)}function Rt(Lt){return Lt===47?(o.consume(Lt),Yt):Lt===58||Lt===95||asciiAlpha(Lt)?(o.consume(Lt),Pt):markdownLineEnding(Lt)?(it=Rt,Ht(Lt)):markdownSpace(Lt)?(o.consume(Lt),Rt):Yt(Lt)}function Pt(Lt){return Lt===45||Lt===46||Lt===58||Lt===95||asciiAlphanumeric(Lt)?(o.consume(Lt),Pt):$t(Lt)}function $t(Lt){return Lt===61?(o.consume(Lt),Ot):markdownLineEnding(Lt)?(it=$t,Ht(Lt)):markdownSpace(Lt)?(o.consume(Lt),$t):Rt(Lt)}function Ot(Lt){return Lt===null||Lt===60||Lt===61||Lt===62||Lt===96?tt(Lt):Lt===34||Lt===39?(o.consume(Lt),rt=Lt,Bt):markdownLineEnding(Lt)?(it=Ot,Ht(Lt)):markdownSpace(Lt)?(o.consume(Lt),Ot):(o.consume(Lt),zt)}function Bt(Lt){return Lt===rt?(o.consume(Lt),rt=void 0,Ft):Lt===null?tt(Lt):markdownLineEnding(Lt)?(it=Bt,Ht(Lt)):(o.consume(Lt),Bt)}function zt(Lt){return Lt===null||Lt===34||Lt===39||Lt===60||Lt===61||Lt===96?tt(Lt):Lt===47||Lt===62||markdownLineEndingOrSpace(Lt)?Rt(Lt):(o.consume(Lt),zt)}function Ft(Lt){return Lt===47||Lt===62||markdownLineEndingOrSpace(Lt)?Rt(Lt):tt(Lt)}function Yt(Lt){return Lt===62?(o.consume(Lt),o.exit("htmlTextData"),o.exit("htmlText"),et):tt(Lt)}function Ht(Lt){return o.exit("htmlTextData"),o.enter("lineEnding"),o.consume(Lt),o.exit("lineEnding"),Ut}function Ut(Lt){return markdownSpace(Lt)?factorySpace(o,qt,"linePrefix",nt.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(Lt):qt(Lt)}function qt(Lt){return o.enter("htmlTextData"),it(Lt)}}const labelEnd={name:"labelEnd",tokenize:tokenizeLabelEnd,resolveTo:resolveToLabelEnd,resolveAll:resolveAllLabelEnd},resourceConstruct={tokenize:tokenizeResource},referenceFullConstruct={tokenize:tokenizeReferenceFull},referenceCollapsedConstruct={tokenize:tokenizeReferenceCollapsed};function resolveAllLabelEnd(o){let et=-1;for(;++et=3&&(ct===null||markdownLineEnding(ct))?(o.exit("thematicBreak"),et(ct)):tt(ct)}function at(ct){return ct===rt?(o.consume(ct),nt++,at):(o.exit("thematicBreakSequence"),markdownSpace(ct)?factorySpace(o,st,"whitespace")(ct):st(ct))}}const list$1={name:"list",tokenize:tokenizeListStart,continuation:{tokenize:tokenizeListContinuation},exit:tokenizeListEnd},listItemPrefixWhitespaceConstruct={tokenize:tokenizeListItemPrefixWhitespace,partial:!0},indentConstruct={tokenize:tokenizeIndent,partial:!0};function tokenizeListStart(o,et,tt){const nt=this,rt=nt.events[nt.events.length-1];let ot=rt&&rt[1].type==="linePrefix"?rt[2].sliceSerialize(rt[1],!0).length:0,it=0;return st;function st(pt){const mt=nt.containerState.type||(pt===42||pt===43||pt===45?"listUnordered":"listOrdered");if(mt==="listUnordered"?!nt.containerState.marker||pt===nt.containerState.marker:asciiDigit(pt)){if(nt.containerState.type||(nt.containerState.type=mt,o.enter(mt,{_container:!0})),mt==="listUnordered")return o.enter("listItemPrefix"),pt===42||pt===45?o.check(thematicBreak$1,tt,ct)(pt):ct(pt);if(!nt.interrupt||pt===49)return o.enter("listItemPrefix"),o.enter("listItemValue"),at(pt)}return tt(pt)}function at(pt){return asciiDigit(pt)&&++it<10?(o.consume(pt),at):(!nt.interrupt||it<2)&&(nt.containerState.marker?pt===nt.containerState.marker:pt===41||pt===46)?(o.exit("listItemValue"),ct(pt)):tt(pt)}function ct(pt){return o.enter("listItemMarker"),o.consume(pt),o.exit("listItemMarker"),nt.containerState.marker=nt.containerState.marker||pt,o.check(blankLine,nt.interrupt?tt:lt,o.attempt(listItemPrefixWhitespaceConstruct,ht,dt))}function lt(pt){return nt.containerState.initialBlankLine=!0,ot++,ht(pt)}function dt(pt){return markdownSpace(pt)?(o.enter("listItemPrefixWhitespace"),o.consume(pt),o.exit("listItemPrefixWhitespace"),ht):tt(pt)}function ht(pt){return nt.containerState.size=ot+nt.sliceSerialize(o.exit("listItemPrefix"),!0).length,et(pt)}}function tokenizeListContinuation(o,et,tt){const nt=this;return nt.containerState._closeFlow=void 0,o.check(blankLine,rt,ot);function rt(st){return nt.containerState.furtherBlankLines=nt.containerState.furtherBlankLines||nt.containerState.initialBlankLine,factorySpace(o,et,"listItemIndent",nt.containerState.size+1)(st)}function ot(st){return nt.containerState.furtherBlankLines||!markdownSpace(st)?(nt.containerState.furtherBlankLines=void 0,nt.containerState.initialBlankLine=void 0,it(st)):(nt.containerState.furtherBlankLines=void 0,nt.containerState.initialBlankLine=void 0,o.attempt(indentConstruct,et,it)(st))}function it(st){return nt.containerState._closeFlow=!0,nt.interrupt=void 0,factorySpace(o,o.attempt(list$1,et,tt),"linePrefix",nt.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(st)}}function tokenizeIndent(o,et,tt){const nt=this;return factorySpace(o,rt,"listItemIndent",nt.containerState.size+1);function rt(ot){const it=nt.events[nt.events.length-1];return it&&it[1].type==="listItemIndent"&&it[2].sliceSerialize(it[1],!0).length===nt.containerState.size?et(ot):tt(ot)}}function tokenizeListEnd(o){o.exit(this.containerState.type)}function tokenizeListItemPrefixWhitespace(o,et,tt){const nt=this;return factorySpace(o,rt,"listItemPrefixWhitespace",nt.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function rt(ot){const it=nt.events[nt.events.length-1];return!markdownSpace(ot)&&it&&it[1].type==="listItemPrefixWhitespace"?et(ot):tt(ot)}}const setextUnderline={name:"setextUnderline",tokenize:tokenizeSetextUnderline,resolveTo:resolveToSetextUnderline};function resolveToSetextUnderline(o,et){let tt=o.length,nt,rt,ot;for(;tt--;)if(o[tt][0]==="enter"){if(o[tt][1].type==="content"){nt=tt;break}o[tt][1].type==="paragraph"&&(rt=tt)}else o[tt][1].type==="content"&&o.splice(tt,1),!ot&&o[tt][1].type==="definition"&&(ot=tt);const it={type:"setextHeading",start:Object.assign({},o[rt][1].start),end:Object.assign({},o[o.length-1][1].end)};return o[rt][1].type="setextHeadingText",ot?(o.splice(rt,0,["enter",it,et]),o.splice(ot+1,0,["exit",o[nt][1],et]),o[nt][1].end=Object.assign({},o[ot][1].end)):o[nt][1]=it,o.push(["exit",it,et]),o}function tokenizeSetextUnderline(o,et,tt){const nt=this;let rt;return ot;function ot(ct){let lt=nt.events.length,dt;for(;lt--;)if(nt.events[lt][1].type!=="lineEnding"&&nt.events[lt][1].type!=="linePrefix"&&nt.events[lt][1].type!=="content"){dt=nt.events[lt][1].type==="paragraph";break}return!nt.parser.lazy[nt.now().line]&&(nt.interrupt||dt)?(o.enter("setextHeadingLine"),rt=ct,it(ct)):tt(ct)}function it(ct){return o.enter("setextHeadingLineSequence"),st(ct)}function st(ct){return ct===rt?(o.consume(ct),st):(o.exit("setextHeadingLineSequence"),markdownSpace(ct)?factorySpace(o,at,"lineSuffix")(ct):at(ct))}function at(ct){return ct===null||markdownLineEnding(ct)?(o.exit("setextHeadingLine"),et(ct)):tt(ct)}}const flow$1={tokenize:initializeFlow};function initializeFlow(o){const et=this,tt=o.attempt(blankLine,nt,o.attempt(this.parser.constructs.flowInitial,rt,factorySpace(o,o.attempt(this.parser.constructs.flow,rt,o.attempt(content,rt)),"linePrefix")));return tt;function nt(ot){if(ot===null){o.consume(ot);return}return o.enter("lineEndingBlank"),o.consume(ot),o.exit("lineEndingBlank"),et.currentConstruct=void 0,tt}function rt(ot){if(ot===null){o.consume(ot);return}return o.enter("lineEnding"),o.consume(ot),o.exit("lineEnding"),et.currentConstruct=void 0,tt}}const resolver={resolveAll:createResolver()},string$1=initializeFactory("string"),text$2=initializeFactory("text");function initializeFactory(o){return{tokenize:et,resolveAll:createResolver(o==="text"?resolveAllLineSuffixes:void 0)};function et(tt){const nt=this,rt=this.parser.constructs[o],ot=tt.attempt(rt,it,st);return it;function it(lt){return ct(lt)?ot(lt):st(lt)}function st(lt){if(lt===null){tt.consume(lt);return}return tt.enter("data"),tt.consume(lt),at}function at(lt){return ct(lt)?(tt.exit("data"),ot(lt)):(tt.consume(lt),at)}function ct(lt){if(lt===null)return!0;const dt=rt[lt];let ht=-1;if(dt)for(;++ht-1){const st=it[0];typeof st=="string"?it[0]=st.slice(nt):it.shift()}ot>0&&it.push(o[rt].slice(0,ot))}return it}function serializeChunks(o,et){let tt=-1;const nt=[];let rt;for(;++tt0&&typeof nt.column=="number"&&nt.column>0)return{line:nt.line,column:nt.column,offset:typeof nt.offset=="number"&&nt.offset>-1?nt.offset:void 0}}}function position$1(o){const et=pointStart(o),tt=pointEnd(o);if(et&&tt)return{start:et,end:tt}}function stringifyPosition(o){return!o||typeof o!="object"?"":"position"in o||"type"in o?position(o.position):"start"in o||"end"in o?position(o):"line"in o||"column"in o?point$1(o):""}function point$1(o){return index(o&&o.line)+":"+index(o&&o.column)}function position(o){return point$1(o&&o.start)+"-"+point$1(o&&o.end)}function index(o){return o&&typeof o=="number"?o:1}class VFileMessage extends Error{constructor(et,tt,nt){super(),typeof tt=="string"&&(nt=tt,tt=void 0);let rt="",ot={},it=!1;if(tt&&("line"in tt&&"column"in tt?ot={place:tt}:"start"in tt&&"end"in tt?ot={place:tt}:"type"in tt?ot={ancestors:[tt],place:tt.position}:ot={...tt}),typeof et=="string"?rt=et:!ot.cause&&et&&(it=!0,rt=et.message,ot.cause=et),!ot.ruleId&&!ot.source&&typeof nt=="string"){const at=nt.indexOf(":");at===-1?ot.ruleId=nt:(ot.source=nt.slice(0,at),ot.ruleId=nt.slice(at+1))}if(!ot.place&&ot.ancestors&&ot.ancestors){const at=ot.ancestors[ot.ancestors.length-1];at&&(ot.place=at.position)}const st=ot.place&&"start"in ot.place?ot.place.start:ot.place;this.ancestors=ot.ancestors||void 0,this.cause=ot.cause||void 0,this.column=st?st.column:void 0,this.fatal=void 0,this.file,this.message=rt,this.line=st?st.line:void 0,this.name=stringifyPosition(ot.place)||"1:1",this.place=ot.place||void 0,this.reason=this.message,this.ruleId=ot.ruleId||void 0,this.source=ot.source||void 0,this.stack=it&&ot.cause&&typeof ot.cause.stack=="string"?ot.cause.stack:"",this.actual,this.expected,this.note,this.url}}VFileMessage.prototype.file="";VFileMessage.prototype.name="";VFileMessage.prototype.reason="";VFileMessage.prototype.message="";VFileMessage.prototype.stack="";VFileMessage.prototype.column=void 0;VFileMessage.prototype.line=void 0;VFileMessage.prototype.ancestors=void 0;VFileMessage.prototype.cause=void 0;VFileMessage.prototype.fatal=void 0;VFileMessage.prototype.place=void 0;VFileMessage.prototype.ruleId=void 0;VFileMessage.prototype.source=void 0;const own$3={}.hasOwnProperty,emptyMap=new Map,cap=/[A-Z]/g,dashSomething=/-([a-z])/g,tableElements=new Set(["table","tbody","thead","tfoot","tr"]),tableCellElement=new Set(["td","th"]),docs="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function toJsxRuntime(o,et){if(!et||et.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const tt=et.filePath||void 0;let nt;if(et.development){if(typeof et.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");nt=developmentCreate(tt,et.jsxDEV)}else{if(typeof et.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof et.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");nt=productionCreate(tt,et.jsx,et.jsxs)}const rt={Fragment:et.Fragment,ancestors:[],components:et.components||{},create:nt,elementAttributeNameCase:et.elementAttributeNameCase||"react",evaluater:et.createEvaluater?et.createEvaluater():void 0,filePath:tt,ignoreInvalidStyle:et.ignoreInvalidStyle||!1,passKeys:et.passKeys!==!1,passNode:et.passNode||!1,schema:et.space==="svg"?svg:html$1,stylePropertyNameCase:et.stylePropertyNameCase||"dom",tableCellAlignToStyle:et.tableCellAlignToStyle!==!1},ot=one$1(rt,o,void 0);return ot&&typeof ot!="string"?ot:rt.create(o,rt.Fragment,{children:ot||void 0},void 0)}function one$1(o,et,tt){if(et.type==="element")return element$1(o,et,tt);if(et.type==="mdxFlowExpression"||et.type==="mdxTextExpression")return mdxExpression(o,et);if(et.type==="mdxJsxFlowElement"||et.type==="mdxJsxTextElement")return mdxJsxElement(o,et,tt);if(et.type==="mdxjsEsm")return mdxEsm(o,et);if(et.type==="root")return root$1(o,et,tt);if(et.type==="text")return text$3(o,et)}function element$1(o,et,tt){const nt=o.schema;let rt=nt;et.tagName.toLowerCase()==="svg"&&nt.space==="html"&&(rt=svg,o.schema=rt),o.ancestors.push(et);const ot=findComponentFromName(o,et.tagName,!1),it=createElementProps(o,et);let st=createChildren(o,et);return tableElements.has(et.tagName)&&(st=st.filter(function(at){return typeof at=="string"?!whitespace(at):!0})),addNode(o,it,ot,et),addChildren(it,st),o.ancestors.pop(),o.schema=nt,o.create(et,ot,it,tt)}function mdxExpression(o,et){if(et.data&&et.data.estree&&o.evaluater){const nt=et.data.estree.body[0];return nt.type,o.evaluater.evaluateExpression(nt.expression)}crashEstree(o,et.position)}function mdxEsm(o,et){if(et.data&&et.data.estree&&o.evaluater)return o.evaluater.evaluateProgram(et.data.estree);crashEstree(o,et.position)}function mdxJsxElement(o,et,tt){const nt=o.schema;let rt=nt;et.name==="svg"&&nt.space==="html"&&(rt=svg,o.schema=rt),o.ancestors.push(et);const ot=et.name===null?o.Fragment:findComponentFromName(o,et.name,!0),it=createJsxElementProps(o,et),st=createChildren(o,et);return addNode(o,it,ot,et),addChildren(it,st),o.ancestors.pop(),o.schema=nt,o.create(et,ot,it,tt)}function root$1(o,et,tt){const nt={};return addChildren(nt,createChildren(o,et)),o.create(et,o.Fragment,nt,tt)}function text$3(o,et){return et.value}function addNode(o,et,tt,nt){typeof tt!="string"&&tt!==o.Fragment&&o.passNode&&(et.node=nt)}function addChildren(o,et){if(et.length>0){const tt=et.length>1?et:et[0];tt&&(o.children=tt)}}function productionCreate(o,et,tt){return nt;function nt(rt,ot,it,st){const ct=Array.isArray(it.children)?tt:et;return st?ct(ot,it,st):ct(ot,it)}}function developmentCreate(o,et){return tt;function tt(nt,rt,ot,it){const st=Array.isArray(ot.children),at=pointStart(nt);return et(rt,ot,it,st,{columnNumber:at?at.column-1:void 0,fileName:o,lineNumber:at?at.line:void 0},void 0)}}function createElementProps(o,et){const tt={};let nt,rt;for(rt in et.properties)if(rt!=="children"&&own$3.call(et.properties,rt)){const ot=createProperty(o,rt,et.properties[rt]);if(ot){const[it,st]=ot;o.tableCellAlignToStyle&&it==="align"&&typeof st=="string"&&tableCellElement.has(et.tagName)?nt=st:tt[it]=st}}if(nt){const ot=tt.style||(tt.style={});ot[o.stylePropertyNameCase==="css"?"text-align":"textAlign"]=nt}return tt}function createJsxElementProps(o,et){const tt={};for(const nt of et.attributes)if(nt.type==="mdxJsxExpressionAttribute")if(nt.data&&nt.data.estree&&o.evaluater){const ot=nt.data.estree.body[0];ot.type;const it=ot.expression;it.type;const st=it.properties[0];st.type,Object.assign(tt,o.evaluater.evaluateExpression(st.argument))}else crashEstree(o,et.position);else{const rt=nt.name;let ot;if(nt.value&&typeof nt.value=="object")if(nt.value.data&&nt.value.data.estree&&o.evaluater){const st=nt.value.data.estree.body[0];st.type,ot=o.evaluater.evaluateExpression(st.expression)}else crashEstree(o,et.position);else ot=nt.value===null?!0:nt.value;tt[rt]=ot}return tt}function createChildren(o,et){const tt=[];let nt=-1;const rt=o.passKeys?new Map:emptyMap;for(;++ntrt?0:rt+et:et=et>rt?rt:et,tt=tt>0?tt:0,nt.length<1e4)it=Array.from(nt),it.unshift(et,tt),o.splice(...it);else for(tt&&o.splice(et,tt);ot0?(splice(o,o.length,0,et),o):et}const hasOwnProperty={}.hasOwnProperty;function combineExtensions(o){const et={};let tt=-1;for(;++tt13&&tt<32||tt>126&&tt<160||tt>55295&&tt<57344||tt>64975&&tt<65008||(tt&65535)===65535||(tt&65535)===65534||tt>1114111?"�":String.fromCodePoint(tt)}function normalizeIdentifier(o){return o.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const asciiAlpha=regexCheck(/[A-Za-z]/),asciiAlphanumeric=regexCheck(/[\dA-Za-z]/),asciiAtext=regexCheck(/[#-'*+\--9=?A-Z^-~]/);function asciiControl(o){return o!==null&&(o<32||o===127)}const asciiDigit=regexCheck(/\d/),asciiHexDigit=regexCheck(/[\dA-Fa-f]/),asciiPunctuation=regexCheck(/[!-/:-@[-`{-~]/);function markdownLineEnding(o){return o!==null&&o<-2}function markdownLineEndingOrSpace(o){return o!==null&&(o<0||o===32)}function markdownSpace(o){return o===-2||o===-1||o===32}const unicodePunctuation=regexCheck(new RegExp("\\p{P}|\\p{S}","u")),unicodeWhitespace=regexCheck(/\s/);function regexCheck(o){return et;function et(tt){return tt!==null&&tt>-1&&o.test(String.fromCharCode(tt))}}function normalizeUri(o){const et=[];let tt=-1,nt=0,rt=0;for(;++tt55295&&ot<57344){const st=o.charCodeAt(tt+1);ot<56320&&st>56319&&st<57344?(it=String.fromCharCode(ot,st),rt=1):it="�"}else it=String.fromCharCode(ot);it&&(et.push(o.slice(nt,tt),encodeURIComponent(it)),nt=tt+rt+1,it=""),rt&&(tt+=rt,rt=0)}return et.join("")+o.slice(nt)}function factorySpace(o,et,tt,nt){const rt=nt?nt-1:Number.POSITIVE_INFINITY;let ot=0;return it;function it(at){return markdownSpace(at)?(o.enter(tt),st(at)):et(at)}function st(at){return markdownSpace(at)&&ot++it))return;const kt=et.events.length;let It=kt,Rt,Pt;for(;It--;)if(et.events[It][0]==="exit"&&et.events[It][1].type==="chunkFlow"){if(Rt){Pt=et.events[It][1].end;break}Rt=!0}for(gt(nt),wt=kt;wtvt;){const Et=tt[bt];et.containerState=Et[1],Et[0].exit.call(et,o)}tt.length=vt}function xt(){rt.write([null]),ot=void 0,rt=void 0,et.containerState._closeFlow=void 0}}function tokenizeContainer(o,et,tt){return factorySpace(o,o.attempt(this.parser.constructs.document,et,tt),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function classifyCharacter(o){if(o===null||markdownLineEndingOrSpace(o)||unicodeWhitespace(o))return 1;if(unicodePunctuation(o))return 2}function resolveAll(o,et,tt){const nt=[];let rt=-1;for(;++rt1&&o[tt][1].end.offset-o[tt][1].start.offset>1?2:1;const dt=Object.assign({},o[nt][1].end),ht=Object.assign({},o[tt][1].start);movePoint(dt,-at),movePoint(ht,at),it={type:at>1?"strongSequence":"emphasisSequence",start:dt,end:Object.assign({},o[nt][1].end)},st={type:at>1?"strongSequence":"emphasisSequence",start:Object.assign({},o[tt][1].start),end:ht},ot={type:at>1?"strongText":"emphasisText",start:Object.assign({},o[nt][1].end),end:Object.assign({},o[tt][1].start)},rt={type:at>1?"strong":"emphasis",start:Object.assign({},it.start),end:Object.assign({},st.end)},o[nt][1].end=Object.assign({},it.start),o[tt][1].start=Object.assign({},st.end),ct=[],o[nt][1].end.offset-o[nt][1].start.offset&&(ct=push(ct,[["enter",o[nt][1],et],["exit",o[nt][1],et]])),ct=push(ct,[["enter",rt,et],["enter",it,et],["exit",it,et],["enter",ot,et]]),ct=push(ct,resolveAll(et.parser.constructs.insideSpan.null,o.slice(nt+1,tt),et)),ct=push(ct,[["exit",ot,et],["enter",st,et],["exit",st,et],["exit",rt,et]]),o[tt][1].end.offset-o[tt][1].start.offset?(lt=2,ct=push(ct,[["enter",o[tt][1],et],["exit",o[tt][1],et]])):lt=0,splice(o,nt-1,tt-nt+3,ct),tt=nt+ct.length-lt-2;break}}for(tt=-1;++tt0&&markdownSpace(wt)?factorySpace(o,xt,"linePrefix",ot+1)(wt):xt(wt)}function xt(wt){return wt===null||markdownLineEnding(wt)?o.check(nonLazyContinuation,ft,bt)(wt):(o.enter("codeFlowValue"),vt(wt))}function vt(wt){return wt===null||markdownLineEnding(wt)?(o.exit("codeFlowValue"),xt(wt)):(o.consume(wt),vt)}function bt(wt){return o.exit("codeFenced"),et(wt)}function Et(wt,kt,It){let Rt=0;return Pt;function Pt(Ft){return wt.enter("lineEnding"),wt.consume(Ft),wt.exit("lineEnding"),jt}function jt(Ft){return wt.enter("codeFencedFence"),markdownSpace(Ft)?factorySpace(wt,Ot,"linePrefix",nt.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(Ft):Ot(Ft)}function Ot(Ft){return Ft===st?(wt.enter("codeFencedFenceSequence"),Bt(Ft)):It(Ft)}function Bt(Ft){return Ft===st?(Rt++,wt.consume(Ft),Bt):Rt>=it?(wt.exit("codeFencedFenceSequence"),markdownSpace(Ft)?factorySpace(wt,zt,"whitespace")(Ft):zt(Ft)):It(Ft)}function zt(Ft){return Ft===null||markdownLineEnding(Ft)?(wt.exit("codeFencedFence"),kt(Ft)):It(Ft)}}}function tokenizeNonLazyContinuation(o,et,tt){const nt=this;return rt;function rt(it){return it===null?tt(it):(o.enter("lineEnding"),o.consume(it),o.exit("lineEnding"),ot)}function ot(it){return nt.parser.lazy[nt.now().line]?tt(it):et(it)}}const codeIndented={name:"codeIndented",tokenize:tokenizeCodeIndented},furtherStart={tokenize:tokenizeFurtherStart,partial:!0};function tokenizeCodeIndented(o,et,tt){const nt=this;return rt;function rt(ct){return o.enter("codeIndented"),factorySpace(o,ot,"linePrefix",5)(ct)}function ot(ct){const lt=nt.events[nt.events.length-1];return lt&<[1].type==="linePrefix"&<[2].sliceSerialize(lt[1],!0).length>=4?it(ct):tt(ct)}function it(ct){return ct===null?at(ct):markdownLineEnding(ct)?o.attempt(furtherStart,it,at)(ct):(o.enter("codeFlowValue"),st(ct))}function st(ct){return ct===null||markdownLineEnding(ct)?(o.exit("codeFlowValue"),it(ct)):(o.consume(ct),st)}function at(ct){return o.exit("codeIndented"),et(ct)}}function tokenizeFurtherStart(o,et,tt){const nt=this;return rt;function rt(it){return nt.parser.lazy[nt.now().line]?tt(it):markdownLineEnding(it)?(o.enter("lineEnding"),o.consume(it),o.exit("lineEnding"),rt):factorySpace(o,ot,"linePrefix",5)(it)}function ot(it){const st=nt.events[nt.events.length-1];return st&&st[1].type==="linePrefix"&&st[2].sliceSerialize(st[1],!0).length>=4?et(it):markdownLineEnding(it)?rt(it):tt(it)}}const codeText={name:"codeText",tokenize:tokenizeCodeText,resolve:resolveCodeText,previous};function resolveCodeText(o){let et=o.length-4,tt=3,nt,rt;if((o[tt][1].type==="lineEnding"||o[tt][1].type==="space")&&(o[et][1].type==="lineEnding"||o[et][1].type==="space")){for(nt=tt;++nt=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+et+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return etthis.left.length?this.right.slice(this.right.length-nt+this.left.length,this.right.length-et+this.left.length).reverse():this.left.slice(et).concat(this.right.slice(this.right.length-nt+this.left.length).reverse())}splice(et,tt,nt){const rt=tt||0;this.setCursor(Math.trunc(et));const ot=this.right.splice(this.right.length-rt,Number.POSITIVE_INFINITY);return nt&&chunkedPush(this.left,nt),ot.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(et){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(et)}pushMany(et){this.setCursor(Number.POSITIVE_INFINITY),chunkedPush(this.left,et)}unshift(et){this.setCursor(0),this.right.push(et)}unshiftMany(et){this.setCursor(0),chunkedPush(this.right,et.reverse())}setCursor(et){if(!(et===this.left.length||et>this.left.length&&this.right.length===0||et<0&&this.left.length===0))if(et=4?et(it):o.interrupt(nt.parser.constructs.flow,tt,et)(it)}}function factoryDestination(o,et,tt,nt,rt,ot,it,st,at){const ct=at||Number.POSITIVE_INFINITY;let lt=0;return dt;function dt(gt){return gt===60?(o.enter(nt),o.enter(rt),o.enter(ot),o.consume(gt),o.exit(ot),ht):gt===null||gt===32||gt===41||asciiControl(gt)?tt(gt):(o.enter(nt),o.enter(it),o.enter(st),o.enter("chunkString",{contentType:"string"}),ft(gt))}function ht(gt){return gt===62?(o.enter(ot),o.consume(gt),o.exit(ot),o.exit(rt),o.exit(nt),et):(o.enter(st),o.enter("chunkString",{contentType:"string"}),pt(gt))}function pt(gt){return gt===62?(o.exit("chunkString"),o.exit(st),ht(gt)):gt===null||gt===60||markdownLineEnding(gt)?tt(gt):(o.consume(gt),gt===92?mt:pt)}function mt(gt){return gt===60||gt===62||gt===92?(o.consume(gt),pt):pt(gt)}function ft(gt){return!lt&&(gt===null||gt===41||markdownLineEndingOrSpace(gt))?(o.exit("chunkString"),o.exit(st),o.exit(it),o.exit(nt),et(gt)):lt999||pt===null||pt===91||pt===93&&!at||pt===94&&!st&&"_hiddenFootnoteSupport"in it.parser.constructs?tt(pt):pt===93?(o.exit(ot),o.enter(rt),o.consume(pt),o.exit(rt),o.exit(nt),et):markdownLineEnding(pt)?(o.enter("lineEnding"),o.consume(pt),o.exit("lineEnding"),lt):(o.enter("chunkString",{contentType:"string"}),dt(pt))}function dt(pt){return pt===null||pt===91||pt===93||markdownLineEnding(pt)||st++>999?(o.exit("chunkString"),lt(pt)):(o.consume(pt),at||(at=!markdownSpace(pt)),pt===92?ht:dt)}function ht(pt){return pt===91||pt===92||pt===93?(o.consume(pt),st++,dt):dt(pt)}}function factoryTitle(o,et,tt,nt,rt,ot){let it;return st;function st(ht){return ht===34||ht===39||ht===40?(o.enter(nt),o.enter(rt),o.consume(ht),o.exit(rt),it=ht===40?41:ht,at):tt(ht)}function at(ht){return ht===it?(o.enter(rt),o.consume(ht),o.exit(rt),o.exit(nt),et):(o.enter(ot),ct(ht))}function ct(ht){return ht===it?(o.exit(ot),at(it)):ht===null?tt(ht):markdownLineEnding(ht)?(o.enter("lineEnding"),o.consume(ht),o.exit("lineEnding"),factorySpace(o,ct,"linePrefix")):(o.enter("chunkString",{contentType:"string"}),lt(ht))}function lt(ht){return ht===it||ht===null||markdownLineEnding(ht)?(o.exit("chunkString"),ct(ht)):(o.consume(ht),ht===92?dt:lt)}function dt(ht){return ht===it||ht===92?(o.consume(ht),lt):lt(ht)}}function factoryWhitespace(o,et){let tt;return nt;function nt(rt){return markdownLineEnding(rt)?(o.enter("lineEnding"),o.consume(rt),o.exit("lineEnding"),tt=!0,nt):markdownSpace(rt)?factorySpace(o,nt,tt?"linePrefix":"lineSuffix")(rt):et(rt)}}const definition={name:"definition",tokenize:tokenizeDefinition},titleBefore={tokenize:tokenizeTitleBefore,partial:!0};function tokenizeDefinition(o,et,tt){const nt=this;let rt;return ot;function ot(pt){return o.enter("definition"),it(pt)}function it(pt){return factoryLabel.call(nt,o,st,tt,"definitionLabel","definitionLabelMarker","definitionLabelString")(pt)}function st(pt){return rt=normalizeIdentifier(nt.sliceSerialize(nt.events[nt.events.length-1][1]).slice(1,-1)),pt===58?(o.enter("definitionMarker"),o.consume(pt),o.exit("definitionMarker"),at):tt(pt)}function at(pt){return markdownLineEndingOrSpace(pt)?factoryWhitespace(o,ct)(pt):ct(pt)}function ct(pt){return factoryDestination(o,lt,tt,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(pt)}function lt(pt){return o.attempt(titleBefore,dt,dt)(pt)}function dt(pt){return markdownSpace(pt)?factorySpace(o,ht,"whitespace")(pt):ht(pt)}function ht(pt){return pt===null||markdownLineEnding(pt)?(o.exit("definition"),nt.parser.defined.push(rt),et(pt)):tt(pt)}}function tokenizeTitleBefore(o,et,tt){return nt;function nt(st){return markdownLineEndingOrSpace(st)?factoryWhitespace(o,rt)(st):tt(st)}function rt(st){return factoryTitle(o,ot,tt,"definitionTitle","definitionTitleMarker","definitionTitleString")(st)}function ot(st){return markdownSpace(st)?factorySpace(o,it,"whitespace")(st):it(st)}function it(st){return st===null||markdownLineEnding(st)?et(st):tt(st)}}const hardBreakEscape={name:"hardBreakEscape",tokenize:tokenizeHardBreakEscape};function tokenizeHardBreakEscape(o,et,tt){return nt;function nt(ot){return o.enter("hardBreakEscape"),o.consume(ot),rt}function rt(ot){return markdownLineEnding(ot)?(o.exit("hardBreakEscape"),et(ot)):tt(ot)}}const headingAtx={name:"headingAtx",tokenize:tokenizeHeadingAtx,resolve:resolveHeadingAtx};function resolveHeadingAtx(o,et){let tt=o.length-2,nt=3,rt,ot;return o[nt][1].type==="whitespace"&&(nt+=2),tt-2>nt&&o[tt][1].type==="whitespace"&&(tt-=2),o[tt][1].type==="atxHeadingSequence"&&(nt===tt-1||tt-4>nt&&o[tt-2][1].type==="whitespace")&&(tt-=nt+1===tt?2:4),tt>nt&&(rt={type:"atxHeadingText",start:o[nt][1].start,end:o[tt][1].end},ot={type:"chunkText",start:o[nt][1].start,end:o[tt][1].end,contentType:"text"},splice(o,nt,tt-nt+1,[["enter",rt,et],["enter",ot,et],["exit",ot,et],["exit",rt,et]])),o}function tokenizeHeadingAtx(o,et,tt){let nt=0;return rt;function rt(lt){return o.enter("atxHeading"),ot(lt)}function ot(lt){return o.enter("atxHeadingSequence"),it(lt)}function it(lt){return lt===35&&nt++<6?(o.consume(lt),it):lt===null||markdownLineEndingOrSpace(lt)?(o.exit("atxHeadingSequence"),st(lt)):tt(lt)}function st(lt){return lt===35?(o.enter("atxHeadingSequence"),at(lt)):lt===null||markdownLineEnding(lt)?(o.exit("atxHeading"),et(lt)):markdownSpace(lt)?factorySpace(o,st,"whitespace")(lt):(o.enter("atxHeadingText"),ct(lt))}function at(lt){return lt===35?(o.consume(lt),at):(o.exit("atxHeadingSequence"),st(lt))}function ct(lt){return lt===null||lt===35||markdownLineEndingOrSpace(lt)?(o.exit("atxHeadingText"),st(lt)):(o.consume(lt),ct)}}const htmlBlockNames=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],htmlRawNames=["pre","script","style","textarea"],htmlFlow={name:"htmlFlow",tokenize:tokenizeHtmlFlow,resolveTo:resolveToHtmlFlow,concrete:!0},blankLineBefore={tokenize:tokenizeBlankLineBefore,partial:!0},nonLazyContinuationStart={tokenize:tokenizeNonLazyContinuationStart,partial:!0};function resolveToHtmlFlow(o){let et=o.length;for(;et--&&!(o[et][0]==="enter"&&o[et][1].type==="htmlFlow"););return et>1&&o[et-2][1].type==="linePrefix"&&(o[et][1].start=o[et-2][1].start,o[et+1][1].start=o[et-2][1].start,o.splice(et-2,2)),o}function tokenizeHtmlFlow(o,et,tt){const nt=this;let rt,ot,it,st,at;return ct;function ct(Nt){return lt(Nt)}function lt(Nt){return o.enter("htmlFlow"),o.enter("htmlFlowData"),o.consume(Nt),dt}function dt(Nt){return Nt===33?(o.consume(Nt),ht):Nt===47?(o.consume(Nt),ot=!0,ft):Nt===63?(o.consume(Nt),rt=3,nt.interrupt?et:Lt):asciiAlpha(Nt)?(o.consume(Nt),it=String.fromCharCode(Nt),yt):tt(Nt)}function ht(Nt){return Nt===45?(o.consume(Nt),rt=2,pt):Nt===91?(o.consume(Nt),rt=5,st=0,mt):asciiAlpha(Nt)?(o.consume(Nt),rt=4,nt.interrupt?et:Lt):tt(Nt)}function pt(Nt){return Nt===45?(o.consume(Nt),nt.interrupt?et:Lt):tt(Nt)}function mt(Nt){const Gt="CDATA[";return Nt===Gt.charCodeAt(st++)?(o.consume(Nt),st===Gt.length?nt.interrupt?et:Ot:mt):tt(Nt)}function ft(Nt){return asciiAlpha(Nt)?(o.consume(Nt),it=String.fromCharCode(Nt),yt):tt(Nt)}function yt(Nt){if(Nt===null||Nt===47||Nt===62||markdownLineEndingOrSpace(Nt)){const Gt=Nt===47,nn=it.toLowerCase();return!Gt&&!ot&&htmlRawNames.includes(nn)?(rt=1,nt.interrupt?et(Nt):Ot(Nt)):htmlBlockNames.includes(it.toLowerCase())?(rt=6,Gt?(o.consume(Nt),gt):nt.interrupt?et(Nt):Ot(Nt)):(rt=7,nt.interrupt&&!nt.parser.lazy[nt.now().line]?tt(Nt):ot?xt(Nt):vt(Nt))}return Nt===45||asciiAlphanumeric(Nt)?(o.consume(Nt),it+=String.fromCharCode(Nt),yt):tt(Nt)}function gt(Nt){return Nt===62?(o.consume(Nt),nt.interrupt?et:Ot):tt(Nt)}function xt(Nt){return markdownSpace(Nt)?(o.consume(Nt),xt):Pt(Nt)}function vt(Nt){return Nt===47?(o.consume(Nt),Pt):Nt===58||Nt===95||asciiAlpha(Nt)?(o.consume(Nt),bt):markdownSpace(Nt)?(o.consume(Nt),vt):Pt(Nt)}function bt(Nt){return Nt===45||Nt===46||Nt===58||Nt===95||asciiAlphanumeric(Nt)?(o.consume(Nt),bt):Et(Nt)}function Et(Nt){return Nt===61?(o.consume(Nt),wt):markdownSpace(Nt)?(o.consume(Nt),Et):vt(Nt)}function wt(Nt){return Nt===null||Nt===60||Nt===61||Nt===62||Nt===96?tt(Nt):Nt===34||Nt===39?(o.consume(Nt),at=Nt,kt):markdownSpace(Nt)?(o.consume(Nt),wt):It(Nt)}function kt(Nt){return Nt===at?(o.consume(Nt),at=null,Rt):Nt===null||markdownLineEnding(Nt)?tt(Nt):(o.consume(Nt),kt)}function It(Nt){return Nt===null||Nt===34||Nt===39||Nt===47||Nt===60||Nt===61||Nt===62||Nt===96||markdownLineEndingOrSpace(Nt)?Et(Nt):(o.consume(Nt),It)}function Rt(Nt){return Nt===47||Nt===62||markdownSpace(Nt)?vt(Nt):tt(Nt)}function Pt(Nt){return Nt===62?(o.consume(Nt),jt):tt(Nt)}function jt(Nt){return Nt===null||markdownLineEnding(Nt)?Ot(Nt):markdownSpace(Nt)?(o.consume(Nt),jt):tt(Nt)}function Ot(Nt){return Nt===45&&rt===2?(o.consume(Nt),Yt):Nt===60&&rt===1?(o.consume(Nt),Ht):Nt===62&&rt===4?(o.consume(Nt),Zt):Nt===63&&rt===3?(o.consume(Nt),Lt):Nt===93&&rt===5?(o.consume(Nt),qt):markdownLineEnding(Nt)&&(rt===6||rt===7)?(o.exit("htmlFlowData"),o.check(blankLineBefore,Qt,Bt)(Nt)):Nt===null||markdownLineEnding(Nt)?(o.exit("htmlFlowData"),Bt(Nt)):(o.consume(Nt),Ot)}function Bt(Nt){return o.check(nonLazyContinuationStart,zt,Qt)(Nt)}function zt(Nt){return o.enter("lineEnding"),o.consume(Nt),o.exit("lineEnding"),Ft}function Ft(Nt){return Nt===null||markdownLineEnding(Nt)?Bt(Nt):(o.enter("htmlFlowData"),Ot(Nt))}function Yt(Nt){return Nt===45?(o.consume(Nt),Lt):Ot(Nt)}function Ht(Nt){return Nt===47?(o.consume(Nt),it="",Ut):Ot(Nt)}function Ut(Nt){if(Nt===62){const Gt=it.toLowerCase();return htmlRawNames.includes(Gt)?(o.consume(Nt),Zt):Ot(Nt)}return asciiAlpha(Nt)&&it.length<8?(o.consume(Nt),it+=String.fromCharCode(Nt),Ut):Ot(Nt)}function qt(Nt){return Nt===93?(o.consume(Nt),Lt):Ot(Nt)}function Lt(Nt){return Nt===62?(o.consume(Nt),Zt):Nt===45&&rt===2?(o.consume(Nt),Lt):Ot(Nt)}function Zt(Nt){return Nt===null||markdownLineEnding(Nt)?(o.exit("htmlFlowData"),Qt(Nt)):(o.consume(Nt),Zt)}function Qt(Nt){return o.exit("htmlFlow"),et(Nt)}}function tokenizeNonLazyContinuationStart(o,et,tt){const nt=this;return rt;function rt(it){return markdownLineEnding(it)?(o.enter("lineEnding"),o.consume(it),o.exit("lineEnding"),ot):tt(it)}function ot(it){return nt.parser.lazy[nt.now().line]?tt(it):et(it)}}function tokenizeBlankLineBefore(o,et,tt){return nt;function nt(rt){return o.enter("lineEnding"),o.consume(rt),o.exit("lineEnding"),o.attempt(blankLine,et,tt)}}const htmlText={name:"htmlText",tokenize:tokenizeHtmlText};function tokenizeHtmlText(o,et,tt){const nt=this;let rt,ot,it;return st;function st(Lt){return o.enter("htmlText"),o.enter("htmlTextData"),o.consume(Lt),at}function at(Lt){return Lt===33?(o.consume(Lt),ct):Lt===47?(o.consume(Lt),Et):Lt===63?(o.consume(Lt),vt):asciiAlpha(Lt)?(o.consume(Lt),It):tt(Lt)}function ct(Lt){return Lt===45?(o.consume(Lt),lt):Lt===91?(o.consume(Lt),ot=0,mt):asciiAlpha(Lt)?(o.consume(Lt),xt):tt(Lt)}function lt(Lt){return Lt===45?(o.consume(Lt),pt):tt(Lt)}function dt(Lt){return Lt===null?tt(Lt):Lt===45?(o.consume(Lt),ht):markdownLineEnding(Lt)?(it=dt,Ht(Lt)):(o.consume(Lt),dt)}function ht(Lt){return Lt===45?(o.consume(Lt),pt):dt(Lt)}function pt(Lt){return Lt===62?Yt(Lt):Lt===45?ht(Lt):dt(Lt)}function mt(Lt){const Zt="CDATA[";return Lt===Zt.charCodeAt(ot++)?(o.consume(Lt),ot===Zt.length?ft:mt):tt(Lt)}function ft(Lt){return Lt===null?tt(Lt):Lt===93?(o.consume(Lt),yt):markdownLineEnding(Lt)?(it=ft,Ht(Lt)):(o.consume(Lt),ft)}function yt(Lt){return Lt===93?(o.consume(Lt),gt):ft(Lt)}function gt(Lt){return Lt===62?Yt(Lt):Lt===93?(o.consume(Lt),gt):ft(Lt)}function xt(Lt){return Lt===null||Lt===62?Yt(Lt):markdownLineEnding(Lt)?(it=xt,Ht(Lt)):(o.consume(Lt),xt)}function vt(Lt){return Lt===null?tt(Lt):Lt===63?(o.consume(Lt),bt):markdownLineEnding(Lt)?(it=vt,Ht(Lt)):(o.consume(Lt),vt)}function bt(Lt){return Lt===62?Yt(Lt):vt(Lt)}function Et(Lt){return asciiAlpha(Lt)?(o.consume(Lt),wt):tt(Lt)}function wt(Lt){return Lt===45||asciiAlphanumeric(Lt)?(o.consume(Lt),wt):kt(Lt)}function kt(Lt){return markdownLineEnding(Lt)?(it=kt,Ht(Lt)):markdownSpace(Lt)?(o.consume(Lt),kt):Yt(Lt)}function It(Lt){return Lt===45||asciiAlphanumeric(Lt)?(o.consume(Lt),It):Lt===47||Lt===62||markdownLineEndingOrSpace(Lt)?Rt(Lt):tt(Lt)}function Rt(Lt){return Lt===47?(o.consume(Lt),Yt):Lt===58||Lt===95||asciiAlpha(Lt)?(o.consume(Lt),Pt):markdownLineEnding(Lt)?(it=Rt,Ht(Lt)):markdownSpace(Lt)?(o.consume(Lt),Rt):Yt(Lt)}function Pt(Lt){return Lt===45||Lt===46||Lt===58||Lt===95||asciiAlphanumeric(Lt)?(o.consume(Lt),Pt):jt(Lt)}function jt(Lt){return Lt===61?(o.consume(Lt),Ot):markdownLineEnding(Lt)?(it=jt,Ht(Lt)):markdownSpace(Lt)?(o.consume(Lt),jt):Rt(Lt)}function Ot(Lt){return Lt===null||Lt===60||Lt===61||Lt===62||Lt===96?tt(Lt):Lt===34||Lt===39?(o.consume(Lt),rt=Lt,Bt):markdownLineEnding(Lt)?(it=Ot,Ht(Lt)):markdownSpace(Lt)?(o.consume(Lt),Ot):(o.consume(Lt),zt)}function Bt(Lt){return Lt===rt?(o.consume(Lt),rt=void 0,Ft):Lt===null?tt(Lt):markdownLineEnding(Lt)?(it=Bt,Ht(Lt)):(o.consume(Lt),Bt)}function zt(Lt){return Lt===null||Lt===34||Lt===39||Lt===60||Lt===61||Lt===96?tt(Lt):Lt===47||Lt===62||markdownLineEndingOrSpace(Lt)?Rt(Lt):(o.consume(Lt),zt)}function Ft(Lt){return Lt===47||Lt===62||markdownLineEndingOrSpace(Lt)?Rt(Lt):tt(Lt)}function Yt(Lt){return Lt===62?(o.consume(Lt),o.exit("htmlTextData"),o.exit("htmlText"),et):tt(Lt)}function Ht(Lt){return o.exit("htmlTextData"),o.enter("lineEnding"),o.consume(Lt),o.exit("lineEnding"),Ut}function Ut(Lt){return markdownSpace(Lt)?factorySpace(o,qt,"linePrefix",nt.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(Lt):qt(Lt)}function qt(Lt){return o.enter("htmlTextData"),it(Lt)}}const labelEnd={name:"labelEnd",tokenize:tokenizeLabelEnd,resolveTo:resolveToLabelEnd,resolveAll:resolveAllLabelEnd},resourceConstruct={tokenize:tokenizeResource},referenceFullConstruct={tokenize:tokenizeReferenceFull},referenceCollapsedConstruct={tokenize:tokenizeReferenceCollapsed};function resolveAllLabelEnd(o){let et=-1;for(;++et=3&&(ct===null||markdownLineEnding(ct))?(o.exit("thematicBreak"),et(ct)):tt(ct)}function at(ct){return ct===rt?(o.consume(ct),nt++,at):(o.exit("thematicBreakSequence"),markdownSpace(ct)?factorySpace(o,st,"whitespace")(ct):st(ct))}}const list$1={name:"list",tokenize:tokenizeListStart,continuation:{tokenize:tokenizeListContinuation},exit:tokenizeListEnd},listItemPrefixWhitespaceConstruct={tokenize:tokenizeListItemPrefixWhitespace,partial:!0},indentConstruct={tokenize:tokenizeIndent,partial:!0};function tokenizeListStart(o,et,tt){const nt=this,rt=nt.events[nt.events.length-1];let ot=rt&&rt[1].type==="linePrefix"?rt[2].sliceSerialize(rt[1],!0).length:0,it=0;return st;function st(pt){const mt=nt.containerState.type||(pt===42||pt===43||pt===45?"listUnordered":"listOrdered");if(mt==="listUnordered"?!nt.containerState.marker||pt===nt.containerState.marker:asciiDigit(pt)){if(nt.containerState.type||(nt.containerState.type=mt,o.enter(mt,{_container:!0})),mt==="listUnordered")return o.enter("listItemPrefix"),pt===42||pt===45?o.check(thematicBreak$1,tt,ct)(pt):ct(pt);if(!nt.interrupt||pt===49)return o.enter("listItemPrefix"),o.enter("listItemValue"),at(pt)}return tt(pt)}function at(pt){return asciiDigit(pt)&&++it<10?(o.consume(pt),at):(!nt.interrupt||it<2)&&(nt.containerState.marker?pt===nt.containerState.marker:pt===41||pt===46)?(o.exit("listItemValue"),ct(pt)):tt(pt)}function ct(pt){return o.enter("listItemMarker"),o.consume(pt),o.exit("listItemMarker"),nt.containerState.marker=nt.containerState.marker||pt,o.check(blankLine,nt.interrupt?tt:lt,o.attempt(listItemPrefixWhitespaceConstruct,ht,dt))}function lt(pt){return nt.containerState.initialBlankLine=!0,ot++,ht(pt)}function dt(pt){return markdownSpace(pt)?(o.enter("listItemPrefixWhitespace"),o.consume(pt),o.exit("listItemPrefixWhitespace"),ht):tt(pt)}function ht(pt){return nt.containerState.size=ot+nt.sliceSerialize(o.exit("listItemPrefix"),!0).length,et(pt)}}function tokenizeListContinuation(o,et,tt){const nt=this;return nt.containerState._closeFlow=void 0,o.check(blankLine,rt,ot);function rt(st){return nt.containerState.furtherBlankLines=nt.containerState.furtherBlankLines||nt.containerState.initialBlankLine,factorySpace(o,et,"listItemIndent",nt.containerState.size+1)(st)}function ot(st){return nt.containerState.furtherBlankLines||!markdownSpace(st)?(nt.containerState.furtherBlankLines=void 0,nt.containerState.initialBlankLine=void 0,it(st)):(nt.containerState.furtherBlankLines=void 0,nt.containerState.initialBlankLine=void 0,o.attempt(indentConstruct,et,it)(st))}function it(st){return nt.containerState._closeFlow=!0,nt.interrupt=void 0,factorySpace(o,o.attempt(list$1,et,tt),"linePrefix",nt.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(st)}}function tokenizeIndent(o,et,tt){const nt=this;return factorySpace(o,rt,"listItemIndent",nt.containerState.size+1);function rt(ot){const it=nt.events[nt.events.length-1];return it&&it[1].type==="listItemIndent"&&it[2].sliceSerialize(it[1],!0).length===nt.containerState.size?et(ot):tt(ot)}}function tokenizeListEnd(o){o.exit(this.containerState.type)}function tokenizeListItemPrefixWhitespace(o,et,tt){const nt=this;return factorySpace(o,rt,"listItemPrefixWhitespace",nt.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function rt(ot){const it=nt.events[nt.events.length-1];return!markdownSpace(ot)&&it&&it[1].type==="listItemPrefixWhitespace"?et(ot):tt(ot)}}const setextUnderline={name:"setextUnderline",tokenize:tokenizeSetextUnderline,resolveTo:resolveToSetextUnderline};function resolveToSetextUnderline(o,et){let tt=o.length,nt,rt,ot;for(;tt--;)if(o[tt][0]==="enter"){if(o[tt][1].type==="content"){nt=tt;break}o[tt][1].type==="paragraph"&&(rt=tt)}else o[tt][1].type==="content"&&o.splice(tt,1),!ot&&o[tt][1].type==="definition"&&(ot=tt);const it={type:"setextHeading",start:Object.assign({},o[rt][1].start),end:Object.assign({},o[o.length-1][1].end)};return o[rt][1].type="setextHeadingText",ot?(o.splice(rt,0,["enter",it,et]),o.splice(ot+1,0,["exit",o[nt][1],et]),o[nt][1].end=Object.assign({},o[ot][1].end)):o[nt][1]=it,o.push(["exit",it,et]),o}function tokenizeSetextUnderline(o,et,tt){const nt=this;let rt;return ot;function ot(ct){let lt=nt.events.length,dt;for(;lt--;)if(nt.events[lt][1].type!=="lineEnding"&&nt.events[lt][1].type!=="linePrefix"&&nt.events[lt][1].type!=="content"){dt=nt.events[lt][1].type==="paragraph";break}return!nt.parser.lazy[nt.now().line]&&(nt.interrupt||dt)?(o.enter("setextHeadingLine"),rt=ct,it(ct)):tt(ct)}function it(ct){return o.enter("setextHeadingLineSequence"),st(ct)}function st(ct){return ct===rt?(o.consume(ct),st):(o.exit("setextHeadingLineSequence"),markdownSpace(ct)?factorySpace(o,at,"lineSuffix")(ct):at(ct))}function at(ct){return ct===null||markdownLineEnding(ct)?(o.exit("setextHeadingLine"),et(ct)):tt(ct)}}const flow$1={tokenize:initializeFlow};function initializeFlow(o){const et=this,tt=o.attempt(blankLine,nt,o.attempt(this.parser.constructs.flowInitial,rt,factorySpace(o,o.attempt(this.parser.constructs.flow,rt,o.attempt(content,rt)),"linePrefix")));return tt;function nt(ot){if(ot===null){o.consume(ot);return}return o.enter("lineEndingBlank"),o.consume(ot),o.exit("lineEndingBlank"),et.currentConstruct=void 0,tt}function rt(ot){if(ot===null){o.consume(ot);return}return o.enter("lineEnding"),o.consume(ot),o.exit("lineEnding"),et.currentConstruct=void 0,tt}}const resolver={resolveAll:createResolver()},string$1=initializeFactory("string"),text$2=initializeFactory("text");function initializeFactory(o){return{tokenize:et,resolveAll:createResolver(o==="text"?resolveAllLineSuffixes:void 0)};function et(tt){const nt=this,rt=this.parser.constructs[o],ot=tt.attempt(rt,it,st);return it;function it(lt){return ct(lt)?ot(lt):st(lt)}function st(lt){if(lt===null){tt.consume(lt);return}return tt.enter("data"),tt.consume(lt),at}function at(lt){return ct(lt)?(tt.exit("data"),ot(lt)):(tt.consume(lt),at)}function ct(lt){if(lt===null)return!0;const dt=rt[lt];let ht=-1;if(dt)for(;++ht-1){const st=it[0];typeof st=="string"?it[0]=st.slice(nt):it.shift()}ot>0&&it.push(o[rt].slice(0,ot))}return it}function serializeChunks(o,et){let tt=-1;const nt=[];let rt;for(;++tt0){const Kt=St.tokenStack[St.tokenStack.length-1];(Kt[1]||defaultOnError).call(St,void 0,Kt[0])}for(It.position={start:point(on.length>0?on[0][1].start:{line:1,column:1,offset:0}),end:point(on.length>0?on[on.length-2][1].end:{line:1,column:1,offset:0})},jt=-1;++jt0){const Kt=St.tokenStack[St.tokenStack.length-1];(Kt[1]||defaultOnError).call(St,void 0,Kt[0])}for(Tt.position={start:point(on.length>0?on[0][1].start:{line:1,column:1,offset:0}),end:point(on.length>0?on[on.length-2][1].end:{line:1,column:1,offset:0})},$t=-1;++$t1?"-"+st:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(it)}]};o.patch(et,at);const ct={type:"element",tagName:"sup",properties:{},children:[at]};return o.patch(et,ct),o.applyData(et,ct)}function heading(o,et){const tt={type:"element",tagName:"h"+et.depth,properties:{},children:o.all(et)};return o.patch(et,tt),o.applyData(et,tt)}function html(o,et){if(o.options.allowDangerousHtml){const tt={type:"raw",value:et.value};return o.patch(et,tt),o.applyData(et,tt)}}function revert(o,et){const tt=et.referenceType;let nt="]";if(tt==="collapsed"?nt+="[]":tt==="full"&&(nt+="["+(et.label||et.identifier)+"]"),et.type==="imageReference")return[{type:"text",value:"!["+et.alt+nt}];const rt=o.all(et),ot=rt[0];ot&&ot.type==="text"?ot.value="["+ot.value:rt.unshift({type:"text",value:"["});const it=rt[rt.length-1];return it&&it.type==="text"?it.value+=nt:rt.push({type:"text",value:nt}),rt}function imageReference(o,et){const tt=String(et.identifier).toUpperCase(),nt=o.definitionById.get(tt);if(!nt)return revert(o,et);const rt={src:normalizeUri(nt.url||""),alt:et.alt};nt.title!==null&&nt.title!==void 0&&(rt.title=nt.title);const ot={type:"element",tagName:"img",properties:rt,children:[]};return o.patch(et,ot),o.applyData(et,ot)}function image(o,et){const tt={src:normalizeUri(et.url)};et.alt!==null&&et.alt!==void 0&&(tt.alt=et.alt),et.title!==null&&et.title!==void 0&&(tt.title=et.title);const nt={type:"element",tagName:"img",properties:tt,children:[]};return o.patch(et,nt),o.applyData(et,nt)}function inlineCode(o,et){const tt={type:"text",value:et.value.replace(/\r?\n|\r/g," ")};o.patch(et,tt);const nt={type:"element",tagName:"code",properties:{},children:[tt]};return o.patch(et,nt),o.applyData(et,nt)}function linkReference(o,et){const tt=String(et.identifier).toUpperCase(),nt=o.definitionById.get(tt);if(!nt)return revert(o,et);const rt={href:normalizeUri(nt.url||"")};nt.title!==null&&nt.title!==void 0&&(rt.title=nt.title);const ot={type:"element",tagName:"a",properties:rt,children:o.all(et)};return o.patch(et,ot),o.applyData(et,ot)}function link(o,et){const tt={href:normalizeUri(et.url)};et.title!==null&&et.title!==void 0&&(tt.title=et.title);const nt={type:"element",tagName:"a",properties:tt,children:o.all(et)};return o.patch(et,nt),o.applyData(et,nt)}function listItem(o,et,tt){const nt=o.all(et),rt=tt?listLoose(tt):listItemLoose(et),ot={},it=[];if(typeof et.checked=="boolean"){const lt=nt[0];let dt;lt&<.type==="element"&<.tagName==="p"?dt=lt:(dt={type:"element",tagName:"p",properties:{},children:[]},nt.unshift(dt)),dt.children.length>0&&dt.children.unshift({type:"text",value:" "}),dt.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:et.checked,disabled:!0},children:[]}),ot.className=["task-list-item"]}let st=-1;for(;++st0&&tt.push({type:"text",value:` `}),tt}function trimMarkdownSpaceStart(o){let et=0,tt=o.charCodeAt(et);for(;tt===9||tt===32;)et++,tt=o.charCodeAt(et);return o.slice(et)}function toHast(o,et){const tt=createState(o,et),nt=tt.one(o,void 0),rt=footer(tt),ot=Array.isArray(nt)?{type:"root",children:nt}:nt||{type:"root",children:[]};return rt&&ot.children.push({type:"text",value:` -`},rt),ot}function remarkRehype(o,et){return o&&"run"in o?async function(tt,nt){const rt=toHast(tt,{file:nt,...et});await o.run(rt,nt)}:function(tt,nt){return toHast(tt,{file:nt,...o||et})}}function bail(o){if(o)throw o}var hasOwn=Object.prototype.hasOwnProperty,toStr=Object.prototype.toString,defineProperty=Object.defineProperty,gOPD=Object.getOwnPropertyDescriptor,isArray=function o(et){return typeof Array.isArray=="function"?Array.isArray(et):toStr.call(et)==="[object Array]"},isPlainObject$1=function o(et){if(!et||toStr.call(et)!=="[object Object]")return!1;var tt=hasOwn.call(et,"constructor"),nt=et.constructor&&et.constructor.prototype&&hasOwn.call(et.constructor.prototype,"isPrototypeOf");if(et.constructor&&!tt&&!nt)return!1;var rt;for(rt in et);return typeof rt>"u"||hasOwn.call(et,rt)},setProperty=function o(et,tt){defineProperty&&tt.name==="__proto__"?defineProperty(et,tt.name,{enumerable:!0,configurable:!0,value:tt.newValue,writable:!0}):et[tt.name]=tt.newValue},getProperty=function o(et,tt){if(tt==="__proto__")if(hasOwn.call(et,tt)){if(gOPD)return gOPD(et,tt).value}else return;return et[tt]},extend=function o(){var et,tt,nt,rt,ot,it,st=arguments[0],at=1,ct=arguments.length,lt=!1;for(typeof st=="boolean"&&(lt=st,st=arguments[1]||{},at=2),(st==null||typeof st!="object"&&typeof st!="function")&&(st={});atit.length;let at;st&&it.push(rt);try{at=o.apply(this,it)}catch(ct){const lt=ct;if(st&&tt)throw lt;return rt(lt)}st||(at&&at.then&&typeof at.then=="function"?at.then(ot,rt):at instanceof Error?rt(at):ot(at))}function rt(it,...st){tt||(tt=!0,et(it,...st))}function ot(it){rt(null,it)}}const minpath={basename,dirname,extname,join,sep:"/"};function basename(o,et){if(et!==void 0&&typeof et!="string")throw new TypeError('"ext" argument must be a string');assertPath$1(o);let tt=0,nt=-1,rt=o.length,ot;if(et===void 0||et.length===0||et.length>o.length){for(;rt--;)if(o.codePointAt(rt)===47){if(ot){tt=rt+1;break}}else nt<0&&(ot=!0,nt=rt+1);return nt<0?"":o.slice(tt,nt)}if(et===o)return"";let it=-1,st=et.length-1;for(;rt--;)if(o.codePointAt(rt)===47){if(ot){tt=rt+1;break}}else it<0&&(ot=!0,it=rt+1),st>-1&&(o.codePointAt(rt)===et.codePointAt(st--)?st<0&&(nt=rt):(st=-1,nt=it));return tt===nt?nt=it:nt<0&&(nt=o.length),o.slice(tt,nt)}function dirname(o){if(assertPath$1(o),o.length===0)return".";let et=-1,tt=o.length,nt;for(;--tt;)if(o.codePointAt(tt)===47){if(nt){et=tt;break}}else nt||(nt=!0);return et<0?o.codePointAt(0)===47?"/":".":et===1&&o.codePointAt(0)===47?"//":o.slice(0,et)}function extname(o){assertPath$1(o);let et=o.length,tt=-1,nt=0,rt=-1,ot=0,it;for(;et--;){const st=o.codePointAt(et);if(st===47){if(it){nt=et+1;break}continue}tt<0&&(it=!0,tt=et+1),st===46?rt<0?rt=et:ot!==1&&(ot=1):rt>-1&&(ot=-1)}return rt<0||tt<0||ot===0||ot===1&&rt===tt-1&&rt===nt+1?"":o.slice(rt,tt)}function join(...o){let et=-1,tt;for(;++et0&&o.codePointAt(o.length-1)===47&&(tt+="/"),et?"/"+tt:tt}function normalizeString(o,et){let tt="",nt=0,rt=-1,ot=0,it=-1,st,at;for(;++it<=o.length;){if(it2){if(at=tt.lastIndexOf("/"),at!==tt.length-1){at<0?(tt="",nt=0):(tt=tt.slice(0,at),nt=tt.length-1-tt.lastIndexOf("/")),rt=it,ot=0;continue}}else if(tt.length>0){tt="",nt=0,rt=it,ot=0;continue}}et&&(tt=tt.length>0?tt+"/..":"..",nt=2)}else tt.length>0?tt+="/"+o.slice(rt+1,it):tt=o.slice(rt+1,it),nt=it-rt-1;rt=it,ot=0}else st===46&&ot>-1?ot++:ot=-1}return tt}function assertPath$1(o){if(typeof o!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(o))}const minproc={cwd};function cwd(){return"/"}function isUrl(o){return!!(o!==null&&typeof o=="object"&&"href"in o&&o.href&&"protocol"in o&&o.protocol&&o.auth===void 0)}function urlToPath(o){if(typeof o=="string")o=new URL(o);else if(!isUrl(o)){const et=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+o+"`");throw et.code="ERR_INVALID_ARG_TYPE",et}if(o.protocol!=="file:"){const et=new TypeError("The URL must be of scheme file");throw et.code="ERR_INVALID_URL_SCHEME",et}return getPathFromURLPosix(o)}function getPathFromURLPosix(o){if(o.hostname!==""){const nt=new TypeError('File URL host must be "localhost" or empty on darwin');throw nt.code="ERR_INVALID_FILE_URL_HOST",nt}const et=o.pathname;let tt=-1;for(;++tt0){let[pt,...mt]=lt;const ft=nt[ht][1];isPlainObject(ft)&&isPlainObject(pt)&&(pt=extend$1(!0,ft,pt)),nt[ht]=[ct,pt,...mt]}}}}const unified=new Processor().freeze();function assertParser(o,et){if(typeof et!="function")throw new TypeError("Cannot `"+o+"` without `parser`")}function assertCompiler(o,et){if(typeof et!="function")throw new TypeError("Cannot `"+o+"` without `compiler`")}function assertUnfrozen(o,et){if(et)throw new Error("Cannot call `"+o+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function assertNode(o){if(!isPlainObject(o)||typeof o.type!="string")throw new TypeError("Expected node, got `"+o+"`")}function assertDone(o,et,tt){if(!tt)throw new Error("`"+o+"` finished async. Use `"+et+"` instead")}function vfile(o){return looksLikeAVFile(o)?o:new VFile(o)}function looksLikeAVFile(o){return!!(o&&typeof o=="object"&&"message"in o&&"messages"in o)}function looksLikeAValue(o){return typeof o=="string"||isUint8Array(o)}function isUint8Array(o){return!!(o&&typeof o=="object"&&"byteLength"in o&&"byteOffset"in o)}const changelog="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",emptyPlugins=[],emptyRemarkRehypeOptions={allowDangerousHtml:!0},safeProtocol=/^(https?|ircs?|mailto|xmpp)$/i,deprecations=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function Markdown(o){const et=o.allowedElements,tt=o.allowElement,nt=o.children||"",rt=o.className,ot=o.components,it=o.disallowedElements,st=o.rehypePlugins||emptyPlugins,at=o.remarkPlugins||emptyPlugins,ct=o.remarkRehypeOptions?{...o.remarkRehypeOptions,...emptyRemarkRehypeOptions}:emptyRemarkRehypeOptions,lt=o.skipHtml,dt=o.unwrapDisallowed,ht=o.urlTransform||defaultUrlTransform,pt=unified().use(remarkParse).use(at).use(remarkRehype,ct).use(st),mt=new VFile;typeof nt=="string"&&(mt.value=nt);for(const xt of deprecations)Object.hasOwn(o,xt.from)&&(""+xt.from+(xt.to?"use `"+xt.to+"` instead":"remove it")+changelog+xt.id,void 0);const ft=pt.parse(mt);let yt=pt.runSync(ft,mt);return rt&&(yt={type:"element",tagName:"div",properties:{className:rt},children:yt.type==="root"?yt.children:[yt]}),visit(yt,gt),toJsxRuntime(yt,{Fragment:jsxRuntimeExports.Fragment,components:ot,ignoreInvalidStyle:!0,jsx:jsxRuntimeExports.jsx,jsxs:jsxRuntimeExports.jsxs,passKeys:!0,passNode:!0});function gt(xt,vt,bt){if(xt.type==="raw"&&bt&&typeof vt=="number")return lt?bt.children.splice(vt,1):bt.children[vt]={type:"text",value:xt.value},vt;if(xt.type==="element"){let Et;for(Et in urlAttributes)if(Object.hasOwn(urlAttributes,Et)&&Object.hasOwn(xt.properties,Et)){const wt=xt.properties[Et],kt=urlAttributes[Et];(kt===null||kt.includes(xt.tagName))&&(xt.properties[Et]=ht(String(wt||""),Et,xt))}}if(xt.type==="element"){let Et=et?!et.includes(xt.tagName):it?it.includes(xt.tagName):!1;if(!Et&&tt&&typeof vt=="number"&&(Et=!tt(xt,vt,bt)),Et&&bt&&typeof vt=="number")return dt&&xt.children?bt.children.splice(vt,1,...xt.children):bt.children.splice(vt,1),vt}}}function defaultUrlTransform(o){const et=o.indexOf(":"),tt=o.indexOf("?"),nt=o.indexOf("#"),rt=o.indexOf("/");return et<0||rt>-1&&et>rt||tt>-1&&et>tt||nt>-1&&et>nt||safeProtocol.test(o.slice(0,et))?o:""}const PrivacyPolicyOptIn=({onOptIn:o})=>{const[et,tt]=reactExports.useState(!1);return jsxRuntimeExports.jsxs("div",{className:"min-h-screen flex items-center justify-center bg-background p-4",children:[jsxRuntimeExports.jsxs(Card,{className:"w-full max-w-md",children:[jsxRuntimeExports.jsx(CardHeader,{className:"space-y-2",children:jsxRuntimeExports.jsx(CardTitle,{className:"text-xl sm:text-2xl",children:"Privacy Policy & Data Collection"})}),jsxRuntimeExports.jsx(CardContent,{children:jsxRuntimeExports.jsxs("div",{className:"space-y-4",children:[jsxRuntimeExports.jsx("p",{className:"text-sm sm:text-base text-muted-foreground",children:"We collect data to improve our services. This data is anonymous and helps us understand how our application is used. You can opt-in or opt-out of this data collection."}),jsxRuntimeExports.jsx(Button,{variant:"link",onClick:()=>tt(!0),className:"px-0 text-sm sm:text-base",children:"View Full Privacy Policy"})]})}),jsxRuntimeExports.jsxs(CardFooter,{className:"flex flex-col sm:flex-row gap-3 sm:gap-4",children:[jsxRuntimeExports.jsx(Button,{variant:"outline",onClick:()=>o(!1),className:"w-full sm:w-auto",children:"Opt Out"}),jsxRuntimeExports.jsx(Button,{onClick:()=>o(!0),className:"w-full sm:w-auto",children:"Opt In"})]})]}),jsxRuntimeExports.jsx(Dialog,{open:et,onOpenChange:tt,children:jsxRuntimeExports.jsxs(DialogContent,{className:"w-[95vw] max-w-4xl max-h-[90vh] p-4 sm:p-6",children:[jsxRuntimeExports.jsx(DialogHeader,{children:jsxRuntimeExports.jsx(DialogTitle,{className:"text-xl sm:text-2xl",children:"Privacy Policy"})}),jsxRuntimeExports.jsx(ScrollArea,{className:"mt-4 h-[50vh] sm:h-[60vh]",children:jsxRuntimeExports.jsx(DialogDescription,{className:"space-y-4",children:jsxRuntimeExports.jsx(Markdown,{className:"prose dark:prose-invert max-w-none text-sm sm:text-base",children:privacyPolicy})})})]})})]})},PrivacyPolicyPage=()=>{const[o,et]=reactExports.useState(!1);reactExports.useEffect(()=>{const nt=localStorage.getItem("privacyPolicyOptIn");nt!==null&&et(nt==="true")},[]);const tt=()=>{const nt=!o;et(nt),localStorage.setItem("privacyPolicyOptIn",nt.toString())};return jsxRuntimeExports.jsxs(Card,{className:"w-full max-w-4xl mx-auto p-4 sm:p-6",children:[jsxRuntimeExports.jsx(CardHeader,{className:"space-y-2",children:jsxRuntimeExports.jsx(CardTitle,{className:"text-2xl sm:text-3xl",children:"Privacy Policy Settings"})}),jsxRuntimeExports.jsx(CardContent,{children:jsxRuntimeExports.jsxs("div",{className:"space-y-6 sm:space-y-8",children:[jsxRuntimeExports.jsxs("div",{className:"space-y-4",children:[jsxRuntimeExports.jsx("p",{className:"text-sm sm:text-base text-muted-foreground",children:"We collect data to improve our services. This data is anonymous and helps us understand how our application is used."}),jsxRuntimeExports.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4",children:[jsxRuntimeExports.jsxs("p",{className:"font-semibold",children:["Current status: ",o?"Opted In":"Opted Out"]}),jsxRuntimeExports.jsx(Button,{onClick:tt,className:"w-full sm:w-auto",children:o?"Opt Out":"Opt In"})]})]}),jsxRuntimeExports.jsxs("div",{children:[jsxRuntimeExports.jsx("h3",{className:"text-lg sm:text-xl font-semibold mb-4",children:"Privacy Policy"}),jsxRuntimeExports.jsx(ScrollArea,{className:"h-[50vh] sm:h-[60vh] border rounded-md p-2 sm:p-4",children:jsxRuntimeExports.jsx(Markdown,{className:"prose dark:prose-invert max-w-none text-sm sm:text-base",children:privacyPolicy})})]})]})})]})},SignSharedChain=({chainsData:o,onChainUpdate:et,isLoading:tt})=>{const{chainUUID:nt,blockUUID:rt}=useParams(),[ot,it]=reactExports.useState(null),st=useNavigate();return reactExports.useEffect(()=>{const at=o.find(ct=>ct.chainUUID===nt&&ct.blockUUID===rt);at&&it(at)},[o,nt,rt]),tt&&!ot?jsxRuntimeExports.jsx(Card,{className:"w-full max-w-md mx-auto",children:jsxRuntimeExports.jsxs(CardContent,{className:"flex flex-col items-center justify-center py-8 space-y-4",children:[jsxRuntimeExports.jsx(LoaderCircle,{className:"h-8 w-8 animate-spin"}),jsxRuntimeExports.jsx("p",{className:"text-sm text-muted-foreground",children:"Looking for chain..."})]})}):ot?jsxRuntimeExports.jsxs(Card,{className:"w-full max-w-2xl mx-auto",children:[jsxRuntimeExports.jsx(CardHeader,{children:jsxRuntimeExports.jsx(CardTitle,{children:"Sign Shared Chain"})}),jsxRuntimeExports.jsxs(CardContent,{children:[jsxRuntimeExports.jsx("h2",{className:"text-xl font-semibold mb-2",children:ot.title}),jsxRuntimeExports.jsx("p",{className:"mb-4",children:ot.description}),jsxRuntimeExports.jsx(SignChain,{block:ot,chainsData:o,onSuccess:et})]})]}):jsxRuntimeExports.jsxs(Card,{className:"w-full max-w-md mx-auto",children:[jsxRuntimeExports.jsx(CardHeader,{children:jsxRuntimeExports.jsx(CardTitle,{children:"Chain Not Found"})}),jsxRuntimeExports.jsxs(CardContent,{children:[jsxRuntimeExports.jsx("p",{className:"mb-4",children:"The requested chain or block could not be found."}),jsxRuntimeExports.jsx(Button,{onClick:()=>st("/view"),children:"View All Chains"})]})]})};function App(){const[o,et]=reactExports.useState(!1),[tt,nt]=reactExports.useState([]),{isLoading:rt,error:ot,node:it}=useWaku(),[st,at]=reactExports.useState({filter:"in-progress",store:"in-progress"}),[ct,lt]=reactExports.useState(null),[dt,ht]=reactExports.useState(!0);reactExports.useEffect(()=>{const yt=localStorage.getItem("telemetryOptIn");yt!==null&<(yt==="true")},[]),reactExports.useEffect(()=>{rt||!it||it.libp2p.getConnections().length===0||tt.length>0||o||(et(!0),mt())},[it,rt,st]);const pt=yt=>{lt(yt),localStorage.setItem("telemetryOptIn",yt.toString())};if(rt)return jsxRuntimeExports.jsx("div",{className:"min-h-screen bg-background text-foreground",children:jsxRuntimeExports.jsxs("div",{className:"container mx-auto px-4 py-16 flex flex-col items-center justify-center space-y-4",children:[jsxRuntimeExports.jsx("h1",{className:"text-2xl md:text-4xl font-bold",children:"BuddyBook"}),jsxRuntimeExports.jsxs("div",{className:"flex flex-col items-center space-y-2",children:[jsxRuntimeExports.jsx(LoaderCircle,{className:"h-8 w-8 animate-spin"}),jsxRuntimeExports.jsx("p",{className:"text-muted-foreground",children:"Connecting to Waku's decentralized network..."})]})]})});const mt=async()=>{console.log("Starting message listening");try{at(gt=>({...gt,store:"in-progress"})),ht(!0);const yt=getMessagesFromStore(it);try{for await(const gt of yt)nt(xt=>xt.some(bt=>bt.blockUUID===gt.blockUUID)?xt:[...xt,gt])}catch(gt){console.error("Error processing message:",gt)}at(gt=>({...gt,store:"success"}))}catch(yt){console.error("Error fetching messages from store:",yt),at(gt=>({...gt,store:"error"}))}finally{ht(!1)}try{at(yt=>({...yt,filter:"in-progress"})),await subscribeToFilter(it,yt=>{ft(yt)}),at(yt=>({...yt,filter:"success"}))}catch(yt){console.error("Error subscribing to filter:",yt),at(gt=>({...gt,filter:"error"}))}};if(ot)return console.error("Waku error:",ot),jsxRuntimeExports.jsxs("div",{className:"min-h-screen bg-background text-foreground flex flex-col justify-center items-center",children:[jsxRuntimeExports.jsx("p",{className:"text-red-500",children:"Error connecting to Waku network"}),jsxRuntimeExports.jsx("p",{className:"text-sm text-muted-foreground",children:ot.toString()})]});const ft=yt=>{nt(gt=>gt.some(vt=>vt.blockUUID===yt.blockUUID)?gt:[...gt,yt])};return ct===null?jsxRuntimeExports.jsx(PrivacyPolicyOptIn,{onOptIn:pt}):jsxRuntimeExports.jsxs("div",{className:"min-h-screen bg-background text-foreground",children:[jsxRuntimeExports.jsx(Header,{wakuStatus:st}),jsxRuntimeExports.jsx("main",{className:"container mx-auto px-4 py-4 md:py-8 max-w-7xl",children:jsxRuntimeExports.jsxs(Routes,{children:[jsxRuntimeExports.jsx(Route,{path:"",element:jsxRuntimeExports.jsx(Home,{})}),jsxRuntimeExports.jsx(Route,{path:"create",element:jsxRuntimeExports.jsx(ChainCreationForm,{})}),jsxRuntimeExports.jsx(Route,{path:"view",element:jsxRuntimeExports.jsx(ChainList,{chainsData:tt,onChainUpdate:ft,isLoading:dt})}),jsxRuntimeExports.jsx(Route,{path:"sign/:chainUUID/:blockUUID",element:jsxRuntimeExports.jsx(SignSharedChain,{chainsData:tt,onChainUpdate:ft,isLoading:dt})}),jsxRuntimeExports.jsx(Route,{path:"telemetry",element:jsxRuntimeExports.jsx(PrivacyPolicyPage,{})}),jsxRuntimeExports.jsx(Route,{path:"*",element:jsxRuntimeExports.jsx(Navigate,{to:"",replace:!0})})]})})]})}const Home=()=>jsxRuntimeExports.jsxs("div",{className:"space-y-4 md:space-y-6 p-4 md:p-6",children:[jsxRuntimeExports.jsx("h1",{className:"text-2xl md:text-4xl font-bold",children:"BuddyBook"}),jsxRuntimeExports.jsxs("div",{className:"w-full max-w-sm mx-auto p-4 md:p-6 bg-card rounded-lg shadow-md",children:[jsxRuntimeExports.jsx(Link,{to:"create",children:jsxRuntimeExports.jsx(Button,{className:"w-full mb-4",children:"Create New Chain"})}),jsxRuntimeExports.jsx("p",{className:"text-sm md:text-base text-muted-foreground",children:"Click the button above to start creating a new chain."})]}),jsxRuntimeExports.jsx("p",{className:"text-xs md:text-sm text-muted-foreground text-center",children:"Welcome to BuddyBook - Create and share your chains!"})]}),projectId="1d93edc21291f98e3bed6ff7617ff539",config=createConfig(defaultConfig({appName:"BuddyBook",walletConnectProjectId:projectId,chains:[mainnet],transports:{[mainnet.id]:http()}})),WAKU_NODE_OPTIONS={defaultBootstrap:!0,protocols:[Protocols.Store,Protocols.Filter,Protocols.LightPush]};typeof globalThis>"u"&&(window.global=window);typeof buffer$2.Buffer>"u"&&(window.Buffer=buffer$2.Buffer);const queryClient=new QueryClient;createRoot(document.getElementById("root")).render(jsxRuntimeExports.jsx(reactExports.StrictMode,{children:jsxRuntimeExports.jsx(WagmiProvider,{config,children:jsxRuntimeExports.jsx(QueryClientProvider,{client:queryClient,children:jsxRuntimeExports.jsx(ConnectKitProvider,{children:jsxRuntimeExports.jsx(LightNodeProvider,{options:WAKU_NODE_OPTIONS,children:jsxRuntimeExports.jsx(BrowserRouter,{basename:"/",children:jsxRuntimeExports.jsx(App,{})})})})})})}));export{isHex as A,BaseError$3 as B,dijkstraExports as C,EventEmitter$1 as E,HttpRequestError as H,InvalidAddressError as I,__vitePreload as _,BytesSizeMismatchError as a,stringToHex as b,concat$3 as c,bytesToHex$4 as d,encodeAbiParameters as e,commonjsGlobal as f,encodeFunctionData as g,getDefaultExportFromCjs as h,isAddress as i,getAugmentedNamespace as j,keccak256$1 as k,sha3$2 as l,bytesToHex$3 as m,numberToHex as n,sha256$2 as o,buffer$2 as p,browserExports as q,tslib_es6$1 as r,size$2 as s,toHex as t,detect as u,__viteBrowserExternal$1 as v,getUrl as w,stringify$2 as x,decodeErrorResult as y,call as z}; +`},rt),ot}function remarkRehype(o,et){return o&&"run"in o?async function(tt,nt){const rt=toHast(tt,{file:nt,...et});await o.run(rt,nt)}:function(tt,nt){return toHast(tt,{file:nt,...o||et})}}function bail(o){if(o)throw o}var hasOwn=Object.prototype.hasOwnProperty,toStr=Object.prototype.toString,defineProperty=Object.defineProperty,gOPD=Object.getOwnPropertyDescriptor,isArray=function o(et){return typeof Array.isArray=="function"?Array.isArray(et):toStr.call(et)==="[object Array]"},isPlainObject$1=function o(et){if(!et||toStr.call(et)!=="[object Object]")return!1;var tt=hasOwn.call(et,"constructor"),nt=et.constructor&&et.constructor.prototype&&hasOwn.call(et.constructor.prototype,"isPrototypeOf");if(et.constructor&&!tt&&!nt)return!1;var rt;for(rt in et);return typeof rt>"u"||hasOwn.call(et,rt)},setProperty=function o(et,tt){defineProperty&&tt.name==="__proto__"?defineProperty(et,tt.name,{enumerable:!0,configurable:!0,value:tt.newValue,writable:!0}):et[tt.name]=tt.newValue},getProperty=function o(et,tt){if(tt==="__proto__")if(hasOwn.call(et,tt)){if(gOPD)return gOPD(et,tt).value}else return;return et[tt]},extend=function o(){var et,tt,nt,rt,ot,it,st=arguments[0],at=1,ct=arguments.length,lt=!1;for(typeof st=="boolean"&&(lt=st,st=arguments[1]||{},at=2),(st==null||typeof st!="object"&&typeof st!="function")&&(st={});atit.length;let at;st&&it.push(rt);try{at=o.apply(this,it)}catch(ct){const lt=ct;if(st&&tt)throw lt;return rt(lt)}st||(at&&at.then&&typeof at.then=="function"?at.then(ot,rt):at instanceof Error?rt(at):ot(at))}function rt(it,...st){tt||(tt=!0,et(it,...st))}function ot(it){rt(null,it)}}const minpath={basename,dirname,extname,join,sep:"/"};function basename(o,et){if(et!==void 0&&typeof et!="string")throw new TypeError('"ext" argument must be a string');assertPath$1(o);let tt=0,nt=-1,rt=o.length,ot;if(et===void 0||et.length===0||et.length>o.length){for(;rt--;)if(o.codePointAt(rt)===47){if(ot){tt=rt+1;break}}else nt<0&&(ot=!0,nt=rt+1);return nt<0?"":o.slice(tt,nt)}if(et===o)return"";let it=-1,st=et.length-1;for(;rt--;)if(o.codePointAt(rt)===47){if(ot){tt=rt+1;break}}else it<0&&(ot=!0,it=rt+1),st>-1&&(o.codePointAt(rt)===et.codePointAt(st--)?st<0&&(nt=rt):(st=-1,nt=it));return tt===nt?nt=it:nt<0&&(nt=o.length),o.slice(tt,nt)}function dirname(o){if(assertPath$1(o),o.length===0)return".";let et=-1,tt=o.length,nt;for(;--tt;)if(o.codePointAt(tt)===47){if(nt){et=tt;break}}else nt||(nt=!0);return et<0?o.codePointAt(0)===47?"/":".":et===1&&o.codePointAt(0)===47?"//":o.slice(0,et)}function extname(o){assertPath$1(o);let et=o.length,tt=-1,nt=0,rt=-1,ot=0,it;for(;et--;){const st=o.codePointAt(et);if(st===47){if(it){nt=et+1;break}continue}tt<0&&(it=!0,tt=et+1),st===46?rt<0?rt=et:ot!==1&&(ot=1):rt>-1&&(ot=-1)}return rt<0||tt<0||ot===0||ot===1&&rt===tt-1&&rt===nt+1?"":o.slice(rt,tt)}function join(...o){let et=-1,tt;for(;++et0&&o.codePointAt(o.length-1)===47&&(tt+="/"),et?"/"+tt:tt}function normalizeString(o,et){let tt="",nt=0,rt=-1,ot=0,it=-1,st,at;for(;++it<=o.length;){if(it2){if(at=tt.lastIndexOf("/"),at!==tt.length-1){at<0?(tt="",nt=0):(tt=tt.slice(0,at),nt=tt.length-1-tt.lastIndexOf("/")),rt=it,ot=0;continue}}else if(tt.length>0){tt="",nt=0,rt=it,ot=0;continue}}et&&(tt=tt.length>0?tt+"/..":"..",nt=2)}else tt.length>0?tt+="/"+o.slice(rt+1,it):tt=o.slice(rt+1,it),nt=it-rt-1;rt=it,ot=0}else st===46&&ot>-1?ot++:ot=-1}return tt}function assertPath$1(o){if(typeof o!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(o))}const minproc={cwd};function cwd(){return"/"}function isUrl(o){return!!(o!==null&&typeof o=="object"&&"href"in o&&o.href&&"protocol"in o&&o.protocol&&o.auth===void 0)}function urlToPath(o){if(typeof o=="string")o=new URL(o);else if(!isUrl(o)){const et=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+o+"`");throw et.code="ERR_INVALID_ARG_TYPE",et}if(o.protocol!=="file:"){const et=new TypeError("The URL must be of scheme file");throw et.code="ERR_INVALID_URL_SCHEME",et}return getPathFromURLPosix(o)}function getPathFromURLPosix(o){if(o.hostname!==""){const nt=new TypeError('File URL host must be "localhost" or empty on darwin');throw nt.code="ERR_INVALID_FILE_URL_HOST",nt}const et=o.pathname;let tt=-1;for(;++tt0){let[pt,...mt]=lt;const ft=nt[ht][1];isPlainObject(ft)&&isPlainObject(pt)&&(pt=extend$1(!0,ft,pt)),nt[ht]=[ct,pt,...mt]}}}}const unified=new Processor().freeze();function assertParser(o,et){if(typeof et!="function")throw new TypeError("Cannot `"+o+"` without `parser`")}function assertCompiler(o,et){if(typeof et!="function")throw new TypeError("Cannot `"+o+"` without `compiler`")}function assertUnfrozen(o,et){if(et)throw new Error("Cannot call `"+o+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function assertNode(o){if(!isPlainObject(o)||typeof o.type!="string")throw new TypeError("Expected node, got `"+o+"`")}function assertDone(o,et,tt){if(!tt)throw new Error("`"+o+"` finished async. Use `"+et+"` instead")}function vfile(o){return looksLikeAVFile(o)?o:new VFile(o)}function looksLikeAVFile(o){return!!(o&&typeof o=="object"&&"message"in o&&"messages"in o)}function looksLikeAValue(o){return typeof o=="string"||isUint8Array(o)}function isUint8Array(o){return!!(o&&typeof o=="object"&&"byteLength"in o&&"byteOffset"in o)}const changelog="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",emptyPlugins=[],emptyRemarkRehypeOptions={allowDangerousHtml:!0},safeProtocol=/^(https?|ircs?|mailto|xmpp)$/i,deprecations=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function Markdown(o){const et=o.allowedElements,tt=o.allowElement,nt=o.children||"",rt=o.className,ot=o.components,it=o.disallowedElements,st=o.rehypePlugins||emptyPlugins,at=o.remarkPlugins||emptyPlugins,ct=o.remarkRehypeOptions?{...o.remarkRehypeOptions,...emptyRemarkRehypeOptions}:emptyRemarkRehypeOptions,lt=o.skipHtml,dt=o.unwrapDisallowed,ht=o.urlTransform||defaultUrlTransform,pt=unified().use(remarkParse).use(at).use(remarkRehype,ct).use(st),mt=new VFile;typeof nt=="string"&&(mt.value=nt);for(const xt of deprecations)Object.hasOwn(o,xt.from)&&(""+xt.from+(xt.to?"use `"+xt.to+"` instead":"remove it")+changelog+xt.id,void 0);const ft=pt.parse(mt);let yt=pt.runSync(ft,mt);return rt&&(yt={type:"element",tagName:"div",properties:{className:rt},children:yt.type==="root"?yt.children:[yt]}),visit(yt,gt),toJsxRuntime(yt,{Fragment:jsxRuntimeExports.Fragment,components:ot,ignoreInvalidStyle:!0,jsx:jsxRuntimeExports.jsx,jsxs:jsxRuntimeExports.jsxs,passKeys:!0,passNode:!0});function gt(xt,vt,bt){if(xt.type==="raw"&&bt&&typeof vt=="number")return lt?bt.children.splice(vt,1):bt.children[vt]={type:"text",value:xt.value},vt;if(xt.type==="element"){let Et;for(Et in urlAttributes)if(Object.hasOwn(urlAttributes,Et)&&Object.hasOwn(xt.properties,Et)){const wt=xt.properties[Et],kt=urlAttributes[Et];(kt===null||kt.includes(xt.tagName))&&(xt.properties[Et]=ht(String(wt||""),Et,xt))}}if(xt.type==="element"){let Et=et?!et.includes(xt.tagName):it?it.includes(xt.tagName):!1;if(!Et&&tt&&typeof vt=="number"&&(Et=!tt(xt,vt,bt)),Et&&bt&&typeof vt=="number")return dt&&xt.children?bt.children.splice(vt,1,...xt.children):bt.children.splice(vt,1),vt}}}function defaultUrlTransform(o){const et=o.indexOf(":"),tt=o.indexOf("?"),nt=o.indexOf("#"),rt=o.indexOf("/");return et<0||rt>-1&&et>rt||tt>-1&&et>tt||nt>-1&&et>nt||safeProtocol.test(o.slice(0,et))?o:""}const PrivacyPolicyOptIn=({onOptIn:o})=>{const[et,tt]=reactExports.useState(!1);return jsxRuntimeExports.jsxs("div",{className:"min-h-screen flex items-center justify-center bg-background p-4",children:[jsxRuntimeExports.jsxs(Card,{className:"w-full max-w-md",children:[jsxRuntimeExports.jsx(CardHeader,{className:"space-y-2",children:jsxRuntimeExports.jsx(CardTitle,{className:"text-xl sm:text-2xl",children:"Privacy Policy & Data Collection"})}),jsxRuntimeExports.jsx(CardContent,{children:jsxRuntimeExports.jsxs("div",{className:"space-y-4",children:[jsxRuntimeExports.jsx("p",{className:"text-sm sm:text-base text-muted-foreground",children:"We collect data to improve our services. This data is anonymous and helps us understand how our application is used. You can opt-in or opt-out of this data collection."}),jsxRuntimeExports.jsx(Button,{variant:"link",onClick:()=>tt(!0),className:"px-0 text-sm sm:text-base",children:"View Full Privacy Policy"})]})}),jsxRuntimeExports.jsxs(CardFooter,{className:"flex flex-col sm:flex-row gap-3 sm:gap-4",children:[jsxRuntimeExports.jsx(Button,{variant:"outline",onClick:()=>o(!1),className:"w-full sm:w-auto",children:"Opt Out"}),jsxRuntimeExports.jsx(Button,{onClick:()=>o(!0),className:"w-full sm:w-auto",children:"Opt In"})]})]}),jsxRuntimeExports.jsx(Dialog,{open:et,onOpenChange:tt,children:jsxRuntimeExports.jsxs(DialogContent,{className:"w-[95vw] max-w-4xl max-h-[90vh] p-4 sm:p-6",children:[jsxRuntimeExports.jsx(DialogHeader,{children:jsxRuntimeExports.jsx(DialogTitle,{className:"text-xl sm:text-2xl",children:"Privacy Policy"})}),jsxRuntimeExports.jsx(ScrollArea,{className:"mt-4 h-[50vh] sm:h-[60vh]",children:jsxRuntimeExports.jsx(DialogDescription,{className:"space-y-4",children:jsxRuntimeExports.jsx(Markdown,{className:"prose dark:prose-invert max-w-none text-sm sm:text-base",children:privacyPolicy})})})]})})]})},PrivacyPolicyPage=()=>{const[o,et]=reactExports.useState(!1);reactExports.useEffect(()=>{const nt=localStorage.getItem("privacyPolicyOptIn");nt!==null&&et(nt==="true")},[]);const tt=()=>{const nt=!o;et(nt),localStorage.setItem("privacyPolicyOptIn",nt.toString())};return jsxRuntimeExports.jsxs(Card,{className:"w-full max-w-4xl mx-auto p-4 sm:p-6",children:[jsxRuntimeExports.jsx(CardHeader,{className:"space-y-2",children:jsxRuntimeExports.jsx(CardTitle,{className:"text-2xl sm:text-3xl",children:"Privacy Policy Settings"})}),jsxRuntimeExports.jsx(CardContent,{children:jsxRuntimeExports.jsxs("div",{className:"space-y-6 sm:space-y-8",children:[jsxRuntimeExports.jsxs("div",{className:"space-y-4",children:[jsxRuntimeExports.jsx("p",{className:"text-sm sm:text-base text-muted-foreground",children:"We collect data to improve our services. This data is anonymous and helps us understand how our application is used."}),jsxRuntimeExports.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4",children:[jsxRuntimeExports.jsxs("p",{className:"font-semibold",children:["Current status: ",o?"Opted In":"Opted Out"]}),jsxRuntimeExports.jsx(Button,{onClick:tt,className:"w-full sm:w-auto",children:o?"Opt Out":"Opt In"})]})]}),jsxRuntimeExports.jsxs("div",{children:[jsxRuntimeExports.jsx("h3",{className:"text-lg sm:text-xl font-semibold mb-4",children:"Privacy Policy"}),jsxRuntimeExports.jsx(ScrollArea,{className:"h-[50vh] sm:h-[60vh] border rounded-md p-2 sm:p-4",children:jsxRuntimeExports.jsx(Markdown,{className:"prose dark:prose-invert max-w-none text-sm sm:text-base",children:privacyPolicy})})]})]})})]})},SignSharedChain=({chainsData:o,onChainUpdate:et,isLoading:tt})=>{const{chainUUID:nt,blockUUID:rt}=useParams(),[ot,it]=reactExports.useState(null),st=useNavigate();return reactExports.useEffect(()=>{const at=o.find(ct=>ct.chainUUID===nt&&ct.blockUUID===rt);at&&it(at)},[o,nt,rt]),tt&&!ot?jsxRuntimeExports.jsx(Card,{className:"w-full max-w-md mx-auto",children:jsxRuntimeExports.jsxs(CardContent,{className:"flex flex-col items-center justify-center py-8 space-y-4",children:[jsxRuntimeExports.jsx(LoaderCircle,{className:"h-8 w-8 animate-spin"}),jsxRuntimeExports.jsx("p",{className:"text-sm text-muted-foreground",children:"Looking for chain..."})]})}):ot?jsxRuntimeExports.jsxs(Card,{className:"w-full max-w-2xl mx-auto",children:[jsxRuntimeExports.jsx(CardHeader,{children:jsxRuntimeExports.jsx(CardTitle,{children:"Sign Shared Chain"})}),jsxRuntimeExports.jsxs(CardContent,{children:[jsxRuntimeExports.jsx("h2",{className:"text-xl font-semibold mb-2",children:ot.title}),jsxRuntimeExports.jsx("p",{className:"mb-4",children:ot.description}),jsxRuntimeExports.jsx(SignChain,{block:ot,chainsData:o,onSuccess:et})]})]}):jsxRuntimeExports.jsxs(Card,{className:"w-full max-w-md mx-auto",children:[jsxRuntimeExports.jsx(CardHeader,{children:jsxRuntimeExports.jsx(CardTitle,{children:"Chain Not Found"})}),jsxRuntimeExports.jsxs(CardContent,{children:[jsxRuntimeExports.jsx("p",{className:"mb-4",children:"The requested chain or block could not be found."}),jsxRuntimeExports.jsx(Button,{onClick:()=>st("/view"),children:"View All Chains"})]})]})},StatusIndicator=({status:o,label:et})=>{const tt=()=>{switch(o){case"success":return jsxRuntimeExports.jsx(CircleCheck,{className:"h-4 w-4 text-green-500"});case"error":return jsxRuntimeExports.jsx(CircleX,{className:"h-4 w-4 text-red-500"});case"in-progress":return jsxRuntimeExports.jsx(LoaderCircle,{className:"h-4 w-4 animate-spin text-yellow-500"})}},nt=()=>{switch(o){case"success":return"bg-green-500/10 text-green-500";case"error":return"bg-red-500/10 text-red-500";case"in-progress":return"bg-yellow-500/10 text-yellow-500"}};return jsxRuntimeExports.jsxs("div",{className:`flex items-center gap-2 px-2 py-1 rounded-full ${nt()}`,children:[tt(),jsxRuntimeExports.jsx("span",{className:"text-xs font-medium",children:et})]})},ConnectionStatus=({filter:o,store:et})=>jsxRuntimeExports.jsx(Card,{className:"fixed bottom-4 left-4 right-4 md:static md:bottom-auto md:left-auto p-2 bg-background/80 backdrop-blur-sm border shadow-lg z-50 md:z-auto",children:jsxRuntimeExports.jsxs("div",{className:"flex flex-row justify-around md:justify-start md:gap-4",children:[jsxRuntimeExports.jsx(StatusIndicator,{status:o,label:"Filter"}),jsxRuntimeExports.jsx(StatusIndicator,{status:et,label:"Store"})]})});function App(){const[o,et]=reactExports.useState(!1),[tt,nt]=reactExports.useState([]),{isLoading:rt,error:ot,node:it}=useWaku(),[st,at]=reactExports.useState({filter:"in-progress",store:"in-progress"});globalThis.window.waku=it;const[ct,lt]=reactExports.useState(null),[dt,ht]=reactExports.useState(!0);reactExports.useEffect(()=>{const yt=localStorage.getItem("telemetryOptIn");yt!==null&<(yt==="true")},[]),reactExports.useEffect(()=>{if(rt||!it||it.libp2p.getConnections().length===0||tt.length>0||o){console.log("not starting message listening"),console.log({isWakuLoading:rt,node:it,connections:it==null?void 0:it.libp2p.getConnections().length,chainsData:tt,isListening:o});return}et(!0),console.log("connections",it.libp2p.getConnections().length),setTimeout(()=>{mt()},2e3)},[it,rt,st]);const pt=yt=>{lt(yt),localStorage.setItem("telemetryOptIn",yt.toString())};if(rt)return jsxRuntimeExports.jsx("div",{className:"min-h-screen bg-background text-foreground",children:jsxRuntimeExports.jsxs("div",{className:"container mx-auto px-4 py-16 flex flex-col items-center justify-center space-y-4",children:[jsxRuntimeExports.jsx("h1",{className:"text-2xl md:text-4xl font-bold",children:"BuddyBook"}),jsxRuntimeExports.jsxs("div",{className:"flex flex-col items-center space-y-2",children:[jsxRuntimeExports.jsx(LoaderCircle,{className:"h-8 w-8 animate-spin"}),jsxRuntimeExports.jsx("p",{className:"text-muted-foreground",children:"Connecting to Waku's decentralized network..."})]})]})});const mt=async()=>{console.log("Starting message listening"),console.log("connections",it.libp2p.getConnections().length);const yt=3e4,gt=new Promise((vt,bt)=>{setTimeout(()=>bt(new Error("Store query timeout")),yt)});try{at(bt=>({...bt,store:"in-progress"})),ht(!0);const vt=getMessagesFromStore(it);try{await Promise.race([(async()=>{for await(const bt of vt)nt(Et=>Et.some(kt=>kt.blockUUID===bt.blockUUID)?Et:[...Et,bt])})(),gt]),at(bt=>({...bt,store:"success"}))}catch(bt){console.error("Error processing message:",bt),at(Et=>({...Et,store:"error"}))}}catch(vt){console.error("Error fetching messages from store:",vt),at(bt=>({...bt,store:"error"}))}finally{ht(!1)}const xt=15e3;try{at(bt=>({...bt,filter:"in-progress"}));const vt=subscribeToFilter(it,bt=>{ft(bt)});await Promise.race([vt,new Promise((bt,Et)=>setTimeout(()=>Et(new Error("Filter subscription timeout")),xt))]),at(bt=>({...bt,filter:"success"}))}catch(vt){console.error("Error subscribing to filter:",vt),at(bt=>({...bt,filter:"error"}))}};if(ot)return console.error("Waku error:",ot),jsxRuntimeExports.jsxs("div",{className:"min-h-screen bg-background text-foreground flex flex-col justify-center items-center",children:[jsxRuntimeExports.jsx("p",{className:"text-red-500",children:"Error connecting to Waku network"}),jsxRuntimeExports.jsx("p",{className:"text-sm text-muted-foreground",children:ot.toString()})]});const ft=yt=>{nt(gt=>gt.some(vt=>vt.blockUUID===yt.blockUUID)?gt:[...gt,yt])};return ct===null?jsxRuntimeExports.jsx(PrivacyPolicyOptIn,{onOptIn:pt}):jsxRuntimeExports.jsxs("div",{className:"min-h-screen bg-background text-foreground",children:[jsxRuntimeExports.jsx(Header,{wakuStatus:st}),jsxRuntimeExports.jsx("div",{className:"md:hidden",children:jsxRuntimeExports.jsx(ConnectionStatus,{filter:st.filter,store:st.store})}),jsxRuntimeExports.jsx("main",{className:"container mx-auto px-4 py-4 md:py-8 max-w-7xl",children:jsxRuntimeExports.jsxs(Routes,{children:[jsxRuntimeExports.jsx(Route,{path:"",element:jsxRuntimeExports.jsx(Home,{})}),jsxRuntimeExports.jsx(Route,{path:"create",element:jsxRuntimeExports.jsx(ChainCreationForm,{})}),jsxRuntimeExports.jsx(Route,{path:"view",element:jsxRuntimeExports.jsx(ChainList,{chainsData:tt,onChainUpdate:ft,isLoading:dt})}),jsxRuntimeExports.jsx(Route,{path:"sign/:chainUUID/:blockUUID",element:jsxRuntimeExports.jsx(SignSharedChain,{chainsData:tt,onChainUpdate:ft,isLoading:dt})}),jsxRuntimeExports.jsx(Route,{path:"telemetry",element:jsxRuntimeExports.jsx(PrivacyPolicyPage,{})}),jsxRuntimeExports.jsx(Route,{path:"*",element:jsxRuntimeExports.jsx(Navigate,{to:"",replace:!0})})]})})]})}const Home=()=>jsxRuntimeExports.jsxs("div",{className:"space-y-4 md:space-y-6 p-4 md:p-6",children:[jsxRuntimeExports.jsx("h1",{className:"text-2xl md:text-4xl font-bold",children:"BuddyBook"}),jsxRuntimeExports.jsxs("div",{className:"w-full max-w-sm mx-auto p-4 md:p-6 bg-card rounded-lg shadow-md",children:[jsxRuntimeExports.jsx(Link,{to:"create",children:jsxRuntimeExports.jsx(Button,{className:"w-full mb-4",children:"Create New Chain"})}),jsxRuntimeExports.jsx("p",{className:"text-sm md:text-base text-muted-foreground",children:"Click the button above to start creating a new chain."})]}),jsxRuntimeExports.jsx("p",{className:"text-xs md:text-sm text-muted-foreground text-center",children:"Welcome to BuddyBook - Create and share your chains!"})]}),projectId="1d93edc21291f98e3bed6ff7617ff539",config=createConfig(defaultConfig({appName:"BuddyBook",walletConnectProjectId:projectId,chains:[mainnet],transports:{[mainnet.id]:http()}}));typeof globalThis>"u"&&(window.global=window);typeof buffer$2.Buffer>"u"&&(window.Buffer=buffer$2.Buffer);const queryClient=new QueryClient;createRoot(document.getElementById("root")).render(jsxRuntimeExports.jsx(reactExports.StrictMode,{children:jsxRuntimeExports.jsx(WagmiProvider,{config,children:jsxRuntimeExports.jsx(QueryClientProvider,{client:queryClient,children:jsxRuntimeExports.jsx(ConnectKitProvider,{children:jsxRuntimeExports.jsx(LightNodeProvider,{options:WAKU_NODE_OPTIONS,children:jsxRuntimeExports.jsx(BrowserRouter,{basename:"/",children:jsxRuntimeExports.jsx(App,{})})})})})})}));export{isHex as A,BaseError$3 as B,dijkstraExports as C,EventEmitter$1 as E,HttpRequestError as H,InvalidAddressError as I,__vitePreload as _,BytesSizeMismatchError as a,stringToHex as b,concat$3 as c,bytesToHex$4 as d,encodeAbiParameters as e,commonjsGlobal as f,encodeFunctionData as g,getDefaultExportFromCjs as h,isAddress as i,getAugmentedNamespace as j,keccak256$1 as k,sha3$2 as l,bytesToHex$3 as m,numberToHex as n,sha256$2 as o,buffer$2 as p,browserExports as q,tslib_es6$1 as r,size$2 as s,toHex as t,detect as u,__viteBrowserExternal$1 as v,getUrl as w,stringify$2 as x,decodeErrorResult as y,call as z}; diff --git a/buddybook/assets/index-B6MMxlAs.js b/buddybook/assets/index-xz6stGwY.js similarity index 99% rename from buddybook/assets/index-B6MMxlAs.js rename to buddybook/assets/index-xz6stGwY.js index 606b7e1..00f9b67 100644 --- a/buddybook/assets/index-B6MMxlAs.js +++ b/buddybook/assets/index-xz6stGwY.js @@ -1,3 +1,3 @@ -import{j as rt,l as at,m as ot,o as ct,E as dt}from"./index-Cye4tEiE.js";import{B as Y,_ as h,h as ae,y as lt}from"./hooks.module-D0gf0yJl.js";const ht=(t,e)=>{let s;switch(t){case"standard":return s=e,`data:image/svg+xml,%3Csvg width='${e}' height='${s}' viewBox='0 0 1024 1024' fill='none' xmlns='http://www.w3.org/2000/svg'%3E %3Crect width='1024' height='1024' fill='%230052FF'/%3E %3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M152 512C152 710.823 313.177 872 512 872C710.823 872 872 710.823 872 512C872 313.177 710.823 152 512 152C313.177 152 152 313.177 152 512ZM420 396C406.745 396 396 406.745 396 420V604C396 617.255 406.745 628 420 628H604C617.255 628 628 617.255 628 604V420C628 406.745 617.255 396 604 396H420Z' fill='white'/%3E %3C/svg%3E `;case"circle":return s=e,`data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='${e}' height='${s}' viewBox='0 0 999.81 999.81'%3E%3Cdefs%3E%3Cstyle%3E.cls-1%7Bfill:%230052fe;%7D.cls-2%7Bfill:%23fefefe;%7D.cls-3%7Bfill:%230152fe;%7D%3C/style%3E%3C/defs%3E%3Cpath class='cls-1' d='M655-115.9h56c.83,1.59,2.36.88,3.56,1a478,478,0,0,1,75.06,10.42C891.4-81.76,978.33-32.58,1049.19,44q116.7,126,131.94,297.61c.38,4.14-.34,8.53,1.78,12.45v59c-1.58.84-.91,2.35-1,3.56a482.05,482.05,0,0,1-10.38,74.05c-24,106.72-76.64,196.76-158.83,268.93s-178.18,112.82-287.2,122.6c-4.83.43-9.86-.25-14.51,1.77H654c-1-1.68-2.69-.91-4.06-1a496.89,496.89,0,0,1-105.9-18.59c-93.54-27.42-172.78-77.59-236.91-150.94Q199.34,590.1,184.87,426.58c-.47-5.19.25-10.56-1.77-15.59V355c1.68-1,.91-2.7,1-4.06a498.12,498.12,0,0,1,18.58-105.9c26-88.75,72.64-164.9,140.6-227.57q126-116.27,297.21-131.61C645.32-114.57,650.35-113.88,655-115.9Zm377.92,500c0-192.44-156.31-349.49-347.56-350.15-194.13-.68-350.94,155.13-352.29,347.42-1.37,194.55,155.51,352.1,348.56,352.47C876.15,734.23,1032.93,577.84,1032.93,384.11Z' transform='translate(-183.1 115.9)'/%3E%3Cpath class='cls-2' d='M1032.93,384.11c0,193.73-156.78,350.12-351.29,349.74-193-.37-349.93-157.92-348.56-352.47C334.43,189.09,491.24,33.28,685.37,34,876.62,34.62,1032.94,191.67,1032.93,384.11ZM683,496.81q43.74,0,87.48,0c15.55,0,25.32-9.72,25.33-25.21q0-87.48,0-175c0-15.83-9.68-25.46-25.59-25.46H595.77c-15.88,0-25.57,9.64-25.58,25.46q0,87.23,0,174.45c0,16.18,9.59,25.7,25.84,25.71Z' transform='translate(-183.1 115.9)'/%3E%3Cpath class='cls-3' d='M683,496.81H596c-16.25,0-25.84-9.53-25.84-25.71q0-87.23,0-174.45c0-15.82,9.7-25.46,25.58-25.46H770.22c15.91,0,25.59,9.63,25.59,25.46q0,87.47,0,175c0,15.49-9.78,25.2-25.33,25.21Q726.74,496.84,683,496.81Z' transform='translate(-183.1 115.9)'/%3E%3C/svg%3E`;case"text":return s=(.1*e).toFixed(2),`data:image/svg+xml,%3Csvg width='${e}' height='${s}' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 528.15 53.64'%3E%3Cdefs%3E%3Cstyle%3E.cls-1%7Bfill:%230052ff;%7D%3C/style%3E%3C/defs%3E%3Ctitle%3ECoinbase_Wordmark_SubBrands_ALL%3C/title%3E%3Cpath class='cls-1' d='M164.45,15a15,15,0,0,0-11.74,5.4V0h-8.64V52.92h8.5V48a15,15,0,0,0,11.88,5.62c10.37,0,18.21-8.21,18.21-19.3S174.67,15,164.45,15Zm-1.3,30.67c-6.19,0-10.73-4.83-10.73-11.31S157,23,163.22,23s10.66,4.82,10.66,11.37S169.34,45.65,163.15,45.65Zm83.31-14.91-6.34-.93c-3-.43-5.18-1.44-5.18-3.82,0-2.59,2.8-3.89,6.62-3.89,4.18,0,6.84,1.8,7.42,4.76h8.35c-.94-7.49-6.7-11.88-15.55-11.88-9.15,0-15.2,4.68-15.2,11.3,0,6.34,4,10,12,11.16l6.33.94c3.1.43,4.83,1.65,4.83,4,0,2.95-3,4.17-7.2,4.17-5.12,0-8-2.09-8.43-5.25h-8.49c.79,7.27,6.48,12.38,16.84,12.38,9.44,0,15.7-4.32,15.7-11.74C258.12,35.28,253.58,31.82,246.46,30.74Zm-27.65-2.3c0-8.06-4.9-13.46-15.27-13.46-9.79,0-15.26,5-16.34,12.6h8.57c.43-3,2.73-5.4,7.63-5.4,4.39,0,6.55,1.94,6.55,4.32,0,3.09-4,3.88-8.85,4.39-6.63.72-14.84,3-14.84,11.66,0,6.7,5,11,12.89,11,6.19,0,10.08-2.59,12-6.7.28,3.67,3,6.05,6.84,6.05h5v-7.7h-4.25Zm-8.5,9.36c0,5-4.32,8.64-9.57,8.64-3.24,0-6-1.37-6-4.25,0-3.67,4.39-4.68,8.42-5.11s6-1.22,7.13-2.88ZM281.09,15c-11.09,0-19.23,8.35-19.23,19.36,0,11.6,8.72,19.3,19.37,19.3,9,0,16.06-5.33,17.86-12.89h-9c-1.3,3.31-4.47,5.19-8.71,5.19-5.55,0-9.72-3.46-10.66-9.51H299.3V33.12C299.3,22.46,291.53,15,281.09,15Zm-9.87,15.26c1.37-5.18,5.26-7.7,9.72-7.7,4.9,0,8.64,2.8,9.51,7.7ZM19.3,23a9.84,9.84,0,0,1,9.5,7h9.14c-1.65-8.93-9-15-18.57-15A19,19,0,0,0,0,34.34c0,11.09,8.28,19.3,19.37,19.3,9.36,0,16.85-6,18.5-15H28.8a9.75,9.75,0,0,1-9.43,7.06c-6.27,0-10.66-4.83-10.66-11.31S13,23,19.3,23Zm41.11-8A19,19,0,0,0,41,34.34c0,11.09,8.28,19.3,19.37,19.3A19,19,0,0,0,79.92,34.27C79.92,23.33,71.64,15,60.41,15Zm.07,30.67c-6.19,0-10.73-4.83-10.73-11.31S54.22,23,60.41,23s10.8,4.89,10.8,11.37S66.67,45.65,60.48,45.65ZM123.41,15c-5.62,0-9.29,2.3-11.45,5.54V15.7h-8.57V52.92H112V32.69C112,27,115.63,23,121,23c5,0,8.06,3.53,8.06,8.64V52.92h8.64V31C137.66,21.6,132.84,15,123.41,15ZM92,.36a5.36,5.36,0,0,0-5.55,5.47,5.55,5.55,0,0,0,11.09,0A5.35,5.35,0,0,0,92,.36Zm-9.72,23h5.4V52.92h8.64V15.7h-14Zm298.17-7.7L366.2,52.92H372L375.29,44H392l3.33,8.88h6L386.87,15.7ZM377,39.23l6.45-17.56h.1l6.56,17.56ZM362.66,15.7l-7.88,29h-.11l-8.14-29H341l-8,28.93h-.1l-8-28.87H319L329.82,53h5.45l8.19-29.24h.11L352,53h5.66L368.1,15.7Zm135.25,0v4.86h12.32V52.92h5.6V20.56h12.32V15.7ZM467.82,52.92h25.54V48.06H473.43v-12h18.35V31.35H473.43V20.56h19.93V15.7H467.82ZM443,15.7h-5.6V52.92h24.32V48.06H443Zm-30.45,0h-5.61V52.92h24.32V48.06H412.52Z'/%3E%3C/svg%3E`;case"textWithLogo":return s=(.25*e).toFixed(2),`data:image/svg+xml,%3Csvg width='${e}' height='${s}' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 308.44 77.61'%3E%3Cdefs%3E%3Cstyle%3E.cls-1%7Bfill:%230052ff;%7D%3C/style%3E%3C/defs%3E%3Cpath class='cls-1' d='M142.94,20.2l-7.88,29H135l-8.15-29h-5.55l-8,28.93h-.11l-8-28.87H99.27l10.84,37.27h5.44l8.2-29.24h.1l8.41,29.24h5.66L148.39,20.2Zm17.82,0L146.48,57.42h5.82l3.28-8.88h16.65l3.34,8.88h6L167.16,20.2Zm-3.44,23.52,6.45-17.55h.11l6.56,17.55ZM278.2,20.2v4.86h12.32V57.42h5.6V25.06h12.32V20.2ZM248.11,57.42h25.54V52.55H253.71V40.61h18.35V35.85H253.71V25.06h19.94V20.2H248.11ZM223.26,20.2h-5.61V57.42H242V52.55H223.26Zm-30.46,0h-5.6V57.42h24.32V52.55H192.8Zm-154,38A19.41,19.41,0,1,1,57.92,35.57H77.47a38.81,38.81,0,1,0,0,6.47H57.92A19.39,19.39,0,0,1,38.81,58.21Z'/%3E%3C/svg%3E`;case"textLight":return s=(.1*e).toFixed(2),`data:image/svg+xml,%3Csvg width='${e}' height='${s}' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 528.15 53.64'%3E%3Cdefs%3E%3Cstyle%3E.cls-1%7Bfill:%23fefefe;%7D%3C/style%3E%3C/defs%3E%3Ctitle%3ECoinbase_Wordmark_SubBrands_ALL%3C/title%3E%3Cpath class='cls-1' d='M164.45,15a15,15,0,0,0-11.74,5.4V0h-8.64V52.92h8.5V48a15,15,0,0,0,11.88,5.62c10.37,0,18.21-8.21,18.21-19.3S174.67,15,164.45,15Zm-1.3,30.67c-6.19,0-10.73-4.83-10.73-11.31S157,23,163.22,23s10.66,4.82,10.66,11.37S169.34,45.65,163.15,45.65Zm83.31-14.91-6.34-.93c-3-.43-5.18-1.44-5.18-3.82,0-2.59,2.8-3.89,6.62-3.89,4.18,0,6.84,1.8,7.42,4.76h8.35c-.94-7.49-6.7-11.88-15.55-11.88-9.15,0-15.2,4.68-15.2,11.3,0,6.34,4,10,12,11.16l6.33.94c3.1.43,4.83,1.65,4.83,4,0,2.95-3,4.17-7.2,4.17-5.12,0-8-2.09-8.43-5.25h-8.49c.79,7.27,6.48,12.38,16.84,12.38,9.44,0,15.7-4.32,15.7-11.74C258.12,35.28,253.58,31.82,246.46,30.74Zm-27.65-2.3c0-8.06-4.9-13.46-15.27-13.46-9.79,0-15.26,5-16.34,12.6h8.57c.43-3,2.73-5.4,7.63-5.4,4.39,0,6.55,1.94,6.55,4.32,0,3.09-4,3.88-8.85,4.39-6.63.72-14.84,3-14.84,11.66,0,6.7,5,11,12.89,11,6.19,0,10.08-2.59,12-6.7.28,3.67,3,6.05,6.84,6.05h5v-7.7h-4.25Zm-8.5,9.36c0,5-4.32,8.64-9.57,8.64-3.24,0-6-1.37-6-4.25,0-3.67,4.39-4.68,8.42-5.11s6-1.22,7.13-2.88ZM281.09,15c-11.09,0-19.23,8.35-19.23,19.36,0,11.6,8.72,19.3,19.37,19.3,9,0,16.06-5.33,17.86-12.89h-9c-1.3,3.31-4.47,5.19-8.71,5.19-5.55,0-9.72-3.46-10.66-9.51H299.3V33.12C299.3,22.46,291.53,15,281.09,15Zm-9.87,15.26c1.37-5.18,5.26-7.7,9.72-7.7,4.9,0,8.64,2.8,9.51,7.7ZM19.3,23a9.84,9.84,0,0,1,9.5,7h9.14c-1.65-8.93-9-15-18.57-15A19,19,0,0,0,0,34.34c0,11.09,8.28,19.3,19.37,19.3,9.36,0,16.85-6,18.5-15H28.8a9.75,9.75,0,0,1-9.43,7.06c-6.27,0-10.66-4.83-10.66-11.31S13,23,19.3,23Zm41.11-8A19,19,0,0,0,41,34.34c0,11.09,8.28,19.3,19.37,19.3A19,19,0,0,0,79.92,34.27C79.92,23.33,71.64,15,60.41,15Zm.07,30.67c-6.19,0-10.73-4.83-10.73-11.31S54.22,23,60.41,23s10.8,4.89,10.8,11.37S66.67,45.65,60.48,45.65ZM123.41,15c-5.62,0-9.29,2.3-11.45,5.54V15.7h-8.57V52.92H112V32.69C112,27,115.63,23,121,23c5,0,8.06,3.53,8.06,8.64V52.92h8.64V31C137.66,21.6,132.84,15,123.41,15ZM92,.36a5.36,5.36,0,0,0-5.55,5.47,5.55,5.55,0,0,0,11.09,0A5.35,5.35,0,0,0,92,.36Zm-9.72,23h5.4V52.92h8.64V15.7h-14Zm298.17-7.7L366.2,52.92H372L375.29,44H392l3.33,8.88h6L386.87,15.7ZM377,39.23l6.45-17.56h.1l6.56,17.56ZM362.66,15.7l-7.88,29h-.11l-8.14-29H341l-8,28.93h-.1l-8-28.87H319L329.82,53h5.45l8.19-29.24h.11L352,53h5.66L368.1,15.7Zm135.25,0v4.86h12.32V52.92h5.6V20.56h12.32V15.7ZM467.82,52.92h25.54V48.06H473.43v-12h18.35V31.35H473.43V20.56h19.93V15.7H467.82ZM443,15.7h-5.6V52.92h24.32V48.06H443Zm-30.45,0h-5.61V52.92h24.32V48.06H412.52Z'/%3E%3C/svg%3E`;case"textWithLogoLight":return s=(.25*e).toFixed(2),`data:image/svg+xml,%3Csvg width='${e}' height='${s}' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 308.44 77.61'%3E%3Cdefs%3E%3Cstyle%3E.cls-1%7Bfill:%23fefefe;%7D%3C/style%3E%3C/defs%3E%3Cpath class='cls-1' d='M142.94,20.2l-7.88,29H135l-8.15-29h-5.55l-8,28.93h-.11l-8-28.87H99.27l10.84,37.27h5.44l8.2-29.24h.1l8.41,29.24h5.66L148.39,20.2Zm17.82,0L146.48,57.42h5.82l3.28-8.88h16.65l3.34,8.88h6L167.16,20.2Zm-3.44,23.52,6.45-17.55h.11l6.56,17.55ZM278.2,20.2v4.86h12.32V57.42h5.6V25.06h12.32V20.2ZM248.11,57.42h25.54V52.55H253.71V40.61h18.35V35.85H253.71V25.06h19.94V20.2H248.11ZM223.26,20.2h-5.61V57.42H242V52.55H223.26Zm-30.46,0h-5.6V57.42h24.32V52.55H192.8Zm-154,38A19.41,19.41,0,1,1,57.92,35.57H77.47a38.81,38.81,0,1,0,0,6.47H57.92A19.39,19.39,0,0,1,38.81,58.21Z'/%3E%3C/svg%3E`;default:return s=e,`data:image/svg+xml,%3Csvg width='${e}' height='${s}' viewBox='0 0 1024 1024' fill='none' xmlns='http://www.w3.org/2000/svg'%3E %3Crect width='1024' height='1024' fill='%230052FF'/%3E %3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M152 512C152 710.823 313.177 872 512 872C710.823 872 872 710.823 872 512C872 313.177 710.823 152 512 152C313.177 152 152 313.177 152 512ZM420 396C406.745 396 396 406.745 396 420V604C396 617.255 406.745 628 420 628H604C617.255 628 628 617.255 628 604V420C628 406.745 617.255 396 604 396H420Z' fill='white'/%3E %3C/svg%3E `}};class v{constructor(e,s){this.scope=e,this.module=s}storeObject(e,s){this.setItem(e,JSON.stringify(s))}loadObject(e){const s=this.getItem(e);return s?JSON.parse(s):void 0}setItem(e,s){localStorage.setItem(this.scopedKey(e),s)}getItem(e){return localStorage.getItem(this.scopedKey(e))}removeItem(e){localStorage.removeItem(this.scopedKey(e))}clear(){const e=this.scopedKey(""),s=[];for(let n=0;nlocalStorage.removeItem(n))}scopedKey(e){return`-${this.scope}${this.module?`:${this.module}`:""}:${e}`}static clearAll(){new v("CBWSDK").clear(),new v("walletlink").clear()}}const u={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}},J={"-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."}},Ie="Unspecified error message.",ut="Unspecified server error.";function te(t,e=Ie){if(t&&Number.isInteger(t)){const s=t.toString();if(Q(J,s))return J[s].message;if(Se(t))return ut}return e}function pt(t){if(!Number.isInteger(t))return!1;const e=t.toString();return!!(J[e]||Se(t))}function ft(t,{shouldIncludeStack:e=!1}={}){const s={};if(t&&typeof t=="object"&&!Array.isArray(t)&&Q(t,"code")&&pt(t.code)){const n=t;s.code=n.code,n.message&&typeof n.message=="string"?(s.message=n.message,Q(n,"data")&&(s.data=n.data)):(s.message=te(s.code),s.data={originalError:oe(t)})}else s.code=u.rpc.internal,s.message=ce(t,"message")?t.message:Ie,s.data={originalError:oe(t)};return e&&(s.stack=ce(t,"stack")?t.stack:void 0),s}function Se(t){return t>=-32099&&t<=-32e3}function oe(t){return t&&typeof t=="object"&&!Array.isArray(t)?Object.assign({},t):t}function Q(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function ce(t,e){return typeof t=="object"&&t!==null&&e in t&&typeof t[e]=="string"}const l={rpc:{parse:t=>b(u.rpc.parse,t),invalidRequest:t=>b(u.rpc.invalidRequest,t),invalidParams:t=>b(u.rpc.invalidParams,t),methodNotFound:t=>b(u.rpc.methodNotFound,t),internal:t=>b(u.rpc.internal,t),server:t=>{if(!t||typeof t!="object"||Array.isArray(t))throw new Error("Ethereum RPC Server errors must provide single object argument.");const{code:e}=t;if(!Number.isInteger(e)||e>-32005||e<-32099)throw new Error('"code" must be an integer such that: -32099 <= code <= -32005');return b(e,t)},invalidInput:t=>b(u.rpc.invalidInput,t),resourceNotFound:t=>b(u.rpc.resourceNotFound,t),resourceUnavailable:t=>b(u.rpc.resourceUnavailable,t),transactionRejected:t=>b(u.rpc.transactionRejected,t),methodNotSupported:t=>b(u.rpc.methodNotSupported,t),limitExceeded:t=>b(u.rpc.limitExceeded,t)},provider:{userRejectedRequest:t=>P(u.provider.userRejectedRequest,t),unauthorized:t=>P(u.provider.unauthorized,t),unsupportedMethod:t=>P(u.provider.unsupportedMethod,t),disconnected:t=>P(u.provider.disconnected,t),chainDisconnected:t=>P(u.provider.chainDisconnected,t),unsupportedChain:t=>P(u.provider.unsupportedChain,t),custom:t=>{if(!t||typeof t!="object"||Array.isArray(t))throw new Error("Ethereum Provider custom errors must provide single object argument.");const{code:e,message:s,data:n}=t;if(!s||typeof s!="string")throw new Error('"message" must be a nonempty string');return new Ae(e,s,n)}}};function b(t,e){const[s,n]=Me(e);return new xe(t,s||te(t),n)}function P(t,e){const[s,n]=Me(e);return new Ae(t,s||te(t),n)}function Me(t){if(t){if(typeof t=="string")return[t];if(typeof t=="object"&&!Array.isArray(t)){const{message:e,data:s}=t;if(e&&typeof e!="string")throw new Error("Must specify string message.");return[e||void 0,s]}}return[]}class xe extends Error{constructor(e,s,n){if(!Number.isInteger(e))throw new Error('"code" must be an integer.');if(!s||typeof s!="string")throw new Error('"message" must be a nonempty string.');super(s),this.code=e,n!==void 0&&(this.data=n)}}class Ae extends xe{constructor(e,s,n){if(!gt(e))throw new Error('"code" must be an integer such that: 1000 <= code <= 4999');super(e,s,n)}}function gt(t){return Number.isInteger(t)&&t>=1e3&&t<=4999}function se(){return t=>t}const B=se(),mt=se(),wt=se();function I(t){return Math.floor(t)}const _e=/^[0-9]*$/,Le=/^[a-f0-9]*$/;function _(t){return ne(crypto.getRandomValues(new Uint8Array(t)))}function ne(t){return[...t].map(e=>e.toString(16).padStart(2,"0")).join("")}function H(t){return new Uint8Array(t.match(/.{1,2}/g).map(e=>Number.parseInt(e,16)))}function O(t,e=!1){const s=t.toString("hex");return B(e?`0x${s}`:s)}function z(t){return O(X(t),!0)}function k(t){return wt(t.toString(10))}function A(t){return B(`0x${BigInt(t).toString(16)}`)}function Pe(t){return t.startsWith("0x")||t.startsWith("0X")}function ie(t){return Pe(t)?t.slice(2):t}function Re(t){return Pe(t)?`0x${t.slice(2)}`:`0x${t}`}function K(t){if(typeof t!="string")return!1;const e=ie(t).toLowerCase();return Le.test(e)}function bt(t,e=!1){if(typeof t=="string"){const s=ie(t).toLowerCase();if(Le.test(s))return B(e?`0x${s}`:s)}throw l.rpc.invalidParams(`"${String(t)}" is not a hexadecimal string`)}function re(t,e=!1){let s=bt(t,!1);return s.length%2===1&&(s=B(`0${s}`)),e?B(`0x${s}`):s}function x(t){if(typeof t=="string"){const e=ie(t).toLowerCase();if(K(e)&&e.length===40)return mt(Re(e))}throw l.rpc.invalidParams(`Invalid Ethereum address: ${String(t)}`)}function X(t){if(Buffer.isBuffer(t))return t;if(typeof t=="string"){if(K(t)){const e=re(t,!1);return Buffer.from(e,"hex")}return Buffer.from(t,"utf8")}throw l.rpc.invalidParams(`Not binary data: ${String(t)}`)}function j(t){if(typeof t=="number"&&Number.isInteger(t))return I(t);if(typeof t=="string"){if(_e.test(t))return I(Number(t));if(K(t))return I(Number(BigInt(re(t,!0))))}throw l.rpc.invalidParams(`Not an integer: ${String(t)}`)}function D(t){if(t!==null&&(typeof t=="bigint"||vt(t)))return BigInt(t.toString(10));if(typeof t=="number")return BigInt(j(t));if(typeof t=="string"){if(_e.test(t))return BigInt(t);if(K(t))return BigInt(re(t,!0))}throw l.rpc.invalidParams(`Not an integer: ${String(t)}`)}function yt(t){if(typeof t=="string")return JSON.parse(t);if(typeof t=="object")return t;throw l.rpc.invalidParams(`Not a JSON string or an object: ${String(t)}`)}function vt(t){if(t==null||typeof t.constructor!="function")return!1;const{constructor:e}=t;return typeof e.config=="function"&&typeof e.EUCLID=="number"}function kt(){const t=document.querySelector('link[sizes="192x192"]')||document.querySelector('link[sizes="180x180"]')||document.querySelector('link[rel="icon"]')||document.querySelector('link[rel="shortcut icon"]'),{protocol:e,host:s}=document.location,n=t?t.getAttribute("href"):null;return!n||n.startsWith("javascript:")||n.startsWith("vbscript:")?`${e}//${s}/favicon.ico`:n.startsWith("http://")||n.startsWith("https://")||n.startsWith("data:")?n:n.startsWith("//")?e+n:`${e}//${s}${n}`}async function Et(){return crypto.subtle.generateKey({name:"ECDH",namedCurve:"P-256"},!0,["deriveKey"])}async function Ct(t,e){return crypto.subtle.deriveKey({name:"ECDH",public:e},t,{name:"AES-GCM",length:256},!1,["encrypt","decrypt"])}async function It(t,e){const s=crypto.getRandomValues(new Uint8Array(12)),n=await crypto.subtle.encrypt({name:"AES-GCM",iv:s},t,new TextEncoder().encode(e));return{iv:s,cipherText:n}}async function St(t,{iv:e,cipherText:s}){const n=await crypto.subtle.decrypt({name:"AES-GCM",iv:e},t,s);return new TextDecoder().decode(n)}function Ne(t){switch(t){case"public":return"spki";case"private":return"pkcs8"}}async function Te(t,e){const s=Ne(t),n=await crypto.subtle.exportKey(s,e);return ne(new Uint8Array(n))}async function De(t,e){const s=Ne(t),n=H(e).buffer;return await crypto.subtle.importKey(s,new Uint8Array(n),{name:"ECDH",namedCurve:"P-256"},!0,t==="private"?["deriveKey"]:[])}async function Mt(t,e){const s=JSON.stringify(t,(n,i)=>{if(!(i instanceof Error))return i;const r=i;return Object.assign(Object.assign({},r.code?{code:r.code}:{}),{message:r.message})});return It(e,s)}async function xt(t,e){return JSON.parse(await St(e,t))}const Z={storageKey:"ownPrivateKey",keyType:"private"},F={storageKey:"ownPublicKey",keyType:"public"},$={storageKey:"peerPublicKey",keyType:"public"};class At{constructor(){this.storage=new v("CBWSDK","SCWKeyManager"),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(e){this.sharedSecret=null,this.peerPublicKey=e,await this.storeKey($,e),await this.loadKeysIfNeeded()}async clear(){this.ownPrivateKey=null,this.ownPublicKey=null,this.peerPublicKey=null,this.sharedSecret=null,this.storage.removeItem(F.storageKey),this.storage.removeItem(Z.storageKey),this.storage.removeItem($.storageKey)}async generateKeyPair(){const e=await Et();this.ownPrivateKey=e.privateKey,this.ownPublicKey=e.publicKey,await this.storeKey(Z,e.privateKey),await this.storeKey(F,e.publicKey)}async loadKeysIfNeeded(){if(this.ownPrivateKey===null&&(this.ownPrivateKey=await this.loadKey(Z)),this.ownPublicKey===null&&(this.ownPublicKey=await this.loadKey(F)),(this.ownPrivateKey===null||this.ownPublicKey===null)&&await this.generateKeyPair(),this.peerPublicKey===null&&(this.peerPublicKey=await this.loadKey($)),this.sharedSecret===null){if(this.ownPrivateKey===null||this.peerPublicKey===null)return;this.sharedSecret=await Ct(this.ownPrivateKey,this.peerPublicKey)}}async loadKey(e){const s=this.storage.getItem(e.storageKey);return s?De(e.keyType,s):null}async storeKey(e,s){const n=await Te(e.keyType,s);this.storage.setItem(e.storageKey,n)}}const T="4.2.1",Oe="@coinbase/wallet-sdk";async function je(t,e){const s=Object.assign(Object.assign({},t),{jsonrpc:"2.0",id:crypto.randomUUID()}),n=await window.fetch(e,{method:"POST",body:JSON.stringify(s),mode:"cors",headers:{"Content-Type":"application/json","X-Cbw-Sdk-Version":T,"X-Cbw-Sdk-Platform":Oe}}),{result:i,error:r}=await n.json();if(r)throw r;return i}function _t(){return globalThis.coinbaseWalletExtension}function Lt(){var t,e;try{const s=globalThis;return(t=s.ethereum)!==null&&t!==void 0?t:(e=s.top)===null||e===void 0?void 0:e.ethereum}catch{return}}function Ue({metadata:t,preference:e}){var s,n;const{appName:i,appLogoUrl:r,appChainIds:a}=t;if(e.options!=="smartWalletOnly"){const c=_t();if(c)return(s=c.setAppInfo)===null||s===void 0||s.call(c,i,r,a,e),c}const o=Lt();if(o!=null&&o.isCoinbaseBrowser)return(n=o.setAppInfo)===null||n===void 0||n.call(o,i,r,a,e),o}function Pt(t){if(!t||typeof t!="object"||Array.isArray(t))throw l.rpc.invalidParams({message:"Expected a single, non-array, object argument.",data:t});const{method:e,params:s}=t;if(typeof e!="string"||e.length===0)throw l.rpc.invalidParams({message:"'args.method' must be a non-empty string.",data:t});if(s!==void 0&&!Array.isArray(s)&&(typeof s!="object"||s===null))throw l.rpc.invalidParams({message:"'args.params' must be an object or array if provided.",data:t});switch(e){case"eth_sign":case"eth_signTypedData_v2":case"eth_subscribe":case"eth_unsubscribe":throw l.provider.unsupportedMethod()}}const de="accounts",le="activeChain",he="availableChains",ue="walletCapabilities";class Rt{constructor(e){var s,n,i;this.metadata=e.metadata,this.communicator=e.communicator,this.callback=e.callback,this.keyManager=new At,this.storage=new v("CBWSDK","SCWStateManager"),this.accounts=(s=this.storage.loadObject(de))!==null&&s!==void 0?s:[],this.chain=this.storage.loadObject(le)||{id:(i=(n=e.metadata.appChainIds)===null||n===void 0?void 0:n[0])!==null&&i!==void 0?i:1},this.handshake=this.handshake.bind(this),this.request=this.request.bind(this),this.createRequestMessage=this.createRequestMessage.bind(this),this.decryptResponseMessage=this.decryptResponseMessage.bind(this)}async handshake(e){var s,n;const i=await this.createRequestMessage({handshake:{method:e.method,params:Object.assign({},this.metadata,(s=e.params)!==null&&s!==void 0?s:{})}}),r=await this.communicator.postRequestAndWaitForResponse(i);if("failure"in r.content)throw r.content.failure;const a=await De("public",r.sender);await this.keyManager.setPeerPublicKey(a);const c=(await this.decryptResponseMessage(r)).result;if("error"in c)throw c.error;const d=c.value;this.accounts=d,this.storage.storeObject(de,d),(n=this.callback)===null||n===void 0||n.call(this,"accountsChanged",d)}async request(e){var s;if(this.accounts.length===0)throw l.provider.unauthorized();switch(e.method){case"eth_requestAccounts":return(s=this.callback)===null||s===void 0||s.call(this,"connect",{chainId:A(this.chain.id)}),this.accounts;case"eth_accounts":return this.accounts;case"eth_coinbase":return this.accounts[0];case"net_version":return this.chain.id;case"eth_chainId":return A(this.chain.id);case"wallet_getCapabilities":return this.storage.loadObject(ue);case"wallet_switchEthereumChain":return this.handleSwitchChainRequest(e);case"eth_ecRecover":case"personal_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(e);default:if(!this.chain.rpcUrl)throw l.rpc.internal("No RPC URL set for chain");return je(e,this.chain.rpcUrl)}}async sendRequestToPopup(e){var s,n;await((n=(s=this.communicator).waitForPopupLoaded)===null||n===void 0?void 0:n.call(s));const i=await this.sendEncryptedRequest(e),a=(await this.decryptResponseMessage(i)).result;if("error"in a)throw a.error;return a.value}async cleanup(){var e,s;this.storage.clear(),await this.keyManager.clear(),this.accounts=[],this.chain={id:(s=(e=this.metadata.appChainIds)===null||e===void 0?void 0:e[0])!==null&&s!==void 0?s:1}}async handleSwitchChainRequest(e){var s;const n=e.params;if(!n||!(!((s=n[0])===null||s===void 0)&&s.chainId))throw l.rpc.invalidParams();const i=j(n[0].chainId);if(this.updateChain(i))return null;const a=await this.sendRequestToPopup(e);return a===null&&this.updateChain(i),a}async sendEncryptedRequest(e){const s=await this.keyManager.getSharedSecret();if(!s)throw l.provider.unauthorized("No valid session found, try requestAccounts before other methods");const n=await Mt({action:e,chainId:this.chain.id},s),i=await this.createRequestMessage({encrypted:n});return this.communicator.postRequestAndWaitForResponse(i)}async createRequestMessage(e){const s=await Te("public",await this.keyManager.getOwnPublicKey());return{id:crypto.randomUUID(),sender:s,content:e,timestamp:new Date}}async decryptResponseMessage(e){var s,n;const i=e.content;if("failure"in i)throw i.failure;const r=await this.keyManager.getSharedSecret();if(!r)throw l.provider.unauthorized("Invalid session");const a=await xt(i.encrypted,r),o=(s=a.data)===null||s===void 0?void 0:s.chains;if(o){const d=Object.entries(o).map(([g,p])=>({id:Number(g),rpcUrl:p}));this.storage.storeObject(he,d),this.updateChain(this.chain.id,d)}const c=(n=a.data)===null||n===void 0?void 0:n.capabilities;return c&&this.storage.storeObject(ue,c),a}updateChain(e,s){var n;const i=s??this.storage.loadObject(he),r=i==null?void 0:i.find(a=>a.id===e);return r?(r!==this.chain&&(this.chain=r,this.storage.storeObject(le,r),(n=this.callback)===null||n===void 0||n.call(this,"chainChanged",A(r.id))),!0):!1}}const Nt=rt(at),{keccak_256:Tt}=Nt;function We(t){return Buffer.allocUnsafe(t).fill(0)}function Dt(t){return t.toString(2).length}function Be(t,e){let s=t.toString(16);s.length%2!==0&&(s="0"+s);const n=s.match(/.{1,2}/g).map(i=>parseInt(i,16));for(;n.length"u")throw new Error("Not an array?");if(s=Ze(t),s!=="dynamic"&&s!==0&&e.length>s)throw new Error("Elements exceed array size: "+s);i=[],t=t.slice(0,t.lastIndexOf("[")),typeof e=="string"&&(e=JSON.parse(e));for(r in e)i.push(E(t,e[r]));if(s==="dynamic"){var a=E("uint256",e.length);i.unshift(a)}return Buffer.concat(i)}else{if(t==="bytes")return e=new Buffer(e),i=Buffer.concat([E("uint256",e.length),e]),e.length%32!==0&&(i=Buffer.concat([i,w.zeros(32-e.length%32)])),i;if(t.startsWith("bytes")){if(s=R(t),s<1||s>32)throw new Error("Invalid bytes width: "+s);return w.setLengthRight(e,32)}else if(t.startsWith("uint")){if(s=R(t),s%8||s<8||s>256)throw new Error("Invalid uint width: "+s);n=L(e);const o=w.bitLengthFromBigInt(n);if(o>s)throw new Error("Supplied uint exceeds width: "+s+" vs "+o);if(n<0)throw new Error("Supplied uint is negative");return w.bufferBEFromBigInt(n,32)}else if(t.startsWith("int")){if(s=R(t),s%8||s<8||s>256)throw new Error("Invalid int width: "+s);n=L(e);const o=w.bitLengthFromBigInt(n);if(o>s)throw new Error("Supplied int exceeds width: "+s+" vs "+o);const c=w.twosFromBigInt(n,256);return w.bufferBEFromBigInt(c,32)}else if(t.startsWith("ufixed")){if(s=pe(t),n=L(e),n<0)throw new Error("Supplied ufixed is negative");return E("uint256",n*BigInt(2)**BigInt(s[1]))}else if(t.startsWith("fixed"))return s=pe(t),E("int256",L(e)*BigInt(2)**BigInt(s[1]))}throw new Error("Unsupported or invalid type: "+t)}function qt(t){return t==="string"||t==="bytes"||Ze(t)==="dynamic"}function Ht(t){return t.lastIndexOf("]")===t.length-1}function Kt(t,e){var s=[],n=[],i=32*t.length;for(var r in t){var a=ze(t[r]),o=e[r],c=E(a,o);qt(a)?(s.push(E("uint256",i)),n.push(c),i+=c.length):s.push(c)}return Buffer.concat(s.concat(n))}function Fe(t,e){if(t.length!==e.length)throw new Error("Number of types are not matching the values");for(var s,n,i=[],r=0;r32)throw new Error("Invalid bytes width: "+s);i.push(w.setLengthRight(o,s))}else if(a.startsWith("uint")){if(s=R(a),s%8||s<8||s>256)throw new Error("Invalid uint width: "+s);n=L(o);const c=w.bitLengthFromBigInt(n);if(c>s)throw new Error("Supplied uint exceeds width: "+s+" vs "+c);i.push(w.bufferBEFromBigInt(n,s/8))}else if(a.startsWith("int")){if(s=R(a),s%8||s<8||s>256)throw new Error("Invalid int width: "+s);n=L(o);const c=w.bitLengthFromBigInt(n);if(c>s)throw new Error("Supplied int exceeds width: "+s+" vs "+c);const d=w.twosFromBigInt(n,s);i.push(w.bufferBEFromBigInt(d,s/8))}else throw new Error("Unsupported or invalid type: "+a)}return Buffer.concat(i)}function Vt(t,e){return w.keccak(Fe(t,e))}var zt={rawEncode:Kt,solidityPack:Fe,soliditySHA3:Vt};const y=Ve,U=zt,$e={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"]},G={encodeData(t,e,s,n=!0){const i=["bytes32"],r=[this.hashType(t,s)];if(n){const a=(o,c,d)=>{if(s[c]!==void 0)return["bytes32",d==null?"0x0000000000000000000000000000000000000000000000000000000000000000":y.keccak(this.encodeData(c,d,s,n))];if(d===void 0)throw new Error(`missing value for field ${o} of type ${c}`);if(c==="bytes")return["bytes32",y.keccak(d)];if(c==="string")return typeof d=="string"&&(d=Buffer.from(d,"utf8")),["bytes32",y.keccak(d)];if(c.lastIndexOf("]")===c.length-1){const g=c.slice(0,c.lastIndexOf("[")),p=d.map(f=>a(o,g,f));return["bytes32",y.keccak(U.rawEncode(p.map(([f])=>f),p.map(([,f])=>f)))]}return[c,d]};for(const o of s[t]){const[c,d]=a(o.name,o.type,e[o.name]);i.push(c),r.push(d)}}else for(const a of s[t]){let o=e[a.name];if(o!==void 0)if(a.type==="bytes")i.push("bytes32"),o=y.keccak(o),r.push(o);else if(a.type==="string")i.push("bytes32"),typeof o=="string"&&(o=Buffer.from(o,"utf8")),o=y.keccak(o),r.push(o);else if(s[a.type]!==void 0)i.push("bytes32"),o=y.keccak(this.encodeData(a.type,o,s,n)),r.push(o);else{if(a.type.lastIndexOf("]")===a.type.length-1)throw new Error("Arrays currently unimplemented in encodeData");i.push(a.type),r.push(o)}}return U.rawEncode(i,r)},encodeType(t,e){let s="",n=this.findTypeDependencies(t,e).filter(i=>i!==t);n=[t].concat(n.sort());for(const i of n){if(!e[i])throw new Error("No type definition specified: "+i);s+=i+"("+e[i].map(({name:a,type:o})=>o+" "+a).join(",")+")"}return s},findTypeDependencies(t,e,s=[]){if(t=t.match(/^\w*/)[0],s.includes(t)||e[t]===void 0)return s;s.push(t);for(const n of e[t])for(const i of this.findTypeDependencies(n.type,e,s))!s.includes(i)&&s.push(i);return s},hashStruct(t,e,s,n=!0){return y.keccak(this.encodeData(t,e,s,n))},hashType(t,e){return y.keccak(this.encodeType(t,e))},sanitizeData(t){const e={};for(const s in $e.properties)t[s]&&(e[s]=t[s]);return e.types&&(e.types=Object.assign({EIP712Domain:[]},e.types)),e},hash(t,e=!0){const s=this.sanitizeData(t),n=[Buffer.from("1901","hex")];return n.push(this.hashStruct("EIP712Domain",s.domain,s.types,e)),s.primaryType!=="EIP712Domain"&&n.push(this.hashStruct(s.primaryType,s.message,s.types,e)),y.keccak(Buffer.concat(n))}};var q={TYPED_MESSAGE_SCHEMA:$e,TypedDataUtils:G,hashForSignTypedDataLegacy:function(t){return Zt(t.data)},hashForSignTypedData_v3:function(t){return G.hash(t.data,!1)},hashForSignTypedData_v4:function(t){return G.hash(t.data)}};function Zt(t){const e=new Error("Expect argument to be non-empty array");if(typeof t!="object"||!t.length)throw e;const s=t.map(function(r){return r.type==="bytes"?y.toBuffer(r.value):r.value}),n=t.map(function(r){return r.type}),i=t.map(function(r){if(!r.name)throw e;return r.type+" "+r.name});return U.soliditySHA3(["bytes32","bytes32"],[U.soliditySHA3(new Array(t.length).fill("string"),i),U.soliditySHA3(n,s)])}const Ft="walletUsername",ee="Addresses",$t="AppVersion";function m(t){return t.errorMessage!==void 0}class Gt{constructor(e){this.secret=e}async encrypt(e){const s=this.secret;if(s.length!==64)throw Error("secret must be 256 bits");const n=crypto.getRandomValues(new Uint8Array(12)),i=await crypto.subtle.importKey("raw",H(s),{name:"aes-gcm"},!1,["encrypt","decrypt"]),r=new TextEncoder,a=await window.crypto.subtle.encrypt({name:"AES-GCM",iv:n},i,r.encode(e)),o=16,c=a.slice(a.byteLength-o),d=a.slice(0,a.byteLength-o),g=new Uint8Array(c),p=new Uint8Array(d),f=new Uint8Array([...n,...g,...p]);return ne(f)}async decrypt(e){const s=this.secret;if(s.length!==64)throw Error("secret must be 256 bits");return new Promise((n,i)=>{(async function(){const r=await crypto.subtle.importKey("raw",H(s),{name:"aes-gcm"},!1,["encrypt","decrypt"]),a=H(e),o=a.slice(0,12),c=a.slice(12,28),d=a.slice(28),g=new Uint8Array([...d,...c]),p={name:"AES-GCM",iv:new Uint8Array(o)};try{const f=await window.crypto.subtle.decrypt(p,r,g),C=new TextDecoder;n(C.decode(f))}catch(f){i(f)}})()})}}class Yt{constructor(e,s,n){this.linkAPIUrl=e,this.sessionId=s;const i=`${s}:${n}`;this.auth=`Basic ${btoa(i)}`}async markUnseenEventsAsSeen(e){return Promise.all(e.map(s=>fetch(`${this.linkAPIUrl}/events/${s.eventId}/seen`,{method:"POST",headers:{Authorization:this.auth}}))).catch(s=>console.error("Unabled to mark event as failed:",s))}async fetchUnseenEvents(){var e;const s=await fetch(`${this.linkAPIUrl}/events?unseen=true`,{headers:{Authorization:this.auth}});if(s.ok){const{events:n,error:i}=await s.json();if(i)throw new Error(`Check unseen events failed: ${i}`);const r=(e=n==null?void 0:n.filter(a=>a.event==="Web3Response").map(a=>({type:"Event",sessionId:this.sessionId,eventId:a.id,event:a.event,data:a.data})))!==null&&e!==void 0?e:[];return this.markUnseenEventsAsSeen(r),r}throw new Error(`Check unseen events failed: ${s.status}`)}}var M;(function(t){t[t.DISCONNECTED=0]="DISCONNECTED",t[t.CONNECTING=1]="CONNECTING",t[t.CONNECTED=2]="CONNECTED"})(M||(M={}));class Jt{setConnectionStateListener(e){this.connectionStateListener=e}setIncomingDataListener(e){this.incomingDataListener=e}constructor(e,s=WebSocket){this.WebSocketClass=s,this.webSocket=null,this.pendingData=[],this.url=e.replace(/^http/,"ws")}async connect(){if(this.webSocket)throw new Error("webSocket object is not null");return new Promise((e,s)=>{var n;let i;try{this.webSocket=i=new this.WebSocketClass(this.url)}catch(r){s(r);return}(n=this.connectionStateListener)===null||n===void 0||n.call(this,M.CONNECTING),i.onclose=r=>{var a;this.clearWebSocket(),s(new Error(`websocket error ${r.code}: ${r.reason}`)),(a=this.connectionStateListener)===null||a===void 0||a.call(this,M.DISCONNECTED)},i.onopen=r=>{var a;e(),(a=this.connectionStateListener)===null||a===void 0||a.call(this,M.CONNECTED),this.pendingData.length>0&&([...this.pendingData].forEach(c=>this.sendData(c)),this.pendingData=[])},i.onmessage=r=>{var a,o;if(r.data==="h")(a=this.incomingDataListener)===null||a===void 0||a.call(this,{type:"Heartbeat"});else try{const c=JSON.parse(r.data);(o=this.incomingDataListener)===null||o===void 0||o.call(this,c)}catch{}}})}disconnect(){var e;const{webSocket:s}=this;if(s){this.clearWebSocket(),(e=this.connectionStateListener)===null||e===void 0||e.call(this,M.DISCONNECTED),this.connectionStateListener=void 0,this.incomingDataListener=void 0;try{s.close()}catch{}}}sendData(e){const{webSocket:s}=this;if(!s){this.pendingData.push(e),this.connect();return}s.send(e)}clearWebSocket(){const{webSocket:e}=this;e&&(this.webSocket=null,e.onclose=null,e.onerror=null,e.onmessage=null,e.onopen=null)}}const fe=1e4,Qt=6e4;class Xt{constructor({session:e,linkAPIUrl:s,listener:n}){this.destroyed=!1,this.lastHeartbeatResponse=0,this.nextReqId=I(1),this._connected=!1,this._linked=!1,this.shouldFetchUnseenEventsOnConnect=!1,this.requestResolutions=new Map,this.handleSessionMetadataUpdated=r=>{if(!r)return;new Map([["__destroyed",this.handleDestroyed],["EthereumAddress",this.handleAccountUpdated],["WalletUsername",this.handleWalletUsernameUpdated],["AppVersion",this.handleAppVersionUpdated],["ChainId",o=>r.JsonRpcUrl&&this.handleChainUpdated(o,r.JsonRpcUrl)]]).forEach((o,c)=>{const d=r[c];d!==void 0&&o(d)})},this.handleDestroyed=r=>{var a;r==="1"&&((a=this.listener)===null||a===void 0||a.resetAndReload())},this.handleAccountUpdated=async r=>{var a;const o=await this.cipher.decrypt(r);(a=this.listener)===null||a===void 0||a.accountUpdated(o)},this.handleMetadataUpdated=async(r,a)=>{var o;const c=await this.cipher.decrypt(a);(o=this.listener)===null||o===void 0||o.metadataUpdated(r,c)},this.handleWalletUsernameUpdated=async r=>{this.handleMetadataUpdated(Ft,r)},this.handleAppVersionUpdated=async r=>{this.handleMetadataUpdated($t,r)},this.handleChainUpdated=async(r,a)=>{var o;const c=await this.cipher.decrypt(r),d=await this.cipher.decrypt(a);(o=this.listener)===null||o===void 0||o.chainUpdated(c,d)},this.session=e,this.cipher=new Gt(e.secret),this.listener=n;const i=new Jt(`${s}/rpc`,WebSocket);i.setConnectionStateListener(async r=>{let a=!1;switch(r){case M.DISCONNECTED:if(!this.destroyed){const o=async()=>{await new Promise(c=>setTimeout(c,5e3)),this.destroyed||i.connect().catch(()=>{o()})};o()}break;case M.CONNECTED:a=await this.handleConnected(),this.updateLastHeartbeat(),setInterval(()=>{this.heartbeat()},fe),this.shouldFetchUnseenEventsOnConnect&&this.fetchUnseenEventsAPI();break;case M.CONNECTING:break}this.connected!==a&&(this.connected=a)}),i.setIncomingDataListener(r=>{var a;switch(r.type){case"Heartbeat":this.updateLastHeartbeat();return;case"IsLinkedOK":case"Linked":{const o=r.type==="IsLinkedOK"?r.linked:void 0;this.linked=o||r.onlineGuests>0;break}case"GetSessionConfigOK":case"SessionConfigUpdated":{this.handleSessionMetadataUpdated(r.metadata);break}case"Event":{this.handleIncomingEvent(r);break}}r.id!==void 0&&((a=this.requestResolutions.get(r.id))===null||a===void 0||a(r))}),this.ws=i,this.http=new Yt(s,e.id,e.key)}connect(){if(this.destroyed)throw new Error("instance is destroyed");this.ws.connect()}async destroy(){this.destroyed||(await this.makeRequest({type:"SetSessionConfig",id:I(this.nextReqId++),sessionId:this.session.id,metadata:{__destroyed:"1"}},{timeout:1e3}),this.destroyed=!0,this.ws.disconnect(),this.listener=void 0)}get connected(){return this._connected}set connected(e){this._connected=e}get linked(){return this._linked}set linked(e){var s,n;this._linked=e,e&&((s=this.onceLinked)===null||s===void 0||s.call(this)),(n=this.listener)===null||n===void 0||n.linkedUpdated(e)}setOnceLinked(e){return new Promise(s=>{this.linked?e().then(s):this.onceLinked=()=>{e().then(s),this.onceLinked=void 0}})}async handleIncomingEvent(e){var s;if(e.type!=="Event"||e.event!=="Web3Response")return;const n=await this.cipher.decrypt(e.data),i=JSON.parse(n);if(i.type!=="WEB3_RESPONSE")return;const{id:r,response:a}=i;(s=this.listener)===null||s===void 0||s.handleWeb3ResponseMessage(r,a)}async checkUnseenEvents(){if(!this.connected){this.shouldFetchUnseenEventsOnConnect=!0;return}await new Promise(e=>setTimeout(e,250));try{await this.fetchUnseenEventsAPI()}catch(e){console.error("Unable to check for unseen events",e)}}async fetchUnseenEventsAPI(){this.shouldFetchUnseenEventsOnConnect=!1,(await this.http.fetchUnseenEvents()).forEach(s=>this.handleIncomingEvent(s))}async publishEvent(e,s,n=!1){const i=await this.cipher.encrypt(JSON.stringify(Object.assign(Object.assign({},s),{origin:location.origin,relaySource:"coinbaseWalletExtension"in window&&window.coinbaseWalletExtension?"injected_sdk":"sdk"}))),r={type:"PublishEvent",id:I(this.nextReqId++),sessionId:this.session.id,event:e,data:i,callWebhook:n};return this.setOnceLinked(async()=>{const a=await this.makeRequest(r);if(a.type==="Fail")throw new Error(a.error||"failed to publish event");return a.eventId})}sendData(e){this.ws.sendData(JSON.stringify(e))}updateLastHeartbeat(){this.lastHeartbeatResponse=Date.now()}heartbeat(){if(Date.now()-this.lastHeartbeatResponse>fe*2){this.ws.disconnect();return}try{this.ws.sendData("h")}catch{}}async makeRequest(e,s={timeout:Qt}){const n=e.id;this.sendData(e);let i;return Promise.race([new Promise((r,a)=>{i=window.setTimeout(()=>{a(new Error(`request ${n} timed out`))},s.timeout)}),new Promise(r=>{this.requestResolutions.set(n,a=>{clearTimeout(i),r(a),this.requestResolutions.delete(n)})})])}async handleConnected(){return(await this.makeRequest({type:"HostSession",id:I(this.nextReqId++),sessionId:this.session.id,sessionKey:this.session.key})).type==="Fail"?!1:(this.sendData({type:"IsLinked",id:I(this.nextReqId++),sessionId:this.session.id}),this.sendData({type:"GetSessionConfig",id:I(this.nextReqId++),sessionId:this.session.id}),!0)}}class es{constructor(){this._nextRequestId=0,this.callbacks=new Map}makeRequestId(){this._nextRequestId=(this._nextRequestId+1)%2147483647;const e=this._nextRequestId,s=Re(e.toString(16));return this.callbacks.get(s)&&this.callbacks.delete(s),e}}const ge="session:id",me="session:secret",we="session:linked";class N{constructor(e,s,n,i=!1){this.storage=e,this.id=s,this.secret=n,this.key=ot(ct(`${s}, ${n} WalletLink`)),this._linked=!!i}static create(e){const s=_(16),n=_(32);return new N(e,s,n).save()}static load(e){const s=e.getItem(ge),n=e.getItem(we),i=e.getItem(me);return s&&i?new N(e,s,i,n==="1"):null}get linked(){return this._linked}set linked(e){this._linked=e,this.persistLinked()}save(){return this.storage.setItem(ge,this.id),this.storage.setItem(me,this.secret),this.persistLinked(),this}persistLinked(){this.storage.setItem(we,this._linked?"1":"0")}}function ts(){try{return window.frameElement!==null}catch{return!1}}function ss(){try{return ts()&&window.top?window.top.location:window.location}catch{return window.location}}function ns(){var t;return/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test((t=window==null?void 0:window.navigator)===null||t===void 0?void 0:t.userAgent)}function Ge(){var t,e;return(e=(t=window==null?void 0:window.matchMedia)===null||t===void 0?void 0:t.call(window,"(prefers-color-scheme: dark)").matches)!==null&&e!==void 0?e:!1}const is='@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 Ye(){const t=document.createElement("style");t.type="text/css",t.appendChild(document.createTextNode(is)),document.documentElement.appendChild(t)}function Je(t){var e,s,n="";if(typeof t=="string"||typeof t=="number")n+=t;else if(typeof t=="object")if(Array.isArray(t))for(e=0;e{this.items.delete(s),this.render()}}clear(){this.items.clear(),this.render()}render(){this.root&&Y(h("div",null,h(Qe,{darkMode:this.darkMode},Array.from(this.items.entries()).map(([e,s])=>h(ds,Object.assign({},s,{key:e}))))),this.root)}}const Qe=t=>h("div",{class:W("-cbwsdk-snackbar-container")},h("style",null,rs),h("div",{class:"-cbwsdk-snackbar"},t.children)),ds=({autoExpand:t,message:e,menuItems:s})=>{const[n,i]=ae(!0),[r,a]=ae(t??!1);lt(()=>{const c=[window.setTimeout(()=>{i(!1)},1),window.setTimeout(()=>{a(!0)},1e4)];return()=>{c.forEach(window.clearTimeout)}});const o=()=>{a(!r)};return h("div",{class:W("-cbwsdk-snackbar-instance",n&&"-cbwsdk-snackbar-instance-hidden",r&&"-cbwsdk-snackbar-instance-expanded")},h("div",{class:"-cbwsdk-snackbar-instance-header",onClick:o},h("img",{src:as,class:"-cbwsdk-snackbar-instance-header-cblogo"})," ",h("div",{class:"-cbwsdk-snackbar-instance-header-message"},e),h("div",{class:"-gear-container"},!r&&h("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},h("circle",{cx:"12",cy:"12",r:"12",fill:"#F5F7F8"})),h("img",{src:os,class:"-gear-icon",title:"Expand"}))),s&&s.length>0&&h("div",{class:"-cbwsdk-snackbar-instance-menu"},s.map((c,d)=>h("div",{class:W("-cbwsdk-snackbar-instance-menu-item",c.isRed&&"-cbwsdk-snackbar-instance-menu-item-is-red"),onClick:c.onClick,key:d},h("svg",{width:c.svgWidth,height:c.svgHeight,viewBox:"0 0 10 11",fill:"none",xmlns:"http://www.w3.org/2000/svg"},h("path",{"fill-rule":c.defaultFillRule,"clip-rule":c.defaultClipRule,d:c.path,fill:"#AAAAAA"})),h("span",{class:W("-cbwsdk-snackbar-instance-menu-item-info",c.isRed&&"-cbwsdk-snackbar-instance-menu-item-info-is-red")},c.info)))))};class ls{constructor(){this.attached=!1,this.snackbar=new cs}attach(){if(this.attached)throw new Error("Coinbase Wallet SDK UI is already attached");const e=document.documentElement,s=document.createElement("div");s.className="-cbwsdk-css-reset",e.appendChild(s),this.snackbar.attach(s),this.attached=!0,Ye()}showConnecting(e){let s;return e.isUnlinkedErrorState?s={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:e.onResetConnection}]}:s={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:e.onCancel},{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:e.onResetConnection}]},this.snackbar.presentItem(s)}}const hs=".-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 us{constructor(){this.root=null,this.darkMode=Ge()}attach(){const e=document.documentElement;this.root=document.createElement("div"),this.root.className="-cbwsdk-css-reset",e.appendChild(this.root),Ye()}present(e){this.render(e)}clear(){this.render(null)}render(e){this.root&&(Y(null,this.root),e&&Y(h(ps,Object.assign({},e,{onDismiss:()=>{this.clear()},darkMode:this.darkMode})),this.root))}}const ps=({title:t,buttonText:e,darkMode:s,onButtonClick:n,onDismiss:i})=>{const r=s?"dark":"light";return h(Qe,{darkMode:s},h("div",{class:"-cbwsdk-redirect-dialog"},h("style",null,hs),h("div",{class:"-cbwsdk-redirect-dialog-backdrop",onClick:i}),h("div",{class:W("-cbwsdk-redirect-dialog-box",r)},h("p",null,t),h("button",{onClick:n},e))))},fs="https://keys.coinbase.com/connect",be="https://www.walletlink.org",gs="https://go.cb-w.com/walletlink";class ye{constructor(){this.attached=!1,this.redirectDialog=new us}attach(){if(this.attached)throw new Error("Coinbase Wallet SDK UI is already attached");this.redirectDialog.attach(),this.attached=!0}redirectToCoinbaseWallet(e){const s=new URL(gs);s.searchParams.append("redirect_url",ss().href),e&&s.searchParams.append("wl_url",e);const n=document.createElement("a");n.target="cbw-opener",n.href=s.href,n.rel="noreferrer noopener",n.click()}openCoinbaseWalletDeeplink(e){this.redirectDialog.present({title:"Redirecting to Coinbase Wallet...",buttonText:"Open",onButtonClick:()=>{this.redirectToCoinbaseWallet(e)}}),setTimeout(()=>{this.redirectToCoinbaseWallet(e)},99)}showConnecting(e){return()=>{this.redirectDialog.clear()}}}class S{constructor(e){this.chainCallbackParams={chainId:"",jsonRpcUrl:""},this.isMobileWeb=ns(),this.linkedUpdated=r=>{this.isLinked=r;const a=this.storage.getItem(ee);if(r&&(this._session.linked=r),this.isUnlinkedErrorState=!1,a){const o=a.split(" "),c=this.storage.getItem("IsStandaloneSigning")==="true";o[0]!==""&&!r&&this._session.linked&&!c&&(this.isUnlinkedErrorState=!0)}},this.metadataUpdated=(r,a)=>{this.storage.setItem(r,a)},this.chainUpdated=(r,a)=>{this.chainCallbackParams.chainId===r&&this.chainCallbackParams.jsonRpcUrl===a||(this.chainCallbackParams={chainId:r,jsonRpcUrl:a},this.chainCallback&&this.chainCallback(a,Number.parseInt(r,10)))},this.accountUpdated=r=>{this.accountsCallback&&this.accountsCallback([r]),S.accountRequestCallbackIds.size>0&&(Array.from(S.accountRequestCallbackIds.values()).forEach(a=>{this.invokeCallback(a,{method:"requestEthereumAccounts",result:[r]})}),S.accountRequestCallbackIds.clear())},this.resetAndReload=this.resetAndReload.bind(this),this.linkAPIUrl=e.linkAPIUrl,this.storage=e.storage,this.metadata=e.metadata,this.accountsCallback=e.accountsCallback,this.chainCallback=e.chainCallback;const{session:s,ui:n,connection:i}=this.subscribe();this._session=s,this.connection=i,this.relayEventManager=new es,this.ui=n,this.ui.attach()}subscribe(){const e=N.load(this.storage)||N.create(this.storage),{linkAPIUrl:s}=this,n=new Xt({session:e,linkAPIUrl:s,listener:this}),i=this.isMobileWeb?new ye:new ls;return n.connect(),{session:e,ui:i,connection:n}}resetAndReload(){this.connection.destroy().then(()=>{const e=N.load(this.storage);(e==null?void 0:e.id)===this._session.id&&v.clearAll(),document.location.reload()}).catch(e=>{})}signEthereumTransaction(e){return this.sendRequest({method:"signEthereumTransaction",params:{fromAddress:e.fromAddress,toAddress:e.toAddress,weiValue:k(e.weiValue),data:O(e.data,!0),nonce:e.nonce,gasPriceInWei:e.gasPriceInWei?k(e.gasPriceInWei):null,maxFeePerGas:e.gasPriceInWei?k(e.gasPriceInWei):null,maxPriorityFeePerGas:e.gasPriceInWei?k(e.gasPriceInWei):null,gasLimit:e.gasLimit?k(e.gasLimit):null,chainId:e.chainId,shouldSubmit:!1}})}signAndSubmitEthereumTransaction(e){return this.sendRequest({method:"signEthereumTransaction",params:{fromAddress:e.fromAddress,toAddress:e.toAddress,weiValue:k(e.weiValue),data:O(e.data,!0),nonce:e.nonce,gasPriceInWei:e.gasPriceInWei?k(e.gasPriceInWei):null,maxFeePerGas:e.maxFeePerGas?k(e.maxFeePerGas):null,maxPriorityFeePerGas:e.maxPriorityFeePerGas?k(e.maxPriorityFeePerGas):null,gasLimit:e.gasLimit?k(e.gasLimit):null,chainId:e.chainId,shouldSubmit:!0}})}submitEthereumTransaction(e,s){return this.sendRequest({method:"submitEthereumTransaction",params:{signedTransaction:O(e,!0),chainId:s}})}getWalletLinkSession(){return this._session}sendRequest(e){let s=null;const n=_(8),i=r=>{this.publishWeb3RequestCanceledEvent(n),this.handleErrorResponse(n,e.method,r),s==null||s()};return new Promise((r,a)=>{s=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:i,onResetConnection:this.resetAndReload}),this.relayEventManager.callbacks.set(n,o=>{if(s==null||s(),m(o))return a(new Error(o.errorMessage));r(o)}),this.publishWeb3RequestEvent(n,e)})}publishWeb3RequestEvent(e,s){const n={type:"WEB3_REQUEST",id:e,request:s};this.publishEvent("Web3Request",n,!0).then(i=>{}).catch(i=>{this.handleWeb3ResponseMessage(n.id,{method:s.method,errorMessage:i.message})}),this.isMobileWeb&&this.openCoinbaseWalletDeeplink(s.method)}openCoinbaseWalletDeeplink(e){if(this.ui instanceof ye)switch(e){case"requestEthereumAccounts":case"switchEthereumChain":return;default:window.addEventListener("blur",()=>{window.addEventListener("focus",()=>{this.connection.checkUnseenEvents()},{once:!0})},{once:!0}),this.ui.openCoinbaseWalletDeeplink();break}}publishWeb3RequestCanceledEvent(e){const s={type:"WEB3_REQUEST_CANCELED",id:e};this.publishEvent("Web3RequestCanceled",s,!1).then()}publishEvent(e,s,n){return this.connection.publishEvent(e,s,n)}handleWeb3ResponseMessage(e,s){if(s.method==="requestEthereumAccounts"){S.accountRequestCallbackIds.forEach(n=>this.invokeCallback(n,s)),S.accountRequestCallbackIds.clear();return}this.invokeCallback(e,s)}handleErrorResponse(e,s,n){var i;const r=(i=n==null?void 0:n.message)!==null&&i!==void 0?i:"Unspecified error message.";this.handleWeb3ResponseMessage(e,{method:s,errorMessage:r})}invokeCallback(e,s){const n=this.relayEventManager.callbacks.get(e);n&&(n(s),this.relayEventManager.callbacks.delete(e))}requestEthereumAccounts(){const{appName:e,appLogoUrl:s}=this.metadata,n={method:"requestEthereumAccounts",params:{appName:e,appLogoUrl:s}},i=_(8);return new Promise((r,a)=>{this.relayEventManager.callbacks.set(i,o=>{if(m(o))return a(new Error(o.errorMessage));r(o)}),S.accountRequestCallbackIds.add(i),this.publishWeb3RequestEvent(i,n)})}watchAsset(e,s,n,i,r,a){const o={method:"watchAsset",params:{type:e,options:{address:s,symbol:n,decimals:i,image:r},chainId:a}};let c=null;const d=_(8),g=p=>{this.publishWeb3RequestCanceledEvent(d),this.handleErrorResponse(d,o.method,p),c==null||c()};return c=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:g,onResetConnection:this.resetAndReload}),new Promise((p,f)=>{this.relayEventManager.callbacks.set(d,C=>{if(c==null||c(),m(C))return f(new Error(C.errorMessage));p(C)}),this.publishWeb3RequestEvent(d,o)})}addEthereumChain(e,s,n,i,r,a){const o={method:"addEthereumChain",params:{chainId:e,rpcUrls:s,blockExplorerUrls:i,chainName:r,iconUrls:n,nativeCurrency:a}};let c=null;const d=_(8),g=p=>{this.publishWeb3RequestCanceledEvent(d),this.handleErrorResponse(d,o.method,p),c==null||c()};return c=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:g,onResetConnection:this.resetAndReload}),new Promise((p,f)=>{this.relayEventManager.callbacks.set(d,C=>{if(c==null||c(),m(C))return f(new Error(C.errorMessage));p(C)}),this.publishWeb3RequestEvent(d,o)})}switchEthereumChain(e,s){const n={method:"switchEthereumChain",params:Object.assign({chainId:e},{address:s})};let i=null;const r=_(8),a=o=>{this.publishWeb3RequestCanceledEvent(r),this.handleErrorResponse(r,n.method,o),i==null||i()};return i=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:a,onResetConnection:this.resetAndReload}),new Promise((o,c)=>{this.relayEventManager.callbacks.set(r,d=>{if(i==null||i(),m(d)&&d.errorCode)return c(l.provider.custom({code:d.errorCode,message:"Unrecognized chain ID. Try adding the chain using addEthereumChain first."}));if(m(d))return c(new Error(d.errorMessage));o(d)}),this.publishWeb3RequestEvent(r,n)})}}S.accountRequestCallbackIds=new Set;const ve="DefaultChainId",ke="DefaultJsonRpcUrl";class Xe{constructor(e){this._relay=null,this._addresses=[],this.metadata=e.metadata,this._storage=new v("walletlink",be),this.callback=e.callback||null;const s=this._storage.getItem(ee);if(s){const n=s.split(" ");n[0]!==""&&(this._addresses=n.map(i=>x(i)))}this.initializeRelay()}getSession(){const e=this.initializeRelay(),{id:s,secret:n}=e.getWalletLinkSession();return{id:s,secret:n}}async handshake(){await this._eth_requestAccounts()}get selectedAddress(){return this._addresses[0]||void 0}get jsonRpcUrl(){var e;return(e=this._storage.getItem(ke))!==null&&e!==void 0?e:void 0}set jsonRpcUrl(e){this._storage.setItem(ke,e)}updateProviderInfo(e,s){var n;this.jsonRpcUrl=e;const i=this.getChainId();this._storage.setItem(ve,s.toString(10)),j(s)!==i&&((n=this.callback)===null||n===void 0||n.call(this,"chainChanged",A(s)))}async watchAsset(e){const s=Array.isArray(e)?e[0]:e;if(!s.type)throw l.rpc.invalidParams("Type is required");if((s==null?void 0:s.type)!=="ERC20")throw l.rpc.invalidParams(`Asset of type '${s.type}' is not supported`);if(!(s!=null&&s.options))throw l.rpc.invalidParams("Options are required");if(!(s!=null&&s.options.address))throw l.rpc.invalidParams("Address is required");const n=this.getChainId(),{address:i,symbol:r,image:a,decimals:o}=s.options,d=await this.initializeRelay().watchAsset(s.type,i,r,o,a,n==null?void 0:n.toString());return m(d)?!1:!!d.result}async addEthereumChain(e){var s,n;const i=e[0];if(((s=i.rpcUrls)===null||s===void 0?void 0:s.length)===0)throw l.rpc.invalidParams("please pass in at least 1 rpcUrl");if(!i.chainName||i.chainName.trim()==="")throw l.rpc.invalidParams("chainName is a required field");if(!i.nativeCurrency)throw l.rpc.invalidParams("nativeCurrency is a required field");const r=Number.parseInt(i.chainId,16);if(r===this.getChainId())return!1;const a=this.initializeRelay(),{rpcUrls:o=[],blockExplorerUrls:c=[],chainName:d,iconUrls:g=[],nativeCurrency:p}=i,f=await a.addEthereumChain(r.toString(),o,g,c,d,p);if(m(f))return!1;if(((n=f.result)===null||n===void 0?void 0:n.isApproved)===!0)return this.updateProviderInfo(o[0],r),null;throw l.rpc.internal("unable to add ethereum chain")}async switchEthereumChain(e){const s=e[0],n=Number.parseInt(s.chainId,16),r=await this.initializeRelay().switchEthereumChain(n.toString(10),this.selectedAddress||void 0);if(m(r))throw r;const a=r.result;return a.isApproved&&a.rpcUrl.length>0&&this.updateProviderInfo(a.rpcUrl,n),null}async cleanup(){this.callback=null,this._relay&&this._relay.resetAndReload(),this._storage.clear()}_setAddresses(e,s){var n;if(!Array.isArray(e))throw new Error("addresses is not an array");const i=e.map(r=>x(r));JSON.stringify(i)!==JSON.stringify(this._addresses)&&(this._addresses=i,(n=this.callback)===null||n===void 0||n.call(this,"accountsChanged",i),this._storage.setItem(ee,i.join(" ")))}async request(e){const s=e.params||[];switch(e.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 A(this.getChainId());case"eth_requestAccounts":return this._eth_requestAccounts();case"eth_ecRecover":case"personal_ecRecover":return this.ecRecover(e);case"personal_sign":return this.personalSign(e);case"eth_signTransaction":return this._eth_signTransaction(s);case"eth_sendRawTransaction":return this._eth_sendRawTransaction(s);case"eth_sendTransaction":return this._eth_sendTransaction(s);case"eth_signTypedData_v1":case"eth_signTypedData_v3":case"eth_signTypedData_v4":case"eth_signTypedData":return this.signTypedData(e);case"wallet_addEthereumChain":return this.addEthereumChain(s);case"wallet_switchEthereumChain":return this.switchEthereumChain(s);case"wallet_watchAsset":return this.watchAsset(s);default:if(!this.jsonRpcUrl)throw l.rpc.internal("No RPC URL set for chain");return je(e,this.jsonRpcUrl)}}_ensureKnownAddress(e){const s=x(e);if(!this._addresses.map(i=>x(i)).includes(s))throw new Error("Unknown Ethereum address")}_prepareTransactionParams(e){const s=e.from?x(e.from):this.selectedAddress;if(!s)throw new Error("Ethereum address is unavailable");this._ensureKnownAddress(s);const n=e.to?x(e.to):null,i=e.value!=null?D(e.value):BigInt(0),r=e.data?X(e.data):Buffer.alloc(0),a=e.nonce!=null?j(e.nonce):null,o=e.gasPrice!=null?D(e.gasPrice):null,c=e.maxFeePerGas!=null?D(e.maxFeePerGas):null,d=e.maxPriorityFeePerGas!=null?D(e.maxPriorityFeePerGas):null,g=e.gas!=null?D(e.gas):null,p=e.chainId?j(e.chainId):this.getChainId();return{fromAddress:s,toAddress:n,weiValue:i,data:r,nonce:a,gasPriceInWei:o,maxFeePerGas:c,maxPriorityFeePerGas:d,gasLimit:g,chainId:p}}async ecRecover(e){const{method:s,params:n}=e;if(!Array.isArray(n))throw l.rpc.invalidParams();const r=await this.initializeRelay().sendRequest({method:"ethereumAddressFromSignedMessage",params:{message:z(n[0]),signature:z(n[1]),addPrefix:s==="personal_ecRecover"}});if(m(r))throw r;return r.result}getChainId(){var e;return Number.parseInt((e=this._storage.getItem(ve))!==null&&e!==void 0?e:"1",10)}async _eth_requestAccounts(){var e,s;if(this._addresses.length>0)return(e=this.callback)===null||e===void 0||e.call(this,"connect",{chainId:A(this.getChainId())}),this._addresses;const i=await this.initializeRelay().requestEthereumAccounts();if(m(i))throw i;if(!i.result)throw new Error("accounts received is empty");return this._setAddresses(i.result),(s=this.callback)===null||s===void 0||s.call(this,"connect",{chainId:A(this.getChainId())}),this._addresses}async personalSign({params:e}){if(!Array.isArray(e))throw l.rpc.invalidParams();const s=e[1],n=e[0];this._ensureKnownAddress(s);const r=await this.initializeRelay().sendRequest({method:"signEthereumMessage",params:{address:x(s),message:z(n),addPrefix:!0,typedDataJson:null}});if(m(r))throw r;return r.result}async _eth_signTransaction(e){const s=this._prepareTransactionParams(e[0]||{}),i=await this.initializeRelay().signEthereumTransaction(s);if(m(i))throw i;return i.result}async _eth_sendRawTransaction(e){const s=X(e[0]),i=await this.initializeRelay().submitEthereumTransaction(s,this.getChainId());if(m(i))throw i;return i.result}async _eth_sendTransaction(e){const s=this._prepareTransactionParams(e[0]||{}),i=await this.initializeRelay().signAndSubmitEthereumTransaction(s);if(m(i))throw i;return i.result}async signTypedData(e){const{method:s,params:n}=e;if(!Array.isArray(n))throw l.rpc.invalidParams();const i=d=>{const g={eth_signTypedData_v1:q.hashForSignTypedDataLegacy,eth_signTypedData_v3:q.hashForSignTypedData_v3,eth_signTypedData_v4:q.hashForSignTypedData_v4,eth_signTypedData:q.hashForSignTypedData_v4};return O(g[s]({data:yt(d)}),!0)},r=n[s==="eth_signTypedData_v1"?1:0],a=n[s==="eth_signTypedData_v1"?0:1];this._ensureKnownAddress(r);const c=await this.initializeRelay().sendRequest({method:"signEthereumMessage",params:{address:x(r),message:i(a),typedDataJson:JSON.stringify(a,null,2),addPrefix:!1}});if(m(c))throw c;return c.result}initializeRelay(){return this._relay||(this._relay=new S({linkAPIUrl:be,storage:this._storage,metadata:this.metadata,accountsCallback:this._setAddresses.bind(this),chainCallback:this.updateProviderInfo.bind(this)})),this._relay}}const et="SignerType",tt=new v("CBWSDK","SignerConfigurator");function ms(){return tt.getItem(et)}function ws(t){tt.setItem(et,t)}async function bs(t){const{communicator:e,metadata:s,handshakeRequest:n,callback:i}=t;vs(e,s,i).catch(()=>{});const r={id:crypto.randomUUID(),event:"selectSignerType",data:Object.assign(Object.assign({},t.preference),{handshakeRequest:n})},{data:a}=await e.postRequestAndWaitForResponse(r);return a}function ys(t){const{signerType:e,metadata:s,communicator:n,callback:i}=t;switch(e){case"scw":return new Rt({metadata:s,callback:i,communicator:n});case"walletlink":return new Xe({metadata:s,callback:i})}}async function vs(t,e,s){await t.onMessage(({event:i})=>i==="WalletLinkSessionRequest");const n=new Xe({metadata:e,callback:s});t.postMessage({event:"WalletLinkUpdate",data:{session:n.getSession()}}),await n.handshake(),t.postMessage({event:"WalletLinkUpdate",data:{connected:!0}})}const ks=`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. +import{j as rt,l as at,m as ot,o as ct,E as dt}from"./index-uonIXzgQ.js";import{B as Y,_ as h,h as ae,y as lt}from"./hooks.module-D0gf0yJl.js";const ht=(t,e)=>{let s;switch(t){case"standard":return s=e,`data:image/svg+xml,%3Csvg width='${e}' height='${s}' viewBox='0 0 1024 1024' fill='none' xmlns='http://www.w3.org/2000/svg'%3E %3Crect width='1024' height='1024' fill='%230052FF'/%3E %3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M152 512C152 710.823 313.177 872 512 872C710.823 872 872 710.823 872 512C872 313.177 710.823 152 512 152C313.177 152 152 313.177 152 512ZM420 396C406.745 396 396 406.745 396 420V604C396 617.255 406.745 628 420 628H604C617.255 628 628 617.255 628 604V420C628 406.745 617.255 396 604 396H420Z' fill='white'/%3E %3C/svg%3E `;case"circle":return s=e,`data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='${e}' height='${s}' viewBox='0 0 999.81 999.81'%3E%3Cdefs%3E%3Cstyle%3E.cls-1%7Bfill:%230052fe;%7D.cls-2%7Bfill:%23fefefe;%7D.cls-3%7Bfill:%230152fe;%7D%3C/style%3E%3C/defs%3E%3Cpath class='cls-1' d='M655-115.9h56c.83,1.59,2.36.88,3.56,1a478,478,0,0,1,75.06,10.42C891.4-81.76,978.33-32.58,1049.19,44q116.7,126,131.94,297.61c.38,4.14-.34,8.53,1.78,12.45v59c-1.58.84-.91,2.35-1,3.56a482.05,482.05,0,0,1-10.38,74.05c-24,106.72-76.64,196.76-158.83,268.93s-178.18,112.82-287.2,122.6c-4.83.43-9.86-.25-14.51,1.77H654c-1-1.68-2.69-.91-4.06-1a496.89,496.89,0,0,1-105.9-18.59c-93.54-27.42-172.78-77.59-236.91-150.94Q199.34,590.1,184.87,426.58c-.47-5.19.25-10.56-1.77-15.59V355c1.68-1,.91-2.7,1-4.06a498.12,498.12,0,0,1,18.58-105.9c26-88.75,72.64-164.9,140.6-227.57q126-116.27,297.21-131.61C645.32-114.57,650.35-113.88,655-115.9Zm377.92,500c0-192.44-156.31-349.49-347.56-350.15-194.13-.68-350.94,155.13-352.29,347.42-1.37,194.55,155.51,352.1,348.56,352.47C876.15,734.23,1032.93,577.84,1032.93,384.11Z' transform='translate(-183.1 115.9)'/%3E%3Cpath class='cls-2' d='M1032.93,384.11c0,193.73-156.78,350.12-351.29,349.74-193-.37-349.93-157.92-348.56-352.47C334.43,189.09,491.24,33.28,685.37,34,876.62,34.62,1032.94,191.67,1032.93,384.11ZM683,496.81q43.74,0,87.48,0c15.55,0,25.32-9.72,25.33-25.21q0-87.48,0-175c0-15.83-9.68-25.46-25.59-25.46H595.77c-15.88,0-25.57,9.64-25.58,25.46q0,87.23,0,174.45c0,16.18,9.59,25.7,25.84,25.71Z' transform='translate(-183.1 115.9)'/%3E%3Cpath class='cls-3' d='M683,496.81H596c-16.25,0-25.84-9.53-25.84-25.71q0-87.23,0-174.45c0-15.82,9.7-25.46,25.58-25.46H770.22c15.91,0,25.59,9.63,25.59,25.46q0,87.47,0,175c0,15.49-9.78,25.2-25.33,25.21Q726.74,496.84,683,496.81Z' transform='translate(-183.1 115.9)'/%3E%3C/svg%3E`;case"text":return s=(.1*e).toFixed(2),`data:image/svg+xml,%3Csvg width='${e}' height='${s}' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 528.15 53.64'%3E%3Cdefs%3E%3Cstyle%3E.cls-1%7Bfill:%230052ff;%7D%3C/style%3E%3C/defs%3E%3Ctitle%3ECoinbase_Wordmark_SubBrands_ALL%3C/title%3E%3Cpath class='cls-1' d='M164.45,15a15,15,0,0,0-11.74,5.4V0h-8.64V52.92h8.5V48a15,15,0,0,0,11.88,5.62c10.37,0,18.21-8.21,18.21-19.3S174.67,15,164.45,15Zm-1.3,30.67c-6.19,0-10.73-4.83-10.73-11.31S157,23,163.22,23s10.66,4.82,10.66,11.37S169.34,45.65,163.15,45.65Zm83.31-14.91-6.34-.93c-3-.43-5.18-1.44-5.18-3.82,0-2.59,2.8-3.89,6.62-3.89,4.18,0,6.84,1.8,7.42,4.76h8.35c-.94-7.49-6.7-11.88-15.55-11.88-9.15,0-15.2,4.68-15.2,11.3,0,6.34,4,10,12,11.16l6.33.94c3.1.43,4.83,1.65,4.83,4,0,2.95-3,4.17-7.2,4.17-5.12,0-8-2.09-8.43-5.25h-8.49c.79,7.27,6.48,12.38,16.84,12.38,9.44,0,15.7-4.32,15.7-11.74C258.12,35.28,253.58,31.82,246.46,30.74Zm-27.65-2.3c0-8.06-4.9-13.46-15.27-13.46-9.79,0-15.26,5-16.34,12.6h8.57c.43-3,2.73-5.4,7.63-5.4,4.39,0,6.55,1.94,6.55,4.32,0,3.09-4,3.88-8.85,4.39-6.63.72-14.84,3-14.84,11.66,0,6.7,5,11,12.89,11,6.19,0,10.08-2.59,12-6.7.28,3.67,3,6.05,6.84,6.05h5v-7.7h-4.25Zm-8.5,9.36c0,5-4.32,8.64-9.57,8.64-3.24,0-6-1.37-6-4.25,0-3.67,4.39-4.68,8.42-5.11s6-1.22,7.13-2.88ZM281.09,15c-11.09,0-19.23,8.35-19.23,19.36,0,11.6,8.72,19.3,19.37,19.3,9,0,16.06-5.33,17.86-12.89h-9c-1.3,3.31-4.47,5.19-8.71,5.19-5.55,0-9.72-3.46-10.66-9.51H299.3V33.12C299.3,22.46,291.53,15,281.09,15Zm-9.87,15.26c1.37-5.18,5.26-7.7,9.72-7.7,4.9,0,8.64,2.8,9.51,7.7ZM19.3,23a9.84,9.84,0,0,1,9.5,7h9.14c-1.65-8.93-9-15-18.57-15A19,19,0,0,0,0,34.34c0,11.09,8.28,19.3,19.37,19.3,9.36,0,16.85-6,18.5-15H28.8a9.75,9.75,0,0,1-9.43,7.06c-6.27,0-10.66-4.83-10.66-11.31S13,23,19.3,23Zm41.11-8A19,19,0,0,0,41,34.34c0,11.09,8.28,19.3,19.37,19.3A19,19,0,0,0,79.92,34.27C79.92,23.33,71.64,15,60.41,15Zm.07,30.67c-6.19,0-10.73-4.83-10.73-11.31S54.22,23,60.41,23s10.8,4.89,10.8,11.37S66.67,45.65,60.48,45.65ZM123.41,15c-5.62,0-9.29,2.3-11.45,5.54V15.7h-8.57V52.92H112V32.69C112,27,115.63,23,121,23c5,0,8.06,3.53,8.06,8.64V52.92h8.64V31C137.66,21.6,132.84,15,123.41,15ZM92,.36a5.36,5.36,0,0,0-5.55,5.47,5.55,5.55,0,0,0,11.09,0A5.35,5.35,0,0,0,92,.36Zm-9.72,23h5.4V52.92h8.64V15.7h-14Zm298.17-7.7L366.2,52.92H372L375.29,44H392l3.33,8.88h6L386.87,15.7ZM377,39.23l6.45-17.56h.1l6.56,17.56ZM362.66,15.7l-7.88,29h-.11l-8.14-29H341l-8,28.93h-.1l-8-28.87H319L329.82,53h5.45l8.19-29.24h.11L352,53h5.66L368.1,15.7Zm135.25,0v4.86h12.32V52.92h5.6V20.56h12.32V15.7ZM467.82,52.92h25.54V48.06H473.43v-12h18.35V31.35H473.43V20.56h19.93V15.7H467.82ZM443,15.7h-5.6V52.92h24.32V48.06H443Zm-30.45,0h-5.61V52.92h24.32V48.06H412.52Z'/%3E%3C/svg%3E`;case"textWithLogo":return s=(.25*e).toFixed(2),`data:image/svg+xml,%3Csvg width='${e}' height='${s}' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 308.44 77.61'%3E%3Cdefs%3E%3Cstyle%3E.cls-1%7Bfill:%230052ff;%7D%3C/style%3E%3C/defs%3E%3Cpath class='cls-1' d='M142.94,20.2l-7.88,29H135l-8.15-29h-5.55l-8,28.93h-.11l-8-28.87H99.27l10.84,37.27h5.44l8.2-29.24h.1l8.41,29.24h5.66L148.39,20.2Zm17.82,0L146.48,57.42h5.82l3.28-8.88h16.65l3.34,8.88h6L167.16,20.2Zm-3.44,23.52,6.45-17.55h.11l6.56,17.55ZM278.2,20.2v4.86h12.32V57.42h5.6V25.06h12.32V20.2ZM248.11,57.42h25.54V52.55H253.71V40.61h18.35V35.85H253.71V25.06h19.94V20.2H248.11ZM223.26,20.2h-5.61V57.42H242V52.55H223.26Zm-30.46,0h-5.6V57.42h24.32V52.55H192.8Zm-154,38A19.41,19.41,0,1,1,57.92,35.57H77.47a38.81,38.81,0,1,0,0,6.47H57.92A19.39,19.39,0,0,1,38.81,58.21Z'/%3E%3C/svg%3E`;case"textLight":return s=(.1*e).toFixed(2),`data:image/svg+xml,%3Csvg width='${e}' height='${s}' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 528.15 53.64'%3E%3Cdefs%3E%3Cstyle%3E.cls-1%7Bfill:%23fefefe;%7D%3C/style%3E%3C/defs%3E%3Ctitle%3ECoinbase_Wordmark_SubBrands_ALL%3C/title%3E%3Cpath class='cls-1' d='M164.45,15a15,15,0,0,0-11.74,5.4V0h-8.64V52.92h8.5V48a15,15,0,0,0,11.88,5.62c10.37,0,18.21-8.21,18.21-19.3S174.67,15,164.45,15Zm-1.3,30.67c-6.19,0-10.73-4.83-10.73-11.31S157,23,163.22,23s10.66,4.82,10.66,11.37S169.34,45.65,163.15,45.65Zm83.31-14.91-6.34-.93c-3-.43-5.18-1.44-5.18-3.82,0-2.59,2.8-3.89,6.62-3.89,4.18,0,6.84,1.8,7.42,4.76h8.35c-.94-7.49-6.7-11.88-15.55-11.88-9.15,0-15.2,4.68-15.2,11.3,0,6.34,4,10,12,11.16l6.33.94c3.1.43,4.83,1.65,4.83,4,0,2.95-3,4.17-7.2,4.17-5.12,0-8-2.09-8.43-5.25h-8.49c.79,7.27,6.48,12.38,16.84,12.38,9.44,0,15.7-4.32,15.7-11.74C258.12,35.28,253.58,31.82,246.46,30.74Zm-27.65-2.3c0-8.06-4.9-13.46-15.27-13.46-9.79,0-15.26,5-16.34,12.6h8.57c.43-3,2.73-5.4,7.63-5.4,4.39,0,6.55,1.94,6.55,4.32,0,3.09-4,3.88-8.85,4.39-6.63.72-14.84,3-14.84,11.66,0,6.7,5,11,12.89,11,6.19,0,10.08-2.59,12-6.7.28,3.67,3,6.05,6.84,6.05h5v-7.7h-4.25Zm-8.5,9.36c0,5-4.32,8.64-9.57,8.64-3.24,0-6-1.37-6-4.25,0-3.67,4.39-4.68,8.42-5.11s6-1.22,7.13-2.88ZM281.09,15c-11.09,0-19.23,8.35-19.23,19.36,0,11.6,8.72,19.3,19.37,19.3,9,0,16.06-5.33,17.86-12.89h-9c-1.3,3.31-4.47,5.19-8.71,5.19-5.55,0-9.72-3.46-10.66-9.51H299.3V33.12C299.3,22.46,291.53,15,281.09,15Zm-9.87,15.26c1.37-5.18,5.26-7.7,9.72-7.7,4.9,0,8.64,2.8,9.51,7.7ZM19.3,23a9.84,9.84,0,0,1,9.5,7h9.14c-1.65-8.93-9-15-18.57-15A19,19,0,0,0,0,34.34c0,11.09,8.28,19.3,19.37,19.3,9.36,0,16.85-6,18.5-15H28.8a9.75,9.75,0,0,1-9.43,7.06c-6.27,0-10.66-4.83-10.66-11.31S13,23,19.3,23Zm41.11-8A19,19,0,0,0,41,34.34c0,11.09,8.28,19.3,19.37,19.3A19,19,0,0,0,79.92,34.27C79.92,23.33,71.64,15,60.41,15Zm.07,30.67c-6.19,0-10.73-4.83-10.73-11.31S54.22,23,60.41,23s10.8,4.89,10.8,11.37S66.67,45.65,60.48,45.65ZM123.41,15c-5.62,0-9.29,2.3-11.45,5.54V15.7h-8.57V52.92H112V32.69C112,27,115.63,23,121,23c5,0,8.06,3.53,8.06,8.64V52.92h8.64V31C137.66,21.6,132.84,15,123.41,15ZM92,.36a5.36,5.36,0,0,0-5.55,5.47,5.55,5.55,0,0,0,11.09,0A5.35,5.35,0,0,0,92,.36Zm-9.72,23h5.4V52.92h8.64V15.7h-14Zm298.17-7.7L366.2,52.92H372L375.29,44H392l3.33,8.88h6L386.87,15.7ZM377,39.23l6.45-17.56h.1l6.56,17.56ZM362.66,15.7l-7.88,29h-.11l-8.14-29H341l-8,28.93h-.1l-8-28.87H319L329.82,53h5.45l8.19-29.24h.11L352,53h5.66L368.1,15.7Zm135.25,0v4.86h12.32V52.92h5.6V20.56h12.32V15.7ZM467.82,52.92h25.54V48.06H473.43v-12h18.35V31.35H473.43V20.56h19.93V15.7H467.82ZM443,15.7h-5.6V52.92h24.32V48.06H443Zm-30.45,0h-5.61V52.92h24.32V48.06H412.52Z'/%3E%3C/svg%3E`;case"textWithLogoLight":return s=(.25*e).toFixed(2),`data:image/svg+xml,%3Csvg width='${e}' height='${s}' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 308.44 77.61'%3E%3Cdefs%3E%3Cstyle%3E.cls-1%7Bfill:%23fefefe;%7D%3C/style%3E%3C/defs%3E%3Cpath class='cls-1' d='M142.94,20.2l-7.88,29H135l-8.15-29h-5.55l-8,28.93h-.11l-8-28.87H99.27l10.84,37.27h5.44l8.2-29.24h.1l8.41,29.24h5.66L148.39,20.2Zm17.82,0L146.48,57.42h5.82l3.28-8.88h16.65l3.34,8.88h6L167.16,20.2Zm-3.44,23.52,6.45-17.55h.11l6.56,17.55ZM278.2,20.2v4.86h12.32V57.42h5.6V25.06h12.32V20.2ZM248.11,57.42h25.54V52.55H253.71V40.61h18.35V35.85H253.71V25.06h19.94V20.2H248.11ZM223.26,20.2h-5.61V57.42H242V52.55H223.26Zm-30.46,0h-5.6V57.42h24.32V52.55H192.8Zm-154,38A19.41,19.41,0,1,1,57.92,35.57H77.47a38.81,38.81,0,1,0,0,6.47H57.92A19.39,19.39,0,0,1,38.81,58.21Z'/%3E%3C/svg%3E`;default:return s=e,`data:image/svg+xml,%3Csvg width='${e}' height='${s}' viewBox='0 0 1024 1024' fill='none' xmlns='http://www.w3.org/2000/svg'%3E %3Crect width='1024' height='1024' fill='%230052FF'/%3E %3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M152 512C152 710.823 313.177 872 512 872C710.823 872 872 710.823 872 512C872 313.177 710.823 152 512 152C313.177 152 152 313.177 152 512ZM420 396C406.745 396 396 406.745 396 420V604C396 617.255 406.745 628 420 628H604C617.255 628 628 617.255 628 604V420C628 406.745 617.255 396 604 396H420Z' fill='white'/%3E %3C/svg%3E `}};class v{constructor(e,s){this.scope=e,this.module=s}storeObject(e,s){this.setItem(e,JSON.stringify(s))}loadObject(e){const s=this.getItem(e);return s?JSON.parse(s):void 0}setItem(e,s){localStorage.setItem(this.scopedKey(e),s)}getItem(e){return localStorage.getItem(this.scopedKey(e))}removeItem(e){localStorage.removeItem(this.scopedKey(e))}clear(){const e=this.scopedKey(""),s=[];for(let n=0;nlocalStorage.removeItem(n))}scopedKey(e){return`-${this.scope}${this.module?`:${this.module}`:""}:${e}`}static clearAll(){new v("CBWSDK").clear(),new v("walletlink").clear()}}const u={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}},J={"-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."}},Ie="Unspecified error message.",ut="Unspecified server error.";function te(t,e=Ie){if(t&&Number.isInteger(t)){const s=t.toString();if(Q(J,s))return J[s].message;if(Se(t))return ut}return e}function pt(t){if(!Number.isInteger(t))return!1;const e=t.toString();return!!(J[e]||Se(t))}function ft(t,{shouldIncludeStack:e=!1}={}){const s={};if(t&&typeof t=="object"&&!Array.isArray(t)&&Q(t,"code")&&pt(t.code)){const n=t;s.code=n.code,n.message&&typeof n.message=="string"?(s.message=n.message,Q(n,"data")&&(s.data=n.data)):(s.message=te(s.code),s.data={originalError:oe(t)})}else s.code=u.rpc.internal,s.message=ce(t,"message")?t.message:Ie,s.data={originalError:oe(t)};return e&&(s.stack=ce(t,"stack")?t.stack:void 0),s}function Se(t){return t>=-32099&&t<=-32e3}function oe(t){return t&&typeof t=="object"&&!Array.isArray(t)?Object.assign({},t):t}function Q(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function ce(t,e){return typeof t=="object"&&t!==null&&e in t&&typeof t[e]=="string"}const l={rpc:{parse:t=>b(u.rpc.parse,t),invalidRequest:t=>b(u.rpc.invalidRequest,t),invalidParams:t=>b(u.rpc.invalidParams,t),methodNotFound:t=>b(u.rpc.methodNotFound,t),internal:t=>b(u.rpc.internal,t),server:t=>{if(!t||typeof t!="object"||Array.isArray(t))throw new Error("Ethereum RPC Server errors must provide single object argument.");const{code:e}=t;if(!Number.isInteger(e)||e>-32005||e<-32099)throw new Error('"code" must be an integer such that: -32099 <= code <= -32005');return b(e,t)},invalidInput:t=>b(u.rpc.invalidInput,t),resourceNotFound:t=>b(u.rpc.resourceNotFound,t),resourceUnavailable:t=>b(u.rpc.resourceUnavailable,t),transactionRejected:t=>b(u.rpc.transactionRejected,t),methodNotSupported:t=>b(u.rpc.methodNotSupported,t),limitExceeded:t=>b(u.rpc.limitExceeded,t)},provider:{userRejectedRequest:t=>P(u.provider.userRejectedRequest,t),unauthorized:t=>P(u.provider.unauthorized,t),unsupportedMethod:t=>P(u.provider.unsupportedMethod,t),disconnected:t=>P(u.provider.disconnected,t),chainDisconnected:t=>P(u.provider.chainDisconnected,t),unsupportedChain:t=>P(u.provider.unsupportedChain,t),custom:t=>{if(!t||typeof t!="object"||Array.isArray(t))throw new Error("Ethereum Provider custom errors must provide single object argument.");const{code:e,message:s,data:n}=t;if(!s||typeof s!="string")throw new Error('"message" must be a nonempty string');return new Ae(e,s,n)}}};function b(t,e){const[s,n]=Me(e);return new xe(t,s||te(t),n)}function P(t,e){const[s,n]=Me(e);return new Ae(t,s||te(t),n)}function Me(t){if(t){if(typeof t=="string")return[t];if(typeof t=="object"&&!Array.isArray(t)){const{message:e,data:s}=t;if(e&&typeof e!="string")throw new Error("Must specify string message.");return[e||void 0,s]}}return[]}class xe extends Error{constructor(e,s,n){if(!Number.isInteger(e))throw new Error('"code" must be an integer.');if(!s||typeof s!="string")throw new Error('"message" must be a nonempty string.');super(s),this.code=e,n!==void 0&&(this.data=n)}}class Ae extends xe{constructor(e,s,n){if(!gt(e))throw new Error('"code" must be an integer such that: 1000 <= code <= 4999');super(e,s,n)}}function gt(t){return Number.isInteger(t)&&t>=1e3&&t<=4999}function se(){return t=>t}const B=se(),mt=se(),wt=se();function I(t){return Math.floor(t)}const _e=/^[0-9]*$/,Le=/^[a-f0-9]*$/;function _(t){return ne(crypto.getRandomValues(new Uint8Array(t)))}function ne(t){return[...t].map(e=>e.toString(16).padStart(2,"0")).join("")}function H(t){return new Uint8Array(t.match(/.{1,2}/g).map(e=>Number.parseInt(e,16)))}function O(t,e=!1){const s=t.toString("hex");return B(e?`0x${s}`:s)}function z(t){return O(X(t),!0)}function k(t){return wt(t.toString(10))}function A(t){return B(`0x${BigInt(t).toString(16)}`)}function Pe(t){return t.startsWith("0x")||t.startsWith("0X")}function ie(t){return Pe(t)?t.slice(2):t}function Re(t){return Pe(t)?`0x${t.slice(2)}`:`0x${t}`}function K(t){if(typeof t!="string")return!1;const e=ie(t).toLowerCase();return Le.test(e)}function bt(t,e=!1){if(typeof t=="string"){const s=ie(t).toLowerCase();if(Le.test(s))return B(e?`0x${s}`:s)}throw l.rpc.invalidParams(`"${String(t)}" is not a hexadecimal string`)}function re(t,e=!1){let s=bt(t,!1);return s.length%2===1&&(s=B(`0${s}`)),e?B(`0x${s}`):s}function x(t){if(typeof t=="string"){const e=ie(t).toLowerCase();if(K(e)&&e.length===40)return mt(Re(e))}throw l.rpc.invalidParams(`Invalid Ethereum address: ${String(t)}`)}function X(t){if(Buffer.isBuffer(t))return t;if(typeof t=="string"){if(K(t)){const e=re(t,!1);return Buffer.from(e,"hex")}return Buffer.from(t,"utf8")}throw l.rpc.invalidParams(`Not binary data: ${String(t)}`)}function j(t){if(typeof t=="number"&&Number.isInteger(t))return I(t);if(typeof t=="string"){if(_e.test(t))return I(Number(t));if(K(t))return I(Number(BigInt(re(t,!0))))}throw l.rpc.invalidParams(`Not an integer: ${String(t)}`)}function D(t){if(t!==null&&(typeof t=="bigint"||vt(t)))return BigInt(t.toString(10));if(typeof t=="number")return BigInt(j(t));if(typeof t=="string"){if(_e.test(t))return BigInt(t);if(K(t))return BigInt(re(t,!0))}throw l.rpc.invalidParams(`Not an integer: ${String(t)}`)}function yt(t){if(typeof t=="string")return JSON.parse(t);if(typeof t=="object")return t;throw l.rpc.invalidParams(`Not a JSON string or an object: ${String(t)}`)}function vt(t){if(t==null||typeof t.constructor!="function")return!1;const{constructor:e}=t;return typeof e.config=="function"&&typeof e.EUCLID=="number"}function kt(){const t=document.querySelector('link[sizes="192x192"]')||document.querySelector('link[sizes="180x180"]')||document.querySelector('link[rel="icon"]')||document.querySelector('link[rel="shortcut icon"]'),{protocol:e,host:s}=document.location,n=t?t.getAttribute("href"):null;return!n||n.startsWith("javascript:")||n.startsWith("vbscript:")?`${e}//${s}/favicon.ico`:n.startsWith("http://")||n.startsWith("https://")||n.startsWith("data:")?n:n.startsWith("//")?e+n:`${e}//${s}${n}`}async function Et(){return crypto.subtle.generateKey({name:"ECDH",namedCurve:"P-256"},!0,["deriveKey"])}async function Ct(t,e){return crypto.subtle.deriveKey({name:"ECDH",public:e},t,{name:"AES-GCM",length:256},!1,["encrypt","decrypt"])}async function It(t,e){const s=crypto.getRandomValues(new Uint8Array(12)),n=await crypto.subtle.encrypt({name:"AES-GCM",iv:s},t,new TextEncoder().encode(e));return{iv:s,cipherText:n}}async function St(t,{iv:e,cipherText:s}){const n=await crypto.subtle.decrypt({name:"AES-GCM",iv:e},t,s);return new TextDecoder().decode(n)}function Ne(t){switch(t){case"public":return"spki";case"private":return"pkcs8"}}async function Te(t,e){const s=Ne(t),n=await crypto.subtle.exportKey(s,e);return ne(new Uint8Array(n))}async function De(t,e){const s=Ne(t),n=H(e).buffer;return await crypto.subtle.importKey(s,new Uint8Array(n),{name:"ECDH",namedCurve:"P-256"},!0,t==="private"?["deriveKey"]:[])}async function Mt(t,e){const s=JSON.stringify(t,(n,i)=>{if(!(i instanceof Error))return i;const r=i;return Object.assign(Object.assign({},r.code?{code:r.code}:{}),{message:r.message})});return It(e,s)}async function xt(t,e){return JSON.parse(await St(e,t))}const Z={storageKey:"ownPrivateKey",keyType:"private"},F={storageKey:"ownPublicKey",keyType:"public"},$={storageKey:"peerPublicKey",keyType:"public"};class At{constructor(){this.storage=new v("CBWSDK","SCWKeyManager"),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(e){this.sharedSecret=null,this.peerPublicKey=e,await this.storeKey($,e),await this.loadKeysIfNeeded()}async clear(){this.ownPrivateKey=null,this.ownPublicKey=null,this.peerPublicKey=null,this.sharedSecret=null,this.storage.removeItem(F.storageKey),this.storage.removeItem(Z.storageKey),this.storage.removeItem($.storageKey)}async generateKeyPair(){const e=await Et();this.ownPrivateKey=e.privateKey,this.ownPublicKey=e.publicKey,await this.storeKey(Z,e.privateKey),await this.storeKey(F,e.publicKey)}async loadKeysIfNeeded(){if(this.ownPrivateKey===null&&(this.ownPrivateKey=await this.loadKey(Z)),this.ownPublicKey===null&&(this.ownPublicKey=await this.loadKey(F)),(this.ownPrivateKey===null||this.ownPublicKey===null)&&await this.generateKeyPair(),this.peerPublicKey===null&&(this.peerPublicKey=await this.loadKey($)),this.sharedSecret===null){if(this.ownPrivateKey===null||this.peerPublicKey===null)return;this.sharedSecret=await Ct(this.ownPrivateKey,this.peerPublicKey)}}async loadKey(e){const s=this.storage.getItem(e.storageKey);return s?De(e.keyType,s):null}async storeKey(e,s){const n=await Te(e.keyType,s);this.storage.setItem(e.storageKey,n)}}const T="4.2.1",Oe="@coinbase/wallet-sdk";async function je(t,e){const s=Object.assign(Object.assign({},t),{jsonrpc:"2.0",id:crypto.randomUUID()}),n=await window.fetch(e,{method:"POST",body:JSON.stringify(s),mode:"cors",headers:{"Content-Type":"application/json","X-Cbw-Sdk-Version":T,"X-Cbw-Sdk-Platform":Oe}}),{result:i,error:r}=await n.json();if(r)throw r;return i}function _t(){return globalThis.coinbaseWalletExtension}function Lt(){var t,e;try{const s=globalThis;return(t=s.ethereum)!==null&&t!==void 0?t:(e=s.top)===null||e===void 0?void 0:e.ethereum}catch{return}}function Ue({metadata:t,preference:e}){var s,n;const{appName:i,appLogoUrl:r,appChainIds:a}=t;if(e.options!=="smartWalletOnly"){const c=_t();if(c)return(s=c.setAppInfo)===null||s===void 0||s.call(c,i,r,a,e),c}const o=Lt();if(o!=null&&o.isCoinbaseBrowser)return(n=o.setAppInfo)===null||n===void 0||n.call(o,i,r,a,e),o}function Pt(t){if(!t||typeof t!="object"||Array.isArray(t))throw l.rpc.invalidParams({message:"Expected a single, non-array, object argument.",data:t});const{method:e,params:s}=t;if(typeof e!="string"||e.length===0)throw l.rpc.invalidParams({message:"'args.method' must be a non-empty string.",data:t});if(s!==void 0&&!Array.isArray(s)&&(typeof s!="object"||s===null))throw l.rpc.invalidParams({message:"'args.params' must be an object or array if provided.",data:t});switch(e){case"eth_sign":case"eth_signTypedData_v2":case"eth_subscribe":case"eth_unsubscribe":throw l.provider.unsupportedMethod()}}const de="accounts",le="activeChain",he="availableChains",ue="walletCapabilities";class Rt{constructor(e){var s,n,i;this.metadata=e.metadata,this.communicator=e.communicator,this.callback=e.callback,this.keyManager=new At,this.storage=new v("CBWSDK","SCWStateManager"),this.accounts=(s=this.storage.loadObject(de))!==null&&s!==void 0?s:[],this.chain=this.storage.loadObject(le)||{id:(i=(n=e.metadata.appChainIds)===null||n===void 0?void 0:n[0])!==null&&i!==void 0?i:1},this.handshake=this.handshake.bind(this),this.request=this.request.bind(this),this.createRequestMessage=this.createRequestMessage.bind(this),this.decryptResponseMessage=this.decryptResponseMessage.bind(this)}async handshake(e){var s,n;const i=await this.createRequestMessage({handshake:{method:e.method,params:Object.assign({},this.metadata,(s=e.params)!==null&&s!==void 0?s:{})}}),r=await this.communicator.postRequestAndWaitForResponse(i);if("failure"in r.content)throw r.content.failure;const a=await De("public",r.sender);await this.keyManager.setPeerPublicKey(a);const c=(await this.decryptResponseMessage(r)).result;if("error"in c)throw c.error;const d=c.value;this.accounts=d,this.storage.storeObject(de,d),(n=this.callback)===null||n===void 0||n.call(this,"accountsChanged",d)}async request(e){var s;if(this.accounts.length===0)throw l.provider.unauthorized();switch(e.method){case"eth_requestAccounts":return(s=this.callback)===null||s===void 0||s.call(this,"connect",{chainId:A(this.chain.id)}),this.accounts;case"eth_accounts":return this.accounts;case"eth_coinbase":return this.accounts[0];case"net_version":return this.chain.id;case"eth_chainId":return A(this.chain.id);case"wallet_getCapabilities":return this.storage.loadObject(ue);case"wallet_switchEthereumChain":return this.handleSwitchChainRequest(e);case"eth_ecRecover":case"personal_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(e);default:if(!this.chain.rpcUrl)throw l.rpc.internal("No RPC URL set for chain");return je(e,this.chain.rpcUrl)}}async sendRequestToPopup(e){var s,n;await((n=(s=this.communicator).waitForPopupLoaded)===null||n===void 0?void 0:n.call(s));const i=await this.sendEncryptedRequest(e),a=(await this.decryptResponseMessage(i)).result;if("error"in a)throw a.error;return a.value}async cleanup(){var e,s;this.storage.clear(),await this.keyManager.clear(),this.accounts=[],this.chain={id:(s=(e=this.metadata.appChainIds)===null||e===void 0?void 0:e[0])!==null&&s!==void 0?s:1}}async handleSwitchChainRequest(e){var s;const n=e.params;if(!n||!(!((s=n[0])===null||s===void 0)&&s.chainId))throw l.rpc.invalidParams();const i=j(n[0].chainId);if(this.updateChain(i))return null;const a=await this.sendRequestToPopup(e);return a===null&&this.updateChain(i),a}async sendEncryptedRequest(e){const s=await this.keyManager.getSharedSecret();if(!s)throw l.provider.unauthorized("No valid session found, try requestAccounts before other methods");const n=await Mt({action:e,chainId:this.chain.id},s),i=await this.createRequestMessage({encrypted:n});return this.communicator.postRequestAndWaitForResponse(i)}async createRequestMessage(e){const s=await Te("public",await this.keyManager.getOwnPublicKey());return{id:crypto.randomUUID(),sender:s,content:e,timestamp:new Date}}async decryptResponseMessage(e){var s,n;const i=e.content;if("failure"in i)throw i.failure;const r=await this.keyManager.getSharedSecret();if(!r)throw l.provider.unauthorized("Invalid session");const a=await xt(i.encrypted,r),o=(s=a.data)===null||s===void 0?void 0:s.chains;if(o){const d=Object.entries(o).map(([g,p])=>({id:Number(g),rpcUrl:p}));this.storage.storeObject(he,d),this.updateChain(this.chain.id,d)}const c=(n=a.data)===null||n===void 0?void 0:n.capabilities;return c&&this.storage.storeObject(ue,c),a}updateChain(e,s){var n;const i=s??this.storage.loadObject(he),r=i==null?void 0:i.find(a=>a.id===e);return r?(r!==this.chain&&(this.chain=r,this.storage.storeObject(le,r),(n=this.callback)===null||n===void 0||n.call(this,"chainChanged",A(r.id))),!0):!1}}const Nt=rt(at),{keccak_256:Tt}=Nt;function We(t){return Buffer.allocUnsafe(t).fill(0)}function Dt(t){return t.toString(2).length}function Be(t,e){let s=t.toString(16);s.length%2!==0&&(s="0"+s);const n=s.match(/.{1,2}/g).map(i=>parseInt(i,16));for(;n.length"u")throw new Error("Not an array?");if(s=Ze(t),s!=="dynamic"&&s!==0&&e.length>s)throw new Error("Elements exceed array size: "+s);i=[],t=t.slice(0,t.lastIndexOf("[")),typeof e=="string"&&(e=JSON.parse(e));for(r in e)i.push(E(t,e[r]));if(s==="dynamic"){var a=E("uint256",e.length);i.unshift(a)}return Buffer.concat(i)}else{if(t==="bytes")return e=new Buffer(e),i=Buffer.concat([E("uint256",e.length),e]),e.length%32!==0&&(i=Buffer.concat([i,w.zeros(32-e.length%32)])),i;if(t.startsWith("bytes")){if(s=R(t),s<1||s>32)throw new Error("Invalid bytes width: "+s);return w.setLengthRight(e,32)}else if(t.startsWith("uint")){if(s=R(t),s%8||s<8||s>256)throw new Error("Invalid uint width: "+s);n=L(e);const o=w.bitLengthFromBigInt(n);if(o>s)throw new Error("Supplied uint exceeds width: "+s+" vs "+o);if(n<0)throw new Error("Supplied uint is negative");return w.bufferBEFromBigInt(n,32)}else if(t.startsWith("int")){if(s=R(t),s%8||s<8||s>256)throw new Error("Invalid int width: "+s);n=L(e);const o=w.bitLengthFromBigInt(n);if(o>s)throw new Error("Supplied int exceeds width: "+s+" vs "+o);const c=w.twosFromBigInt(n,256);return w.bufferBEFromBigInt(c,32)}else if(t.startsWith("ufixed")){if(s=pe(t),n=L(e),n<0)throw new Error("Supplied ufixed is negative");return E("uint256",n*BigInt(2)**BigInt(s[1]))}else if(t.startsWith("fixed"))return s=pe(t),E("int256",L(e)*BigInt(2)**BigInt(s[1]))}throw new Error("Unsupported or invalid type: "+t)}function qt(t){return t==="string"||t==="bytes"||Ze(t)==="dynamic"}function Ht(t){return t.lastIndexOf("]")===t.length-1}function Kt(t,e){var s=[],n=[],i=32*t.length;for(var r in t){var a=ze(t[r]),o=e[r],c=E(a,o);qt(a)?(s.push(E("uint256",i)),n.push(c),i+=c.length):s.push(c)}return Buffer.concat(s.concat(n))}function Fe(t,e){if(t.length!==e.length)throw new Error("Number of types are not matching the values");for(var s,n,i=[],r=0;r32)throw new Error("Invalid bytes width: "+s);i.push(w.setLengthRight(o,s))}else if(a.startsWith("uint")){if(s=R(a),s%8||s<8||s>256)throw new Error("Invalid uint width: "+s);n=L(o);const c=w.bitLengthFromBigInt(n);if(c>s)throw new Error("Supplied uint exceeds width: "+s+" vs "+c);i.push(w.bufferBEFromBigInt(n,s/8))}else if(a.startsWith("int")){if(s=R(a),s%8||s<8||s>256)throw new Error("Invalid int width: "+s);n=L(o);const c=w.bitLengthFromBigInt(n);if(c>s)throw new Error("Supplied int exceeds width: "+s+" vs "+c);const d=w.twosFromBigInt(n,s);i.push(w.bufferBEFromBigInt(d,s/8))}else throw new Error("Unsupported or invalid type: "+a)}return Buffer.concat(i)}function Vt(t,e){return w.keccak(Fe(t,e))}var zt={rawEncode:Kt,solidityPack:Fe,soliditySHA3:Vt};const y=Ve,U=zt,$e={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"]},G={encodeData(t,e,s,n=!0){const i=["bytes32"],r=[this.hashType(t,s)];if(n){const a=(o,c,d)=>{if(s[c]!==void 0)return["bytes32",d==null?"0x0000000000000000000000000000000000000000000000000000000000000000":y.keccak(this.encodeData(c,d,s,n))];if(d===void 0)throw new Error(`missing value for field ${o} of type ${c}`);if(c==="bytes")return["bytes32",y.keccak(d)];if(c==="string")return typeof d=="string"&&(d=Buffer.from(d,"utf8")),["bytes32",y.keccak(d)];if(c.lastIndexOf("]")===c.length-1){const g=c.slice(0,c.lastIndexOf("[")),p=d.map(f=>a(o,g,f));return["bytes32",y.keccak(U.rawEncode(p.map(([f])=>f),p.map(([,f])=>f)))]}return[c,d]};for(const o of s[t]){const[c,d]=a(o.name,o.type,e[o.name]);i.push(c),r.push(d)}}else for(const a of s[t]){let o=e[a.name];if(o!==void 0)if(a.type==="bytes")i.push("bytes32"),o=y.keccak(o),r.push(o);else if(a.type==="string")i.push("bytes32"),typeof o=="string"&&(o=Buffer.from(o,"utf8")),o=y.keccak(o),r.push(o);else if(s[a.type]!==void 0)i.push("bytes32"),o=y.keccak(this.encodeData(a.type,o,s,n)),r.push(o);else{if(a.type.lastIndexOf("]")===a.type.length-1)throw new Error("Arrays currently unimplemented in encodeData");i.push(a.type),r.push(o)}}return U.rawEncode(i,r)},encodeType(t,e){let s="",n=this.findTypeDependencies(t,e).filter(i=>i!==t);n=[t].concat(n.sort());for(const i of n){if(!e[i])throw new Error("No type definition specified: "+i);s+=i+"("+e[i].map(({name:a,type:o})=>o+" "+a).join(",")+")"}return s},findTypeDependencies(t,e,s=[]){if(t=t.match(/^\w*/)[0],s.includes(t)||e[t]===void 0)return s;s.push(t);for(const n of e[t])for(const i of this.findTypeDependencies(n.type,e,s))!s.includes(i)&&s.push(i);return s},hashStruct(t,e,s,n=!0){return y.keccak(this.encodeData(t,e,s,n))},hashType(t,e){return y.keccak(this.encodeType(t,e))},sanitizeData(t){const e={};for(const s in $e.properties)t[s]&&(e[s]=t[s]);return e.types&&(e.types=Object.assign({EIP712Domain:[]},e.types)),e},hash(t,e=!0){const s=this.sanitizeData(t),n=[Buffer.from("1901","hex")];return n.push(this.hashStruct("EIP712Domain",s.domain,s.types,e)),s.primaryType!=="EIP712Domain"&&n.push(this.hashStruct(s.primaryType,s.message,s.types,e)),y.keccak(Buffer.concat(n))}};var q={TYPED_MESSAGE_SCHEMA:$e,TypedDataUtils:G,hashForSignTypedDataLegacy:function(t){return Zt(t.data)},hashForSignTypedData_v3:function(t){return G.hash(t.data,!1)},hashForSignTypedData_v4:function(t){return G.hash(t.data)}};function Zt(t){const e=new Error("Expect argument to be non-empty array");if(typeof t!="object"||!t.length)throw e;const s=t.map(function(r){return r.type==="bytes"?y.toBuffer(r.value):r.value}),n=t.map(function(r){return r.type}),i=t.map(function(r){if(!r.name)throw e;return r.type+" "+r.name});return U.soliditySHA3(["bytes32","bytes32"],[U.soliditySHA3(new Array(t.length).fill("string"),i),U.soliditySHA3(n,s)])}const Ft="walletUsername",ee="Addresses",$t="AppVersion";function m(t){return t.errorMessage!==void 0}class Gt{constructor(e){this.secret=e}async encrypt(e){const s=this.secret;if(s.length!==64)throw Error("secret must be 256 bits");const n=crypto.getRandomValues(new Uint8Array(12)),i=await crypto.subtle.importKey("raw",H(s),{name:"aes-gcm"},!1,["encrypt","decrypt"]),r=new TextEncoder,a=await window.crypto.subtle.encrypt({name:"AES-GCM",iv:n},i,r.encode(e)),o=16,c=a.slice(a.byteLength-o),d=a.slice(0,a.byteLength-o),g=new Uint8Array(c),p=new Uint8Array(d),f=new Uint8Array([...n,...g,...p]);return ne(f)}async decrypt(e){const s=this.secret;if(s.length!==64)throw Error("secret must be 256 bits");return new Promise((n,i)=>{(async function(){const r=await crypto.subtle.importKey("raw",H(s),{name:"aes-gcm"},!1,["encrypt","decrypt"]),a=H(e),o=a.slice(0,12),c=a.slice(12,28),d=a.slice(28),g=new Uint8Array([...d,...c]),p={name:"AES-GCM",iv:new Uint8Array(o)};try{const f=await window.crypto.subtle.decrypt(p,r,g),C=new TextDecoder;n(C.decode(f))}catch(f){i(f)}})()})}}class Yt{constructor(e,s,n){this.linkAPIUrl=e,this.sessionId=s;const i=`${s}:${n}`;this.auth=`Basic ${btoa(i)}`}async markUnseenEventsAsSeen(e){return Promise.all(e.map(s=>fetch(`${this.linkAPIUrl}/events/${s.eventId}/seen`,{method:"POST",headers:{Authorization:this.auth}}))).catch(s=>console.error("Unabled to mark event as failed:",s))}async fetchUnseenEvents(){var e;const s=await fetch(`${this.linkAPIUrl}/events?unseen=true`,{headers:{Authorization:this.auth}});if(s.ok){const{events:n,error:i}=await s.json();if(i)throw new Error(`Check unseen events failed: ${i}`);const r=(e=n==null?void 0:n.filter(a=>a.event==="Web3Response").map(a=>({type:"Event",sessionId:this.sessionId,eventId:a.id,event:a.event,data:a.data})))!==null&&e!==void 0?e:[];return this.markUnseenEventsAsSeen(r),r}throw new Error(`Check unseen events failed: ${s.status}`)}}var M;(function(t){t[t.DISCONNECTED=0]="DISCONNECTED",t[t.CONNECTING=1]="CONNECTING",t[t.CONNECTED=2]="CONNECTED"})(M||(M={}));class Jt{setConnectionStateListener(e){this.connectionStateListener=e}setIncomingDataListener(e){this.incomingDataListener=e}constructor(e,s=WebSocket){this.WebSocketClass=s,this.webSocket=null,this.pendingData=[],this.url=e.replace(/^http/,"ws")}async connect(){if(this.webSocket)throw new Error("webSocket object is not null");return new Promise((e,s)=>{var n;let i;try{this.webSocket=i=new this.WebSocketClass(this.url)}catch(r){s(r);return}(n=this.connectionStateListener)===null||n===void 0||n.call(this,M.CONNECTING),i.onclose=r=>{var a;this.clearWebSocket(),s(new Error(`websocket error ${r.code}: ${r.reason}`)),(a=this.connectionStateListener)===null||a===void 0||a.call(this,M.DISCONNECTED)},i.onopen=r=>{var a;e(),(a=this.connectionStateListener)===null||a===void 0||a.call(this,M.CONNECTED),this.pendingData.length>0&&([...this.pendingData].forEach(c=>this.sendData(c)),this.pendingData=[])},i.onmessage=r=>{var a,o;if(r.data==="h")(a=this.incomingDataListener)===null||a===void 0||a.call(this,{type:"Heartbeat"});else try{const c=JSON.parse(r.data);(o=this.incomingDataListener)===null||o===void 0||o.call(this,c)}catch{}}})}disconnect(){var e;const{webSocket:s}=this;if(s){this.clearWebSocket(),(e=this.connectionStateListener)===null||e===void 0||e.call(this,M.DISCONNECTED),this.connectionStateListener=void 0,this.incomingDataListener=void 0;try{s.close()}catch{}}}sendData(e){const{webSocket:s}=this;if(!s){this.pendingData.push(e),this.connect();return}s.send(e)}clearWebSocket(){const{webSocket:e}=this;e&&(this.webSocket=null,e.onclose=null,e.onerror=null,e.onmessage=null,e.onopen=null)}}const fe=1e4,Qt=6e4;class Xt{constructor({session:e,linkAPIUrl:s,listener:n}){this.destroyed=!1,this.lastHeartbeatResponse=0,this.nextReqId=I(1),this._connected=!1,this._linked=!1,this.shouldFetchUnseenEventsOnConnect=!1,this.requestResolutions=new Map,this.handleSessionMetadataUpdated=r=>{if(!r)return;new Map([["__destroyed",this.handleDestroyed],["EthereumAddress",this.handleAccountUpdated],["WalletUsername",this.handleWalletUsernameUpdated],["AppVersion",this.handleAppVersionUpdated],["ChainId",o=>r.JsonRpcUrl&&this.handleChainUpdated(o,r.JsonRpcUrl)]]).forEach((o,c)=>{const d=r[c];d!==void 0&&o(d)})},this.handleDestroyed=r=>{var a;r==="1"&&((a=this.listener)===null||a===void 0||a.resetAndReload())},this.handleAccountUpdated=async r=>{var a;const o=await this.cipher.decrypt(r);(a=this.listener)===null||a===void 0||a.accountUpdated(o)},this.handleMetadataUpdated=async(r,a)=>{var o;const c=await this.cipher.decrypt(a);(o=this.listener)===null||o===void 0||o.metadataUpdated(r,c)},this.handleWalletUsernameUpdated=async r=>{this.handleMetadataUpdated(Ft,r)},this.handleAppVersionUpdated=async r=>{this.handleMetadataUpdated($t,r)},this.handleChainUpdated=async(r,a)=>{var o;const c=await this.cipher.decrypt(r),d=await this.cipher.decrypt(a);(o=this.listener)===null||o===void 0||o.chainUpdated(c,d)},this.session=e,this.cipher=new Gt(e.secret),this.listener=n;const i=new Jt(`${s}/rpc`,WebSocket);i.setConnectionStateListener(async r=>{let a=!1;switch(r){case M.DISCONNECTED:if(!this.destroyed){const o=async()=>{await new Promise(c=>setTimeout(c,5e3)),this.destroyed||i.connect().catch(()=>{o()})};o()}break;case M.CONNECTED:a=await this.handleConnected(),this.updateLastHeartbeat(),setInterval(()=>{this.heartbeat()},fe),this.shouldFetchUnseenEventsOnConnect&&this.fetchUnseenEventsAPI();break;case M.CONNECTING:break}this.connected!==a&&(this.connected=a)}),i.setIncomingDataListener(r=>{var a;switch(r.type){case"Heartbeat":this.updateLastHeartbeat();return;case"IsLinkedOK":case"Linked":{const o=r.type==="IsLinkedOK"?r.linked:void 0;this.linked=o||r.onlineGuests>0;break}case"GetSessionConfigOK":case"SessionConfigUpdated":{this.handleSessionMetadataUpdated(r.metadata);break}case"Event":{this.handleIncomingEvent(r);break}}r.id!==void 0&&((a=this.requestResolutions.get(r.id))===null||a===void 0||a(r))}),this.ws=i,this.http=new Yt(s,e.id,e.key)}connect(){if(this.destroyed)throw new Error("instance is destroyed");this.ws.connect()}async destroy(){this.destroyed||(await this.makeRequest({type:"SetSessionConfig",id:I(this.nextReqId++),sessionId:this.session.id,metadata:{__destroyed:"1"}},{timeout:1e3}),this.destroyed=!0,this.ws.disconnect(),this.listener=void 0)}get connected(){return this._connected}set connected(e){this._connected=e}get linked(){return this._linked}set linked(e){var s,n;this._linked=e,e&&((s=this.onceLinked)===null||s===void 0||s.call(this)),(n=this.listener)===null||n===void 0||n.linkedUpdated(e)}setOnceLinked(e){return new Promise(s=>{this.linked?e().then(s):this.onceLinked=()=>{e().then(s),this.onceLinked=void 0}})}async handleIncomingEvent(e){var s;if(e.type!=="Event"||e.event!=="Web3Response")return;const n=await this.cipher.decrypt(e.data),i=JSON.parse(n);if(i.type!=="WEB3_RESPONSE")return;const{id:r,response:a}=i;(s=this.listener)===null||s===void 0||s.handleWeb3ResponseMessage(r,a)}async checkUnseenEvents(){if(!this.connected){this.shouldFetchUnseenEventsOnConnect=!0;return}await new Promise(e=>setTimeout(e,250));try{await this.fetchUnseenEventsAPI()}catch(e){console.error("Unable to check for unseen events",e)}}async fetchUnseenEventsAPI(){this.shouldFetchUnseenEventsOnConnect=!1,(await this.http.fetchUnseenEvents()).forEach(s=>this.handleIncomingEvent(s))}async publishEvent(e,s,n=!1){const i=await this.cipher.encrypt(JSON.stringify(Object.assign(Object.assign({},s),{origin:location.origin,relaySource:"coinbaseWalletExtension"in window&&window.coinbaseWalletExtension?"injected_sdk":"sdk"}))),r={type:"PublishEvent",id:I(this.nextReqId++),sessionId:this.session.id,event:e,data:i,callWebhook:n};return this.setOnceLinked(async()=>{const a=await this.makeRequest(r);if(a.type==="Fail")throw new Error(a.error||"failed to publish event");return a.eventId})}sendData(e){this.ws.sendData(JSON.stringify(e))}updateLastHeartbeat(){this.lastHeartbeatResponse=Date.now()}heartbeat(){if(Date.now()-this.lastHeartbeatResponse>fe*2){this.ws.disconnect();return}try{this.ws.sendData("h")}catch{}}async makeRequest(e,s={timeout:Qt}){const n=e.id;this.sendData(e);let i;return Promise.race([new Promise((r,a)=>{i=window.setTimeout(()=>{a(new Error(`request ${n} timed out`))},s.timeout)}),new Promise(r=>{this.requestResolutions.set(n,a=>{clearTimeout(i),r(a),this.requestResolutions.delete(n)})})])}async handleConnected(){return(await this.makeRequest({type:"HostSession",id:I(this.nextReqId++),sessionId:this.session.id,sessionKey:this.session.key})).type==="Fail"?!1:(this.sendData({type:"IsLinked",id:I(this.nextReqId++),sessionId:this.session.id}),this.sendData({type:"GetSessionConfig",id:I(this.nextReqId++),sessionId:this.session.id}),!0)}}class es{constructor(){this._nextRequestId=0,this.callbacks=new Map}makeRequestId(){this._nextRequestId=(this._nextRequestId+1)%2147483647;const e=this._nextRequestId,s=Re(e.toString(16));return this.callbacks.get(s)&&this.callbacks.delete(s),e}}const ge="session:id",me="session:secret",we="session:linked";class N{constructor(e,s,n,i=!1){this.storage=e,this.id=s,this.secret=n,this.key=ot(ct(`${s}, ${n} WalletLink`)),this._linked=!!i}static create(e){const s=_(16),n=_(32);return new N(e,s,n).save()}static load(e){const s=e.getItem(ge),n=e.getItem(we),i=e.getItem(me);return s&&i?new N(e,s,i,n==="1"):null}get linked(){return this._linked}set linked(e){this._linked=e,this.persistLinked()}save(){return this.storage.setItem(ge,this.id),this.storage.setItem(me,this.secret),this.persistLinked(),this}persistLinked(){this.storage.setItem(we,this._linked?"1":"0")}}function ts(){try{return window.frameElement!==null}catch{return!1}}function ss(){try{return ts()&&window.top?window.top.location:window.location}catch{return window.location}}function ns(){var t;return/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test((t=window==null?void 0:window.navigator)===null||t===void 0?void 0:t.userAgent)}function Ge(){var t,e;return(e=(t=window==null?void 0:window.matchMedia)===null||t===void 0?void 0:t.call(window,"(prefers-color-scheme: dark)").matches)!==null&&e!==void 0?e:!1}const is='@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 Ye(){const t=document.createElement("style");t.type="text/css",t.appendChild(document.createTextNode(is)),document.documentElement.appendChild(t)}function Je(t){var e,s,n="";if(typeof t=="string"||typeof t=="number")n+=t;else if(typeof t=="object")if(Array.isArray(t))for(e=0;e{this.items.delete(s),this.render()}}clear(){this.items.clear(),this.render()}render(){this.root&&Y(h("div",null,h(Qe,{darkMode:this.darkMode},Array.from(this.items.entries()).map(([e,s])=>h(ds,Object.assign({},s,{key:e}))))),this.root)}}const Qe=t=>h("div",{class:W("-cbwsdk-snackbar-container")},h("style",null,rs),h("div",{class:"-cbwsdk-snackbar"},t.children)),ds=({autoExpand:t,message:e,menuItems:s})=>{const[n,i]=ae(!0),[r,a]=ae(t??!1);lt(()=>{const c=[window.setTimeout(()=>{i(!1)},1),window.setTimeout(()=>{a(!0)},1e4)];return()=>{c.forEach(window.clearTimeout)}});const o=()=>{a(!r)};return h("div",{class:W("-cbwsdk-snackbar-instance",n&&"-cbwsdk-snackbar-instance-hidden",r&&"-cbwsdk-snackbar-instance-expanded")},h("div",{class:"-cbwsdk-snackbar-instance-header",onClick:o},h("img",{src:as,class:"-cbwsdk-snackbar-instance-header-cblogo"})," ",h("div",{class:"-cbwsdk-snackbar-instance-header-message"},e),h("div",{class:"-gear-container"},!r&&h("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},h("circle",{cx:"12",cy:"12",r:"12",fill:"#F5F7F8"})),h("img",{src:os,class:"-gear-icon",title:"Expand"}))),s&&s.length>0&&h("div",{class:"-cbwsdk-snackbar-instance-menu"},s.map((c,d)=>h("div",{class:W("-cbwsdk-snackbar-instance-menu-item",c.isRed&&"-cbwsdk-snackbar-instance-menu-item-is-red"),onClick:c.onClick,key:d},h("svg",{width:c.svgWidth,height:c.svgHeight,viewBox:"0 0 10 11",fill:"none",xmlns:"http://www.w3.org/2000/svg"},h("path",{"fill-rule":c.defaultFillRule,"clip-rule":c.defaultClipRule,d:c.path,fill:"#AAAAAA"})),h("span",{class:W("-cbwsdk-snackbar-instance-menu-item-info",c.isRed&&"-cbwsdk-snackbar-instance-menu-item-info-is-red")},c.info)))))};class ls{constructor(){this.attached=!1,this.snackbar=new cs}attach(){if(this.attached)throw new Error("Coinbase Wallet SDK UI is already attached");const e=document.documentElement,s=document.createElement("div");s.className="-cbwsdk-css-reset",e.appendChild(s),this.snackbar.attach(s),this.attached=!0,Ye()}showConnecting(e){let s;return e.isUnlinkedErrorState?s={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:e.onResetConnection}]}:s={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:e.onCancel},{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:e.onResetConnection}]},this.snackbar.presentItem(s)}}const hs=".-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 us{constructor(){this.root=null,this.darkMode=Ge()}attach(){const e=document.documentElement;this.root=document.createElement("div"),this.root.className="-cbwsdk-css-reset",e.appendChild(this.root),Ye()}present(e){this.render(e)}clear(){this.render(null)}render(e){this.root&&(Y(null,this.root),e&&Y(h(ps,Object.assign({},e,{onDismiss:()=>{this.clear()},darkMode:this.darkMode})),this.root))}}const ps=({title:t,buttonText:e,darkMode:s,onButtonClick:n,onDismiss:i})=>{const r=s?"dark":"light";return h(Qe,{darkMode:s},h("div",{class:"-cbwsdk-redirect-dialog"},h("style",null,hs),h("div",{class:"-cbwsdk-redirect-dialog-backdrop",onClick:i}),h("div",{class:W("-cbwsdk-redirect-dialog-box",r)},h("p",null,t),h("button",{onClick:n},e))))},fs="https://keys.coinbase.com/connect",be="https://www.walletlink.org",gs="https://go.cb-w.com/walletlink";class ye{constructor(){this.attached=!1,this.redirectDialog=new us}attach(){if(this.attached)throw new Error("Coinbase Wallet SDK UI is already attached");this.redirectDialog.attach(),this.attached=!0}redirectToCoinbaseWallet(e){const s=new URL(gs);s.searchParams.append("redirect_url",ss().href),e&&s.searchParams.append("wl_url",e);const n=document.createElement("a");n.target="cbw-opener",n.href=s.href,n.rel="noreferrer noopener",n.click()}openCoinbaseWalletDeeplink(e){this.redirectDialog.present({title:"Redirecting to Coinbase Wallet...",buttonText:"Open",onButtonClick:()=>{this.redirectToCoinbaseWallet(e)}}),setTimeout(()=>{this.redirectToCoinbaseWallet(e)},99)}showConnecting(e){return()=>{this.redirectDialog.clear()}}}class S{constructor(e){this.chainCallbackParams={chainId:"",jsonRpcUrl:""},this.isMobileWeb=ns(),this.linkedUpdated=r=>{this.isLinked=r;const a=this.storage.getItem(ee);if(r&&(this._session.linked=r),this.isUnlinkedErrorState=!1,a){const o=a.split(" "),c=this.storage.getItem("IsStandaloneSigning")==="true";o[0]!==""&&!r&&this._session.linked&&!c&&(this.isUnlinkedErrorState=!0)}},this.metadataUpdated=(r,a)=>{this.storage.setItem(r,a)},this.chainUpdated=(r,a)=>{this.chainCallbackParams.chainId===r&&this.chainCallbackParams.jsonRpcUrl===a||(this.chainCallbackParams={chainId:r,jsonRpcUrl:a},this.chainCallback&&this.chainCallback(a,Number.parseInt(r,10)))},this.accountUpdated=r=>{this.accountsCallback&&this.accountsCallback([r]),S.accountRequestCallbackIds.size>0&&(Array.from(S.accountRequestCallbackIds.values()).forEach(a=>{this.invokeCallback(a,{method:"requestEthereumAccounts",result:[r]})}),S.accountRequestCallbackIds.clear())},this.resetAndReload=this.resetAndReload.bind(this),this.linkAPIUrl=e.linkAPIUrl,this.storage=e.storage,this.metadata=e.metadata,this.accountsCallback=e.accountsCallback,this.chainCallback=e.chainCallback;const{session:s,ui:n,connection:i}=this.subscribe();this._session=s,this.connection=i,this.relayEventManager=new es,this.ui=n,this.ui.attach()}subscribe(){const e=N.load(this.storage)||N.create(this.storage),{linkAPIUrl:s}=this,n=new Xt({session:e,linkAPIUrl:s,listener:this}),i=this.isMobileWeb?new ye:new ls;return n.connect(),{session:e,ui:i,connection:n}}resetAndReload(){this.connection.destroy().then(()=>{const e=N.load(this.storage);(e==null?void 0:e.id)===this._session.id&&v.clearAll(),document.location.reload()}).catch(e=>{})}signEthereumTransaction(e){return this.sendRequest({method:"signEthereumTransaction",params:{fromAddress:e.fromAddress,toAddress:e.toAddress,weiValue:k(e.weiValue),data:O(e.data,!0),nonce:e.nonce,gasPriceInWei:e.gasPriceInWei?k(e.gasPriceInWei):null,maxFeePerGas:e.gasPriceInWei?k(e.gasPriceInWei):null,maxPriorityFeePerGas:e.gasPriceInWei?k(e.gasPriceInWei):null,gasLimit:e.gasLimit?k(e.gasLimit):null,chainId:e.chainId,shouldSubmit:!1}})}signAndSubmitEthereumTransaction(e){return this.sendRequest({method:"signEthereumTransaction",params:{fromAddress:e.fromAddress,toAddress:e.toAddress,weiValue:k(e.weiValue),data:O(e.data,!0),nonce:e.nonce,gasPriceInWei:e.gasPriceInWei?k(e.gasPriceInWei):null,maxFeePerGas:e.maxFeePerGas?k(e.maxFeePerGas):null,maxPriorityFeePerGas:e.maxPriorityFeePerGas?k(e.maxPriorityFeePerGas):null,gasLimit:e.gasLimit?k(e.gasLimit):null,chainId:e.chainId,shouldSubmit:!0}})}submitEthereumTransaction(e,s){return this.sendRequest({method:"submitEthereumTransaction",params:{signedTransaction:O(e,!0),chainId:s}})}getWalletLinkSession(){return this._session}sendRequest(e){let s=null;const n=_(8),i=r=>{this.publishWeb3RequestCanceledEvent(n),this.handleErrorResponse(n,e.method,r),s==null||s()};return new Promise((r,a)=>{s=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:i,onResetConnection:this.resetAndReload}),this.relayEventManager.callbacks.set(n,o=>{if(s==null||s(),m(o))return a(new Error(o.errorMessage));r(o)}),this.publishWeb3RequestEvent(n,e)})}publishWeb3RequestEvent(e,s){const n={type:"WEB3_REQUEST",id:e,request:s};this.publishEvent("Web3Request",n,!0).then(i=>{}).catch(i=>{this.handleWeb3ResponseMessage(n.id,{method:s.method,errorMessage:i.message})}),this.isMobileWeb&&this.openCoinbaseWalletDeeplink(s.method)}openCoinbaseWalletDeeplink(e){if(this.ui instanceof ye)switch(e){case"requestEthereumAccounts":case"switchEthereumChain":return;default:window.addEventListener("blur",()=>{window.addEventListener("focus",()=>{this.connection.checkUnseenEvents()},{once:!0})},{once:!0}),this.ui.openCoinbaseWalletDeeplink();break}}publishWeb3RequestCanceledEvent(e){const s={type:"WEB3_REQUEST_CANCELED",id:e};this.publishEvent("Web3RequestCanceled",s,!1).then()}publishEvent(e,s,n){return this.connection.publishEvent(e,s,n)}handleWeb3ResponseMessage(e,s){if(s.method==="requestEthereumAccounts"){S.accountRequestCallbackIds.forEach(n=>this.invokeCallback(n,s)),S.accountRequestCallbackIds.clear();return}this.invokeCallback(e,s)}handleErrorResponse(e,s,n){var i;const r=(i=n==null?void 0:n.message)!==null&&i!==void 0?i:"Unspecified error message.";this.handleWeb3ResponseMessage(e,{method:s,errorMessage:r})}invokeCallback(e,s){const n=this.relayEventManager.callbacks.get(e);n&&(n(s),this.relayEventManager.callbacks.delete(e))}requestEthereumAccounts(){const{appName:e,appLogoUrl:s}=this.metadata,n={method:"requestEthereumAccounts",params:{appName:e,appLogoUrl:s}},i=_(8);return new Promise((r,a)=>{this.relayEventManager.callbacks.set(i,o=>{if(m(o))return a(new Error(o.errorMessage));r(o)}),S.accountRequestCallbackIds.add(i),this.publishWeb3RequestEvent(i,n)})}watchAsset(e,s,n,i,r,a){const o={method:"watchAsset",params:{type:e,options:{address:s,symbol:n,decimals:i,image:r},chainId:a}};let c=null;const d=_(8),g=p=>{this.publishWeb3RequestCanceledEvent(d),this.handleErrorResponse(d,o.method,p),c==null||c()};return c=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:g,onResetConnection:this.resetAndReload}),new Promise((p,f)=>{this.relayEventManager.callbacks.set(d,C=>{if(c==null||c(),m(C))return f(new Error(C.errorMessage));p(C)}),this.publishWeb3RequestEvent(d,o)})}addEthereumChain(e,s,n,i,r,a){const o={method:"addEthereumChain",params:{chainId:e,rpcUrls:s,blockExplorerUrls:i,chainName:r,iconUrls:n,nativeCurrency:a}};let c=null;const d=_(8),g=p=>{this.publishWeb3RequestCanceledEvent(d),this.handleErrorResponse(d,o.method,p),c==null||c()};return c=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:g,onResetConnection:this.resetAndReload}),new Promise((p,f)=>{this.relayEventManager.callbacks.set(d,C=>{if(c==null||c(),m(C))return f(new Error(C.errorMessage));p(C)}),this.publishWeb3RequestEvent(d,o)})}switchEthereumChain(e,s){const n={method:"switchEthereumChain",params:Object.assign({chainId:e},{address:s})};let i=null;const r=_(8),a=o=>{this.publishWeb3RequestCanceledEvent(r),this.handleErrorResponse(r,n.method,o),i==null||i()};return i=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:a,onResetConnection:this.resetAndReload}),new Promise((o,c)=>{this.relayEventManager.callbacks.set(r,d=>{if(i==null||i(),m(d)&&d.errorCode)return c(l.provider.custom({code:d.errorCode,message:"Unrecognized chain ID. Try adding the chain using addEthereumChain first."}));if(m(d))return c(new Error(d.errorMessage));o(d)}),this.publishWeb3RequestEvent(r,n)})}}S.accountRequestCallbackIds=new Set;const ve="DefaultChainId",ke="DefaultJsonRpcUrl";class Xe{constructor(e){this._relay=null,this._addresses=[],this.metadata=e.metadata,this._storage=new v("walletlink",be),this.callback=e.callback||null;const s=this._storage.getItem(ee);if(s){const n=s.split(" ");n[0]!==""&&(this._addresses=n.map(i=>x(i)))}this.initializeRelay()}getSession(){const e=this.initializeRelay(),{id:s,secret:n}=e.getWalletLinkSession();return{id:s,secret:n}}async handshake(){await this._eth_requestAccounts()}get selectedAddress(){return this._addresses[0]||void 0}get jsonRpcUrl(){var e;return(e=this._storage.getItem(ke))!==null&&e!==void 0?e:void 0}set jsonRpcUrl(e){this._storage.setItem(ke,e)}updateProviderInfo(e,s){var n;this.jsonRpcUrl=e;const i=this.getChainId();this._storage.setItem(ve,s.toString(10)),j(s)!==i&&((n=this.callback)===null||n===void 0||n.call(this,"chainChanged",A(s)))}async watchAsset(e){const s=Array.isArray(e)?e[0]:e;if(!s.type)throw l.rpc.invalidParams("Type is required");if((s==null?void 0:s.type)!=="ERC20")throw l.rpc.invalidParams(`Asset of type '${s.type}' is not supported`);if(!(s!=null&&s.options))throw l.rpc.invalidParams("Options are required");if(!(s!=null&&s.options.address))throw l.rpc.invalidParams("Address is required");const n=this.getChainId(),{address:i,symbol:r,image:a,decimals:o}=s.options,d=await this.initializeRelay().watchAsset(s.type,i,r,o,a,n==null?void 0:n.toString());return m(d)?!1:!!d.result}async addEthereumChain(e){var s,n;const i=e[0];if(((s=i.rpcUrls)===null||s===void 0?void 0:s.length)===0)throw l.rpc.invalidParams("please pass in at least 1 rpcUrl");if(!i.chainName||i.chainName.trim()==="")throw l.rpc.invalidParams("chainName is a required field");if(!i.nativeCurrency)throw l.rpc.invalidParams("nativeCurrency is a required field");const r=Number.parseInt(i.chainId,16);if(r===this.getChainId())return!1;const a=this.initializeRelay(),{rpcUrls:o=[],blockExplorerUrls:c=[],chainName:d,iconUrls:g=[],nativeCurrency:p}=i,f=await a.addEthereumChain(r.toString(),o,g,c,d,p);if(m(f))return!1;if(((n=f.result)===null||n===void 0?void 0:n.isApproved)===!0)return this.updateProviderInfo(o[0],r),null;throw l.rpc.internal("unable to add ethereum chain")}async switchEthereumChain(e){const s=e[0],n=Number.parseInt(s.chainId,16),r=await this.initializeRelay().switchEthereumChain(n.toString(10),this.selectedAddress||void 0);if(m(r))throw r;const a=r.result;return a.isApproved&&a.rpcUrl.length>0&&this.updateProviderInfo(a.rpcUrl,n),null}async cleanup(){this.callback=null,this._relay&&this._relay.resetAndReload(),this._storage.clear()}_setAddresses(e,s){var n;if(!Array.isArray(e))throw new Error("addresses is not an array");const i=e.map(r=>x(r));JSON.stringify(i)!==JSON.stringify(this._addresses)&&(this._addresses=i,(n=this.callback)===null||n===void 0||n.call(this,"accountsChanged",i),this._storage.setItem(ee,i.join(" ")))}async request(e){const s=e.params||[];switch(e.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 A(this.getChainId());case"eth_requestAccounts":return this._eth_requestAccounts();case"eth_ecRecover":case"personal_ecRecover":return this.ecRecover(e);case"personal_sign":return this.personalSign(e);case"eth_signTransaction":return this._eth_signTransaction(s);case"eth_sendRawTransaction":return this._eth_sendRawTransaction(s);case"eth_sendTransaction":return this._eth_sendTransaction(s);case"eth_signTypedData_v1":case"eth_signTypedData_v3":case"eth_signTypedData_v4":case"eth_signTypedData":return this.signTypedData(e);case"wallet_addEthereumChain":return this.addEthereumChain(s);case"wallet_switchEthereumChain":return this.switchEthereumChain(s);case"wallet_watchAsset":return this.watchAsset(s);default:if(!this.jsonRpcUrl)throw l.rpc.internal("No RPC URL set for chain");return je(e,this.jsonRpcUrl)}}_ensureKnownAddress(e){const s=x(e);if(!this._addresses.map(i=>x(i)).includes(s))throw new Error("Unknown Ethereum address")}_prepareTransactionParams(e){const s=e.from?x(e.from):this.selectedAddress;if(!s)throw new Error("Ethereum address is unavailable");this._ensureKnownAddress(s);const n=e.to?x(e.to):null,i=e.value!=null?D(e.value):BigInt(0),r=e.data?X(e.data):Buffer.alloc(0),a=e.nonce!=null?j(e.nonce):null,o=e.gasPrice!=null?D(e.gasPrice):null,c=e.maxFeePerGas!=null?D(e.maxFeePerGas):null,d=e.maxPriorityFeePerGas!=null?D(e.maxPriorityFeePerGas):null,g=e.gas!=null?D(e.gas):null,p=e.chainId?j(e.chainId):this.getChainId();return{fromAddress:s,toAddress:n,weiValue:i,data:r,nonce:a,gasPriceInWei:o,maxFeePerGas:c,maxPriorityFeePerGas:d,gasLimit:g,chainId:p}}async ecRecover(e){const{method:s,params:n}=e;if(!Array.isArray(n))throw l.rpc.invalidParams();const r=await this.initializeRelay().sendRequest({method:"ethereumAddressFromSignedMessage",params:{message:z(n[0]),signature:z(n[1]),addPrefix:s==="personal_ecRecover"}});if(m(r))throw r;return r.result}getChainId(){var e;return Number.parseInt((e=this._storage.getItem(ve))!==null&&e!==void 0?e:"1",10)}async _eth_requestAccounts(){var e,s;if(this._addresses.length>0)return(e=this.callback)===null||e===void 0||e.call(this,"connect",{chainId:A(this.getChainId())}),this._addresses;const i=await this.initializeRelay().requestEthereumAccounts();if(m(i))throw i;if(!i.result)throw new Error("accounts received is empty");return this._setAddresses(i.result),(s=this.callback)===null||s===void 0||s.call(this,"connect",{chainId:A(this.getChainId())}),this._addresses}async personalSign({params:e}){if(!Array.isArray(e))throw l.rpc.invalidParams();const s=e[1],n=e[0];this._ensureKnownAddress(s);const r=await this.initializeRelay().sendRequest({method:"signEthereumMessage",params:{address:x(s),message:z(n),addPrefix:!0,typedDataJson:null}});if(m(r))throw r;return r.result}async _eth_signTransaction(e){const s=this._prepareTransactionParams(e[0]||{}),i=await this.initializeRelay().signEthereumTransaction(s);if(m(i))throw i;return i.result}async _eth_sendRawTransaction(e){const s=X(e[0]),i=await this.initializeRelay().submitEthereumTransaction(s,this.getChainId());if(m(i))throw i;return i.result}async _eth_sendTransaction(e){const s=this._prepareTransactionParams(e[0]||{}),i=await this.initializeRelay().signAndSubmitEthereumTransaction(s);if(m(i))throw i;return i.result}async signTypedData(e){const{method:s,params:n}=e;if(!Array.isArray(n))throw l.rpc.invalidParams();const i=d=>{const g={eth_signTypedData_v1:q.hashForSignTypedDataLegacy,eth_signTypedData_v3:q.hashForSignTypedData_v3,eth_signTypedData_v4:q.hashForSignTypedData_v4,eth_signTypedData:q.hashForSignTypedData_v4};return O(g[s]({data:yt(d)}),!0)},r=n[s==="eth_signTypedData_v1"?1:0],a=n[s==="eth_signTypedData_v1"?0:1];this._ensureKnownAddress(r);const c=await this.initializeRelay().sendRequest({method:"signEthereumMessage",params:{address:x(r),message:i(a),typedDataJson:JSON.stringify(a,null,2),addPrefix:!1}});if(m(c))throw c;return c.result}initializeRelay(){return this._relay||(this._relay=new S({linkAPIUrl:be,storage:this._storage,metadata:this.metadata,accountsCallback:this._setAddresses.bind(this),chainCallback:this.updateProviderInfo.bind(this)})),this._relay}}const et="SignerType",tt=new v("CBWSDK","SignerConfigurator");function ms(){return tt.getItem(et)}function ws(t){tt.setItem(et,t)}async function bs(t){const{communicator:e,metadata:s,handshakeRequest:n,callback:i}=t;vs(e,s,i).catch(()=>{});const r={id:crypto.randomUUID(),event:"selectSignerType",data:Object.assign(Object.assign({},t.preference),{handshakeRequest:n})},{data:a}=await e.postRequestAndWaitForResponse(r);return a}function ys(t){const{signerType:e,metadata:s,communicator:n,callback:i}=t;switch(e){case"scw":return new Rt({metadata:s,callback:i,communicator:n});case"walletlink":return new Xe({metadata:s,callback:i})}}async function vs(t,e,s){await t.onMessage(({event:i})=>i==="WalletLinkSessionRequest");const n=new Xe({metadata:e,callback:s});t.postMessage({event:"WalletLinkUpdate",data:{session:n.getSession()}}),await n.handshake(),t.postMessage({event:"WalletLinkUpdate",data:{connected:!0}})}const ks=`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. Please see https://www.smartwallet.dev/guides/tips/popup-tips#cross-origin-opener-policy for more information.`,Es=()=>{let t;return{getCrossOriginOpenerPolicy:()=>t===void 0?"undefined":t,checkCrossOriginOpenerPolicy:async()=>{if(typeof window>"u"){t="non-browser-env";return}try{const e=`${window.location.origin}${window.location.pathname}`,s=await fetch(e,{method:"HEAD"});if(!s.ok)throw new Error(`HTTP error! status: ${s.status}`);const n=s.headers.get("Cross-Origin-Opener-Policy");t=n??"null",t==="same-origin"&&console.error(ks)}catch(e){console.error("Error checking Cross-Origin-Opener-Policy:",e.message),t="error"}}}},{checkCrossOriginOpenerPolicy:st,getCrossOriginOpenerPolicy:Cs}=Es(),Ee=420,Ce=540;function Is(t){const e=(window.innerWidth-Ee)/2+window.screenX,s=(window.innerHeight-Ce)/2+window.screenY;Ms(t);const n=window.open(t,"Smart Wallet",`width=${Ee}, height=${Ce}, left=${e}, top=${s}`);if(n==null||n.focus(),!n)throw l.rpc.internal("Pop up window failed to open");return n}function Ss(t){t&&!t.closed&&t.close()}function Ms(t){const e={sdkName:Oe,sdkVersion:T,origin:window.location.origin,coop:Cs()};for(const[s,n]of Object.entries(e))t.searchParams.append(s,n.toString())}class xs{constructor({url:e=fs,metadata:s,preference:n}){this.popup=null,this.listeners=new Map,this.postMessage=async i=>{(await this.waitForPopupLoaded()).postMessage(i,this.url.origin)},this.postRequestAndWaitForResponse=async i=>{const r=this.onMessage(({requestId:a})=>a===i.id);return this.postMessage(i),await r},this.onMessage=async i=>new Promise((r,a)=>{const o=c=>{if(c.origin!==this.url.origin)return;const d=c.data;i(d)&&(r(d),window.removeEventListener("message",o),this.listeners.delete(o))};window.addEventListener("message",o),this.listeners.set(o,{reject:a})}),this.disconnect=()=>{Ss(this.popup),this.popup=null,this.listeners.forEach(({reject:i},r)=>{i(l.provider.userRejectedRequest("Request rejected")),window.removeEventListener("message",r)}),this.listeners.clear()},this.waitForPopupLoaded=async()=>this.popup&&!this.popup.closed?(this.popup.focus(),this.popup):(this.popup=Is(this.url),this.onMessage(({event:i})=>i==="PopupUnload").then(this.disconnect).catch(()=>{}),this.onMessage(({event:i})=>i==="PopupLoaded").then(i=>{this.postMessage({requestId:i.id,data:{version:T,metadata:this.metadata,preference:this.preference,location:window.location.toString()}})}).then(()=>{if(!this.popup)throw l.rpc.internal();return this.popup})),this.url=new URL(e),this.metadata=s,this.preference=n}}function As(t){const e=ft(_s(t),{shouldIncludeStack:!0}),s=new URL("https://docs.cloud.coinbase.com/wallet-sdk/docs/errors");return s.searchParams.set("version",T),s.searchParams.set("code",e.code.toString()),s.searchParams.set("message",e.message),Object.assign(Object.assign({},e),{docUrl:s.href})}function _s(t){var e;if(typeof t=="string")return{message:t,code:u.rpc.internal};if(m(t)){const s=t.errorMessage,n=(e=t.errorCode)!==null&&e!==void 0?e:s.match(/(denied|rejected)/i)?u.provider.userRejectedRequest:void 0;return Object.assign(Object.assign({},t),{message:s,code:n,data:{method:t.method}})}return t}class Ls extends dt{}var Ps=function(t,e){var s={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(s[n]=t[n]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(t);i(i||(i=Rs(n)),i)}}export{Os as CoinbaseWalletSDK,js as createCoinbaseWalletSDK,Os as default}; diff --git a/buddybook/assets/index.es-BocJIoGE.js b/buddybook/assets/index.es-C5jEvyUt.js similarity index 99% rename from buddybook/assets/index.es-BocJIoGE.js rename to buddybook/assets/index.es-C5jEvyUt.js index 8be2b86..911702c 100644 --- a/buddybook/assets/index.es-BocJIoGE.js +++ b/buddybook/assets/index.es-C5jEvyUt.js @@ -1,5 +1,5 @@ -const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-C91wHTLi.js","assets/index-Cye4tEiE.js","assets/index-CwoEHhxw.css"])))=>i.map(i=>d[i]); -import{j as ev,f as tv,u as w4,h as Ld,_ as _4}from"./index-Cye4tEiE.js";import{e as Vi,J as Fd}from"./events-EbrwmdBG.js";import{r as zd,i as Pf}from"./inherits_browser-DKXdsDax.js";var Ae={};/*! ***************************************************************************** +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-Dzj92ueM.js","assets/index-uonIXzgQ.js","assets/index-Dd5JfyyB.css"])))=>i.map(i=>d[i]); +import{j as ev,f as tv,u as w4,h as Ld,_ as _4}from"./index-uonIXzgQ.js";import{e as Vi,J as Fd}from"./events-xQ4utD7e.js";import{r as zd,i as Pf}from"./inherits_browser-Bb3-ajt6.js";var Ae={};/*! ***************************************************************************** Copyright (c) Microsoft Corporation. Permission to use, copy, modify, and/or distribute this software for any @@ -67,4 +67,4 @@ __p += '`),Tt&&(ge+=`' + function print() { __p += __j.call(arguments, '') } `:`; `)+ge+`return __p -}`;var wt=v1(function(){return Bt(F,Je+"return "+ge).apply(t,Q)});if(wt.source=ge,nl(wt))throw wt;return wt}function M5(s){return $t(s).toLowerCase()}function I5(s){return $t(s).toUpperCase()}function C5(s,o,l){if(s=$t(s),s&&(l||o===t))return S0(s);if(!s||!(o=vi(o)))return s;var A=rn(s),T=rn(o),F=M0(A,T),Q=I0(A,T)+1;return Cs(A,F,Q).join("")}function P5(s,o,l){if(s=$t(s),s&&(l||o===t))return s.slice(0,P0(s)+1);if(!s||!(o=vi(o)))return s;var A=rn(s),T=I0(A,rn(o))+1;return Cs(A,0,T).join("")}function O5(s,o,l){if(s=$t(s),s&&(l||o===t))return s.replace(it,"");if(!s||!(o=vi(o)))return s;var A=rn(s),T=M0(A,rn(o));return Cs(A,T).join("")}function T5(s,o){var l=le,A=U;if(Zt(o)){var T="separator"in o?o.separator:T;l="length"in o?yt(o.length):l,A="omission"in o?vi(o.omission):A}s=$t(s);var F=s.length;if(Ba(s)){var Q=rn(s);F=Q.length}if(l>=F)return s;var X=l-$a(A);if(X<1)return A;var ie=Q?Cs(Q,0,X).join(""):s.slice(0,X);if(T===t)return ie+A;if(Q&&(X+=ie.length-X),sl(T)){if(s.slice(X).search(T)){var he,de=ie;for(T.global||(T=_h(T.source,$t(vt.exec(T))+"g")),T.lastIndex=0;he=T.exec(de);)var ge=he.index;ie=ie.slice(0,ge===t?X:ge)}}else if(s.indexOf(vi(T),X)!=X){var Ie=ie.lastIndexOf(T);Ie>-1&&(ie=ie.slice(0,Ie))}return ie+A}function R5(s){return s=$t(s),s&&Be.test(s)?s.replace(Et,cm):s}var N5=ka(function(s,o,l){return s+(l?" ":"")+o.toUpperCase()}),cl=mp("toUpperCase");function b1(s,o,l){return s=$t(s),o=l?t:o,o===t?im(s)?hm(s):J2(s):s.match(o)||[]}var v1=Dt(function(s,o){try{return vr(s,t,o)}catch(l){return nl(l)?l:new dt(l)}}),B5=ts(function(s,o){return Pi(o,function(l){l=En(l),Zn(s,l,rl(s[l],s))}),s});function $5(s){var o=s==null?0:s.length,l=nt();return s=o?Xt(s,function(A){if(typeof A[1]!="function")throw new Oi(c);return[l(A[0]),A[1]]}):[],Dt(function(A){for(var T=-1;++TM)return[];var l=b,A=qr(s,b);o=nt(o),s-=b;for(var T=mh(A,o);++l0||o<0)?new Mt(l):(s<0?l=l.takeRight(-s):s&&(l=l.drop(s)),o!==t&&(o=yt(o),l=o<0?l.dropRight(-o):l.take(o-s)),l)},Mt.prototype.takeRightWhile=function(s){return this.reverse().takeWhile(s).reverse()},Mt.prototype.toArray=function(){return this.take(b)},_n(Mt.prototype,function(s,o){var l=/^(?:filter|find|map|reject)|While$/.test(o),A=/^(?:head|last)$/.test(o),T=$[A?"take"+(o=="last"?"Right":""):o],F=A||/^find/.test(o);T&&($.prototype[o]=function(){var Q=this.__wrapped__,X=A?[1]:arguments,ie=Q instanceof Mt,he=X[0],de=ie||gt(Q),ge=function(At){var Tt=T.apply($,Es([At],X));return A&&Ie?Tt[0]:Tt};de&&l&&typeof he=="function"&&he.length!=1&&(ie=de=!1);var Ie=this.__chain__,Je=!!this.__actions__.length,ot=F&&!Ie,wt=ie&&!Je;if(!F&&de){Q=wt?Q:new Mt(this);var ct=s.apply(Q,X);return ct.__actions__.push({func:Bu,args:[ge],thisArg:t}),new Ti(ct,Ie)}return ot&&wt?s.apply(this,X):(ct=this.thru(ge),ot?A?ct.value()[0]:ct.value():ct)})}),Pi(["pop","push","shift","sort","splice","unshift"],function(s){var o=ou[s],l=/^(?:push|sort|unshift)$/.test(s)?"tap":"thru",A=/^(?:pop|shift)$/.test(s);$.prototype[s]=function(){var T=arguments;if(A&&!this.__chain__){var F=this.value();return o.apply(gt(F)?F:[],T)}return this[l](function(Q){return o.apply(gt(Q)?Q:[],T)})}}),_n(Mt.prototype,function(s,o){var l=$[o];if(l){var A=l.name+"";qt.call(Fa,A)||(Fa[A]=[]),Fa[A].push({name:o,func:l})}}),Fa[Iu(t,Y).name]=[{name:"wrapper",func:t}],Mt.prototype.clone=Rm,Mt.prototype.reverse=Nm,Mt.prototype.value=Bm,$.prototype.at=f8,$.prototype.chain=h8,$.prototype.commit=l8,$.prototype.next=d8,$.prototype.plant=g8,$.prototype.reverse=b8,$.prototype.toJSON=$.prototype.valueOf=$.prototype.value=v8,$.prototype.first=$.prototype.head,Ro&&($.prototype[Ro]=p8),$},Ua=lm();sr?((sr.exports=Ua)._=Ua,kt._=Ua):Ot._=Ua}).call(ac)})($d,$d.exports);var SB=Object.defineProperty,MB=Object.defineProperties,IB=Object.getOwnPropertyDescriptors,jb=Object.getOwnPropertySymbols,CB=Object.prototype.hasOwnProperty,PB=Object.prototype.propertyIsEnumerable,kb=(r,e,t)=>e in r?SB(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Zu=(r,e)=>{for(var t in e||(e={}))CB.call(e,t)&&kb(r,t,e[t]);if(jb)for(var t of jb(e))PB.call(e,t)&&kb(r,t,e[t]);return r},OB=(r,e)=>MB(r,IB(e));function bn(r,e,t){var i;const n=fc(r);return((i=e.rpcMap)==null?void 0:i[n.reference])||`${F2}?chainId=${n.namespace}:${n.reference}&projectId=${t}`}function Ca(r){return r.includes(":")?r.split(":")[1]:r}function z2(r){return r.map(e=>`${e.split(":")[0]}:${e.split(":")[1]}`)}function TB(r,e){const t=Object.keys(e.namespaces).filter(n=>n.includes(r));if(!t.length)return[];const i=[];return t.forEach(n=>{const a=e.namespaces[n].accounts;i.push(...a)}),i}function td(r={},e={}){const t=Hb(r),i=Hb(e);return $d.exports.merge(t,i)}function Hb(r){var e,t,i,n;const a={};if(!_c(r))return a;for(const[c,f]of Object.entries(r)){const g=f0(c)?[c]:f.chains,d=f.methods||[],m=f.events||[],w=f.rpcMap||{},O=uc(c);a[O]=OB(Zu(Zu({},a[O]),f),{chains:rf(g,(e=a[O])==null?void 0:e.chains),methods:rf(d,(t=a[O])==null?void 0:t.methods),events:rf(m,(i=a[O])==null?void 0:i.events),rpcMap:Zu(Zu({},w),(n=a[O])==null?void 0:n.rpcMap)})}return a}function RB(r){return r.includes(":")?r.split(":")[2]:r}function Kb(r){const e={};for(const[t,i]of Object.entries(r)){const n=i.methods||[],a=i.events||[],c=i.accounts||[],f=f0(t)?[t]:i.chains?i.chains:z2(i.accounts);e[t]={chains:f,methods:n,events:a,accounts:c}}return e}function rd(r){return typeof r=="number"?r:r.includes("0x")?parseInt(r,16):(r=r.includes(":")?r.split(":")[1]:r,isNaN(Number(r))?r:Number(r))}const j2={},Ut=r=>j2[r],id=(r,e)=>{j2[r]=e};class NB{constructor(e){this.name="polkadot",this.namespace=e.namespace,this.events=Ut("events"),this.client=Ut("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(e,t),this.chainId=e,this.events.emit(mn.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getAccounts(){const e=this.namespace.accounts;return e?e.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2])||[]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(t=>{var i;const n=Ca(t);e[n]=this.createHttpProvider(n,(i=this.namespace.rpcMap)==null?void 0:i[t])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){const i=this.createHttpProvider(e,t);i&&(this.httpProviders[e]=i)}createHttpProvider(e,t){const i=t||bn(e,this.namespace,this.client.core.projectId);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);return new vn(new Wn(i,Ut("disableProviderPing")))}}var BB=Object.defineProperty,$B=Object.defineProperties,UB=Object.getOwnPropertyDescriptors,Vb=Object.getOwnPropertySymbols,qB=Object.prototype.hasOwnProperty,LB=Object.prototype.propertyIsEnumerable,Gb=(r,e,t)=>e in r?BB(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Jb=(r,e)=>{for(var t in e||(e={}))qB.call(e,t)&&Gb(r,t,e[t]);if(Vb)for(var t of Vb(e))LB.call(e,t)&&Gb(r,t,e[t]);return r},Wb=(r,e)=>$B(r,UB(e));class FB{constructor(e){this.name="eip155",this.namespace=e.namespace,this.events=Ut("events"),this.client=Ut("client"),this.httpProviders=this.createHttpProviders(),this.chainId=parseInt(this.getDefaultChain())}async request(e){switch(e.request.method){case"eth_requestAccounts":return this.getAccounts();case"eth_accounts":return this.getAccounts();case"wallet_switchEthereumChain":return await this.handleSwitchChain(e);case"eth_chainId":return parseInt(this.getDefaultChain());case"wallet_getCapabilities":return await this.getCapabilities(e);case"wallet_getCallsStatus":return await this.getCallStatus(e)}return this.namespace.methods.includes(e.request.method)?await this.client.request(e):this.getHttpProvider().request(e.request)}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(parseInt(e),t),this.chainId=parseInt(e),this.events.emit(mn.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId.toString();if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}createHttpProvider(e,t){const i=t||bn(`${this.name}:${e}`,this.namespace,this.client.core.projectId);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);return new vn(new Wn(i,Ut("disableProviderPing")))}setHttpProvider(e,t){const i=this.createHttpProvider(e,t);i&&(this.httpProviders[e]=i)}createHttpProviders(){const e={};return this.namespace.chains.forEach(t=>{var i;const n=parseInt(Ca(t));e[n]=this.createHttpProvider(n,(i=this.namespace.rpcMap)==null?void 0:i[t])}),e}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2]))]:[]}getHttpProvider(){const e=this.chainId,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}async handleSwitchChain(e){var t,i;let n=e.request.params?(t=e.request.params[0])==null?void 0:t.chainId:"0x0";n=n.startsWith("0x")?n:`0x${n}`;const a=parseInt(n,16);if(this.isChainApproved(a))this.setDefaultChain(`${a}`);else if(this.namespace.methods.includes("wallet_switchEthereumChain"))await this.client.request({topic:e.topic,request:{method:e.request.method,params:[{chainId:n}]},chainId:(i=this.namespace.chains)==null?void 0:i[0]}),this.setDefaultChain(`${a}`);else throw new Error(`Failed to switch to chain 'eip155:${a}'. The chain is not approved or the wallet does not support 'wallet_switchEthereumChain' method.`);return null}isChainApproved(e){return this.namespace.chains.includes(`${this.name}:${e}`)}async getCapabilities(e){var t,i,n;const a=(i=(t=e.request)==null?void 0:t.params)==null?void 0:i[0];if(!a)throw new Error("Missing address parameter in `wallet_getCapabilities` request");const c=this.client.session.get(e.topic),f=((n=c==null?void 0:c.sessionProperties)==null?void 0:n.capabilities)||{};if(f!=null&&f[a])return f==null?void 0:f[a];const g=await this.client.request(e);try{await this.client.session.update(e.topic,{sessionProperties:Wb(Jb({},c.sessionProperties||{}),{capabilities:Wb(Jb({},f||{}),{[a]:g})})})}catch(d){console.warn("Failed to update session with capabilities",d)}return g}async getCallStatus(e){var t,i;const n=this.client.session.get(e.topic),a=(t=n.sessionProperties)==null?void 0:t.bundler_name;if(a){const f=this.getBundlerUrl(e.chainId,a);try{return await this.getUserOperationReceipt(f,e)}catch(g){console.warn("Failed to fetch call status from bundler",g,f)}}const c=(i=n.sessionProperties)==null?void 0:i.bundler_url;if(c)try{return await this.getUserOperationReceipt(c,e)}catch(f){console.warn("Failed to fetch call status from custom bundler",f,c)}if(this.namespace.methods.includes(e.request.method))return await this.client.request(e);throw new Error("Fetching call status not approved by the wallet.")}async getUserOperationReceipt(e,t){var i;const n=new URL(e),a=await fetch(n,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(Fs("eth_getUserOperationReceipt",[(i=t.request.params)==null?void 0:i[0]]))});if(!a.ok)throw new Error(`Failed to fetch user operation receipt - ${a.status}`);return await a.json()}getBundlerUrl(e,t){return`${xB}?projectId=${this.client.core.projectId}&chainId=${e}&bundler=${t}`}}class zB{constructor(e){this.name="solana",this.namespace=e.namespace,this.events=Ut("events"),this.client=Ut("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(e,t),this.chainId=e,this.events.emit(mn.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(t=>{var i;const n=Ca(t);e[n]=this.createHttpProvider(n,(i=this.namespace.rpcMap)==null?void 0:i[t])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){const i=this.createHttpProvider(e,t);i&&(this.httpProviders[e]=i)}createHttpProvider(e,t){const i=t||bn(e,this.namespace,this.client.core.projectId);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);return new vn(new Wn(i,Ut("disableProviderPing")))}}class jB{constructor(e){this.name="cosmos",this.namespace=e.namespace,this.events=Ut("events"),this.client=Ut("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(e,t),this.chainId=e,this.events.emit(mn.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(t=>{var i;const n=Ca(t);e[n]=this.createHttpProvider(n,(i=this.namespace.rpcMap)==null?void 0:i[t])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){const i=this.createHttpProvider(e,t);i&&(this.httpProviders[e]=i)}createHttpProvider(e,t){const i=t||bn(e,this.namespace,this.client.core.projectId);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);return new vn(new Wn(i,Ut("disableProviderPing")))}}class kB{constructor(e){this.name="algorand",this.namespace=e.namespace,this.events=Ut("events"),this.client=Ut("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){if(!this.httpProviders[e]){const i=t||bn(`${this.name}:${e}`,this.namespace,this.client.core.projectId);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);this.setHttpProvider(e,i)}this.chainId=e,this.events.emit(mn.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(t=>{var i;e[t]=this.createHttpProvider(t,(i=this.namespace.rpcMap)==null?void 0:i[t])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){const i=this.createHttpProvider(e,t);i&&(this.httpProviders[e]=i)}createHttpProvider(e,t){const i=t||bn(e,this.namespace,this.client.core.projectId);return typeof i>"u"?void 0:new vn(new Wn(i,Ut("disableProviderPing")))}}class HB{constructor(e){this.name="cip34",this.namespace=e.namespace,this.events=Ut("events"),this.client=Ut("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(e,t),this.chainId=e,this.events.emit(mn.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(t=>{const i=this.getCardanoRPCUrl(t),n=Ca(t);e[n]=this.createHttpProvider(n,i)}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}getCardanoRPCUrl(e){const t=this.namespace.rpcMap;if(t)return t[e]}setHttpProvider(e,t){const i=this.createHttpProvider(e,t);i&&(this.httpProviders[e]=i)}createHttpProvider(e,t){const i=t||this.getCardanoRPCUrl(e);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);return new vn(new Wn(i,Ut("disableProviderPing")))}}class KB{constructor(e){this.name="elrond",this.namespace=e.namespace,this.events=Ut("events"),this.client=Ut("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(e,t),this.chainId=e,this.events.emit(mn.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(t=>{var i;const n=Ca(t);e[n]=this.createHttpProvider(n,(i=this.namespace.rpcMap)==null?void 0:i[t])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){const i=this.createHttpProvider(e,t);i&&(this.httpProviders[e]=i)}createHttpProvider(e,t){const i=t||bn(e,this.namespace,this.client.core.projectId);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);return new vn(new Wn(i,Ut("disableProviderPing")))}}class VB{constructor(e){this.name="multiversx",this.namespace=e.namespace,this.events=Ut("events"),this.client=Ut("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(e,t),this.chainId=e,this.events.emit(mn.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(t=>{var i;const n=Ca(t);e[n]=this.createHttpProvider(n,(i=this.namespace.rpcMap)==null?void 0:i[t])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){const i=this.createHttpProvider(e,t);i&&(this.httpProviders[e]=i)}createHttpProvider(e,t){const i=t||bn(e,this.namespace,this.client.core.projectId);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);return new vn(new Wn(i,Ut("disableProviderPing")))}}class GB{constructor(e){this.name="near",this.namespace=e.namespace,this.events=Ut("events"),this.client=Ut("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){if(this.chainId=e,!this.httpProviders[e]){const i=t||bn(`${this.name}:${e}`,this.namespace);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);this.setHttpProvider(e,i)}this.events.emit(mn.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e?e.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2])||[]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(t=>{var i;e[t]=this.createHttpProvider(t,(i=this.namespace.rpcMap)==null?void 0:i[t])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){const i=this.createHttpProvider(e,t);i&&(this.httpProviders[e]=i)}createHttpProvider(e,t){const i=t||bn(e,this.namespace);return typeof i>"u"?void 0:new vn(new Wn(i,Ut("disableProviderPing")))}}class JB{constructor(e){this.name=Za,this.namespace=e.namespace,this.events=Ut("events"),this.client=Ut("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace.chains=[...new Set((this.namespace.chains||[]).concat(e.chains||[]))],this.namespace.accounts=[...new Set((this.namespace.accounts||[]).concat(e.accounts||[]))],this.namespace.methods=[...new Set((this.namespace.methods||[]).concat(e.methods||[]))],this.namespace.events=[...new Set((this.namespace.events||[]).concat(e.events||[]))],this.httpProviders=this.createHttpProviders()}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider(e.chainId).request(e.request)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(e,t),this.chainId=e,this.events.emit(mn.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2]))]:[]}createHttpProviders(){var e,t;const i={};return(t=(e=this.namespace)==null?void 0:e.accounts)==null||t.forEach(n=>{const a=fc(n);i[`${a.namespace}:${a.reference}`]=this.createHttpProvider(n)}),i}getHttpProvider(e){const t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){const i=this.createHttpProvider(e,t);i&&(this.httpProviders[e]=i)}createHttpProvider(e,t){const i=t||bn(e,this.namespace,this.client.core.projectId);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);return new vn(new Wn(i,Ut("disableProviderPing")))}}var WB=Object.defineProperty,YB=Object.defineProperties,QB=Object.getOwnPropertyDescriptors,Yb=Object.getOwnPropertySymbols,XB=Object.prototype.hasOwnProperty,ZB=Object.prototype.propertyIsEnumerable,Qb=(r,e,t)=>e in r?WB(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,ef=(r,e)=>{for(var t in e||(e={}))XB.call(e,t)&&Qb(r,t,e[t]);if(Yb)for(var t of Yb(e))ZB.call(e,t)&&Qb(r,t,e[t]);return r},nd=(r,e)=>YB(r,QB(e));class y0{constructor(e){this.events=new Fd,this.rpcProviders={},this.shouldAbortPairingAttempt=!1,this.maxPairingAttempts=10,this.disableProviderPing=!1,this.providerOpts=e,this.logger=typeof(e==null?void 0:e.logger)<"u"&&typeof(e==null?void 0:e.logger)!="string"?e.logger:Uc(Zf({level:(e==null?void 0:e.logger)||Fb})),this.disableProviderPing=(e==null?void 0:e.disableProviderPing)||!1}static async init(e){const t=new y0(e);return await t.initialize(),t}async request(e,t,i){const[n,a]=this.validateChain(t);if(!this.session)throw new Error("Please call connect() before request()");return await this.getProvider(n).request({request:ef({},e),chainId:`${n}:${a}`,topic:this.session.topic,expiry:i})}sendAsync(e,t,i,n){const a=new Date().getTime();this.request(e,i,n).then(c=>t(null,th(a,c))).catch(c=>t(c,void 0))}async enable(){if(!this.client)throw new Error("Sign Client not initialized");return this.session||await this.connect({namespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties}),await this.requestAccounts()}async disconnect(){var e;if(!this.session)throw new Error("Please call connect() before enable()");await this.client.disconnect({topic:(e=this.session)==null?void 0:e.topic,reason:Lt("USER_DISCONNECTED")}),await this.cleanup()}async connect(e){if(!this.client)throw new Error("Sign Client not initialized");if(this.setNamespaces(e),await this.cleanupPendingPairings(),!e.skipPairing)return await this.pair(e.pairingTopic)}async authenticate(e,t){if(!this.client)throw new Error("Sign Client not initialized");this.setNamespaces(e),await this.cleanupPendingPairings();const{uri:i,response:n}=await this.client.authenticate(e,t);i&&(this.uri=i,this.events.emit("display_uri",i));const a=await n();if(this.session=a.session,this.session){const c=Kb(this.session.namespaces);this.namespaces=td(this.namespaces,c),this.persist("namespaces",this.namespaces),this.onConnect()}return a}on(e,t){this.events.on(e,t)}once(e,t){this.events.once(e,t)}removeListener(e,t){this.events.removeListener(e,t)}off(e,t){this.events.off(e,t)}get isWalletConnect(){return!0}async pair(e){this.shouldAbortPairingAttempt=!1;let t=0;do{if(this.shouldAbortPairingAttempt)throw new Error("Pairing aborted");if(t>=this.maxPairingAttempts)throw new Error("Max auto pairing attempts reached");const{uri:i,approval:n}=await this.client.connect({pairingTopic:e,requiredNamespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties});i&&(this.uri=i,this.events.emit("display_uri",i)),await n().then(a=>{this.session=a;const c=Kb(a.namespaces);this.namespaces=td(this.namespaces,c),this.persist("namespaces",this.namespaces)}).catch(a=>{if(a.message!==L2)throw a;t++})}while(!this.session);return this.onConnect(),this.session}setDefaultChain(e,t){try{if(!this.session)return;const[i,n]=this.validateChain(e),a=this.getProvider(i);a.name===Za?a.setDefaultChain(`${i}:${n}`,t):a.setDefaultChain(n,t)}catch(i){if(!/Please call connect/.test(i.message))throw i}}async cleanupPendingPairings(e={}){this.logger.info("Cleaning up inactive pairings...");const t=this.client.pairing.getAll();if(Hn(t)){for(const i of t)e.deletePairings?this.client.core.expirer.set(i.topic,0):await this.client.core.relayer.subscriber.unsubscribe(i.topic);this.logger.info(`Inactive pairings cleared: ${t.length}`)}}abortPairingAttempt(){this.shouldAbortPairingAttempt=!0}async checkStorage(){if(this.namespaces=await this.getFromStore("namespaces"),this.optionalNamespaces=await this.getFromStore("optionalNamespaces")||{},this.client.session.length){const e=this.client.session.keys.length-1;this.session=this.client.session.get(this.client.session.keys[e]),this.createProviders()}}async initialize(){this.logger.trace("Initialized"),await this.createClient(),await this.checkStorage(),this.registerEventListeners()}async createClient(){this.client=this.providerOpts.client||await m0.init({core:this.providerOpts.core,logger:this.providerOpts.logger||Fb,relayUrl:this.providerOpts.relayUrl||DB,projectId:this.providerOpts.projectId,metadata:this.providerOpts.metadata,storageOptions:this.providerOpts.storageOptions,storage:this.providerOpts.storage,name:this.providerOpts.name,customStoragePrefix:this.providerOpts.customStoragePrefix,telemetryEnabled:this.providerOpts.telemetryEnabled}),this.logger.trace("SignClient Initialized")}createProviders(){if(!this.client)throw new Error("Sign Client not initialized");if(!this.session)throw new Error("Session not initialized. Please call connect() before enable()");const e=[...new Set(Object.keys(this.session.namespaces).map(t=>uc(t)))];id("client",this.client),id("events",this.events),id("disableProviderPing",this.disableProviderPing),e.forEach(t=>{if(!this.session)return;const i=TB(t,this.session),n=z2(i),a=td(this.namespaces,this.optionalNamespaces),c=nd(ef({},a[t]),{accounts:i,chains:n});switch(t){case"eip155":this.rpcProviders[t]=new FB({namespace:c});break;case"algorand":this.rpcProviders[t]=new kB({namespace:c});break;case"solana":this.rpcProviders[t]=new zB({namespace:c});break;case"cosmos":this.rpcProviders[t]=new jB({namespace:c});break;case"polkadot":this.rpcProviders[t]=new NB({namespace:c});break;case"cip34":this.rpcProviders[t]=new HB({namespace:c});break;case"elrond":this.rpcProviders[t]=new KB({namespace:c});break;case"multiversx":this.rpcProviders[t]=new VB({namespace:c});break;case"near":this.rpcProviders[t]=new GB({namespace:c});break;default:this.rpcProviders[Za]?this.rpcProviders[Za].updateNamespace(c):this.rpcProviders[Za]=new JB({namespace:c})}})}registerEventListeners(){if(typeof this.client>"u")throw new Error("Sign Client is not initialized");this.client.on("session_ping",e=>{this.events.emit("session_ping",e)}),this.client.on("session_event",e=>{const{params:t}=e,{event:i}=t;if(i.name==="accountsChanged"){const n=i.data;n&&Hn(n)&&this.events.emit("accountsChanged",n.map(RB))}else if(i.name==="chainChanged"){const n=t.chainId,a=t.event.data,c=uc(n),f=rd(n)!==rd(a)?`${c}:${rd(a)}`:n;this.onChainChanged(f)}else this.events.emit(i.name,i.data);this.events.emit("session_event",e)}),this.client.on("session_update",({topic:e,params:t})=>{var i;const{namespaces:n}=t,a=(i=this.client)==null?void 0:i.session.get(e);this.session=nd(ef({},a),{namespaces:n}),this.onSessionUpdate(),this.events.emit("session_update",{topic:e,params:t})}),this.client.on("session_delete",async e=>{await this.cleanup(),this.events.emit("session_delete",e),this.events.emit("disconnect",nd(ef({},Lt("USER_DISCONNECTED")),{data:e.topic}))}),this.on(mn.DEFAULT_CHAIN_CHANGED,e=>{this.onChainChanged(e,!0)})}getProvider(e){return this.rpcProviders[e]||this.rpcProviders[Za]}onSessionUpdate(){Object.keys(this.rpcProviders).forEach(e=>{var t;this.getProvider(e).updateNamespace((t=this.session)==null?void 0:t.namespaces[e])})}setNamespaces(e){const{namespaces:t,optionalNamespaces:i,sessionProperties:n}=e;t&&Object.keys(t).length&&(this.namespaces=t),i&&Object.keys(i).length&&(this.optionalNamespaces=i),this.sessionProperties=n,this.persist("namespaces",t),this.persist("optionalNamespaces",i)}validateChain(e){const[t,i]=(e==null?void 0:e.split(":"))||["",""];if(!this.namespaces||!Object.keys(this.namespaces).length)return[t,i];if(t&&!Object.keys(this.namespaces||{}).map(c=>uc(c)).includes(t))throw new Error(`Namespace '${t}' is not configured. Please call connect() first with namespace config.`);if(t&&i)return[t,i];const n=uc(Object.keys(this.namespaces)[0]),a=this.rpcProviders[n].getDefaultChain();return[n,a]}async requestAccounts(){const[e]=this.validateChain();return await this.getProvider(e).requestAccounts()}onChainChanged(e,t=!1){if(!this.namespaces)return;const[i,n]=this.validateChain(e);n&&(t||this.getProvider(i).setDefaultChain(n),this.namespaces[i]?this.namespaces[i].defaultChain=n:this.namespaces[`${i}:${n}`]?this.namespaces[`${i}:${n}`].defaultChain=n:this.namespaces[`${i}:${n}`]={defaultChain:n},this.persist("namespaces",this.namespaces),this.events.emit("chainChanged",n))}onConnect(){this.createProviders(),this.events.emit("connect",{session:this.session})}async cleanup(){this.session=void 0,this.namespaces=void 0,this.optionalNamespaces=void 0,this.sessionProperties=void 0,this.persist("namespaces",void 0),this.persist("optionalNamespaces",void 0),this.persist("sessionProperties",void 0),await this.cleanupPendingPairings({deletePairings:!0})}persist(e,t){this.client.core.storage.setItem(`${zb}/${e}`,t)}async getFromStore(e){return await this.client.core.storage.getItem(`${zb}/${e}`)}}const e$=y0,t$="wc",r$="ethereum_provider",i$=`${t$}@2:${r$}:`,n$="https://rpc.walletconnect.org/v1/",Ud=["eth_sendTransaction","personal_sign"],s$=["eth_accounts","eth_requestAccounts","eth_sendRawTransaction","eth_sign","eth_signTransaction","eth_signTypedData","eth_signTypedData_v3","eth_signTypedData_v4","eth_sendTransaction","personal_sign","wallet_switchEthereumChain","wallet_addEthereumChain","wallet_getPermissions","wallet_requestPermissions","wallet_registerOnboarding","wallet_watchAsset","wallet_scanQRCode","wallet_sendCalls","wallet_getCapabilities","wallet_getCallsStatus","wallet_showCallsStatus"],qd=["chainChanged","accountsChanged"],a$=["chainChanged","accountsChanged","message","disconnect","connect"];var o$=Object.defineProperty,c$=Object.defineProperties,u$=Object.getOwnPropertyDescriptors,Xb=Object.getOwnPropertySymbols,f$=Object.prototype.hasOwnProperty,h$=Object.prototype.propertyIsEnumerable,Zb=(r,e,t)=>e in r?o$(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,eo=(r,e)=>{for(var t in e||(e={}))f$.call(e,t)&&Zb(r,t,e[t]);if(Xb)for(var t of Xb(e))h$.call(e,t)&&Zb(r,t,e[t]);return r},sd=(r,e)=>c$(r,u$(e));function Cf(r){return Number(r[0].split(":")[1])}function tf(r){return`0x${r.toString(16)}`}function l$(r){const{chains:e,optionalChains:t,methods:i,optionalMethods:n,events:a,optionalEvents:c,rpcMap:f}=r;if(!Hn(e))throw new Error("Invalid chains");const g={chains:e,methods:i||Ud,events:a||qd,rpcMap:eo({},e.length?{[Cf(e)]:f[Cf(e)]}:{})},d=a==null?void 0:a.filter(C=>!qd.includes(C)),m=i==null?void 0:i.filter(C=>!Ud.includes(C));if(!t&&!c&&!n&&!(d!=null&&d.length)&&!(m!=null&&m.length))return{required:e.length?g:void 0};const w=(d==null?void 0:d.length)&&(m==null?void 0:m.length)||!t,O={chains:[...new Set(w?g.chains.concat(t||[]):t)],methods:[...new Set(g.methods.concat(n!=null&&n.length?n:s$))],events:[...new Set(g.events.concat(c!=null&&c.length?c:a$))],rpcMap:f};return{required:e.length?g:void 0,optional:t.length?O:void 0}}class w0{constructor(){this.events=new Vi.EventEmitter,this.namespace="eip155",this.accounts=[],this.chainId=1,this.STORAGE_KEY=i$,this.on=(e,t)=>(this.events.on(e,t),this),this.once=(e,t)=>(this.events.once(e,t),this),this.removeListener=(e,t)=>(this.events.removeListener(e,t),this),this.off=(e,t)=>(this.events.off(e,t),this),this.parseAccount=e=>this.isCompatibleChainId(e)?this.parseAccountId(e).address:e,this.signer={},this.rpc={}}static async init(e){const t=new w0;return await t.initialize(e),t}async request(e,t){return await this.signer.request(e,this.formatChainId(this.chainId),t)}sendAsync(e,t,i){this.signer.sendAsync(e,t,this.formatChainId(this.chainId),i)}get connected(){return this.signer.client?this.signer.client.core.relayer.connected:!1}get connecting(){return this.signer.client?this.signer.client.core.relayer.connecting:!1}async enable(){return this.session||await this.connect(),await this.request({method:"eth_requestAccounts"})}async connect(e){if(!this.signer.client)throw new Error("Provider not initialized. Call init() first");this.loadConnectOpts(e);const{required:t,optional:i}=l$(this.rpc);try{const n=await new Promise(async(c,f)=>{var g;this.rpc.showQrModal&&((g=this.modal)==null||g.subscribeModal(d=>{!d.open&&!this.signer.session&&(this.signer.abortPairingAttempt(),f(new Error("Connection request reset. Please try again.")))})),await this.signer.connect(sd(eo({namespaces:eo({},t&&{[this.namespace]:t})},i&&{optionalNamespaces:{[this.namespace]:i}}),{pairingTopic:e==null?void 0:e.pairingTopic})).then(d=>{c(d)}).catch(d=>{f(new Error(d.message))})});if(!n)return;const a=X1(n.namespaces,[this.namespace]);this.setChainIds(this.rpc.chains.length?this.rpc.chains:a),this.setAccounts(a),this.events.emit("connect",{chainId:tf(this.chainId)})}catch(n){throw this.signer.logger.error(n),n}finally{this.modal&&this.modal.closeModal()}}async authenticate(e,t){if(!this.signer.client)throw new Error("Provider not initialized. Call init() first");this.loadConnectOpts({chains:e==null?void 0:e.chains});try{const i=await new Promise(async(a,c)=>{var f;this.rpc.showQrModal&&((f=this.modal)==null||f.subscribeModal(g=>{!g.open&&!this.signer.session&&(this.signer.abortPairingAttempt(),c(new Error("Connection request reset. Please try again.")))})),await this.signer.authenticate(sd(eo({},e),{chains:this.rpc.chains}),t).then(g=>{a(g)}).catch(g=>{c(new Error(g.message))})}),n=i.session;if(n){const a=X1(n.namespaces,[this.namespace]);this.setChainIds(this.rpc.chains.length?this.rpc.chains:a),this.setAccounts(a),this.events.emit("connect",{chainId:tf(this.chainId)})}return i}catch(i){throw this.signer.logger.error(i),i}finally{this.modal&&this.modal.closeModal()}}async disconnect(){this.session&&await this.signer.disconnect(),this.reset()}get isWalletConnect(){return!0}get session(){return this.signer.session}registerEventListeners(){this.signer.on("session_event",e=>{const{params:t}=e,{event:i}=t;i.name==="accountsChanged"?(this.accounts=this.parseAccounts(i.data),this.events.emit("accountsChanged",this.accounts)):i.name==="chainChanged"?this.setChainId(this.formatChainId(i.data)):this.events.emit(i.name,i.data),this.events.emit("session_event",e)}),this.signer.on("chainChanged",e=>{const t=parseInt(e);this.chainId=t,this.events.emit("chainChanged",tf(this.chainId)),this.persist()}),this.signer.on("session_update",e=>{this.events.emit("session_update",e)}),this.signer.on("session_delete",e=>{this.reset(),this.events.emit("session_delete",e),this.events.emit("disconnect",sd(eo({},Lt("USER_DISCONNECTED")),{data:e.topic,name:"USER_DISCONNECTED"}))}),this.signer.on("display_uri",e=>{var t,i;this.rpc.showQrModal&&((t=this.modal)==null||t.closeModal(),(i=this.modal)==null||i.openModal({uri:e})),this.events.emit("display_uri",e)})}switchEthereumChain(e){this.request({method:"wallet_switchEthereumChain",params:[{chainId:e.toString(16)}]})}isCompatibleChainId(e){return typeof e=="string"?e.startsWith(`${this.namespace}:`):!1}formatChainId(e){return`${this.namespace}:${e}`}parseChainId(e){return Number(e.split(":")[1])}setChainIds(e){const t=e.filter(i=>this.isCompatibleChainId(i)).map(i=>this.parseChainId(i));t.length&&(this.chainId=t[0],this.events.emit("chainChanged",tf(this.chainId)),this.persist())}setChainId(e){if(this.isCompatibleChainId(e)){const t=this.parseChainId(e);this.chainId=t,this.switchEthereumChain(t)}}parseAccountId(e){const[t,i,n]=e.split(":");return{chainId:`${t}:${i}`,address:n}}setAccounts(e){this.accounts=e.filter(t=>this.parseChainId(this.parseAccountId(t).chainId)===this.chainId).map(t=>this.parseAccountId(t).address),this.events.emit("accountsChanged",this.accounts)}getRpcConfig(e){var t,i;const n=(t=e==null?void 0:e.chains)!=null?t:[],a=(i=e==null?void 0:e.optionalChains)!=null?i:[],c=n.concat(a);if(!c.length)throw new Error("No chains specified in either `chains` or `optionalChains`");const f=n.length?(e==null?void 0:e.methods)||Ud:[],g=n.length?(e==null?void 0:e.events)||qd:[],d=(e==null?void 0:e.optionalMethods)||[],m=(e==null?void 0:e.optionalEvents)||[],w=(e==null?void 0:e.rpcMap)||this.buildRpcMap(c,e.projectId),O=(e==null?void 0:e.qrModalOptions)||void 0;return{chains:n==null?void 0:n.map(C=>this.formatChainId(C)),optionalChains:a.map(C=>this.formatChainId(C)),methods:f,events:g,optionalMethods:d,optionalEvents:m,rpcMap:w,showQrModal:!!(e!=null&&e.showQrModal),qrModalOptions:O,projectId:e.projectId,metadata:e.metadata}}buildRpcMap(e,t){const i={};return e.forEach(n=>{i[n]=this.getRpcUrl(n,t)}),i}async initialize(e){if(this.rpc=this.getRpcConfig(e),this.chainId=this.rpc.chains.length?Cf(this.rpc.chains):Cf(this.rpc.optionalChains),this.signer=await e$.init({projectId:this.rpc.projectId,metadata:this.rpc.metadata,disableProviderPing:e.disableProviderPing,relayUrl:e.relayUrl,storageOptions:e.storageOptions,customStoragePrefix:e.customStoragePrefix,telemetryEnabled:e.telemetryEnabled}),this.registerEventListeners(),await this.loadPersistedSession(),this.rpc.showQrModal){let t;try{const{WalletConnectModal:i}=await _4(()=>import("./index-C91wHTLi.js").then(n=>n.i),__vite__mapDeps([0,1,2]));t=i}catch{throw new Error("To use QR modal, please install @walletconnect/modal package")}if(t)try{this.modal=new t(eo({projectId:this.rpc.projectId},this.rpc.qrModalOptions))}catch(i){throw this.signer.logger.error(i),new Error("Could not generate WalletConnectModal Instance")}}}loadConnectOpts(e){if(!e)return;const{chains:t,optionalChains:i,rpcMap:n}=e;t&&Hn(t)&&(this.rpc.chains=t.map(a=>this.formatChainId(a)),t.forEach(a=>{this.rpc.rpcMap[a]=(n==null?void 0:n[a])||this.getRpcUrl(a)})),i&&Hn(i)&&(this.rpc.optionalChains=[],this.rpc.optionalChains=i==null?void 0:i.map(a=>this.formatChainId(a)),i.forEach(a=>{this.rpc.rpcMap[a]=(n==null?void 0:n[a])||this.getRpcUrl(a)}))}getRpcUrl(e,t){var i;return((i=this.rpc.rpcMap)==null?void 0:i[e])||`${n$}?chainId=eip155:${e}&projectId=${t||this.rpc.projectId}`}async loadPersistedSession(){if(this.session)try{const e=await this.signer.client.core.storage.getItem(`${this.STORAGE_KEY}/chainId`),t=this.session.namespaces[`${this.namespace}:${e}`]?this.session.namespaces[`${this.namespace}:${e}`]:this.session.namespaces[this.namespace];this.setChainIds(e?[this.formatChainId(e)]:t==null?void 0:t.accounts),this.setAccounts(t==null?void 0:t.accounts)}catch(e){this.signer.logger.error("Failed to load persisted session, clearing state..."),this.signer.logger.error(e),await this.disconnect().catch(t=>this.signer.logger.warn(t))}}reset(){this.chainId=1,this.accounts=[]}persist(){this.session&&this.signer.client.core.storage.setItem(`${this.STORAGE_KEY}/chainId`,this.chainId)}parseAccounts(e){return typeof e=="string"||e instanceof String?[this.parseAccount(e)]:e.map(t=>this.parseAccount(t))}}const V$=w0;export{V$ as EthereumProvider,a$ as OPTIONAL_EVENTS,s$ as OPTIONAL_METHODS,qd as REQUIRED_EVENTS,Ud as REQUIRED_METHODS,w0 as default}; +}`;var wt=v1(function(){return Bt(F,Je+"return "+ge).apply(t,Q)});if(wt.source=ge,nl(wt))throw wt;return wt}function M5(s){return $t(s).toLowerCase()}function I5(s){return $t(s).toUpperCase()}function C5(s,o,l){if(s=$t(s),s&&(l||o===t))return S0(s);if(!s||!(o=vi(o)))return s;var A=rn(s),T=rn(o),F=M0(A,T),Q=I0(A,T)+1;return Cs(A,F,Q).join("")}function P5(s,o,l){if(s=$t(s),s&&(l||o===t))return s.slice(0,P0(s)+1);if(!s||!(o=vi(o)))return s;var A=rn(s),T=I0(A,rn(o))+1;return Cs(A,0,T).join("")}function O5(s,o,l){if(s=$t(s),s&&(l||o===t))return s.replace(it,"");if(!s||!(o=vi(o)))return s;var A=rn(s),T=M0(A,rn(o));return Cs(A,T).join("")}function T5(s,o){var l=le,A=U;if(Zt(o)){var T="separator"in o?o.separator:T;l="length"in o?yt(o.length):l,A="omission"in o?vi(o.omission):A}s=$t(s);var F=s.length;if(Ba(s)){var Q=rn(s);F=Q.length}if(l>=F)return s;var X=l-$a(A);if(X<1)return A;var ie=Q?Cs(Q,0,X).join(""):s.slice(0,X);if(T===t)return ie+A;if(Q&&(X+=ie.length-X),sl(T)){if(s.slice(X).search(T)){var he,de=ie;for(T.global||(T=_h(T.source,$t(vt.exec(T))+"g")),T.lastIndex=0;he=T.exec(de);)var ge=he.index;ie=ie.slice(0,ge===t?X:ge)}}else if(s.indexOf(vi(T),X)!=X){var Ie=ie.lastIndexOf(T);Ie>-1&&(ie=ie.slice(0,Ie))}return ie+A}function R5(s){return s=$t(s),s&&Be.test(s)?s.replace(Et,cm):s}var N5=ka(function(s,o,l){return s+(l?" ":"")+o.toUpperCase()}),cl=mp("toUpperCase");function b1(s,o,l){return s=$t(s),o=l?t:o,o===t?im(s)?hm(s):J2(s):s.match(o)||[]}var v1=Dt(function(s,o){try{return vr(s,t,o)}catch(l){return nl(l)?l:new dt(l)}}),B5=ts(function(s,o){return Pi(o,function(l){l=En(l),Zn(s,l,rl(s[l],s))}),s});function $5(s){var o=s==null?0:s.length,l=nt();return s=o?Xt(s,function(A){if(typeof A[1]!="function")throw new Oi(c);return[l(A[0]),A[1]]}):[],Dt(function(A){for(var T=-1;++TM)return[];var l=b,A=qr(s,b);o=nt(o),s-=b;for(var T=mh(A,o);++l0||o<0)?new Mt(l):(s<0?l=l.takeRight(-s):s&&(l=l.drop(s)),o!==t&&(o=yt(o),l=o<0?l.dropRight(-o):l.take(o-s)),l)},Mt.prototype.takeRightWhile=function(s){return this.reverse().takeWhile(s).reverse()},Mt.prototype.toArray=function(){return this.take(b)},_n(Mt.prototype,function(s,o){var l=/^(?:filter|find|map|reject)|While$/.test(o),A=/^(?:head|last)$/.test(o),T=$[A?"take"+(o=="last"?"Right":""):o],F=A||/^find/.test(o);T&&($.prototype[o]=function(){var Q=this.__wrapped__,X=A?[1]:arguments,ie=Q instanceof Mt,he=X[0],de=ie||gt(Q),ge=function(At){var Tt=T.apply($,Es([At],X));return A&&Ie?Tt[0]:Tt};de&&l&&typeof he=="function"&&he.length!=1&&(ie=de=!1);var Ie=this.__chain__,Je=!!this.__actions__.length,ot=F&&!Ie,wt=ie&&!Je;if(!F&&de){Q=wt?Q:new Mt(this);var ct=s.apply(Q,X);return ct.__actions__.push({func:Bu,args:[ge],thisArg:t}),new Ti(ct,Ie)}return ot&&wt?s.apply(this,X):(ct=this.thru(ge),ot?A?ct.value()[0]:ct.value():ct)})}),Pi(["pop","push","shift","sort","splice","unshift"],function(s){var o=ou[s],l=/^(?:push|sort|unshift)$/.test(s)?"tap":"thru",A=/^(?:pop|shift)$/.test(s);$.prototype[s]=function(){var T=arguments;if(A&&!this.__chain__){var F=this.value();return o.apply(gt(F)?F:[],T)}return this[l](function(Q){return o.apply(gt(Q)?Q:[],T)})}}),_n(Mt.prototype,function(s,o){var l=$[o];if(l){var A=l.name+"";qt.call(Fa,A)||(Fa[A]=[]),Fa[A].push({name:o,func:l})}}),Fa[Iu(t,Y).name]=[{name:"wrapper",func:t}],Mt.prototype.clone=Rm,Mt.prototype.reverse=Nm,Mt.prototype.value=Bm,$.prototype.at=f8,$.prototype.chain=h8,$.prototype.commit=l8,$.prototype.next=d8,$.prototype.plant=g8,$.prototype.reverse=b8,$.prototype.toJSON=$.prototype.valueOf=$.prototype.value=v8,$.prototype.first=$.prototype.head,Ro&&($.prototype[Ro]=p8),$},Ua=lm();sr?((sr.exports=Ua)._=Ua,kt._=Ua):Ot._=Ua}).call(ac)})($d,$d.exports);var SB=Object.defineProperty,MB=Object.defineProperties,IB=Object.getOwnPropertyDescriptors,jb=Object.getOwnPropertySymbols,CB=Object.prototype.hasOwnProperty,PB=Object.prototype.propertyIsEnumerable,kb=(r,e,t)=>e in r?SB(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Zu=(r,e)=>{for(var t in e||(e={}))CB.call(e,t)&&kb(r,t,e[t]);if(jb)for(var t of jb(e))PB.call(e,t)&&kb(r,t,e[t]);return r},OB=(r,e)=>MB(r,IB(e));function bn(r,e,t){var i;const n=fc(r);return((i=e.rpcMap)==null?void 0:i[n.reference])||`${F2}?chainId=${n.namespace}:${n.reference}&projectId=${t}`}function Ca(r){return r.includes(":")?r.split(":")[1]:r}function z2(r){return r.map(e=>`${e.split(":")[0]}:${e.split(":")[1]}`)}function TB(r,e){const t=Object.keys(e.namespaces).filter(n=>n.includes(r));if(!t.length)return[];const i=[];return t.forEach(n=>{const a=e.namespaces[n].accounts;i.push(...a)}),i}function td(r={},e={}){const t=Hb(r),i=Hb(e);return $d.exports.merge(t,i)}function Hb(r){var e,t,i,n;const a={};if(!_c(r))return a;for(const[c,f]of Object.entries(r)){const g=f0(c)?[c]:f.chains,d=f.methods||[],m=f.events||[],w=f.rpcMap||{},O=uc(c);a[O]=OB(Zu(Zu({},a[O]),f),{chains:rf(g,(e=a[O])==null?void 0:e.chains),methods:rf(d,(t=a[O])==null?void 0:t.methods),events:rf(m,(i=a[O])==null?void 0:i.events),rpcMap:Zu(Zu({},w),(n=a[O])==null?void 0:n.rpcMap)})}return a}function RB(r){return r.includes(":")?r.split(":")[2]:r}function Kb(r){const e={};for(const[t,i]of Object.entries(r)){const n=i.methods||[],a=i.events||[],c=i.accounts||[],f=f0(t)?[t]:i.chains?i.chains:z2(i.accounts);e[t]={chains:f,methods:n,events:a,accounts:c}}return e}function rd(r){return typeof r=="number"?r:r.includes("0x")?parseInt(r,16):(r=r.includes(":")?r.split(":")[1]:r,isNaN(Number(r))?r:Number(r))}const j2={},Ut=r=>j2[r],id=(r,e)=>{j2[r]=e};class NB{constructor(e){this.name="polkadot",this.namespace=e.namespace,this.events=Ut("events"),this.client=Ut("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(e,t),this.chainId=e,this.events.emit(mn.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getAccounts(){const e=this.namespace.accounts;return e?e.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2])||[]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(t=>{var i;const n=Ca(t);e[n]=this.createHttpProvider(n,(i=this.namespace.rpcMap)==null?void 0:i[t])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){const i=this.createHttpProvider(e,t);i&&(this.httpProviders[e]=i)}createHttpProvider(e,t){const i=t||bn(e,this.namespace,this.client.core.projectId);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);return new vn(new Wn(i,Ut("disableProviderPing")))}}var BB=Object.defineProperty,$B=Object.defineProperties,UB=Object.getOwnPropertyDescriptors,Vb=Object.getOwnPropertySymbols,qB=Object.prototype.hasOwnProperty,LB=Object.prototype.propertyIsEnumerable,Gb=(r,e,t)=>e in r?BB(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,Jb=(r,e)=>{for(var t in e||(e={}))qB.call(e,t)&&Gb(r,t,e[t]);if(Vb)for(var t of Vb(e))LB.call(e,t)&&Gb(r,t,e[t]);return r},Wb=(r,e)=>$B(r,UB(e));class FB{constructor(e){this.name="eip155",this.namespace=e.namespace,this.events=Ut("events"),this.client=Ut("client"),this.httpProviders=this.createHttpProviders(),this.chainId=parseInt(this.getDefaultChain())}async request(e){switch(e.request.method){case"eth_requestAccounts":return this.getAccounts();case"eth_accounts":return this.getAccounts();case"wallet_switchEthereumChain":return await this.handleSwitchChain(e);case"eth_chainId":return parseInt(this.getDefaultChain());case"wallet_getCapabilities":return await this.getCapabilities(e);case"wallet_getCallsStatus":return await this.getCallStatus(e)}return this.namespace.methods.includes(e.request.method)?await this.client.request(e):this.getHttpProvider().request(e.request)}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(parseInt(e),t),this.chainId=parseInt(e),this.events.emit(mn.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId.toString();if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}createHttpProvider(e,t){const i=t||bn(`${this.name}:${e}`,this.namespace,this.client.core.projectId);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);return new vn(new Wn(i,Ut("disableProviderPing")))}setHttpProvider(e,t){const i=this.createHttpProvider(e,t);i&&(this.httpProviders[e]=i)}createHttpProviders(){const e={};return this.namespace.chains.forEach(t=>{var i;const n=parseInt(Ca(t));e[n]=this.createHttpProvider(n,(i=this.namespace.rpcMap)==null?void 0:i[t])}),e}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2]))]:[]}getHttpProvider(){const e=this.chainId,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}async handleSwitchChain(e){var t,i;let n=e.request.params?(t=e.request.params[0])==null?void 0:t.chainId:"0x0";n=n.startsWith("0x")?n:`0x${n}`;const a=parseInt(n,16);if(this.isChainApproved(a))this.setDefaultChain(`${a}`);else if(this.namespace.methods.includes("wallet_switchEthereumChain"))await this.client.request({topic:e.topic,request:{method:e.request.method,params:[{chainId:n}]},chainId:(i=this.namespace.chains)==null?void 0:i[0]}),this.setDefaultChain(`${a}`);else throw new Error(`Failed to switch to chain 'eip155:${a}'. The chain is not approved or the wallet does not support 'wallet_switchEthereumChain' method.`);return null}isChainApproved(e){return this.namespace.chains.includes(`${this.name}:${e}`)}async getCapabilities(e){var t,i,n;const a=(i=(t=e.request)==null?void 0:t.params)==null?void 0:i[0];if(!a)throw new Error("Missing address parameter in `wallet_getCapabilities` request");const c=this.client.session.get(e.topic),f=((n=c==null?void 0:c.sessionProperties)==null?void 0:n.capabilities)||{};if(f!=null&&f[a])return f==null?void 0:f[a];const g=await this.client.request(e);try{await this.client.session.update(e.topic,{sessionProperties:Wb(Jb({},c.sessionProperties||{}),{capabilities:Wb(Jb({},f||{}),{[a]:g})})})}catch(d){console.warn("Failed to update session with capabilities",d)}return g}async getCallStatus(e){var t,i;const n=this.client.session.get(e.topic),a=(t=n.sessionProperties)==null?void 0:t.bundler_name;if(a){const f=this.getBundlerUrl(e.chainId,a);try{return await this.getUserOperationReceipt(f,e)}catch(g){console.warn("Failed to fetch call status from bundler",g,f)}}const c=(i=n.sessionProperties)==null?void 0:i.bundler_url;if(c)try{return await this.getUserOperationReceipt(c,e)}catch(f){console.warn("Failed to fetch call status from custom bundler",f,c)}if(this.namespace.methods.includes(e.request.method))return await this.client.request(e);throw new Error("Fetching call status not approved by the wallet.")}async getUserOperationReceipt(e,t){var i;const n=new URL(e),a=await fetch(n,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(Fs("eth_getUserOperationReceipt",[(i=t.request.params)==null?void 0:i[0]]))});if(!a.ok)throw new Error(`Failed to fetch user operation receipt - ${a.status}`);return await a.json()}getBundlerUrl(e,t){return`${xB}?projectId=${this.client.core.projectId}&chainId=${e}&bundler=${t}`}}class zB{constructor(e){this.name="solana",this.namespace=e.namespace,this.events=Ut("events"),this.client=Ut("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(e,t),this.chainId=e,this.events.emit(mn.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(t=>{var i;const n=Ca(t);e[n]=this.createHttpProvider(n,(i=this.namespace.rpcMap)==null?void 0:i[t])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){const i=this.createHttpProvider(e,t);i&&(this.httpProviders[e]=i)}createHttpProvider(e,t){const i=t||bn(e,this.namespace,this.client.core.projectId);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);return new vn(new Wn(i,Ut("disableProviderPing")))}}class jB{constructor(e){this.name="cosmos",this.namespace=e.namespace,this.events=Ut("events"),this.client=Ut("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(e,t),this.chainId=e,this.events.emit(mn.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(t=>{var i;const n=Ca(t);e[n]=this.createHttpProvider(n,(i=this.namespace.rpcMap)==null?void 0:i[t])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){const i=this.createHttpProvider(e,t);i&&(this.httpProviders[e]=i)}createHttpProvider(e,t){const i=t||bn(e,this.namespace,this.client.core.projectId);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);return new vn(new Wn(i,Ut("disableProviderPing")))}}class kB{constructor(e){this.name="algorand",this.namespace=e.namespace,this.events=Ut("events"),this.client=Ut("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){if(!this.httpProviders[e]){const i=t||bn(`${this.name}:${e}`,this.namespace,this.client.core.projectId);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);this.setHttpProvider(e,i)}this.chainId=e,this.events.emit(mn.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(t=>{var i;e[t]=this.createHttpProvider(t,(i=this.namespace.rpcMap)==null?void 0:i[t])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){const i=this.createHttpProvider(e,t);i&&(this.httpProviders[e]=i)}createHttpProvider(e,t){const i=t||bn(e,this.namespace,this.client.core.projectId);return typeof i>"u"?void 0:new vn(new Wn(i,Ut("disableProviderPing")))}}class HB{constructor(e){this.name="cip34",this.namespace=e.namespace,this.events=Ut("events"),this.client=Ut("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(e,t),this.chainId=e,this.events.emit(mn.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(t=>{const i=this.getCardanoRPCUrl(t),n=Ca(t);e[n]=this.createHttpProvider(n,i)}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}getCardanoRPCUrl(e){const t=this.namespace.rpcMap;if(t)return t[e]}setHttpProvider(e,t){const i=this.createHttpProvider(e,t);i&&(this.httpProviders[e]=i)}createHttpProvider(e,t){const i=t||this.getCardanoRPCUrl(e);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);return new vn(new Wn(i,Ut("disableProviderPing")))}}class KB{constructor(e){this.name="elrond",this.namespace=e.namespace,this.events=Ut("events"),this.client=Ut("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(e,t),this.chainId=e,this.events.emit(mn.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(t=>{var i;const n=Ca(t);e[n]=this.createHttpProvider(n,(i=this.namespace.rpcMap)==null?void 0:i[t])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){const i=this.createHttpProvider(e,t);i&&(this.httpProviders[e]=i)}createHttpProvider(e,t){const i=t||bn(e,this.namespace,this.client.core.projectId);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);return new vn(new Wn(i,Ut("disableProviderPing")))}}class VB{constructor(e){this.name="multiversx",this.namespace=e.namespace,this.events=Ut("events"),this.client=Ut("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(e,t),this.chainId=e,this.events.emit(mn.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(t=>{var i;const n=Ca(t);e[n]=this.createHttpProvider(n,(i=this.namespace.rpcMap)==null?void 0:i[t])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){const i=this.createHttpProvider(e,t);i&&(this.httpProviders[e]=i)}createHttpProvider(e,t){const i=t||bn(e,this.namespace,this.client.core.projectId);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);return new vn(new Wn(i,Ut("disableProviderPing")))}}class GB{constructor(e){this.name="near",this.namespace=e.namespace,this.events=Ut("events"),this.client=Ut("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){if(this.chainId=e,!this.httpProviders[e]){const i=t||bn(`${this.name}:${e}`,this.namespace);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);this.setHttpProvider(e,i)}this.events.emit(mn.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e?e.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2])||[]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(t=>{var i;e[t]=this.createHttpProvider(t,(i=this.namespace.rpcMap)==null?void 0:i[t])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){const i=this.createHttpProvider(e,t);i&&(this.httpProviders[e]=i)}createHttpProvider(e,t){const i=t||bn(e,this.namespace);return typeof i>"u"?void 0:new vn(new Wn(i,Ut("disableProviderPing")))}}class JB{constructor(e){this.name=Za,this.namespace=e.namespace,this.events=Ut("events"),this.client=Ut("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace.chains=[...new Set((this.namespace.chains||[]).concat(e.chains||[]))],this.namespace.accounts=[...new Set((this.namespace.accounts||[]).concat(e.accounts||[]))],this.namespace.methods=[...new Set((this.namespace.methods||[]).concat(e.methods||[]))],this.namespace.events=[...new Set((this.namespace.events||[]).concat(e.events||[]))],this.httpProviders=this.createHttpProviders()}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider(e.chainId).request(e.request)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(e,t),this.chainId=e,this.events.emit(mn.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(t=>t.split(":")[1]===this.chainId.toString()).map(t=>t.split(":")[2]))]:[]}createHttpProviders(){var e,t;const i={};return(t=(e=this.namespace)==null?void 0:e.accounts)==null||t.forEach(n=>{const a=fc(n);i[`${a.namespace}:${a.reference}`]=this.createHttpProvider(n)}),i}getHttpProvider(e){const t=this.httpProviders[e];if(typeof t>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){const i=this.createHttpProvider(e,t);i&&(this.httpProviders[e]=i)}createHttpProvider(e,t){const i=t||bn(e,this.namespace,this.client.core.projectId);if(!i)throw new Error(`No RPC url provided for chainId: ${e}`);return new vn(new Wn(i,Ut("disableProviderPing")))}}var WB=Object.defineProperty,YB=Object.defineProperties,QB=Object.getOwnPropertyDescriptors,Yb=Object.getOwnPropertySymbols,XB=Object.prototype.hasOwnProperty,ZB=Object.prototype.propertyIsEnumerable,Qb=(r,e,t)=>e in r?WB(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,ef=(r,e)=>{for(var t in e||(e={}))XB.call(e,t)&&Qb(r,t,e[t]);if(Yb)for(var t of Yb(e))ZB.call(e,t)&&Qb(r,t,e[t]);return r},nd=(r,e)=>YB(r,QB(e));class y0{constructor(e){this.events=new Fd,this.rpcProviders={},this.shouldAbortPairingAttempt=!1,this.maxPairingAttempts=10,this.disableProviderPing=!1,this.providerOpts=e,this.logger=typeof(e==null?void 0:e.logger)<"u"&&typeof(e==null?void 0:e.logger)!="string"?e.logger:Uc(Zf({level:(e==null?void 0:e.logger)||Fb})),this.disableProviderPing=(e==null?void 0:e.disableProviderPing)||!1}static async init(e){const t=new y0(e);return await t.initialize(),t}async request(e,t,i){const[n,a]=this.validateChain(t);if(!this.session)throw new Error("Please call connect() before request()");return await this.getProvider(n).request({request:ef({},e),chainId:`${n}:${a}`,topic:this.session.topic,expiry:i})}sendAsync(e,t,i,n){const a=new Date().getTime();this.request(e,i,n).then(c=>t(null,th(a,c))).catch(c=>t(c,void 0))}async enable(){if(!this.client)throw new Error("Sign Client not initialized");return this.session||await this.connect({namespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties}),await this.requestAccounts()}async disconnect(){var e;if(!this.session)throw new Error("Please call connect() before enable()");await this.client.disconnect({topic:(e=this.session)==null?void 0:e.topic,reason:Lt("USER_DISCONNECTED")}),await this.cleanup()}async connect(e){if(!this.client)throw new Error("Sign Client not initialized");if(this.setNamespaces(e),await this.cleanupPendingPairings(),!e.skipPairing)return await this.pair(e.pairingTopic)}async authenticate(e,t){if(!this.client)throw new Error("Sign Client not initialized");this.setNamespaces(e),await this.cleanupPendingPairings();const{uri:i,response:n}=await this.client.authenticate(e,t);i&&(this.uri=i,this.events.emit("display_uri",i));const a=await n();if(this.session=a.session,this.session){const c=Kb(this.session.namespaces);this.namespaces=td(this.namespaces,c),this.persist("namespaces",this.namespaces),this.onConnect()}return a}on(e,t){this.events.on(e,t)}once(e,t){this.events.once(e,t)}removeListener(e,t){this.events.removeListener(e,t)}off(e,t){this.events.off(e,t)}get isWalletConnect(){return!0}async pair(e){this.shouldAbortPairingAttempt=!1;let t=0;do{if(this.shouldAbortPairingAttempt)throw new Error("Pairing aborted");if(t>=this.maxPairingAttempts)throw new Error("Max auto pairing attempts reached");const{uri:i,approval:n}=await this.client.connect({pairingTopic:e,requiredNamespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties});i&&(this.uri=i,this.events.emit("display_uri",i)),await n().then(a=>{this.session=a;const c=Kb(a.namespaces);this.namespaces=td(this.namespaces,c),this.persist("namespaces",this.namespaces)}).catch(a=>{if(a.message!==L2)throw a;t++})}while(!this.session);return this.onConnect(),this.session}setDefaultChain(e,t){try{if(!this.session)return;const[i,n]=this.validateChain(e),a=this.getProvider(i);a.name===Za?a.setDefaultChain(`${i}:${n}`,t):a.setDefaultChain(n,t)}catch(i){if(!/Please call connect/.test(i.message))throw i}}async cleanupPendingPairings(e={}){this.logger.info("Cleaning up inactive pairings...");const t=this.client.pairing.getAll();if(Hn(t)){for(const i of t)e.deletePairings?this.client.core.expirer.set(i.topic,0):await this.client.core.relayer.subscriber.unsubscribe(i.topic);this.logger.info(`Inactive pairings cleared: ${t.length}`)}}abortPairingAttempt(){this.shouldAbortPairingAttempt=!0}async checkStorage(){if(this.namespaces=await this.getFromStore("namespaces"),this.optionalNamespaces=await this.getFromStore("optionalNamespaces")||{},this.client.session.length){const e=this.client.session.keys.length-1;this.session=this.client.session.get(this.client.session.keys[e]),this.createProviders()}}async initialize(){this.logger.trace("Initialized"),await this.createClient(),await this.checkStorage(),this.registerEventListeners()}async createClient(){this.client=this.providerOpts.client||await m0.init({core:this.providerOpts.core,logger:this.providerOpts.logger||Fb,relayUrl:this.providerOpts.relayUrl||DB,projectId:this.providerOpts.projectId,metadata:this.providerOpts.metadata,storageOptions:this.providerOpts.storageOptions,storage:this.providerOpts.storage,name:this.providerOpts.name,customStoragePrefix:this.providerOpts.customStoragePrefix,telemetryEnabled:this.providerOpts.telemetryEnabled}),this.logger.trace("SignClient Initialized")}createProviders(){if(!this.client)throw new Error("Sign Client not initialized");if(!this.session)throw new Error("Session not initialized. Please call connect() before enable()");const e=[...new Set(Object.keys(this.session.namespaces).map(t=>uc(t)))];id("client",this.client),id("events",this.events),id("disableProviderPing",this.disableProviderPing),e.forEach(t=>{if(!this.session)return;const i=TB(t,this.session),n=z2(i),a=td(this.namespaces,this.optionalNamespaces),c=nd(ef({},a[t]),{accounts:i,chains:n});switch(t){case"eip155":this.rpcProviders[t]=new FB({namespace:c});break;case"algorand":this.rpcProviders[t]=new kB({namespace:c});break;case"solana":this.rpcProviders[t]=new zB({namespace:c});break;case"cosmos":this.rpcProviders[t]=new jB({namespace:c});break;case"polkadot":this.rpcProviders[t]=new NB({namespace:c});break;case"cip34":this.rpcProviders[t]=new HB({namespace:c});break;case"elrond":this.rpcProviders[t]=new KB({namespace:c});break;case"multiversx":this.rpcProviders[t]=new VB({namespace:c});break;case"near":this.rpcProviders[t]=new GB({namespace:c});break;default:this.rpcProviders[Za]?this.rpcProviders[Za].updateNamespace(c):this.rpcProviders[Za]=new JB({namespace:c})}})}registerEventListeners(){if(typeof this.client>"u")throw new Error("Sign Client is not initialized");this.client.on("session_ping",e=>{this.events.emit("session_ping",e)}),this.client.on("session_event",e=>{const{params:t}=e,{event:i}=t;if(i.name==="accountsChanged"){const n=i.data;n&&Hn(n)&&this.events.emit("accountsChanged",n.map(RB))}else if(i.name==="chainChanged"){const n=t.chainId,a=t.event.data,c=uc(n),f=rd(n)!==rd(a)?`${c}:${rd(a)}`:n;this.onChainChanged(f)}else this.events.emit(i.name,i.data);this.events.emit("session_event",e)}),this.client.on("session_update",({topic:e,params:t})=>{var i;const{namespaces:n}=t,a=(i=this.client)==null?void 0:i.session.get(e);this.session=nd(ef({},a),{namespaces:n}),this.onSessionUpdate(),this.events.emit("session_update",{topic:e,params:t})}),this.client.on("session_delete",async e=>{await this.cleanup(),this.events.emit("session_delete",e),this.events.emit("disconnect",nd(ef({},Lt("USER_DISCONNECTED")),{data:e.topic}))}),this.on(mn.DEFAULT_CHAIN_CHANGED,e=>{this.onChainChanged(e,!0)})}getProvider(e){return this.rpcProviders[e]||this.rpcProviders[Za]}onSessionUpdate(){Object.keys(this.rpcProviders).forEach(e=>{var t;this.getProvider(e).updateNamespace((t=this.session)==null?void 0:t.namespaces[e])})}setNamespaces(e){const{namespaces:t,optionalNamespaces:i,sessionProperties:n}=e;t&&Object.keys(t).length&&(this.namespaces=t),i&&Object.keys(i).length&&(this.optionalNamespaces=i),this.sessionProperties=n,this.persist("namespaces",t),this.persist("optionalNamespaces",i)}validateChain(e){const[t,i]=(e==null?void 0:e.split(":"))||["",""];if(!this.namespaces||!Object.keys(this.namespaces).length)return[t,i];if(t&&!Object.keys(this.namespaces||{}).map(c=>uc(c)).includes(t))throw new Error(`Namespace '${t}' is not configured. Please call connect() first with namespace config.`);if(t&&i)return[t,i];const n=uc(Object.keys(this.namespaces)[0]),a=this.rpcProviders[n].getDefaultChain();return[n,a]}async requestAccounts(){const[e]=this.validateChain();return await this.getProvider(e).requestAccounts()}onChainChanged(e,t=!1){if(!this.namespaces)return;const[i,n]=this.validateChain(e);n&&(t||this.getProvider(i).setDefaultChain(n),this.namespaces[i]?this.namespaces[i].defaultChain=n:this.namespaces[`${i}:${n}`]?this.namespaces[`${i}:${n}`].defaultChain=n:this.namespaces[`${i}:${n}`]={defaultChain:n},this.persist("namespaces",this.namespaces),this.events.emit("chainChanged",n))}onConnect(){this.createProviders(),this.events.emit("connect",{session:this.session})}async cleanup(){this.session=void 0,this.namespaces=void 0,this.optionalNamespaces=void 0,this.sessionProperties=void 0,this.persist("namespaces",void 0),this.persist("optionalNamespaces",void 0),this.persist("sessionProperties",void 0),await this.cleanupPendingPairings({deletePairings:!0})}persist(e,t){this.client.core.storage.setItem(`${zb}/${e}`,t)}async getFromStore(e){return await this.client.core.storage.getItem(`${zb}/${e}`)}}const e$=y0,t$="wc",r$="ethereum_provider",i$=`${t$}@2:${r$}:`,n$="https://rpc.walletconnect.org/v1/",Ud=["eth_sendTransaction","personal_sign"],s$=["eth_accounts","eth_requestAccounts","eth_sendRawTransaction","eth_sign","eth_signTransaction","eth_signTypedData","eth_signTypedData_v3","eth_signTypedData_v4","eth_sendTransaction","personal_sign","wallet_switchEthereumChain","wallet_addEthereumChain","wallet_getPermissions","wallet_requestPermissions","wallet_registerOnboarding","wallet_watchAsset","wallet_scanQRCode","wallet_sendCalls","wallet_getCapabilities","wallet_getCallsStatus","wallet_showCallsStatus"],qd=["chainChanged","accountsChanged"],a$=["chainChanged","accountsChanged","message","disconnect","connect"];var o$=Object.defineProperty,c$=Object.defineProperties,u$=Object.getOwnPropertyDescriptors,Xb=Object.getOwnPropertySymbols,f$=Object.prototype.hasOwnProperty,h$=Object.prototype.propertyIsEnumerable,Zb=(r,e,t)=>e in r?o$(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,eo=(r,e)=>{for(var t in e||(e={}))f$.call(e,t)&&Zb(r,t,e[t]);if(Xb)for(var t of Xb(e))h$.call(e,t)&&Zb(r,t,e[t]);return r},sd=(r,e)=>c$(r,u$(e));function Cf(r){return Number(r[0].split(":")[1])}function tf(r){return`0x${r.toString(16)}`}function l$(r){const{chains:e,optionalChains:t,methods:i,optionalMethods:n,events:a,optionalEvents:c,rpcMap:f}=r;if(!Hn(e))throw new Error("Invalid chains");const g={chains:e,methods:i||Ud,events:a||qd,rpcMap:eo({},e.length?{[Cf(e)]:f[Cf(e)]}:{})},d=a==null?void 0:a.filter(C=>!qd.includes(C)),m=i==null?void 0:i.filter(C=>!Ud.includes(C));if(!t&&!c&&!n&&!(d!=null&&d.length)&&!(m!=null&&m.length))return{required:e.length?g:void 0};const w=(d==null?void 0:d.length)&&(m==null?void 0:m.length)||!t,O={chains:[...new Set(w?g.chains.concat(t||[]):t)],methods:[...new Set(g.methods.concat(n!=null&&n.length?n:s$))],events:[...new Set(g.events.concat(c!=null&&c.length?c:a$))],rpcMap:f};return{required:e.length?g:void 0,optional:t.length?O:void 0}}class w0{constructor(){this.events=new Vi.EventEmitter,this.namespace="eip155",this.accounts=[],this.chainId=1,this.STORAGE_KEY=i$,this.on=(e,t)=>(this.events.on(e,t),this),this.once=(e,t)=>(this.events.once(e,t),this),this.removeListener=(e,t)=>(this.events.removeListener(e,t),this),this.off=(e,t)=>(this.events.off(e,t),this),this.parseAccount=e=>this.isCompatibleChainId(e)?this.parseAccountId(e).address:e,this.signer={},this.rpc={}}static async init(e){const t=new w0;return await t.initialize(e),t}async request(e,t){return await this.signer.request(e,this.formatChainId(this.chainId),t)}sendAsync(e,t,i){this.signer.sendAsync(e,t,this.formatChainId(this.chainId),i)}get connected(){return this.signer.client?this.signer.client.core.relayer.connected:!1}get connecting(){return this.signer.client?this.signer.client.core.relayer.connecting:!1}async enable(){return this.session||await this.connect(),await this.request({method:"eth_requestAccounts"})}async connect(e){if(!this.signer.client)throw new Error("Provider not initialized. Call init() first");this.loadConnectOpts(e);const{required:t,optional:i}=l$(this.rpc);try{const n=await new Promise(async(c,f)=>{var g;this.rpc.showQrModal&&((g=this.modal)==null||g.subscribeModal(d=>{!d.open&&!this.signer.session&&(this.signer.abortPairingAttempt(),f(new Error("Connection request reset. Please try again.")))})),await this.signer.connect(sd(eo({namespaces:eo({},t&&{[this.namespace]:t})},i&&{optionalNamespaces:{[this.namespace]:i}}),{pairingTopic:e==null?void 0:e.pairingTopic})).then(d=>{c(d)}).catch(d=>{f(new Error(d.message))})});if(!n)return;const a=X1(n.namespaces,[this.namespace]);this.setChainIds(this.rpc.chains.length?this.rpc.chains:a),this.setAccounts(a),this.events.emit("connect",{chainId:tf(this.chainId)})}catch(n){throw this.signer.logger.error(n),n}finally{this.modal&&this.modal.closeModal()}}async authenticate(e,t){if(!this.signer.client)throw new Error("Provider not initialized. Call init() first");this.loadConnectOpts({chains:e==null?void 0:e.chains});try{const i=await new Promise(async(a,c)=>{var f;this.rpc.showQrModal&&((f=this.modal)==null||f.subscribeModal(g=>{!g.open&&!this.signer.session&&(this.signer.abortPairingAttempt(),c(new Error("Connection request reset. Please try again.")))})),await this.signer.authenticate(sd(eo({},e),{chains:this.rpc.chains}),t).then(g=>{a(g)}).catch(g=>{c(new Error(g.message))})}),n=i.session;if(n){const a=X1(n.namespaces,[this.namespace]);this.setChainIds(this.rpc.chains.length?this.rpc.chains:a),this.setAccounts(a),this.events.emit("connect",{chainId:tf(this.chainId)})}return i}catch(i){throw this.signer.logger.error(i),i}finally{this.modal&&this.modal.closeModal()}}async disconnect(){this.session&&await this.signer.disconnect(),this.reset()}get isWalletConnect(){return!0}get session(){return this.signer.session}registerEventListeners(){this.signer.on("session_event",e=>{const{params:t}=e,{event:i}=t;i.name==="accountsChanged"?(this.accounts=this.parseAccounts(i.data),this.events.emit("accountsChanged",this.accounts)):i.name==="chainChanged"?this.setChainId(this.formatChainId(i.data)):this.events.emit(i.name,i.data),this.events.emit("session_event",e)}),this.signer.on("chainChanged",e=>{const t=parseInt(e);this.chainId=t,this.events.emit("chainChanged",tf(this.chainId)),this.persist()}),this.signer.on("session_update",e=>{this.events.emit("session_update",e)}),this.signer.on("session_delete",e=>{this.reset(),this.events.emit("session_delete",e),this.events.emit("disconnect",sd(eo({},Lt("USER_DISCONNECTED")),{data:e.topic,name:"USER_DISCONNECTED"}))}),this.signer.on("display_uri",e=>{var t,i;this.rpc.showQrModal&&((t=this.modal)==null||t.closeModal(),(i=this.modal)==null||i.openModal({uri:e})),this.events.emit("display_uri",e)})}switchEthereumChain(e){this.request({method:"wallet_switchEthereumChain",params:[{chainId:e.toString(16)}]})}isCompatibleChainId(e){return typeof e=="string"?e.startsWith(`${this.namespace}:`):!1}formatChainId(e){return`${this.namespace}:${e}`}parseChainId(e){return Number(e.split(":")[1])}setChainIds(e){const t=e.filter(i=>this.isCompatibleChainId(i)).map(i=>this.parseChainId(i));t.length&&(this.chainId=t[0],this.events.emit("chainChanged",tf(this.chainId)),this.persist())}setChainId(e){if(this.isCompatibleChainId(e)){const t=this.parseChainId(e);this.chainId=t,this.switchEthereumChain(t)}}parseAccountId(e){const[t,i,n]=e.split(":");return{chainId:`${t}:${i}`,address:n}}setAccounts(e){this.accounts=e.filter(t=>this.parseChainId(this.parseAccountId(t).chainId)===this.chainId).map(t=>this.parseAccountId(t).address),this.events.emit("accountsChanged",this.accounts)}getRpcConfig(e){var t,i;const n=(t=e==null?void 0:e.chains)!=null?t:[],a=(i=e==null?void 0:e.optionalChains)!=null?i:[],c=n.concat(a);if(!c.length)throw new Error("No chains specified in either `chains` or `optionalChains`");const f=n.length?(e==null?void 0:e.methods)||Ud:[],g=n.length?(e==null?void 0:e.events)||qd:[],d=(e==null?void 0:e.optionalMethods)||[],m=(e==null?void 0:e.optionalEvents)||[],w=(e==null?void 0:e.rpcMap)||this.buildRpcMap(c,e.projectId),O=(e==null?void 0:e.qrModalOptions)||void 0;return{chains:n==null?void 0:n.map(C=>this.formatChainId(C)),optionalChains:a.map(C=>this.formatChainId(C)),methods:f,events:g,optionalMethods:d,optionalEvents:m,rpcMap:w,showQrModal:!!(e!=null&&e.showQrModal),qrModalOptions:O,projectId:e.projectId,metadata:e.metadata}}buildRpcMap(e,t){const i={};return e.forEach(n=>{i[n]=this.getRpcUrl(n,t)}),i}async initialize(e){if(this.rpc=this.getRpcConfig(e),this.chainId=this.rpc.chains.length?Cf(this.rpc.chains):Cf(this.rpc.optionalChains),this.signer=await e$.init({projectId:this.rpc.projectId,metadata:this.rpc.metadata,disableProviderPing:e.disableProviderPing,relayUrl:e.relayUrl,storageOptions:e.storageOptions,customStoragePrefix:e.customStoragePrefix,telemetryEnabled:e.telemetryEnabled}),this.registerEventListeners(),await this.loadPersistedSession(),this.rpc.showQrModal){let t;try{const{WalletConnectModal:i}=await _4(()=>import("./index-Dzj92ueM.js").then(n=>n.i),__vite__mapDeps([0,1,2]));t=i}catch{throw new Error("To use QR modal, please install @walletconnect/modal package")}if(t)try{this.modal=new t(eo({projectId:this.rpc.projectId},this.rpc.qrModalOptions))}catch(i){throw this.signer.logger.error(i),new Error("Could not generate WalletConnectModal Instance")}}}loadConnectOpts(e){if(!e)return;const{chains:t,optionalChains:i,rpcMap:n}=e;t&&Hn(t)&&(this.rpc.chains=t.map(a=>this.formatChainId(a)),t.forEach(a=>{this.rpc.rpcMap[a]=(n==null?void 0:n[a])||this.getRpcUrl(a)})),i&&Hn(i)&&(this.rpc.optionalChains=[],this.rpc.optionalChains=i==null?void 0:i.map(a=>this.formatChainId(a)),i.forEach(a=>{this.rpc.rpcMap[a]=(n==null?void 0:n[a])||this.getRpcUrl(a)}))}getRpcUrl(e,t){var i;return((i=this.rpc.rpcMap)==null?void 0:i[e])||`${n$}?chainId=eip155:${e}&projectId=${t||this.rpc.projectId}`}async loadPersistedSession(){if(this.session)try{const e=await this.signer.client.core.storage.getItem(`${this.STORAGE_KEY}/chainId`),t=this.session.namespaces[`${this.namespace}:${e}`]?this.session.namespaces[`${this.namespace}:${e}`]:this.session.namespaces[this.namespace];this.setChainIds(e?[this.formatChainId(e)]:t==null?void 0:t.accounts),this.setAccounts(t==null?void 0:t.accounts)}catch(e){this.signer.logger.error("Failed to load persisted session, clearing state..."),this.signer.logger.error(e),await this.disconnect().catch(t=>this.signer.logger.warn(t))}}reset(){this.chainId=1,this.accounts=[]}persist(){this.session&&this.signer.client.core.storage.setItem(`${this.STORAGE_KEY}/chainId`,this.chainId)}parseAccounts(e){return typeof e=="string"||e instanceof String?[this.parseAccount(e)]:e.map(t=>this.parseAccount(t))}}const V$=w0;export{V$ as EthereumProvider,a$ as OPTIONAL_EVENTS,s$ as OPTIONAL_METHODS,qd as REQUIRED_EVENTS,Ud as REQUIRED_METHODS,w0 as default}; diff --git a/buddybook/assets/inherits_browser-DKXdsDax.js b/buddybook/assets/inherits_browser-Bb3-ajt6.js similarity index 85% rename from buddybook/assets/inherits_browser-DKXdsDax.js rename to buddybook/assets/inherits_browser-Bb3-ajt6.js index b22e9cf..770a755 100644 --- a/buddybook/assets/inherits_browser-DKXdsDax.js +++ b/buddybook/assets/inherits_browser-Bb3-ajt6.js @@ -1 +1 @@ -import{j as n,v as s}from"./index-Cye4tEiE.js";const a=n(s);var r={exports:{}};typeof Object.create=="function"?r.exports=function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:r.exports=function(e,t){if(t){e.super_=t;var o=function(){};o.prototype=t.prototype,e.prototype=new o,e.prototype.constructor=e}};var f=r.exports;export{f as i,a as r}; +import{j as n,v as s}from"./index-uonIXzgQ.js";const a=n(s);var r={exports:{}};typeof Object.create=="function"?r.exports=function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:r.exports=function(e,t){if(t){e.super_=t;var o=function(){};o.prototype=t.prototype,e.prototype=new o,e.prototype.constructor=e}};var f=r.exports;export{f as i,a as r}; diff --git a/buddybook/index.html b/buddybook/index.html index 27ff4d0..06e7828 100644 --- a/buddybook/index.html +++ b/buddybook/index.html @@ -23,16 +23,8 @@ browser: true }; - - - + +
diff --git a/flush-notes/404.html b/flush-notes/404.html index 9fb6aba..6243685 100644 --- a/flush-notes/404.html +++ b/flush-notes/404.html @@ -1 +1 @@ -Share notes

Loading...

\ No newline at end of file +Share notes

Loading...

\ No newline at end of file diff --git a/flush-notes/_next/static/5-GwyAoDnZqLVyoBYvyMp/_buildManifest.js b/flush-notes/_next/static/QYaJ0AjbbxerL0dOZkk5s/_buildManifest.js similarity index 100% rename from flush-notes/_next/static/5-GwyAoDnZqLVyoBYvyMp/_buildManifest.js rename to flush-notes/_next/static/QYaJ0AjbbxerL0dOZkk5s/_buildManifest.js diff --git a/flush-notes/_next/static/5-GwyAoDnZqLVyoBYvyMp/_ssgManifest.js b/flush-notes/_next/static/QYaJ0AjbbxerL0dOZkk5s/_ssgManifest.js similarity index 100% rename from flush-notes/_next/static/5-GwyAoDnZqLVyoBYvyMp/_ssgManifest.js rename to flush-notes/_next/static/QYaJ0AjbbxerL0dOZkk5s/_ssgManifest.js diff --git a/flush-notes/index.html b/flush-notes/index.html index ab6cece..3e9bd12 100644 --- a/flush-notes/index.html +++ b/flush-notes/index.html @@ -1 +1 @@ -Share notes

Loading...

\ No newline at end of file +Share notes

Loading...

\ No newline at end of file diff --git a/flush-notes/index.txt b/flush-notes/index.txt index 0ef9a62..188a850 100644 --- a/flush-notes/index.txt +++ b/flush-notes/index.txt @@ -1,6 +1,6 @@ 1:HL["/_next/static/media/a34f9d1faa5f3315-s.p.woff2","font",{"crossOrigin":"","type":"font/woff2"}] 2:HL["/_next/static/css/93e318bfbcd18d37.css","style",{"crossOrigin":""}] -0:["5-GwyAoDnZqLVyoBYvyMp",[[["",{"children":["__PAGE__",{}]},"$undefined","$undefined",true],"$L3",[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/93e318bfbcd18d37.css","precedence":"next","crossOrigin":""}]],"$L4"]]]] +0:["QYaJ0AjbbxerL0dOZkk5s",[[["",{"children":["__PAGE__",{}]},"$undefined","$undefined",true],"$L3",[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/93e318bfbcd18d37.css","precedence":"next","crossOrigin":""}]],"$L4"]]]] 5:I[5685,["948","static/chunks/948-50bbf5866eb892b4.js","185","static/chunks/app/layout-6076b03a814c7003.js"],""] 6:I[6954,[],""] 7:I[7264,[],""] diff --git a/flush-notes/view.html b/flush-notes/view.html index ad4f0f2..0ea05a7 100644 --- a/flush-notes/view.html +++ b/flush-notes/view.html @@ -1 +1 @@ -Share notes

Loading...

\ No newline at end of file +Share notes

Loading...

\ No newline at end of file diff --git a/flush-notes/view.txt b/flush-notes/view.txt index c6f5051..e5bab35 100644 --- a/flush-notes/view.txt +++ b/flush-notes/view.txt @@ -1,6 +1,6 @@ 1:HL["/_next/static/media/a34f9d1faa5f3315-s.p.woff2","font",{"crossOrigin":"","type":"font/woff2"}] 2:HL["/_next/static/css/93e318bfbcd18d37.css","style",{"crossOrigin":""}] -0:["5-GwyAoDnZqLVyoBYvyMp",[[["",{"children":["view",{"children":["__PAGE__",{}]}]},"$undefined","$undefined",true],"$L3",[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/93e318bfbcd18d37.css","precedence":"next","crossOrigin":""}]],"$L4"]]]] +0:["QYaJ0AjbbxerL0dOZkk5s",[[["",{"children":["view",{"children":["__PAGE__",{}]}]},"$undefined","$undefined",true],"$L3",[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/93e318bfbcd18d37.css","precedence":"next","crossOrigin":""}]],"$L4"]]]] 5:I[5685,["948","static/chunks/948-50bbf5866eb892b4.js","185","static/chunks/app/layout-6076b03a814c7003.js"],""] 6:I[6954,[],""] 7:I[7264,[],""]