@babylonlabs-io/wallet-connector 1.0.7 → 1.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs.js +1 -1
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +15 -8
- package/dist/index.es.js.map +1 -1
- package/dist/style.css +1 -1
- package/package.json +3 -3
package/dist/index.cjs.js
CHANGED
|
@@ -89,7 +89,7 @@ Check the top-level render call using <`+Su+">.")}return Pu}}function ei(hu,Pu){
|
|
|
89
89
|
<%s {...props} />
|
|
90
90
|
React keys must be passed directly to JSX without using spread:
|
|
91
91
|
let props = %s;
|
|
92
|
-
<%s key={someKey} {...props} />`,Lu,Tu,ju,Tu),cu[Tu+Lu]=!0}}return hu===n?tu(Au):ti(Au),Au}}function mu(hu,Pu,Su){return Eu(hu,Pu,Su,!0)}function Ru(hu,Pu,Su){return Eu(hu,Pu,Su,!1)}var Hu=Ru,Bu=mu;V0.Fragment=n,V0.jsx=Hu,V0.jsxs=Bu}()),V0}process$1.env.NODE_ENV==="production"?v2.exports=Ve():v2.exports=Ze();var I=v2.exports;const p0={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1};let Ge=0;function c0(e,t){const r=`atom${++Ge}`,n={toString(){return(p0?"production":void 0)!=="production"&&this.debugLabel?r+":"+this.debugLabel:r}};return typeof e=="function"?n.read=e:(n.init=e,n.read=Ye,n.write=ze),t&&(n.write=t),n}function Ye(e){return e(this)}function ze(e,t,r){return t(this,typeof r=="function"?r(e(this)):r)}const V2=(e,t)=>e.unstable_is?e.unstable_is(t):t===e,h2=e=>"init"in e,m2=e=>!!e.write,i2=new WeakMap,E2=e=>{var t;return _2(e)&&!((t=i2.get(e))!=null&&t[1])},qe=(e,t)=>{const r=i2.get(e);if(r)r[1]=!0,r[0].forEach(n=>n(t));else if((p0?"production":void 0)!=="production")throw new Error("[Bug] cancelable promise not found")},Je=e=>{if(i2.has(e))return;const t=[new Set,!1];i2.set(e,t);const r=()=>{t[1]=!0};e.then(r,r),e.onCancel=n=>{t[0].add(n)}},_2=e=>typeof(e==null?void 0:e.then)=="function",Z2=e=>"v"in e||"e"in e,r2=e=>{if("e"in e)throw e.e;if((p0?"production":void 0)!=="production"&&!("v"in e))throw new Error("[Bug] atom state is not initialized");return e.v},ee=(e,t,r)=>{r.p.has(e)||(r.p.add(e),t.then(()=>{r.p.delete(e)},()=>{r.p.delete(e)}))},G2=(e,t,r,n,o)=>{var s;if((p0?"production":void 0)!=="production"&&n===t)throw new Error("[Bug] atom cannot depend on itself");r.d.set(n,o.n),E2(r.v)&&ee(t,r.v,o),(s=o.m)==null||s.t.add(t),e&&Ke(e,n,t)},j0=()=>[new Map,new Map,new Set],C2=(e,t,r)=>{e[0].has(t)||e[0].set(t,new Set),e[1].set(t,r)},Ke=(e,t,r)=>{const n=e[0].get(t);n&&n.add(r)},Xe=(e,t)=>e[0].get(t),Y2=(e,t)=>{e[2].add(t)},T0=e=>{for(;e[1].size||e[2].size;){e[0].clear();const t=new Set(e[1].values());e[1].clear();const r=new Set(e[2]);e[2].clear(),t.forEach(n=>{var o;return(o=n.m)==null?void 0:o.l.forEach(s=>s())}),r.forEach(n=>n())}},te=e=>{let t;(p0?"production":void 0)!=="production"&&(t=new Set);const r=(v,S,E)=>{const x="v"in S,O=S.v,q=E2(S.v)?S.v:null;if(_2(E)){Je(E);for(const U of S.d.keys())ee(v,E,e(U,S));S.v=E,delete S.e}else S.v=E,delete S.e;(!x||!Object.is(O,S.v))&&(++S.n,q&&qe(q,E))},n=(v,S,E,x)=>{var O;if(Z2(E)&&(E.m&&!(x!=null&&x.has(S))||Array.from(E.d).every(([y,T])=>n(v,y,e(y,E),x).n===T)))return E;E.d.clear();let q=!0;const U=y=>{if(V2(S,y)){const D=e(y,E);if(!Z2(D))if(h2(y))r(y,D,y.init);else throw new Error("no atom init");return r2(D)}const T=n(v,y,e(y,E),x);if(q)G2(v,S,E,y,T);else{const D=j0();G2(D,S,E,y,T),d(D,S,E),T0(D)}return r2(T)};let L,z;const F={get signal(){return L||(L=new AbortController),L.signal},get setSelf(){return(p0?"production":void 0)!=="production"&&!m2(S)&&console.warn("setSelf function cannot be used with read-only atom"),!z&&m2(S)&&(z=(...y)=>{if((p0?"production":void 0)!=="production"&&q&&console.warn("setSelf function cannot be called in sync"),!q)return p(S,...y)}),z}};try{const y=S.read(U,F);if(r(S,E,y),_2(y)){(O=y.onCancel)==null||O.call(y,()=>L==null?void 0:L.abort());const T=()=>{if(E.m){const D=j0();d(D,S,E),T0(D)}};y.then(T,T)}return E}catch(y){return delete E.v,E.e=y,++E.n,E}finally{q=!1}},o=v=>r2(n(void 0,v,e(v))),s=(v,S,E)=>{var x,O;const q=new Map;for(const U of((x=E.m)==null?void 0:x.t)||[])q.set(U,e(U,E));for(const U of E.p)q.set(U,e(U,E));return(O=Xe(v,S))==null||O.forEach(U=>{q.set(U,e(U,E))}),q},a=(v,S,E)=>{const x=[],O=new Set,q=(L,z)=>{if(!O.has(L)){O.add(L);for(const[F,y]of s(v,L,z))L!==F&&q(F,y);x.push([L,z,z.n])}};q(S,E);const U=new Set([S]);for(let L=x.length-1;L>=0;--L){const[z,F,y]=x[L];let T=!1;for(const D of F.d.keys())if(D!==z&&U.has(D)){T=!0;break}T&&(n(v,z,F,O),d(v,z,F),y!==F.n&&(C2(v,z,F),U.add(z))),O.delete(z)}},u=(v,S,E,...x)=>{const O=U=>r2(n(v,U,e(U,E))),q=(U,...L)=>{const z=e(U,E);let F;if(V2(S,U)){if(!h2(U))throw new Error("atom not writable");const y="v"in z,T=z.v,D=L[0];r(U,z,D),d(v,U,z),(!y||!Object.is(T,z.v))&&(C2(v,U,z),a(v,U,z))}else F=u(v,U,z,...L);return T0(v),F};return S.write(O,q,...x)},p=(v,...S)=>{const E=j0(),x=u(E,v,e(v),...S);return T0(E),x},d=(v,S,E)=>{if(E.m&&!E2(E.v)){for(const x of E.d.keys())E.m.d.has(x)||(c(v,x,e(x,E)).t.add(S),E.m.d.add(x));for(const x of E.m.d||[])if(!E.d.has(x)){E.m.d.delete(x);const O=m(v,x,e(x,E));O==null||O.t.delete(S)}}},c=(v,S,E)=>{if(!E.m){n(v,S,E);for(const x of E.d.keys())c(v,x,e(x,E)).t.add(S);if(E.m={l:new Set,d:new Set(E.d.keys()),t:new Set},(p0?"production":void 0)!=="production"&&t.add(S),m2(S)&&S.onMount){const x=E.m,{onMount:O}=S;Y2(v,()=>{const q=O((...U)=>u(v,S,E,...U));q&&(x.u=q)})}}return E.m},m=(v,S,E)=>{if(E.m&&!E.m.l.size&&!Array.from(E.m.t).some(x=>{var O;return(O=e(x,E).m)==null?void 0:O.d.has(S)})){const x=E.m.u;x&&Y2(v,x),delete E.m,(p0?"production":void 0)!=="production"&&t.delete(S);for(const O of E.d.keys()){const q=m(v,O,e(O,E));q==null||q.t.delete(S)}return}return E.m},_={get:o,set:p,sub:(v,S)=>{const E=j0(),x=e(v),O=c(E,v,x);T0(E);const q=O.l;return q.add(S),()=>{q.delete(S);const U=j0();m(U,v,x),T0(U)}},unstable_derive:v=>te(...v(e))};return(p0?"production":void 0)!=="production"&&Object.assign(_,{dev4_get_internal_weak_map:()=>({get:v=>{const S=e(v);if(S.n!==0)return S}}),dev4_get_mounted_atoms:()=>t,dev4_restore_atoms:v=>{const S=j0();for(const[E,x]of v)if(h2(E)){const O=e(E),q="v"in O,U=O.v;r(E,O,x),d(S,E,O),(!q||!Object.is(U,O.v))&&(C2(S,E,O),a(S,E,O))}T0(S)}}),_},re=()=>{const e=new WeakMap;return te(t=>{let r=e.get(t);return r||(r={d:new Map,p:new Set,n:0},e.set(t,r)),r})};let Z0;const Qe=()=>(Z0||(Z0=re(),(p0?"production":void 0)!=="production"&&(globalThis.__JOTAI_DEFAULT_STORE__||(globalThis.__JOTAI_DEFAULT_STORE__=Z0),globalThis.__JOTAI_DEFAULT_STORE__!==Z0&&console.warn("Detected multiple Jotai instances. It may cause unexpected behavior with the default store. https://github.com/pmndrs/jotai/discussions/2044"))),Z0),ne={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1},ie=R2.createContext(void 0),oe=e=>R2.useContext(ie)||Qe(),et=({children:e,store:t})=>{const r=R2.useRef();return!t&&!r.current&&(r.current=re()),R2.createElement(ie.Provider,{value:t||r.current},e)},se=e=>typeof(e==null?void 0:e.then)=="function",tt=e=>{e.status="pending",e.then(t=>{e.status="fulfilled",e.value=t},t=>{e.status="rejected",e.reason=t})},rt=R2.use||(e=>{if(e.status==="pending")throw e;if(e.status==="fulfilled")return e.value;throw e.status==="rejected"?e.reason:(tt(e),e)}),w2=new WeakMap,nt=e=>{let t=w2.get(e);return t||(t=new Promise((r,n)=>{let o=e;const s=p=>d=>{o===p&&r(d)},a=p=>d=>{o===p&&n(d)},u=p=>{"onCancel"in p&&typeof p.onCancel=="function"&&p.onCancel(d=>{if((ne?"production":void 0)!=="production"&&d===p)throw new Error("[Bug] p is not updated even after cancelation");se(d)?(w2.set(d,t),o=d,d.then(s(d),a(d)),u(d)):r(d)})};e.then(s(e),a(e)),u(e)}),w2.set(e,t)),t};function t0(e,t){const r=oe(),[[n,o,s],a]=R2.useReducer(p=>{const d=r.get(e);return Object.is(p[0],d)&&p[1]===r&&p[2]===e?p:[d,r,e]},void 0,()=>[r.get(e),r,e]);let u=n;if((o!==r||s!==e)&&(a(),u=r.get(e)),R2.useEffect(()=>{const p=r.sub(e,()=>{a()});return a(),p},[r,e,void 0]),R2.useDebugValue(u),se(u)){const p=nt(u);return rt(p)}return u}function g0(e,t){const r=oe();return R2.useCallback((...n)=>{if((ne?"production":void 0)!=="production"&&!("write"in e))throw new Error("not writable atom");return r.set(e,...n)},[r,e])}function it(e,t){return[t0(e),g0(e)]}class ot extends Me{constructor(t){var r;const n=(r=we$1(t))==null?void 0:r.injectedTomo,o=n==null?void 0:n.bitcoin;if(!o)throw new Error("Injected Tomo Wallet not found");super(t,o),t2(this,"injectedTomo"),t2(this,"connectWallet",async()=>{var s;const a=(await((s=this.bitcoinNetworkProvider)==null?void 0:s.requestAccounts()))[0],u=await this.getPublicKeyHex();if(!a||!u)throw new Error("Could not connect to injected Wallet");return this}),b2.img=n.info.logo,b2.name=n.info.name,this.injectedTomo=n}getWalletProviderName(){var t,r;return Promise.resolve((r=(t=this.injectedTomo)==null?void 0:t.info)==null?void 0:r.name)}getWalletProviderIcon(){var t,r;return Promise.resolve((r=(t=this.injectedTomo)==null?void 0:t.info)==null?void 0:r.logo)}}class st extends Mt$1{constructor(t){var r;const n=(r=we$1(t))==null?void 0:r.injectedTomo,o=n==null?void 0:n.cosmos;if(!o)throw new Error("Injected Tomo Wallet not found");super(t,o),t2(this,"injectedTomo"),I2.img=n.info.logo,I2.name=n.info.name,this.injectedTomo=n}getWalletProviderName(){var t,r;return Promise.resolve((r=(t=this.injectedTomo)==null?void 0:t.info)==null?void 0:r.name)}getWalletProviderIcon(){var t,r;return Promise.resolve((r=(t=this.injectedTomo)==null?void 0:t.info)==null?void 0:r.logo)}}const b2={id:"bitcoin_tomo_auto",img:"",name:"Tomo Injected",chainType:"bitcoin",connectProvider:ot,type:"injected"},I2={id:"cosmos_tomo_auto",img:"",name:"Tomo Injected",chainType:"cosmos",connectProvider:st,type:"injected"},ce=[b2,I2,..._f,...$f],ct=ce.reduce((e,t)=>(e[t.id]=t,e),{}),ae=ce.map(e=>e.id);function o2(e,t){var r;return((r=t.additionalWallets)==null?void 0:r.find(n=>n.id===e))||ct[e]}function le(e){let t=(e.indexWallets||[]).map(r=>o2(r,e)).filter(r=>!!r);return(!e.indexWallets||e.indexWallets===ae)&&e.additionalWallets&&(t=[...t.filter(r=>{var n;return(n=e.additionalWallets)==null?void 0:n.every(o=>o.id!==r.id)}),...e.additionalWallets]),t}const at="data:image/svg+xml,%3csvg%20width='32'%20height='32'%20viewBox='0%200%2032%2032'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20id='Token'%3e%3cpath%20id='Network%20Icon%20Background'%20d='M16%2032C24.8366%2032%2032%2024.8366%2032%2016C32%207.16344%2024.8366%200%2016%200C7.16344%200%200%207.16344%200%2016C0%2024.8366%207.16344%2032%2016%2032Z'%20fill='%23F7931A'/%3e%3cpath%20id='Vector'%20d='M23.3198%2014.1189C23.6398%2012.1016%2022.0122%2011.0169%2019.7884%2010.2932L20.51%207.55978L18.7489%207.14593L18.0457%209.80711C17.583%209.69739%2017.1081%209.59537%2016.6342%209.49335L17.3425%206.81484L15.5814%206.40002L14.8599%209.13243C14.4767%209.04966%2014.0996%208.96882%2013.7347%208.88219L13.7368%208.87353L11.3071%208.30087L10.8383%2010.0776C10.8383%2010.0776%2012.1459%2010.3605%2012.1184%2010.3778C12.8318%2010.5463%2012.9602%2010.9919%2012.9388%2011.3461L12.1173%2014.4596C12.1663%2014.4712%2012.2295%2014.4885%2012.3008%2014.5145L12.1143%2014.4712L10.9627%2018.833C10.875%2019.037%2010.6539%2019.3441%2010.1545%2019.2276C10.1728%2019.2517%208.87443%2018.9264%208.87443%2018.9264L8%2020.8301L10.2931%2021.37C10.7191%2021.4711%2011.1369%2021.577%2011.5476%2021.6761L10.819%2024.4403L12.579%2024.8541L13.3006%2022.1208C13.7816%2022.243%2014.2484%2022.3566%2014.705%2022.4643L13.9854%2025.1862L15.7465%2025.6L16.4752%2022.8416C19.4796%2023.3787%2021.7381%2023.1621%2022.6889%2020.5962C23.4553%2018.5308%2022.6512%2017.3383%2021.0705%2016.5616C22.2222%2016.3114%2023.0884%2015.5963%2023.3198%2014.1189ZM19.2942%2019.449C18.751%2021.5154%2015.0667%2020.398%2013.8723%2020.1179L14.8405%2016.4557C16.0349%2016.7377%2019.8639%2017.295%2019.2942%2019.449ZM19.8394%2014.0891C19.3431%2015.9687%2016.2775%2015.013%2015.2838%2014.7792L16.1603%2011.4587C17.154%2011.6926%2020.3571%2012.1286%2019.8394%2014.0891Z'%20fill='white'/%3e%3c/g%3e%3c/svg%3e",lt="data:image/svg+xml,%3csvg%20width='40'%20height='40'%20viewBox='0%200%2040%2040'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M20%2040C31.0457%2040%2040%2031.0457%2040%2020C40%208.9543%2031.0457%200%2020%200C8.9543%200%200%208.9543%200%2020C0%2031.0457%208.9543%2040%2020%2040Z'%20fill='%23AE219E'/%3e%3cpath%20d='M29.1497%2017.6486C29.5497%2015.127%2027.5153%2013.7711%2024.7356%2012.8664L25.6375%209.4497L23.4361%208.93238L22.5571%2012.2589C21.9788%2012.1217%2021.3851%2011.9942%2020.7927%2011.8667L21.6781%208.51852L19.4768%208L18.5748%2011.4155C18.0958%2011.312%2017.6245%2011.211%2017.1684%2011.1027L17.171%2011.0919L14.1339%2010.3761L13.5479%2012.5969C13.5479%2012.5969%2015.1824%2012.9506%2015.148%2012.9723C16.0397%2013.1828%2016.2002%2013.7398%2016.1735%2014.1826L15.1467%2018.0745C15.2078%2018.0889%2015.2868%2018.1106%2015.376%2018.1431L15.1429%2018.0889L13.7033%2023.5412C13.5938%2023.7963%2013.3173%2024.1801%2012.6931%2024.0345C12.716%2024.0646%2011.093%2023.6579%2011.093%2023.6579L10%2026.0376L12.8663%2026.7125C13.3988%2026.8388%2013.9212%2026.9712%2014.4346%2027.0951L13.5237%2030.5503L15.7238%2031.0676L16.6257%2027.6509C17.227%2027.8037%2017.8105%2027.9457%2018.3812%2028.0804L17.4818%2031.4827L19.6831%2032L20.594%2028.552C24.3496%2029.2233%2027.1726%2028.9526%2028.3612%2025.7453C29.3192%2023.1635%2028.314%2021.6729%2026.3382%2020.702C27.7777%2020.3892%2028.8605%2019.4953%2029.1497%2017.6486V17.6486ZM24.1177%2024.3112C23.4387%2026.8942%2018.8334%2025.4974%2017.3404%2025.1473L18.5506%2020.5697C20.0437%2020.9222%2024.8298%2021.6187%2024.1177%2024.3112ZM24.7993%2017.6113C24.1788%2019.9609%2020.3469%2018.7663%2019.1048%2018.4739L20.2004%2014.3233C21.4424%2014.6157%2025.4464%2015.1607%2024.7993%2017.6113Z'%20fill='white'/%3e%3c/svg%3e",ut="data:image/svg+xml,%3csvg%20width='1024'%20height='1024'%20viewBox='0%200%201024%201024'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3ccircle%20cx='512'%20cy='512'%20r='512'%20fill='url(%23paint0_radial)'/%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M559.489%20834.999C575.149%20766.673%20586.037%20671.007%20588.667%20562.846L612.66%20563.429C610.005%20672.632%20599.01%20769.997%20582.883%20840.361C574.842%20875.446%20565.383%20904.46%20554.695%20924.986C549.359%20935.233%20543.415%20943.961%20536.702%20950.27C529.942%20956.624%20521.636%20961.2%20512%20961.2C500.94%20961.2%20491.681%20955.206%20484.372%20947.318C477.039%20939.402%20470.522%20928.41%20464.667%20915.38C452.92%20889.241%20442.683%20852.265%20434.371%20807.75L457.963%20803.345C466.127%20847.065%20475.94%20881.915%20486.558%20905.543C491.885%20917.397%20497.13%20925.774%20501.978%20931.006C506.851%20936.266%20510.194%20937.2%20512%20937.2C513.589%20937.2%20516.306%20936.503%20520.265%20932.783C524.27%20929.017%20528.739%20922.868%20533.408%20913.902C542.727%20896.005%20551.637%20869.259%20559.489%20834.999Z'%20fill='url(%23paint1_linear)'/%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M472.024%20159.599C457.662%20209.824%20446.256%20281.346%20440%20365.329L416.066%20363.546C422.388%20278.678%20433.97%20205.382%20448.949%20153.001C456.413%20126.9%20464.908%20105.31%20474.426%2089.9811C483.479%2075.4018%20495.808%2062.8003%20511.998%2062.8003C521.634%2062.8003%20529.94%2067.3757%20536.7%2073.7298C543.412%2080.0394%20549.357%2088.7673%20554.692%2099.0135C565.381%20119.54%20574.839%20148.554%20582.881%20183.639C599.008%20254.003%20610.003%20351.368%20612.657%20460.571L588.665%20461.154C586.035%20352.993%20575.147%20257.327%20559.487%20189.001C551.635%20154.741%20542.725%20127.995%20533.405%20110.098C528.737%20101.132%20524.268%2094.9826%20520.262%2091.2174C516.304%2087.4967%20513.586%2086.8003%20511.998%2086.8003C509.194%2086.8003%20503.102%2089.2971%20494.815%20102.642C486.994%20115.237%20479.231%20134.397%20472.024%20159.599Z'%20fill='url(%23paint2_linear)'/%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M440.002%20365.329C436.591%20411.12%20434.719%20460.503%20434.719%20512C434.719%20624.426%20443.64%20726.638%20457.963%20803.345L434.37%20807.75C419.716%20729.271%20410.719%20625.538%20410.719%20512C410.719%20459.931%20412.611%20409.952%20416.068%20363.546L440.002%20365.329Z'%20fill='url(%23paint3_linear)'/%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M428.801%20552.768C350.948%20505.24%20283.687%20457.047%20233.733%20414.458L218.162%20432.722C269.286%20476.307%20337.624%20525.225%20416.296%20573.252L428.801%20552.768Z'%20fill='url(%23paint4_linear)'/%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M767.494%20714.63C700.498%20694.032%20612.212%20655.633%20517.234%20603.835L505.743%20624.905C601.636%20677.202%20691.446%20716.357%20760.441%20737.57C794.843%20748.147%20824.697%20754.462%20847.816%20755.468C859.356%20755.97%20869.886%20755.186%20878.706%20752.527C887.588%20749.849%20895.703%20744.944%20900.521%20736.6C908.648%20722.523%20903.832%20705.465%20895.658%20690.267C887.059%20674.28%20872.482%20656.027%20853.448%20636.401C815.251%20597.014%20757.103%20550.07%20686.25%20501.935L672.763%20521.787C742.879%20569.422%20799.58%20615.329%20836.219%20653.109C854.604%20672.066%20867.443%20688.477%20874.521%20701.636C882.024%20715.585%20881.146%20722.158%20879.736%20724.6C878.942%20725.975%20876.98%20727.98%20871.779%20729.548C866.516%20731.135%20858.957%20731.93%20848.859%20731.491C828.702%20730.613%20801.087%20724.958%20767.494%20714.63Z'%20fill='url(%23paint5_linear)'/%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M550.142%20445.073C594.052%20470.424%20635.28%20496.323%20672.762%20521.787L686.249%20501.935C648.265%20476.13%20606.54%20449.922%20562.142%20424.288C457.09%20363.637%20356.566%20317.459%20278.943%20291.673C240.225%20278.812%20206.608%20270.82%20180.71%20268.863C167.793%20267.887%20156.102%20268.352%20146.399%20270.883C136.678%20273.419%20127.677%20278.403%20122.483%20287.4C116.91%20297.053%20117.522%20308.162%20120.767%20318.51C124.025%20328.902%20130.394%20340.143%20138.889%20351.844C155.934%20375.32%20183.256%20402.964%20218.161%20432.722L233.731%20414.459C199.44%20385.224%20173.744%20359%20158.31%20337.744C150.567%20327.079%20145.833%20318.237%20143.667%20311.33C141.488%20304.381%20142.358%20300.976%20143.267%20299.4C144.118%20297.927%20146.344%20295.701%20152.457%20294.106C158.588%20292.507%20167.34%20291.921%20178.901%20292.795C201.959%20294.537%20233.439%20301.847%20271.377%20314.45C347.064%20339.592%20446.084%20384.995%20550.142%20445.073Z'%20fill='url(%23paint6_linear)'/%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M520.48%20418.94C601.097%20375.105%20676.844%20340.946%20738.738%20319.198L730.782%20296.555C667.411%20318.822%20590.478%20353.561%20509.016%20397.855L520.48%20418.94Z'%20fill='url(%23paint7_linear)'/%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M208.476%20632.887C259.443%20585.405%20336.327%20528.414%20428.139%20472.245L415.614%20451.773C322.917%20508.484%20244.615%20566.418%20192.116%20615.326C165.939%20639.713%20145.692%20662.301%20133.359%20681.732C127.202%20691.432%20122.654%20700.906%20120.571%20709.841C118.473%20718.842%20118.68%20728.286%20123.48%20736.6C131.596%20750.657%20148.739%20755.021%20165.952%20755.552C184.057%20756.111%20207.098%20752.635%20233.547%20745.995C286.627%20732.669%20356.187%20705.881%20433.135%20668.71L422.696%20647.099C346.549%20683.883%20278.611%20709.937%20227.704%20722.717C202.16%20729.13%20181.585%20732.023%20166.692%20731.564C150.909%20731.077%20145.672%20727.037%20144.265%20724.6C143.473%20723.229%20142.72%20720.542%20143.945%20715.29C145.184%20709.973%20148.241%20703.07%20153.622%20694.593C164.363%20677.669%20182.919%20656.695%20208.476%20632.887Z'%20fill='url(%23paint8_linear)'/%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M551.138%20578.927C506.978%20604.423%20463.696%20627.293%20422.695%20647.099L433.135%20668.709C474.685%20648.638%20518.488%20625.491%20563.138%20599.711C668.19%20539.06%20758.443%20475.093%20819.586%20420.762C850.083%20393.662%20873.812%20368.545%20888.456%20347.094C895.76%20336.397%20901.203%20326.039%20903.862%20316.37C906.527%20306.684%20906.711%20296.397%20901.516%20287.4C896.007%20277.858%20886.239%20272.837%20875.802%20270.442C865.332%20268.039%20852.623%20267.871%20838.494%20269.285C810.15%20272.121%20773.234%20281.637%20730.78%20296.555L738.736%20319.197C780.427%20304.548%20815.286%20295.727%20840.884%20293.166C853.726%20291.881%20863.531%20292.25%20870.433%20293.834C877.369%20295.426%20879.832%20297.842%20880.732%20299.4C881.582%20300.873%20882.398%20303.914%20880.722%20310.005C879.041%20316.115%20875.173%20323.986%20868.635%20333.562C855.597%20352.659%20833.527%20376.267%20803.644%20402.821C744.026%20455.797%20655.196%20518.849%20551.138%20578.927Z'%20fill='url(%23paint9_linear)'/%3e%3ccircle%20cx='449.975'%20cy='804.495'%20r='31.3505'%20fill='white'/%3e%3ccircle%20r='31.3505'%20transform='matrix(0.5%20-0.866025%20-0.866025%20-0.5%20227.181%20419.466)'%20fill='white'/%3e%3ccircle%20r='31.3505'%20transform='matrix(0.5%200.866025%200.866025%20-0.5%20734.794%20312.039)'%20fill='white'/%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M512.012%20457.433C542.156%20457.433%20566.592%20481.869%20566.592%20512.012C566.592%20542.156%20542.156%20566.592%20512.012%20566.592C481.869%20566.592%20457.433%20542.156%20457.433%20512.012C457.433%20481.869%20481.869%20457.433%20512.012%20457.433Z'%20fill='white'/%3e%3cdefs%3e%3cradialGradient%20id='paint0_radial'%20cx='0'%20cy='0'%20r='1'%20gradientUnits='userSpaceOnUse'%20gradientTransform='translate(512%20512)%20rotate(90)%20scale(512)'%3e%3cstop%20offset='0.0909055'%20stop-color='%237C7C7C'/%3e%3cstop%20offset='0.233848'%20stop-color='%233E3E3E'/%3e%3cstop%20offset='0.817221'/%3e%3c/radialGradient%3e%3clinearGradient%20id='paint1_linear'%20x1='523.515'%20y1='961.2'%20x2='639.469'%20y2='570.809'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20offset='0.377307'%20stop-color='white'%20stop-opacity='0.6'/%3e%3cstop%20offset='0.992239'%20stop-color='white'%20stop-opacity='0'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint2_linear'%20x1='514.362'%20y1='62.8003'%20x2='663.926'%20y2='441'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20offset='0.634963'%20stop-color='white'%20stop-opacity='0.81'/%3e%3cstop%20offset='1'%20stop-color='white'%20stop-opacity='0'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint3_linear'%20x1='457.499'%20y1='363.546'%20x2='457.499'%20y2='808.261'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='white'%20stop-opacity='0.81'/%3e%3cstop%20offset='0.646422'%20stop-color='white'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint4_linear'%20x1='234.384'%20y1='411.354'%20x2='430.501'%20y2='549.696'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='white'%20stop-opacity='0.6'/%3e%3cstop%20offset='1'%20stop-color='white'%20stop-opacity='0'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint5_linear'%20x1='923.391'%20y1='735.037'%20x2='488.534'%20y2='662.67'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20offset='0.60731'%20stop-color='white'%20stop-opacity='0.81'/%3e%3cstop%20offset='1'%20stop-color='white'%20stop-opacity='0'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint6_linear'%20x1='674.619'%20y1='497.805'%20x2='110.127'%20y2='288.499'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='white'%20stop-opacity='0.81'/%3e%3cstop%20offset='0.478389'%20stop-color='white'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint7_linear'%20x1='743.225'%20y1='320.878'%20x2='508.048'%20y2='430.154'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='white'%20stop-opacity='0.6'/%3e%3cstop%20offset='1'%20stop-color='white'%20stop-opacity='0'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint8_linear'%20x1='110.421'%20y1='738.194'%20x2='404.819'%20y2='431.181'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20offset='0.54518'%20stop-color='white'%20stop-opacity='0.81'/%3e%3cstop%20offset='1'%20stop-color='white'%20stop-opacity='0'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint9_linear'%20x1='913.606'%20y1='276.28'%20x2='438.264'%20y2='671.645'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20offset='0.518582'%20stop-color='white'/%3e%3cstop%20offset='1'%20stop-color='white'%20stop-opacity='0.81'/%3e%3c/linearGradient%3e%3c/defs%3e%3c/svg%3e",ft={id:1,name:"Bitcoin",network:"mainnet",type:"bitcoin",logo:at},dt={id:2,name:"Bitcoin Signet",type:"bitcoin",network:"signet",logo:lt},pt={id:1,name:"Cosmos",type:"cosmos",network:"cosmoshub-4",logo:ut},ht=[ft,dt],mt=[pt];var ue={},s2={};s2.byteLength=yt;s2.toByteArray=xt;s2.fromByteArray=_t;var w0=[],u0=[],Ct=typeof Uint8Array<"u"?Uint8Array:Array,y2="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(var O0=0,wt=y2.length;O0<wt;++O0)w0[O0]=y2[O0],u0[y2.charCodeAt(O0)]=O0;u0[45]=62;u0[95]=63;function fe(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");r===-1&&(r=t);var n=r===t?0:4-r%4;return[r,n]}function yt(e){var t=fe(e),r=t[0],n=t[1];return(r+n)*3/4-n}function gt(e,t,r){return(t+r)*3/4-r}function xt(e){var t,r=fe(e),n=r[0],o=r[1],s=new Ct(gt(e,n,o)),a=0,u=o>0?n-4:n,p;for(p=0;p<u;p+=4)t=u0[e.charCodeAt(p)]<<18|u0[e.charCodeAt(p+1)]<<12|u0[e.charCodeAt(p+2)]<<6|u0[e.charCodeAt(p+3)],s[a++]=t>>16&255,s[a++]=t>>8&255,s[a++]=t&255;return o===2&&(t=u0[e.charCodeAt(p)]<<2|u0[e.charCodeAt(p+1)]>>4,s[a++]=t&255),o===1&&(t=u0[e.charCodeAt(p)]<<10|u0[e.charCodeAt(p+1)]<<4|u0[e.charCodeAt(p+2)]>>2,s[a++]=t>>8&255,s[a++]=t&255),s}function vt(e){return w0[e>>18&63]+w0[e>>12&63]+w0[e>>6&63]+w0[e&63]}function Et(e,t,r){for(var n,o=[],s=t;s<r;s+=3)n=(e[s]<<16&16711680)+(e[s+1]<<8&65280)+(e[s+2]&255),o.push(vt(n));return o.join("")}function _t(e){for(var t,r=e.length,n=r%3,o=[],s=16383,a=0,u=r-n;a<u;a+=s)o.push(Et(e,a,a+s>u?u:a+s));return n===1?(t=e[r-1],o.push(w0[t>>2]+w0[t<<4&63]+"==")):n===2&&(t=(e[r-2]<<8)+e[r-1],o.push(w0[t>>10]+w0[t>>4&63]+w0[t<<2&63]+"=")),o.join("")}var F2={};F2.read=function(e,t,r,n,o){var s,a,u=o*8-n-1,p=(1<<u)-1,d=p>>1,c=-7,m=r?o-1:0,_=r?-1:1,v=e[t+m];for(m+=_,s=v&(1<<-c)-1,v>>=-c,c+=u;c>0;s=s*256+e[t+m],m+=_,c-=8);for(a=s&(1<<-c)-1,s>>=-c,c+=n;c>0;a=a*256+e[t+m],m+=_,c-=8);if(s===0)s=1-d;else{if(s===p)return a?NaN:(v?-1:1)*(1/0);a=a+Math.pow(2,n),s=s-d}return(v?-1:1)*a*Math.pow(2,s-n)};F2.write=function(e,t,r,n,o,s){var a,u,p,d=s*8-o-1,c=(1<<d)-1,m=c>>1,_=o===23?Math.pow(2,-24)-Math.pow(2,-77):0,v=n?0:s-1,S=n?1:-1,E=t<0||t===0&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(u=isNaN(t)?1:0,a=c):(a=Math.floor(Math.log(t)/Math.LN2),t*(p=Math.pow(2,-a))<1&&(a--,p*=2),a+m>=1?t+=_/p:t+=_*Math.pow(2,1-m),t*p>=2&&(a++,p/=2),a+m>=c?(u=0,a=c):a+m>=1?(u=(t*p-1)*Math.pow(2,o),a=a+m):(u=t*Math.pow(2,m-1)*Math.pow(2,o),a=0));o>=8;e[r+v]=u&255,v+=S,u/=256,o-=8);for(a=a<<o|u,d+=o;d>0;e[r+v]=a&255,v+=S,a/=256,d-=8);e[r+v-S]|=E*128};(function(e){const t=s2,r=F2,n=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;e.Buffer=u,e.SlowBuffer=q,e.INSPECT_MAX_BYTES=50;const o=2147483647;e.kMaxLength=o,u.TYPED_ARRAY_SUPPORT=s(),!u.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 s(){try{const j=new Uint8Array(1),Y={foo:function(){return 42}};return Object.setPrototypeOf(Y,Uint8Array.prototype),Object.setPrototypeOf(j,Y),j.foo()===42}catch{return!1}}Object.defineProperty(u.prototype,"parent",{enumerable:!0,get:function(){if(u.isBuffer(this))return this.buffer}}),Object.defineProperty(u.prototype,"offset",{enumerable:!0,get:function(){if(u.isBuffer(this))return this.byteOffset}});function a(j){if(j>o)throw new RangeError('The value "'+j+'" is invalid for option "size"');const Y=new Uint8Array(j);return Object.setPrototypeOf(Y,u.prototype),Y}function u(j,Y,be){if(typeof j=="number"){if(typeof Y=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return m(j)}return p(j,Y,be)}u.poolSize=8192;function p(j,Y,be){if(typeof j=="string")return _(j,Y);if(ArrayBuffer.isView(j))return S(j);if(j==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof j);if(_u(j,ArrayBuffer)||j&&_u(j.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(_u(j,SharedArrayBuffer)||j&&_u(j.buffer,SharedArrayBuffer)))return E(j,Y,be);if(typeof j=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');const Q=j.valueOf&&j.valueOf();if(Q!=null&&Q!==j)return u.from(Q,Y,be);const X=x(j);if(X)return X;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof j[Symbol.toPrimitive]=="function")return u.from(j[Symbol.toPrimitive]("string"),Y,be);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof j)}u.from=function(j,Y,be){return p(j,Y,be)},Object.setPrototypeOf(u.prototype,Uint8Array.prototype),Object.setPrototypeOf(u,Uint8Array);function d(j){if(typeof j!="number")throw new TypeError('"size" argument must be of type number');if(j<0)throw new RangeError('The value "'+j+'" is invalid for option "size"')}function c(j,Y,be){return d(j),j<=0?a(j):Y!==void 0?typeof be=="string"?a(j).fill(Y,be):a(j).fill(Y):a(j)}u.alloc=function(j,Y,be){return c(j,Y,be)};function m(j){return d(j),a(j<0?0:O(j)|0)}u.allocUnsafe=function(j){return m(j)},u.allocUnsafeSlow=function(j){return m(j)};function _(j,Y){if((typeof Y!="string"||Y==="")&&(Y="utf8"),!u.isEncoding(Y))throw new TypeError("Unknown encoding: "+Y);const be=U(j,Y)|0;let Q=a(be);const X=Q.write(j,Y);return X!==be&&(Q=Q.slice(0,X)),Q}function v(j){const Y=j.length<0?0:O(j.length)|0,be=a(Y);for(let Q=0;Q<Y;Q+=1)be[Q]=j[Q]&255;return be}function S(j){if(_u(j,Uint8Array)){const Y=new Uint8Array(j);return E(Y.buffer,Y.byteOffset,Y.byteLength)}return v(j)}function E(j,Y,be){if(Y<0||j.byteLength<Y)throw new RangeError('"offset" is outside of buffer bounds');if(j.byteLength<Y+(be||0))throw new RangeError('"length" is outside of buffer bounds');let Q;return Y===void 0&&be===void 0?Q=new Uint8Array(j):be===void 0?Q=new Uint8Array(j,Y):Q=new Uint8Array(j,Y,be),Object.setPrototypeOf(Q,u.prototype),Q}function x(j){if(u.isBuffer(j)){const Y=O(j.length)|0,be=a(Y);return be.length===0||j.copy(be,0,0,Y),be}if(j.length!==void 0)return typeof j.length!="number"||Nu(j.length)?a(0):v(j);if(j.type==="Buffer"&&Array.isArray(j.data))return v(j.data)}function O(j){if(j>=o)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+o.toString(16)+" bytes");return j|0}function q(j){return+j!=j&&(j=0),u.alloc(+j)}u.isBuffer=function(j){return j!=null&&j._isBuffer===!0&&j!==u.prototype},u.compare=function(j,Y){if(_u(j,Uint8Array)&&(j=u.from(j,j.offset,j.byteLength)),_u(Y,Uint8Array)&&(Y=u.from(Y,Y.offset,Y.byteLength)),!u.isBuffer(j)||!u.isBuffer(Y))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(j===Y)return 0;let be=j.length,Q=Y.length;for(let X=0,ke=Math.min(be,Q);X<ke;++X)if(j[X]!==Y[X]){be=j[X],Q=Y[X];break}return be<Q?-1:Q<be?1:0},u.isEncoding=function(j){switch(String(j).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},u.concat=function(j,Y){if(!Array.isArray(j))throw new TypeError('"list" argument must be an Array of Buffers');if(j.length===0)return u.alloc(0);let be;if(Y===void 0)for(Y=0,be=0;be<j.length;++be)Y+=j[be].length;const Q=u.allocUnsafe(Y);let X=0;for(be=0;be<j.length;++be){let ke=j[be];if(_u(ke,Uint8Array))X+ke.length>Q.length?(u.isBuffer(ke)||(ke=u.from(ke)),ke.copy(Q,X)):Uint8Array.prototype.set.call(Q,ke,X);else if(u.isBuffer(ke))ke.copy(Q,X);else throw new TypeError('"list" argument must be an Array of Buffers');X+=ke.length}return Q};function U(j,Y){if(u.isBuffer(j))return j.length;if(ArrayBuffer.isView(j)||_u(j,ArrayBuffer))return j.byteLength;if(typeof j!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof j);const be=j.length,Q=arguments.length>2&&arguments[2]===!0;if(!Q&&be===0)return 0;let X=!1;for(;;)switch(Y){case"ascii":case"latin1":case"binary":return be;case"utf8":case"utf-8":return du(j).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return be*2;case"hex":return be>>>1;case"base64":return $u(j).length;default:if(X)return Q?-1:du(j).length;Y=(""+Y).toLowerCase(),X=!0}}u.byteLength=U;function L(j,Y,be){let Q=!1;if((Y===void 0||Y<0)&&(Y=0),Y>this.length||((be===void 0||be>this.length)&&(be=this.length),be<=0)||(be>>>=0,Y>>>=0,be<=Y))return"";for(j||(j="utf8");;)switch(j){case"hex":return N(this,Y,be);case"utf8":case"utf-8":return w(this,Y,be);case"ascii":return H(this,Y,be);case"latin1":case"binary":return V(this,Y,be);case"base64":return A(this,Y,be);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return b(this,Y,be);default:if(Q)throw new TypeError("Unknown encoding: "+j);j=(j+"").toLowerCase(),Q=!0}}u.prototype._isBuffer=!0;function z(j,Y,be){const Q=j[Y];j[Y]=j[be],j[be]=Q}u.prototype.swap16=function(){const j=this.length;if(j%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let Y=0;Y<j;Y+=2)z(this,Y,Y+1);return this},u.prototype.swap32=function(){const j=this.length;if(j%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let Y=0;Y<j;Y+=4)z(this,Y,Y+3),z(this,Y+1,Y+2);return this},u.prototype.swap64=function(){const j=this.length;if(j%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let Y=0;Y<j;Y+=8)z(this,Y,Y+7),z(this,Y+1,Y+6),z(this,Y+2,Y+5),z(this,Y+3,Y+4);return this},u.prototype.toString=function(){const j=this.length;return j===0?"":arguments.length===0?w(this,0,j):L.apply(this,arguments)},u.prototype.toLocaleString=u.prototype.toString,u.prototype.equals=function(j){if(!u.isBuffer(j))throw new TypeError("Argument must be a Buffer");return this===j?!0:u.compare(this,j)===0},u.prototype.inspect=function(){let j="";const Y=e.INSPECT_MAX_BYTES;return j=this.toString("hex",0,Y).replace(/(.{2})/g,"$1 ").trim(),this.length>Y&&(j+=" ... "),"<Buffer "+j+">"},n&&(u.prototype[n]=u.prototype.inspect),u.prototype.compare=function(j,Y,be,Q,X){if(_u(j,Uint8Array)&&(j=u.from(j,j.offset,j.byteLength)),!u.isBuffer(j))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof j);if(Y===void 0&&(Y=0),be===void 0&&(be=j?j.length:0),Q===void 0&&(Q=0),X===void 0&&(X=this.length),Y<0||be>j.length||Q<0||X>this.length)throw new RangeError("out of range index");if(Q>=X&&Y>=be)return 0;if(Q>=X)return-1;if(Y>=be)return 1;if(Y>>>=0,be>>>=0,Q>>>=0,X>>>=0,this===j)return 0;let ke=X-Q,Jr=be-Y;const eu=Math.min(ke,Jr),vu=this.slice(Q,X),lu=j.slice(Y,be);for(let bu=0;bu<eu;++bu)if(vu[bu]!==lu[bu]){ke=vu[bu],Jr=lu[bu];break}return ke<Jr?-1:Jr<ke?1:0};function F(j,Y,be,Q,X){if(j.length===0)return-1;if(typeof be=="string"?(Q=be,be=0):be>2147483647?be=2147483647:be<-2147483648&&(be=-2147483648),be=+be,Nu(be)&&(be=X?0:j.length-1),be<0&&(be=j.length+be),be>=j.length){if(X)return-1;be=j.length-1}else if(be<0)if(X)be=0;else return-1;if(typeof Y=="string"&&(Y=u.from(Y,Q)),u.isBuffer(Y))return Y.length===0?-1:y(j,Y,be,Q,X);if(typeof Y=="number")return Y=Y&255,typeof Uint8Array.prototype.indexOf=="function"?X?Uint8Array.prototype.indexOf.call(j,Y,be):Uint8Array.prototype.lastIndexOf.call(j,Y,be):y(j,[Y],be,Q,X);throw new TypeError("val must be string, number or Buffer")}function y(j,Y,be,Q,X){let ke=1,Jr=j.length,eu=Y.length;if(Q!==void 0&&(Q=String(Q).toLowerCase(),Q==="ucs2"||Q==="ucs-2"||Q==="utf16le"||Q==="utf-16le")){if(j.length<2||Y.length<2)return-1;ke=2,Jr/=2,eu/=2,be/=2}function vu(bu,ku){return ke===1?bu[ku]:bu.readUInt16BE(ku*ke)}let lu;if(X){let bu=-1;for(lu=be;lu<Jr;lu++)if(vu(j,lu)===vu(Y,bu===-1?0:lu-bu)){if(bu===-1&&(bu=lu),lu-bu+1===eu)return bu*ke}else bu!==-1&&(lu-=lu-bu),bu=-1}else for(be+eu>Jr&&(be=Jr-eu),lu=be;lu>=0;lu--){let bu=!0;for(let ku=0;ku<eu;ku++)if(vu(j,lu+ku)!==vu(Y,ku)){bu=!1;break}if(bu)return lu}return-1}u.prototype.includes=function(j,Y,be){return this.indexOf(j,Y,be)!==-1},u.prototype.indexOf=function(j,Y,be){return F(this,j,Y,be,!0)},u.prototype.lastIndexOf=function(j,Y,be){return F(this,j,Y,be,!1)};function T(j,Y,be,Q){be=Number(be)||0;const X=j.length-be;Q?(Q=Number(Q),Q>X&&(Q=X)):Q=X;const ke=Y.length;Q>ke/2&&(Q=ke/2);let Jr;for(Jr=0;Jr<Q;++Jr){const eu=parseInt(Y.substr(Jr*2,2),16);if(Nu(eu))return Jr;j[be+Jr]=eu}return Jr}function D(j,Y,be,Q){return gu(du(Y,j.length-be),j,be,Q)}function G(j,Y,be,Q){return gu(au(Y),j,be,Q)}function C(j,Y,be,Q){return gu($u(Y),j,be,Q)}function l(j,Y,be,Q){return gu(iu(Y,j.length-be),j,be,Q)}u.prototype.write=function(j,Y,be,Q){if(Y===void 0)Q="utf8",be=this.length,Y=0;else if(be===void 0&&typeof Y=="string")Q=Y,be=this.length,Y=0;else if(isFinite(Y))Y=Y>>>0,isFinite(be)?(be=be>>>0,Q===void 0&&(Q="utf8")):(Q=be,be=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");const X=this.length-Y;if((be===void 0||be>X)&&(be=X),j.length>0&&(be<0||Y<0)||Y>this.length)throw new RangeError("Attempt to write outside buffer bounds");Q||(Q="utf8");let ke=!1;for(;;)switch(Q){case"hex":return T(this,j,Y,be);case"utf8":case"utf-8":return D(this,j,Y,be);case"ascii":case"latin1":case"binary":return G(this,j,Y,be);case"base64":return C(this,j,Y,be);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return l(this,j,Y,be);default:if(ke)throw new TypeError("Unknown encoding: "+Q);Q=(""+Q).toLowerCase(),ke=!0}},u.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function A(j,Y,be){return Y===0&&be===j.length?t.fromByteArray(j):t.fromByteArray(j.slice(Y,be))}function w(j,Y,be){be=Math.min(j.length,be);const Q=[];let X=Y;for(;X<be;){const ke=j[X];let Jr=null,eu=ke>239?4:ke>223?3:ke>191?2:1;if(X+eu<=be){let vu,lu,bu,ku;switch(eu){case 1:ke<128&&(Jr=ke);break;case 2:vu=j[X+1],(vu&192)===128&&(ku=(ke&31)<<6|vu&63,ku>127&&(Jr=ku));break;case 3:vu=j[X+1],lu=j[X+2],(vu&192)===128&&(lu&192)===128&&(ku=(ke&15)<<12|(vu&63)<<6|lu&63,ku>2047&&(ku<55296||ku>57343)&&(Jr=ku));break;case 4:vu=j[X+1],lu=j[X+2],bu=j[X+3],(vu&192)===128&&(lu&192)===128&&(bu&192)===128&&(ku=(ke&15)<<18|(vu&63)<<12|(lu&63)<<6|bu&63,ku>65535&&ku<1114112&&(Jr=ku))}}Jr===null?(Jr=65533,eu=1):Jr>65535&&(Jr-=65536,Q.push(Jr>>>10&1023|55296),Jr=56320|Jr&1023),Q.push(Jr),X+=eu}return P(Q)}const B=4096;function P(j){const Y=j.length;if(Y<=B)return String.fromCharCode.apply(String,j);let be="",Q=0;for(;Q<Y;)be+=String.fromCharCode.apply(String,j.slice(Q,Q+=B));return be}function H(j,Y,be){let Q="";be=Math.min(j.length,be);for(let X=Y;X<be;++X)Q+=String.fromCharCode(j[X]&127);return Q}function V(j,Y,be){let Q="";be=Math.min(j.length,be);for(let X=Y;X<be;++X)Q+=String.fromCharCode(j[X]);return Q}function N(j,Y,be){const Q=j.length;(!Y||Y<0)&&(Y=0),(!be||be<0||be>Q)&&(be=Q);let X="";for(let ke=Y;ke<be;++ke)X+=su[j[ke]];return X}function b(j,Y,be){const Q=j.slice(Y,be);let X="";for(let ke=0;ke<Q.length-1;ke+=2)X+=String.fromCharCode(Q[ke]+Q[ke+1]*256);return X}u.prototype.slice=function(j,Y){const be=this.length;j=~~j,Y=Y===void 0?be:~~Y,j<0?(j+=be,j<0&&(j=0)):j>be&&(j=be),Y<0?(Y+=be,Y<0&&(Y=0)):Y>be&&(Y=be),Y<j&&(Y=j);const Q=this.subarray(j,Y);return Object.setPrototypeOf(Q,u.prototype),Q};function k(j,Y,be){if(j%1!==0||j<0)throw new RangeError("offset is not uint");if(j+Y>be)throw new RangeError("Trying to access beyond buffer length")}u.prototype.readUintLE=u.prototype.readUIntLE=function(j,Y,be){j=j>>>0,Y=Y>>>0,be||k(j,Y,this.length);let Q=this[j],X=1,ke=0;for(;++ke<Y&&(X*=256);)Q+=this[j+ke]*X;return Q},u.prototype.readUintBE=u.prototype.readUIntBE=function(j,Y,be){j=j>>>0,Y=Y>>>0,be||k(j,Y,this.length);let Q=this[j+--Y],X=1;for(;Y>0&&(X*=256);)Q+=this[j+--Y]*X;return Q},u.prototype.readUint8=u.prototype.readUInt8=function(j,Y){return j=j>>>0,Y||k(j,1,this.length),this[j]},u.prototype.readUint16LE=u.prototype.readUInt16LE=function(j,Y){return j=j>>>0,Y||k(j,2,this.length),this[j]|this[j+1]<<8},u.prototype.readUint16BE=u.prototype.readUInt16BE=function(j,Y){return j=j>>>0,Y||k(j,2,this.length),this[j]<<8|this[j+1]},u.prototype.readUint32LE=u.prototype.readUInt32LE=function(j,Y){return j=j>>>0,Y||k(j,4,this.length),(this[j]|this[j+1]<<8|this[j+2]<<16)+this[j+3]*16777216},u.prototype.readUint32BE=u.prototype.readUInt32BE=function(j,Y){return j=j>>>0,Y||k(j,4,this.length),this[j]*16777216+(this[j+1]<<16|this[j+2]<<8|this[j+3])},u.prototype.readBigUInt64LE=yu(function(j){j=j>>>0,Fr(j,"offset");const Y=this[j],be=this[j+7];(Y===void 0||be===void 0)&&zs(j,this.length-8);const Q=Y+this[++j]*2**8+this[++j]*2**16+this[++j]*2**24,X=this[++j]+this[++j]*2**8+this[++j]*2**16+be*2**24;return BigInt(Q)+(BigInt(X)<<BigInt(32))}),u.prototype.readBigUInt64BE=yu(function(j){j=j>>>0,Fr(j,"offset");const Y=this[j],be=this[j+7];(Y===void 0||be===void 0)&&zs(j,this.length-8);const Q=Y*2**24+this[++j]*2**16+this[++j]*2**8+this[++j],X=this[++j]*2**24+this[++j]*2**16+this[++j]*2**8+be;return(BigInt(Q)<<BigInt(32))+BigInt(X)}),u.prototype.readIntLE=function(j,Y,be){j=j>>>0,Y=Y>>>0,be||k(j,Y,this.length);let Q=this[j],X=1,ke=0;for(;++ke<Y&&(X*=256);)Q+=this[j+ke]*X;return X*=128,Q>=X&&(Q-=Math.pow(2,8*Y)),Q},u.prototype.readIntBE=function(j,Y,be){j=j>>>0,Y=Y>>>0,be||k(j,Y,this.length);let Q=Y,X=1,ke=this[j+--Q];for(;Q>0&&(X*=256);)ke+=this[j+--Q]*X;return X*=128,ke>=X&&(ke-=Math.pow(2,8*Y)),ke},u.prototype.readInt8=function(j,Y){return j=j>>>0,Y||k(j,1,this.length),this[j]&128?(255-this[j]+1)*-1:this[j]},u.prototype.readInt16LE=function(j,Y){j=j>>>0,Y||k(j,2,this.length);const be=this[j]|this[j+1]<<8;return be&32768?be|4294901760:be},u.prototype.readInt16BE=function(j,Y){j=j>>>0,Y||k(j,2,this.length);const be=this[j+1]|this[j]<<8;return be&32768?be|4294901760:be},u.prototype.readInt32LE=function(j,Y){return j=j>>>0,Y||k(j,4,this.length),this[j]|this[j+1]<<8|this[j+2]<<16|this[j+3]<<24},u.prototype.readInt32BE=function(j,Y){return j=j>>>0,Y||k(j,4,this.length),this[j]<<24|this[j+1]<<16|this[j+2]<<8|this[j+3]},u.prototype.readBigInt64LE=yu(function(j){j=j>>>0,Fr(j,"offset");const Y=this[j],be=this[j+7];(Y===void 0||be===void 0)&&zs(j,this.length-8);const Q=this[j+4]+this[j+5]*2**8+this[j+6]*2**16+(be<<24);return(BigInt(Q)<<BigInt(32))+BigInt(Y+this[++j]*2**8+this[++j]*2**16+this[++j]*2**24)}),u.prototype.readBigInt64BE=yu(function(j){j=j>>>0,Fr(j,"offset");const Y=this[j],be=this[j+7];(Y===void 0||be===void 0)&&zs(j,this.length-8);const Q=(Y<<24)+this[++j]*2**16+this[++j]*2**8+this[++j];return(BigInt(Q)<<BigInt(32))+BigInt(this[++j]*2**24+this[++j]*2**16+this[++j]*2**8+be)}),u.prototype.readFloatLE=function(j,Y){return j=j>>>0,Y||k(j,4,this.length),r.read(this,j,!0,23,4)},u.prototype.readFloatBE=function(j,Y){return j=j>>>0,Y||k(j,4,this.length),r.read(this,j,!1,23,4)},u.prototype.readDoubleLE=function(j,Y){return j=j>>>0,Y||k(j,8,this.length),r.read(this,j,!0,52,8)},u.prototype.readDoubleBE=function(j,Y){return j=j>>>0,Y||k(j,8,this.length),r.read(this,j,!1,52,8)};function J(j,Y,be,Q,X,ke){if(!u.isBuffer(j))throw new TypeError('"buffer" argument must be a Buffer instance');if(Y>X||Y<ke)throw new RangeError('"value" argument is out of bounds');if(be+Q>j.length)throw new RangeError("Index out of range")}u.prototype.writeUintLE=u.prototype.writeUIntLE=function(j,Y,be,Q){if(j=+j,Y=Y>>>0,be=be>>>0,!Q){const Jr=Math.pow(2,8*be)-1;J(this,j,Y,be,Jr,0)}let X=1,ke=0;for(this[Y]=j&255;++ke<be&&(X*=256);)this[Y+ke]=j/X&255;return Y+be},u.prototype.writeUintBE=u.prototype.writeUIntBE=function(j,Y,be,Q){if(j=+j,Y=Y>>>0,be=be>>>0,!Q){const Jr=Math.pow(2,8*be)-1;J(this,j,Y,be,Jr,0)}let X=be-1,ke=1;for(this[Y+X]=j&255;--X>=0&&(ke*=256);)this[Y+X]=j/ke&255;return Y+be},u.prototype.writeUint8=u.prototype.writeUInt8=function(j,Y,be){return j=+j,Y=Y>>>0,be||J(this,j,Y,1,255,0),this[Y]=j&255,Y+1},u.prototype.writeUint16LE=u.prototype.writeUInt16LE=function(j,Y,be){return j=+j,Y=Y>>>0,be||J(this,j,Y,2,65535,0),this[Y]=j&255,this[Y+1]=j>>>8,Y+2},u.prototype.writeUint16BE=u.prototype.writeUInt16BE=function(j,Y,be){return j=+j,Y=Y>>>0,be||J(this,j,Y,2,65535,0),this[Y]=j>>>8,this[Y+1]=j&255,Y+2},u.prototype.writeUint32LE=u.prototype.writeUInt32LE=function(j,Y,be){return j=+j,Y=Y>>>0,be||J(this,j,Y,4,4294967295,0),this[Y+3]=j>>>24,this[Y+2]=j>>>16,this[Y+1]=j>>>8,this[Y]=j&255,Y+4},u.prototype.writeUint32BE=u.prototype.writeUInt32BE=function(j,Y,be){return j=+j,Y=Y>>>0,be||J(this,j,Y,4,4294967295,0),this[Y]=j>>>24,this[Y+1]=j>>>16,this[Y+2]=j>>>8,this[Y+3]=j&255,Y+4};function De(j,Y,be,Q,X){Z(Y,Q,X,j,be,7);let ke=Number(Y&BigInt(4294967295));j[be++]=ke,ke=ke>>8,j[be++]=ke,ke=ke>>8,j[be++]=ke,ke=ke>>8,j[be++]=ke;let Jr=Number(Y>>BigInt(32)&BigInt(4294967295));return j[be++]=Jr,Jr=Jr>>8,j[be++]=Jr,Jr=Jr>>8,j[be++]=Jr,Jr=Jr>>8,j[be++]=Jr,be}function Ue(j,Y,be,Q,X){Z(Y,Q,X,j,be,7);let ke=Number(Y&BigInt(4294967295));j[be+7]=ke,ke=ke>>8,j[be+6]=ke,ke=ke>>8,j[be+5]=ke,ke=ke>>8,j[be+4]=ke;let Jr=Number(Y>>BigInt(32)&BigInt(4294967295));return j[be+3]=Jr,Jr=Jr>>8,j[be+2]=Jr,Jr=Jr>>8,j[be+1]=Jr,Jr=Jr>>8,j[be]=Jr,be+8}u.prototype.writeBigUInt64LE=yu(function(j,Y=0){return De(this,j,Y,BigInt(0),BigInt("0xffffffffffffffff"))}),u.prototype.writeBigUInt64BE=yu(function(j,Y=0){return Ue(this,j,Y,BigInt(0),BigInt("0xffffffffffffffff"))}),u.prototype.writeIntLE=function(j,Y,be,Q){if(j=+j,Y=Y>>>0,!Q){const eu=Math.pow(2,8*be-1);J(this,j,Y,be,eu-1,-eu)}let X=0,ke=1,Jr=0;for(this[Y]=j&255;++X<be&&(ke*=256);)j<0&&Jr===0&&this[Y+X-1]!==0&&(Jr=1),this[Y+X]=(j/ke>>0)-Jr&255;return Y+be},u.prototype.writeIntBE=function(j,Y,be,Q){if(j=+j,Y=Y>>>0,!Q){const eu=Math.pow(2,8*be-1);J(this,j,Y,be,eu-1,-eu)}let X=be-1,ke=1,Jr=0;for(this[Y+X]=j&255;--X>=0&&(ke*=256);)j<0&&Jr===0&&this[Y+X+1]!==0&&(Jr=1),this[Y+X]=(j/ke>>0)-Jr&255;return Y+be},u.prototype.writeInt8=function(j,Y,be){return j=+j,Y=Y>>>0,be||J(this,j,Y,1,127,-128),j<0&&(j=255+j+1),this[Y]=j&255,Y+1},u.prototype.writeInt16LE=function(j,Y,be){return j=+j,Y=Y>>>0,be||J(this,j,Y,2,32767,-32768),this[Y]=j&255,this[Y+1]=j>>>8,Y+2},u.prototype.writeInt16BE=function(j,Y,be){return j=+j,Y=Y>>>0,be||J(this,j,Y,2,32767,-32768),this[Y]=j>>>8,this[Y+1]=j&255,Y+2},u.prototype.writeInt32LE=function(j,Y,be){return j=+j,Y=Y>>>0,be||J(this,j,Y,4,2147483647,-2147483648),this[Y]=j&255,this[Y+1]=j>>>8,this[Y+2]=j>>>16,this[Y+3]=j>>>24,Y+4},u.prototype.writeInt32BE=function(j,Y,be){return j=+j,Y=Y>>>0,be||J(this,j,Y,4,2147483647,-2147483648),j<0&&(j=4294967295+j+1),this[Y]=j>>>24,this[Y+1]=j>>>16,this[Y+2]=j>>>8,this[Y+3]=j&255,Y+4},u.prototype.writeBigInt64LE=yu(function(j,Y=0){return De(this,j,Y,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),u.prototype.writeBigInt64BE=yu(function(j,Y=0){return Ue(this,j,Y,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function Ks(j,Y,be,Q,X,ke){if(be+Q>j.length)throw new RangeError("Index out of range");if(be<0)throw new RangeError("Index out of range")}function rn(j,Y,be,Q,X){return Y=+Y,be=be>>>0,X||Ks(j,Y,be,4),r.write(j,Y,be,Q,23,4),be+4}u.prototype.writeFloatLE=function(j,Y,be){return rn(this,j,Y,!0,be)},u.prototype.writeFloatBE=function(j,Y,be){return rn(this,j,Y,!1,be)};function Ur(j,Y,be,Q,X){return Y=+Y,be=be>>>0,X||Ks(j,Y,be,8),r.write(j,Y,be,Q,52,8),be+8}u.prototype.writeDoubleLE=function(j,Y,be){return Ur(this,j,Y,!0,be)},u.prototype.writeDoubleBE=function(j,Y,be){return Ur(this,j,Y,!1,be)},u.prototype.copy=function(j,Y,be,Q){if(!u.isBuffer(j))throw new TypeError("argument should be a Buffer");if(be||(be=0),!Q&&Q!==0&&(Q=this.length),Y>=j.length&&(Y=j.length),Y||(Y=0),Q>0&&Q<be&&(Q=be),Q===be||j.length===0||this.length===0)return 0;if(Y<0)throw new RangeError("targetStart out of bounds");if(be<0||be>=this.length)throw new RangeError("Index out of range");if(Q<0)throw new RangeError("sourceEnd out of bounds");Q>this.length&&(Q=this.length),j.length-Y<Q-be&&(Q=j.length-Y+be);const X=Q-be;return this===j&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(Y,be,Q):Uint8Array.prototype.set.call(j,this.subarray(be,Q),Y),X},u.prototype.fill=function(j,Y,be,Q){if(typeof j=="string"){if(typeof Y=="string"?(Q=Y,Y=0,be=this.length):typeof be=="string"&&(Q=be,be=this.length),Q!==void 0&&typeof Q!="string")throw new TypeError("encoding must be a string");if(typeof Q=="string"&&!u.isEncoding(Q))throw new TypeError("Unknown encoding: "+Q);if(j.length===1){const ke=j.charCodeAt(0);(Q==="utf8"&&ke<128||Q==="latin1")&&(j=ke)}}else typeof j=="number"?j=j&255:typeof j=="boolean"&&(j=Number(j));if(Y<0||this.length<Y||this.length<be)throw new RangeError("Out of range index");if(be<=Y)return this;Y=Y>>>0,be=be===void 0?this.length:be>>>0,j||(j=0);let X;if(typeof j=="number")for(X=Y;X<be;++X)this[X]=j;else{const ke=u.isBuffer(j)?j:u.from(j,Q),Jr=ke.length;if(Jr===0)throw new TypeError('The value "'+j+'" is invalid for argument "value"');for(X=0;X<be-Y;++X)this[X+Y]=ke[X%Jr]}return this};const js={};function Gs(j,Y,be){js[j]=class extends be{constructor(){super(),Object.defineProperty(this,"message",{value:Y.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${j}]`,this.stack,delete this.name}get code(){return j}set code(Q){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:Q,writable:!0})}toString(){return`${this.name} [${j}]: ${this.message}`}}}Gs("ERR_BUFFER_OUT_OF_BOUNDS",function(j){return j?`${j} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),Gs("ERR_INVALID_ARG_TYPE",function(j,Y){return`The "${j}" argument must be of type number. Received type ${typeof Y}`},TypeError),Gs("ERR_OUT_OF_RANGE",function(j,Y,be){let Q=`The value of "${j}" is out of range.`,X=be;return Number.isInteger(be)&&Math.abs(be)>2**32?X=je(String(be)):typeof be=="bigint"&&(X=String(be),(be>BigInt(2)**BigInt(32)||be<-(BigInt(2)**BigInt(32)))&&(X=je(X)),X+="n"),Q+=` It must be ${Y}. Received ${X}`,Q},RangeError);function je(j){let Y="",be=j.length;const Q=j[0]==="-"?1:0;for(;be>=Q+4;be-=3)Y=`_${j.slice(be-3,be)}${Y}`;return`${j.slice(0,be)}${Y}`}function Ee(j,Y,be){Fr(Y,"offset"),(j[Y]===void 0||j[Y+be]===void 0)&&zs(Y,j.length-(be+1))}function Z(j,Y,be,Q,X,ke){if(j>be||j<Y){const Jr=typeof Y=="bigint"?"n":"";let eu;throw Y===0||Y===BigInt(0)?eu=`>= 0${Jr} and < 2${Jr} ** ${(ke+1)*8}${Jr}`:eu=`>= -(2${Jr} ** ${(ke+1)*8-1}${Jr}) and < 2 ** ${(ke+1)*8-1}${Jr}`,new js.ERR_OUT_OF_RANGE("value",eu,j)}Ee(Q,X,ke)}function Fr(j,Y){if(typeof j!="number")throw new js.ERR_INVALID_ARG_TYPE(Y,"number",j)}function zs(j,Y,be){throw Math.floor(j)!==j?(Fr(j,be),new js.ERR_OUT_OF_RANGE("offset","an integer",j)):Y<0?new js.ERR_BUFFER_OUT_OF_BOUNDS:new js.ERR_OUT_OF_RANGE("offset",`>= 0 and <= ${Y}`,j)}const Ys=/[^+/0-9A-Za-z-_]/g;function nu(j){if(j=j.split("=")[0],j=j.trim().replace(Ys,""),j.length<2)return"";for(;j.length%4!==0;)j=j+"=";return j}function du(j,Y){Y=Y||1/0;let be;const Q=j.length;let X=null;const ke=[];for(let Jr=0;Jr<Q;++Jr){if(be=j.charCodeAt(Jr),be>55295&&be<57344){if(!X){if(be>56319){(Y-=3)>-1&&ke.push(239,191,189);continue}else if(Jr+1===Q){(Y-=3)>-1&&ke.push(239,191,189);continue}X=be;continue}if(be<56320){(Y-=3)>-1&&ke.push(239,191,189),X=be;continue}be=(X-55296<<10|be-56320)+65536}else X&&(Y-=3)>-1&&ke.push(239,191,189);if(X=null,be<128){if((Y-=1)<0)break;ke.push(be)}else if(be<2048){if((Y-=2)<0)break;ke.push(be>>6|192,be&63|128)}else if(be<65536){if((Y-=3)<0)break;ke.push(be>>12|224,be>>6&63|128,be&63|128)}else if(be<1114112){if((Y-=4)<0)break;ke.push(be>>18|240,be>>12&63|128,be>>6&63|128,be&63|128)}else throw new Error("Invalid code point")}return ke}function au(j){const Y=[];for(let be=0;be<j.length;++be)Y.push(j.charCodeAt(be)&255);return Y}function iu(j,Y){let be,Q,X;const ke=[];for(let Jr=0;Jr<j.length&&!((Y-=2)<0);++Jr)be=j.charCodeAt(Jr),Q=be>>8,X=be%256,ke.push(X),ke.push(Q);return ke}function $u(j){return t.toByteArray(nu(j))}function gu(j,Y,be,Q){let X;for(X=0;X<Q&&!(X+be>=Y.length||X>=j.length);++X)Y[X+be]=j[X];return X}function _u(j,Y){return j instanceof Y||j!=null&&j.constructor!=null&&j.constructor.name!=null&&j.constructor.name===Y.name}function Nu(j){return j!==j}const su=function(){const j="0123456789abcdef",Y=new Array(256);for(let be=0;be<16;++be){const Q=be*16;for(let X=0;X<16;++X)Y[Q+X]=j[be]+j[X]}return Y}();function yu(j){return typeof BigInt>"u"?Ws:j}function Ws(){throw new Error("BigInt not supported")}})(ue);typeof window<"u"&&(window.Buffer=ue.Buffer);const M2=[];function bt(e,t){if(typeof window>"u")return c0(t);const r=localStorage.getItem(e),n=c0(r==="undefined"||r===null?t:JSON.parse(r));return c0(o=>o(n),(o,s,a)=>{let u=a;return typeof a=="function"&&(u=a(o(n))),localStorage.setItem(e,JSON.stringify(u)),s(n,u),u})}const de=["bitcoin","cosmos"],pe={isConnected:!1,bitcoin:{connected:!1,chainType:"bitcoin"},cosmos:{connected:!1,chainType:"cosmos"}},h0=bt("tomo_wallet_state",pe),v0=c0({state:0}),z2=c0(M2),k2=c0([]);c0(e=>e(k2).findLast(t=>t.type==="page"));const It={bitcoinChains:ht,cosmosChains:mt,chainTypes:de,socialTypes:[],indexWallets:ae,onlySocial:!1,useServerSettings:!1},m0=c0(It);c0(void 0);const B2=c0({open:!1,chainType:"bitcoin"}),he=c0(M2),me=c0({theme:"light"});function y0(e,t){const r=R2.useMemo(()=>c0(null,(n,o,...s)=>e(n,o,...s)),[e]);return g0(r)}var T2={exports:{}};(function(e,t){Object.defineProperty(t,"__esModule",{value:!0});function r(y){return typeof y=="object"&&!("toString"in y)?Object.prototype.toString.call(y).slice(8,-1):y}var n=typeof process$1=="object"&&process$1.env.NODE_ENV==="production";function o(y,T){if(!y)throw n?new Error("Invariant failed"):new Error(T())}t.invariant=o;var s=Object.prototype.hasOwnProperty,a=Array.prototype.splice,u=Object.prototype.toString;function p(y){return u.call(y).slice(8,-1)}var d=Object.assign||function(y,T){return c(T).forEach(function(D){s.call(T,D)&&(y[D]=T[D])}),y},c=typeof Object.getOwnPropertySymbols=="function"?function(y){return Object.keys(y).concat(Object.getOwnPropertySymbols(y))}:function(y){return Object.keys(y)};function m(y){return Array.isArray(y)?d(y.constructor(y.length),y):p(y)==="Map"?new Map(y):p(y)==="Set"?new Set(y):y&&typeof y=="object"?d(Object.create(Object.getPrototypeOf(y)),y):y}var _=function(){function y(){this.commands=d({},v),this.update=this.update.bind(this),this.update.extend=this.extend=this.extend.bind(this),this.update.isEquals=function(T,D){return T===D},this.update.newContext=function(){return new y().update}}return Object.defineProperty(y.prototype,"isEquals",{get:function(){return this.update.isEquals},set:function(T){this.update.isEquals=T},enumerable:!0,configurable:!0}),y.prototype.extend=function(T,D){this.commands[T]=D},y.prototype.update=function(T,D){var G=this,C=typeof D=="function"?{$apply:D}:D;Array.isArray(T)&&Array.isArray(C)||o(!Array.isArray(C),function(){return"update(): You provided an invalid spec to update(). The spec may not contain an array except as the value of $set, $push, $unshift, $splice or any custom command allowing an array value."}),o(typeof C=="object"&&C!==null,function(){return"update(): You provided an invalid spec to update(). The spec and every included key path must be plain objects containing one of the "+("following commands: "+Object.keys(G.commands).join(", ")+".")});var l=T;return c(C).forEach(function(A){if(s.call(G.commands,A)){var w=T===l;l=G.commands[A](C[A],l,C,T),w&&G.isEquals(l,T)&&(l=T)}else{var B=p(T)==="Map"?G.update(T.get(A),C[A]):G.update(T[A],C[A]),P=p(l)==="Map"?l.get(A):l[A];(!G.isEquals(B,P)||typeof B>"u"&&!s.call(T,A))&&(l===T&&(l=m(T)),p(l)==="Map"?l.set(A,B):l[A]=B)}}),l},y}();t.Context=_;var v={$push:function(y,T,D){return E(T,D,"$push"),y.length?T.concat(y):T},$unshift:function(y,T,D){return E(T,D,"$unshift"),y.length?y.concat(T):T},$splice:function(y,T,D,G){return O(T,D),y.forEach(function(C){q(C),T===G&&C.length&&(T=m(G)),a.apply(T,C)}),T},$set:function(y,T,D){return L(D),y},$toggle:function(y,T){x(y,"$toggle");var D=y.length?m(T):T;return y.forEach(function(G){D[G]=!T[G]}),D},$unset:function(y,T,D,G){return x(y,"$unset"),y.forEach(function(C){Object.hasOwnProperty.call(T,C)&&(T===G&&(T=m(G)),delete T[C])}),T},$add:function(y,T,D,G){return F(T,"$add"),x(y,"$add"),p(T)==="Map"?y.forEach(function(C){var l=C[0],A=C[1];T===G&&T.get(l)!==A&&(T=m(G)),T.set(l,A)}):y.forEach(function(C){T===G&&!T.has(C)&&(T=m(G)),T.add(C)}),T},$remove:function(y,T,D,G){return F(T,"$remove"),x(y,"$remove"),y.forEach(function(C){T===G&&T.has(C)&&(T=m(G)),T.delete(C)}),T},$merge:function(y,T,D,G){return z(T,y),c(y).forEach(function(C){y[C]!==T[C]&&(T===G&&(T=m(G)),T[C]=y[C])}),T},$apply:function(y,T){return U(y),y(T)}},S=new _;t.isEquals=S.update.isEquals,t.extend=S.extend,t.default=S.update,t.default.default=e.exports=d(t.default,t);function E(y,T,D){o(Array.isArray(y),function(){return"update(): expected target of "+r(D)+" to be an array; got "+r(y)+"."}),x(T[D],D)}function x(y,T){o(Array.isArray(y),function(){return"update(): expected spec of "+r(T)+" to be an array; got "+r(y)+". Did you forget to wrap your parameter in an array?"})}function O(y,T){o(Array.isArray(y),function(){return"Expected $splice target to be an array; got "+r(y)}),q(T.$splice)}function q(y){o(Array.isArray(y),function(){return"update(): expected spec of $splice to be an array of arrays; got "+r(y)+". Did you forget to wrap your parameters in an array?"})}function U(y){o(typeof y=="function",function(){return"update(): expected spec of $apply to be a function; got "+r(y)+"."})}function L(y){o(Object.keys(y).length===1,function(){return"Cannot have more than one key in an object with $set"})}function z(y,T){o(T&&typeof T=="object",function(){return"update(): $merge expects a spec of type 'object'; got "+r(T)}),o(y&&typeof y=="object",function(){return"update(): $merge expects a target of type 'object'; got "+r(y)})}function F(y,T){var D=p(y);o(D==="Map"||D==="Set",function(){return"update(): "+r(T)+" expects a target of type Set or Map; got "+r(D)})}})(T2,T2.exports);var Bt=T2.exports;const N0=He(Bt),Tt=[{wallet:"cosmos_keplr",messageRegex:/There is no modular chain info for/},{wallet:"cosmos_leap",messageRegex:/Invalid chain id/},{wallet:"cosmos_cosmostation",messageRegex:/There is no chain info for/}];function At(e,t){return e[t+"Chains"]}function c2(){const e=g0(h0),t=g0(v0),r=y0(R2.useCallback(async(a,u,p)=>{const{chainType:d}=p,c=await a(v0)[`${d}Provider`].getAddress();e(m=>N0(m,{[d]:{address:{$set:c}}}))},[])),n=y0(R2.useCallback(async(a,u,p,d={})=>{var c;const m=a(v0),_=a(m0),v=a(h0);try{const S=m[`${p}Provider`];if(!S)throw new Error(`Unsupported Chain: ${p}`);try{await S.connectWallet()}catch(O){if(p!=="cosmos"||!((c=S==null?void 0:S.provider)!=null&&c.experimentalSuggestChain))throw O;const q=Tt.find(L=>{var z;return L.wallet===((z=v.cosmos)==null?void 0:z.walletId)});if(!q||!q.messageRegex.test(O.message||""))throw O;const U=_.cosmosChains[0].modularData;if(!U)throw O;await S.provider.experimentalSuggestChain(U),await S.connectWallet()}const E=await S.getNetwork();let x=_[`${p}Chains`].find(O=>O.network===E);if(!x){const O=At(_,p);if(!(O!=null&&O.length))throw new Error("Unsupported network");x=O[0],await o(x);return}await r({chainType:p}),e(O=>N0(O,{[p]:{$merge:{network:E,chainId:x.id}}}))}catch(S){throw S}},[])),o=y0(R2.useCallback(async(a,u,p)=>{const d=a(v0)[`${p.type}Provider`];if(!d||!d.switchNetwork)throw new Error(`switchNetwork error: ${p.type}`);await d.switchNetwork(p.network);const c=await(d==null?void 0:d.getAddress()),m=await(d==null?void 0:d.getNetwork());e(_=>N0(_,{[p.type]:{$merge:{network:m,chainId:p.id,address:c}}}))},[])),s=y0(R2.useCallback((a,u,p)=>{const d=a(m0),c={},m=o2(p,d);if(!m)throw new Error("Wallet does not exist");const _=c[`${m.chainType}Provider`]=new m.connectProvider({chains:d[`${m.chainType}Chains`],...d.providerOptions});return t(v=>({...v,...c})),_},[]));return{initProvider:s,switchChainType:n,switchChain:o,reloadAddress:r,disconnect:y0(R2.useCallback(async(a,u)=>{const p=a(m0);e(Ce(pe,p))},[])),connect:y0(R2.useCallback(async(a,u,p)=>{var d;const c=a(m0);for(const _ of p){const v=o2(_,c);if(!v)throw new Error("Wallet does not exist");e(S=>N0(S,{[v.chainType]:{$merge:{walletId:_}}})),s(_),await n(v.chainType),e(S=>N0(S,{[v.chainType]:{$merge:{connected:!0}}}))}const m=a(h0);(d=c.chainTypes)!=null&&d.every(_=>m[_].connected)&&e(_=>({..._,isConnected:!0}))},[]))}}const Rt=e=>{if(window.ethereum){let t=[];const r=n=>{const o=[n.detail];t=t.concat(o),e(t||[])};window.addEventListener("eip6963:announceProvider",r),window.dispatchEvent(new Event("eip6963:requestProvider")),window.removeEventListener("eip6963:announceProvider",r)}else e([])};function Pt(e){return e?e==null?void 0:e.map(t=>t):[]}function Ce(e,t){let r=e;return t.chainTypes.forEach(n=>{r[n]||(r={...r,[n]:{connected:!1,chainType:n}})}),r}function Lt(e){const t=t0(z2),r=c2(),n=g0(z2);R2.useEffect(()=>{Rt(n)},[]);const o=y0(R2.useCallback(async(s,a)=>{var u,p;const d={...s(m0),...e};de.forEach(_=>{d[`${_}Chains`]=Pt(d[`${_}Chains`])}),a(h0,_=>Ce(_,d)),a(m0,d);const c=()=>{a(h0,_=>{var v;return(v=d.chainTypes)==null||v.forEach(S=>{_=N0(_,{[S]:{connected:{$set:!1}}})}),{..._,isConnected:!1}})},m=s(h0);if((u=d.chainTypes)==null||u.forEach(_=>{const v=m[_].walletId;if(v){const S=o2(v,d);if(S)try{new S.connectProvider({chains:d[`${_}Chains`],...d.providerOptions})}catch{}}}),m.isConnected&&d.autoReconnect!==!1)try{if((p=d.chainTypes)!=null&&p.some(v=>!m[v].connected))throw new Error("chain not connected");const _=d.chainTypes;for(const v of _){const S=m[v].walletId;r.initProvider(S),await r.switchChainType(v,{type:"init"})}}catch{a(h0,_=>({..._,isConnected:!1})),c()}else c();a(v0,_=>({..._,state:1}))},[]));return R2.useEffect(()=>{t!==M2&&o()},[t]),null}function Ft(){const e=t0(v0),t=c2(),r=t0(h0);R2.useEffect(()=>{var n,o;if(!r.bitcoin.connected)return;const s=async()=>{await t.reloadAddress({chainType:"bitcoin"})};return(o=(n=e.bitcoinProvider)==null?void 0:n.on)==null||o.call(n,"accountsChanged",s),()=>{var a,u;(u=(a=e.bitcoinProvider)==null?void 0:a.off)==null||u.call(a,"accountsChanged",s)}},[e.bitcoinProvider,r.bitcoin.connected]),R2.useEffect(()=>{var n,o;if(!r.cosmos.connected)return;const s=async()=>{await t.reloadAddress({chainType:"cosmos"})};return(o=(n=e.cosmosProvider)==null?void 0:n.on)==null||o.call(n,"accountChanged",s),()=>{var a,u;(u=(a=e.cosmosProvider)==null?void 0:a.off)==null||u.call(a,"accountChanged",s)}},[e.cosmosProvider,r.cosmos.connected])}function Mt(e){return I.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",...e,children:I.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M7.41425 6.00025L11.7072 1.70725C12.0982 1.31625 12.0982 0.68425 11.7072 0.29325C11.3162 -0.09775 10.6842 -0.09775 10.2933 0.29325L6.00025 4.58625L1.70725 0.29325C1.31625 -0.09775 0.68425 -0.09775 0.29325 0.29325C-0.09775 0.68425 -0.09775 1.31625 0.29325 1.70725L4.58625 6.00025L0.29325 10.2933C-0.09775 10.6842 -0.09775 11.3162 0.29325 11.7072C0.48825 11.9022 0.74425 12.0002 1.00025 12.0002C1.25625 12.0002 1.51225 11.9022 1.70725 11.7072L6.00025 7.41425L10.2933 11.7072C10.4882 11.9022 10.7443 12.0002 11.0002 12.0002C11.2562 12.0002 11.5122 11.9022 11.7072 11.7072C12.0982 11.3162 12.0982 10.6842 11.7072 10.2933L7.41425 6.00025Z",fill:"currentColor",fillOpacity:"0.4"})})}function we(e){return I.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",...e,children:[I.jsx("g",{clipPath:"url(#clip0_1_1460)",children:I.jsx("path",{d:"M14.6672 7.33284C14.2985 7.33284 14.0001 7.63127 14.0001 8.00002C14.0001 11.3078 11.3079 14 8.00005 14C6.59849 14 5.2813 13.525 4.22661 12.6672H5.33442C5.70317 12.6672 6.00161 12.3688 6.00161 12C6.00161 11.6313 5.70317 11.3328 5.33442 11.3328H2.66724C2.66099 11.3328 2.65474 11.3344 2.64849 11.3344C2.62661 11.3344 2.60474 11.3375 2.58442 11.3406C2.56255 11.3438 2.54067 11.3453 2.5188 11.35C2.50005 11.3547 2.4813 11.361 2.46255 11.3672C2.43911 11.375 2.41724 11.3813 2.39536 11.3922C2.37974 11.4 2.36411 11.4094 2.34849 11.4172C2.32505 11.4297 2.30317 11.4422 2.2813 11.4578C2.27661 11.461 2.27192 11.4625 2.2688 11.4656C2.25786 11.4735 2.25005 11.4844 2.23911 11.4922C2.22036 11.5078 2.20161 11.525 2.18442 11.5422C2.17036 11.5578 2.15786 11.5735 2.1438 11.5906C2.12974 11.6078 2.11724 11.625 2.1063 11.6438C2.0938 11.6625 2.08442 11.6813 2.07505 11.7016C2.06567 11.7203 2.0563 11.7391 2.04849 11.7594C2.04067 11.7813 2.03442 11.8031 2.02817 11.825C2.02349 11.8438 2.01724 11.8625 2.01411 11.8828C2.00942 11.9078 2.00786 11.9344 2.0063 11.961C2.0063 11.9735 2.00317 11.986 2.00317 11.9985V14.6656C2.00317 15.0344 2.30161 15.3328 2.67036 15.3328C3.03911 15.3328 3.33755 15.0344 3.33755 14.6656V13.6594C4.63599 14.736 6.26724 15.3313 8.00474 15.3313C12.0485 15.3313 15.3376 12.0422 15.3376 7.99846C15.3329 7.63127 15.0344 7.33284 14.6672 7.33284ZM8.00005 2.00002C9.40161 2.00002 10.7188 2.47502 11.7735 3.33284H10.6657C10.2969 3.33284 9.99849 3.63127 9.99849 4.00002C9.99849 4.36877 10.2969 4.66721 10.6657 4.66721H13.3329C13.3391 4.66721 13.3438 4.66565 13.3501 4.66565C13.3735 4.66565 13.3954 4.66096 13.4188 4.6594C13.4391 4.65627 13.461 4.65471 13.4813 4.65002C13.5016 4.64534 13.5204 4.63752 13.5407 4.63127C13.5625 4.62346 13.5844 4.61721 13.6063 4.60784C13.6235 4.60002 13.6391 4.59065 13.6547 4.58127C13.6766 4.56877 13.7 4.55627 13.7204 4.54221C13.725 4.53909 13.7297 4.53752 13.7344 4.5344C13.7454 4.52502 13.7547 4.51565 13.7657 4.50627C13.7844 4.49065 13.8016 4.47502 13.8188 4.45784C13.8344 4.44221 13.8469 4.42502 13.8594 4.40784C13.8719 4.39065 13.886 4.37502 13.8969 4.35627C13.9094 4.33752 13.9188 4.31721 13.9282 4.2969C13.9376 4.27815 13.9469 4.2594 13.9532 4.24065C13.961 4.21877 13.9672 4.1969 13.9735 4.17502C13.9782 4.15627 13.9844 4.13752 13.9876 4.11877C13.9922 4.09221 13.9938 4.06565 13.9954 4.04065C13.9954 4.02815 13.9985 4.01721 13.9985 4.00315V1.33284C13.9985 0.964087 13.7001 0.665649 13.3313 0.665649C12.9626 0.665649 12.6641 0.964087 12.6641 1.33284V2.33909C11.3657 1.26252 9.73442 0.667212 7.99692 0.667212C3.9563 0.667212 0.667236 3.95627 0.667236 8.00002C0.667236 8.36877 0.965674 8.66721 1.33442 8.66721C1.70317 8.66721 2.00005 8.36877 2.00005 8.00002C2.00005 4.69221 4.69224 2.00002 8.00005 2.00002Z",fill:"currentColor"})}),I.jsx("defs",{children:I.jsx("clipPath",{id:"clip0_1_1460",children:I.jsx("rect",{width:"16",height:"16",fill:"white"})})})]})}function kt(e){return I.jsx("svg",{viewBox:"64 64 896 896",focusable:"false","data-icon":"check-circle",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true",...e,children:I.jsx("path",{d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm193.5 301.7l-210.6 292a31.8 31.8 0 01-51.7 0L318.5 484.9c-3.8-5.3 0-12.7 6.5-12.7h46.9c10.2 0 19.9 4.9 25.9 13.3l71.2 98.8 157.2-218c6-8.3 15.6-13.3 25.9-13.3H699c6.5 0 10.3 7.4 6.5 12.7z"})})}function Ut(e){return I.jsx("svg",{viewBox:"64 64 896 896",focusable:"false","data-icon":"exclamation-circle",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true",...e,children:I.jsx("path",{d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm-32 232c0-4.4 3.6-8 8-8h48c4.4 0 8 3.6 8 8v272c0 4.4-3.6 8-8 8h-48c-4.4 0-8-3.6-8-8V296zm32 440a48.01 48.01 0 010-96 48.01 48.01 0 010 96z"})})}function St(e){return I.jsx("svg",{fillRule:"evenodd",viewBox:"64 64 896 896",focusable:"false","data-icon":"close-circle",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true",...e,children:I.jsx("path",{d:"M512 64c247.4 0 448 200.6 448 448S759.4 960 512 960 64 759.4 64 512 264.6 64 512 64zm127.98 274.82h-.04l-.08.06L512 466.75 384.14 338.88c-.04-.05-.06-.06-.08-.06a.12.12 0 00-.07 0c-.03 0-.05.01-.09.05l-45.02 45.02a.2.2 0 00-.05.09.12.12 0 000 .07v.02a.27.27 0 00.06.06L466.75 512 338.88 639.86c-.05.04-.06.06-.06.08a.12.12 0 000 .07c0 .03.01.05.05.09l45.02 45.02a.2.2 0 00.09.05.12.12 0 00.07 0c.02 0 .04-.01.08-.05L512 557.25l127.86 127.87c.04.04.06.05.08.05a.12.12 0 00.07 0c.03 0 .05-.01.09-.05l45.02-45.02a.2.2 0 00.05-.09.12.12 0 000-.07v-.02a.27.27 0 00-.05-.06L557.25 512l127.87-127.86c.04-.04.05-.06.05-.08a.12.12 0 000-.07c0-.03-.01-.05-.05-.09l-45.02-45.02a.2.2 0 00-.09-.05.12.12 0 00-.07 0z"})})}let jt=1;function ye(){const e=g0(k2),t=R2.useContext(A2);return{open:(r,n)=>{const{type:o="page",showClose:s=!0,...a}=n||{},u=jt++,p=new Promise(d=>{e(c=>[...c,{jsx:r,resolve:d,type:o,showClose:s,openPageId:o==="drawer"?t.page.type==="drawer"?t.page.openPageId:t.id:void 0,id:u,opt:a}])});return p._pageId=u,p},close:(r,n)=>{e(o=>{const s=o.find(a=>a.id===r);return s&&s.resolve(n),o.filter(a=>a.id!==r)})}}}const A2=R2.createContext({id:0,page:{}}),q2={getNextState(e,t){return(!e||typeof e=="boolean")&&(e=0),e+t},createFn(e){return async function(t){if(typeof t=="boolean"){e(t?1:-1);return}e(1);let r;try{typeof t=="function"?r=await t():r=await t}catch(n){throw e(-1),n}return e(-1),r}}};function Ot(e=!1){const[t,r]=R2.useState(e);return[!!t,q2.createFn(n=>{r(o=>q2.getNextState(o,n))})]}function Nt(e){const t=ye();R2.useEffect(()=>{if(e){const r=t.open(I.jsx(ge,{}),{type:"drawer",noBg:!0,full:!0,animate:!1});return()=>{t.close(r._pageId)}}},[e])}function ge(){return I.jsx("div",{className:"tm-flex tm-h-full tm-w-full tm-items-center tm-justify-center",children:I.jsx("div",{className:"tm-flex tm-size-16 tm-items-center tm-justify-center tm-rounded-lg tm-bg-white dark:tm-bg-white-dark",children:I.jsx(we,{className:"tm-size-7 tm-animate-spin tm-text-tc1 dark:tm-text-tc1-dark"})})})}const $t="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='38'%20height='16'%20viewBox='0%200%2038%2016'%20fill='none'%3e%3crect%20width='37.0683'%20height='16.0002'%20rx='1.11164'%20fill='%23666666'/%3e%3cpath%20d='M19.946%207.50648C19.5159%207.50648%2019.1206%207.40657%2018.7601%207.20674C18.4039%207.00692%2018.1194%206.72891%2017.9065%206.37271C17.698%206.01216%2017.5938%205.60817%2017.5938%205.16075C17.5938%204.71332%2017.698%204.31151%2017.9065%203.9553C18.1194%203.5991%2018.4039%203.32109%2018.7601%203.12127C19.1206%202.92144%2019.5159%202.82153%2019.946%202.82153C20.376%202.82153%2020.7692%202.92144%2021.1254%203.12127C21.4859%203.32109%2021.7683%203.5991%2021.9724%203.9553C22.181%204.31151%2022.2852%204.71332%2022.2852%205.16075C22.2852%205.60817%2022.181%206.01216%2021.9724%206.37271C21.7639%206.72891%2021.4816%207.00692%2021.1254%207.20674C20.7692%207.40657%2020.376%207.50648%2019.946%207.50648ZM19.946%206.48999C20.3109%206.48999%2020.6019%206.36836%2020.8191%206.1251C21.0407%205.88184%2021.1514%205.56039%2021.1514%205.16075C21.1514%204.75676%2021.0407%204.43531%2020.8191%204.19639C20.6019%203.95313%2020.3109%203.8315%2019.946%203.8315C19.5768%203.8315%2019.2814%203.95096%2019.0598%204.18988C18.8426%204.42879%2018.734%204.75242%2018.734%205.16075C18.734%205.56473%2018.8426%205.88836%2019.0598%206.13162C19.2814%206.37054%2019.5768%206.48999%2019.946%206.48999Z'%20fill='%23121212'/%3e%3cpath%20d='M16.9809%202.88672V7.46089H15.8667V4.71769L14.8437%207.46089H13.9445L12.915%204.71118V7.46089H11.8008V2.88672H13.117L14.4006%206.05345L15.6712%202.88672H16.9809Z'%20fill='%23121212'/%3e%3cpath%20d='M8.84248%207.50648C8.41243%207.50648%208.01713%207.40657%207.65658%207.20674C7.30038%207.00692%207.01585%206.72891%206.803%206.37271C6.59449%206.01216%206.49023%205.60817%206.49023%205.16075C6.49023%204.71332%206.59449%204.31151%206.803%203.9553C7.01585%203.5991%207.30038%203.32109%207.65658%203.12127C8.01713%202.92144%208.41243%202.82153%208.84248%202.82153C9.27253%202.82153%209.66566%202.92144%2010.0219%203.12127C10.3824%203.32109%2010.6648%203.5991%2010.8689%203.9553C11.0774%204.31151%2011.1817%204.71332%2011.1817%205.16075C11.1817%205.60817%2011.0774%206.01216%2010.8689%206.37271C10.6604%206.72891%2010.3781%207.00692%2010.0219%207.20674C9.66566%207.40657%209.27253%207.50648%208.84248%207.50648ZM8.84248%206.48999C9.20737%206.48999%209.49842%206.36836%209.71561%206.1251C9.93715%205.88184%2010.0479%205.56039%2010.0479%205.16075C10.0479%204.75676%209.93715%204.43531%209.71561%204.19639C9.49842%203.95313%209.20737%203.8315%208.84248%203.8315C8.47324%203.8315%208.17786%203.95096%207.95632%204.18988C7.73912%204.42879%207.63052%204.75242%207.63052%205.16075C7.63052%205.56473%207.73912%205.88836%207.95632%206.13162C8.17786%206.37054%208.47324%206.48999%208.84248%206.48999Z'%20fill='%23121212'/%3e%3cpath%20d='M6.12017%202.88672V3.7794H4.90821V7.46089H3.79399V3.7794H2.58203V2.88672H6.12017Z'%20fill='%23121212'/%3e%3cpath%20d='M34.4932%209.06519V9.95787H33.2813V13.6394H32.167V9.95787H30.9551V9.06519H34.4932Z'%20fill='%23121212'/%3e%3cpath%20d='M26.0508%2011.3458C26.0508%2010.894%2026.1485%2010.4922%2026.344%2010.1403C26.5395%209.78411%2026.811%209.50827%2027.1585%209.31279C27.5103%209.11297%2027.9078%209.01306%2028.3509%209.01306C28.8939%209.01306%2029.3587%209.15641%2029.7453%209.44311C30.1319%209.72981%2030.3904%2010.1208%2030.5207%2010.616H29.2957C29.2045%2010.4248%2029.0742%2010.2793%2028.9048%2010.1794C28.7397%2010.0795%2028.5507%2010.0295%2028.3379%2010.0295C27.9947%2010.0295%2027.7167%2010.149%2027.5038%2010.3879C27.291%2010.6268%2027.1846%2010.9461%2027.1846%2011.3458C27.1846%2011.7454%2027.291%2012.0647%2027.5038%2012.3036C27.7167%2012.5425%2027.9947%2012.662%2028.3379%2012.662C28.5507%2012.662%2028.7397%2012.612%2028.9048%2012.5121C29.0742%2012.4122%2029.2045%2012.2667%2029.2957%2012.0755H30.5207C30.3904%2012.5708%2030.1319%2012.9617%2029.7453%2013.2484C29.3587%2013.5308%2028.8939%2013.6719%2028.3509%2013.6719C27.9078%2013.6719%2027.5103%2013.5742%2027.1585%2013.3787C26.811%2013.1789%2026.5395%2012.9031%2026.344%2012.5512C26.1485%2012.1993%2026.0508%2011.7975%2026.0508%2011.3458Z'%20fill='%23121212'/%3e%3cpath%20d='M23.8291%209.95787V10.8831H25.3212V11.7432H23.8291V12.7467H25.5167V13.6394H22.7148V9.06519H25.5167V9.95787H23.8291Z'%20fill='%23121212'/%3e%3cpath%20d='M21.9064%2013.6394H20.7922L18.9287%2010.818V13.6394H17.8145V9.06519H18.9287L20.7922%2011.8996V9.06519H21.9064V13.6394Z'%20fill='%23121212'/%3e%3cpath%20d='M17.008%2013.6394H15.8938L14.0302%2010.818V13.6394H12.916V9.06519H14.0302L15.8938%2011.8996V9.06519H17.008V13.6394Z'%20fill='%23121212'/%3e%3cpath%20d='M9.95576%2013.6849C9.52571%2013.6849%209.13041%2013.585%208.76986%2013.3852C8.41366%2013.1854%208.12913%2012.9074%207.91628%2012.5512C7.70777%2012.1906%207.60352%2011.7866%207.60352%2011.3392C7.60352%2010.8918%207.70777%2010.49%207.91628%2010.1338C8.12913%209.77757%208.41366%209.49955%208.76986%209.29973C9.13041%209.09991%209.52571%209%209.95576%209C10.3858%209%2010.7789%209.09991%2011.1351%209.29973C11.4957%209.49955%2011.778%209.77757%2011.9822%2010.1338C12.1907%2010.49%2012.295%2010.8918%2012.295%2011.3392C12.295%2011.7866%2012.1907%2012.1906%2011.9822%2012.5512C11.7737%2012.9074%2011.4913%2013.1854%2011.1351%2013.3852C10.7789%2013.585%2010.3858%2013.6849%209.95576%2013.6849ZM9.95576%2012.6685C10.3207%2012.6685%2010.6117%2012.5468%2010.8289%2012.3036C11.0504%2012.0603%2011.1612%2011.7389%2011.1612%2011.3392C11.1612%2010.9352%2011.0504%2010.6138%2010.8289%2010.3749C10.6117%2010.1316%2010.3207%2010.01%209.95576%2010.01C9.58653%2010.01%209.29114%2010.1294%209.0696%2010.3683C8.8524%2010.6073%208.7438%2010.9309%208.7438%2011.3392C8.7438%2011.7432%208.8524%2012.0668%209.0696%2012.3101C9.29114%2012.549%209.58653%2012.6685%209.95576%2012.6685Z'%20fill='%23121212'/%3e%3cpath%20d='M2.64062%2011.3458C2.64062%2010.894%202.73836%2010.4922%202.93384%2010.1403C3.12932%209.78411%203.40082%209.50827%203.74833%209.31279C4.10019%209.11297%204.49766%209.01306%204.94074%209.01306C5.48374%209.01306%205.94854%209.15641%206.33515%209.44311C6.72176%209.72981%206.98022%2010.1208%207.11054%2010.616H5.88555C5.79433%2010.4248%205.66401%2010.2793%205.4946%2010.1794C5.32953%2010.0795%205.14056%2010.0295%204.92771%2010.0295C4.58454%2010.0295%204.30653%2010.149%204.09367%2010.3879C3.88082%2010.6268%203.77439%2010.9461%203.77439%2011.3458C3.77439%2011.7454%203.88082%2012.0647%204.09367%2012.3036C4.30653%2012.5425%204.58454%2012.662%204.92771%2012.662C5.14056%2012.662%205.32953%2012.612%205.4946%2012.5121C5.66401%2012.4122%205.79433%2012.2667%205.88555%2012.0755H7.11054C6.98022%2012.5708%206.72176%2012.9617%206.33515%2013.2484C5.94854%2013.5308%205.48374%2013.6719%204.94074%2013.6719C4.49766%2013.6719%204.10019%2013.5742%203.74833%2013.3787C3.40082%2013.1789%203.12932%2012.9031%202.93384%2012.5512C2.73836%2012.1993%202.64062%2011.7975%202.64062%2011.3458Z'%20fill='%23121212'/%3e%3c/svg%3e",Dt="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='38'%20height='16'%20viewBox='0%200%2038%2016'%20fill='none'%3e%3crect%20width='37.0683'%20height='16.0002'%20rx='1.11164'%20fill='black'/%3e%3cpath%20d='M19.946%207.50648C19.5159%207.50648%2019.1206%207.40657%2018.7601%207.20674C18.4039%207.00692%2018.1194%206.72891%2017.9065%206.37271C17.698%206.01216%2017.5938%205.60817%2017.5938%205.16075C17.5938%204.71332%2017.698%204.31151%2017.9065%203.9553C18.1194%203.5991%2018.4039%203.32109%2018.7601%203.12127C19.1206%202.92144%2019.5159%202.82153%2019.946%202.82153C20.376%202.82153%2020.7692%202.92144%2021.1254%203.12127C21.4859%203.32109%2021.7683%203.5991%2021.9724%203.9553C22.181%204.31151%2022.2852%204.71332%2022.2852%205.16075C22.2852%205.60817%2022.181%206.01216%2021.9724%206.37271C21.7639%206.72891%2021.4816%207.00692%2021.1254%207.20674C20.7692%207.40657%2020.376%207.50648%2019.946%207.50648ZM19.946%206.48999C20.3109%206.48999%2020.6019%206.36836%2020.8191%206.1251C21.0407%205.88184%2021.1514%205.56039%2021.1514%205.16075C21.1514%204.75676%2021.0407%204.43531%2020.8191%204.19639C20.6019%203.95313%2020.3109%203.8315%2019.946%203.8315C19.5768%203.8315%2019.2814%203.95096%2019.0598%204.18988C18.8426%204.42879%2018.734%204.75242%2018.734%205.16075C18.734%205.56473%2018.8426%205.88836%2019.0598%206.13162C19.2814%206.37054%2019.5768%206.48999%2019.946%206.48999Z'%20fill='white'/%3e%3cpath%20d='M16.9809%202.88672V7.46089H15.8667V4.71769L14.8437%207.46089H13.9445L12.915%204.71118V7.46089H11.8008V2.88672H13.117L14.4006%206.05345L15.6712%202.88672H16.9809Z'%20fill='white'/%3e%3cpath%20d='M8.84248%207.50648C8.41243%207.50648%208.01713%207.40657%207.65658%207.20674C7.30038%207.00692%207.01585%206.72891%206.803%206.37271C6.59449%206.01216%206.49023%205.60817%206.49023%205.16075C6.49023%204.71332%206.59449%204.31151%206.803%203.9553C7.01585%203.5991%207.30038%203.32109%207.65658%203.12127C8.01713%202.92144%208.41243%202.82153%208.84248%202.82153C9.27253%202.82153%209.66566%202.92144%2010.0219%203.12127C10.3824%203.32109%2010.6648%203.5991%2010.8689%203.9553C11.0774%204.31151%2011.1817%204.71332%2011.1817%205.16075C11.1817%205.60817%2011.0774%206.01216%2010.8689%206.37271C10.6604%206.72891%2010.3781%207.00692%2010.0219%207.20674C9.66566%207.40657%209.27253%207.50648%208.84248%207.50648ZM8.84248%206.48999C9.20737%206.48999%209.49842%206.36836%209.71561%206.1251C9.93715%205.88184%2010.0479%205.56039%2010.0479%205.16075C10.0479%204.75676%209.93715%204.43531%209.71561%204.19639C9.49842%203.95313%209.20737%203.8315%208.84248%203.8315C8.47324%203.8315%208.17786%203.95096%207.95632%204.18988C7.73912%204.42879%207.63052%204.75242%207.63052%205.16075C7.63052%205.56473%207.73912%205.88836%207.95632%206.13162C8.17786%206.37054%208.47324%206.48999%208.84248%206.48999Z'%20fill='white'/%3e%3cpath%20d='M6.12017%202.88672V3.7794H4.90821V7.46089H3.79399V3.7794H2.58203V2.88672H6.12017Z'%20fill='white'/%3e%3cpath%20d='M34.4932%209.06519V9.95787H33.2813V13.6394H32.167V9.95787H30.9551V9.06519H34.4932Z'%20fill='white'/%3e%3cpath%20d='M26.0508%2011.3458C26.0508%2010.894%2026.1485%2010.4922%2026.344%2010.1403C26.5395%209.78411%2026.811%209.50827%2027.1585%209.31279C27.5103%209.11297%2027.9078%209.01306%2028.3509%209.01306C28.8939%209.01306%2029.3587%209.15641%2029.7453%209.44311C30.1319%209.72981%2030.3904%2010.1208%2030.5207%2010.616H29.2957C29.2045%2010.4248%2029.0742%2010.2793%2028.9048%2010.1794C28.7397%2010.0795%2028.5507%2010.0295%2028.3379%2010.0295C27.9947%2010.0295%2027.7167%2010.149%2027.5038%2010.3879C27.291%2010.6268%2027.1846%2010.9461%2027.1846%2011.3458C27.1846%2011.7454%2027.291%2012.0647%2027.5038%2012.3036C27.7167%2012.5425%2027.9947%2012.662%2028.3379%2012.662C28.5507%2012.662%2028.7397%2012.612%2028.9048%2012.5121C29.0742%2012.4122%2029.2045%2012.2667%2029.2957%2012.0755H30.5207C30.3904%2012.5708%2030.1319%2012.9617%2029.7453%2013.2484C29.3587%2013.5308%2028.8939%2013.6719%2028.3509%2013.6719C27.9078%2013.6719%2027.5103%2013.5742%2027.1585%2013.3787C26.811%2013.1789%2026.5395%2012.9031%2026.344%2012.5512C26.1485%2012.1993%2026.0508%2011.7975%2026.0508%2011.3458Z'%20fill='white'/%3e%3cpath%20d='M23.8291%209.95787V10.8831H25.3212V11.7432H23.8291V12.7467H25.5167V13.6394H22.7148V9.06519H25.5167V9.95787H23.8291Z'%20fill='white'/%3e%3cpath%20d='M21.9064%2013.6394H20.7922L18.9287%2010.818V13.6394H17.8145V9.06519H18.9287L20.7922%2011.8996V9.06519H21.9064V13.6394Z'%20fill='white'/%3e%3cpath%20d='M17.008%2013.6394H15.8938L14.0302%2010.818V13.6394H12.916V9.06519H14.0302L15.8938%2011.8996V9.06519H17.008V13.6394Z'%20fill='white'/%3e%3cpath%20d='M9.95576%2013.6849C9.52571%2013.6849%209.13041%2013.585%208.76986%2013.3852C8.41366%2013.1854%208.12913%2012.9074%207.91628%2012.5512C7.70777%2012.1906%207.60352%2011.7866%207.60352%2011.3392C7.60352%2010.8918%207.70777%2010.49%207.91628%2010.1338C8.12913%209.77757%208.41366%209.49955%208.76986%209.29973C9.13041%209.09991%209.52571%209%209.95576%209C10.3858%209%2010.7789%209.09991%2011.1351%209.29973C11.4957%209.49955%2011.778%209.77757%2011.9822%2010.1338C12.1907%2010.49%2012.295%2010.8918%2012.295%2011.3392C12.295%2011.7866%2012.1907%2012.1906%2011.9822%2012.5512C11.7737%2012.9074%2011.4913%2013.1854%2011.1351%2013.3852C10.7789%2013.585%2010.3858%2013.6849%209.95576%2013.6849ZM9.95576%2012.6685C10.3207%2012.6685%2010.6117%2012.5468%2010.8289%2012.3036C11.0504%2012.0603%2011.1612%2011.7389%2011.1612%2011.3392C11.1612%2010.9352%2011.0504%2010.6138%2010.8289%2010.3749C10.6117%2010.1316%2010.3207%2010.01%209.95576%2010.01C9.58653%2010.01%209.29114%2010.1294%209.0696%2010.3683C8.8524%2010.6073%208.7438%2010.9309%208.7438%2011.3392C8.7438%2011.7432%208.8524%2012.0668%209.0696%2012.3101C9.29114%2012.549%209.58653%2012.6685%209.95576%2012.6685Z'%20fill='white'/%3e%3cpath%20d='M2.64062%2011.3458C2.64062%2010.894%202.73836%2010.4922%202.93384%2010.1403C3.12932%209.78411%203.40082%209.50827%203.74833%209.31279C4.10019%209.11297%204.49766%209.01306%204.94074%209.01306C5.48374%209.01306%205.94854%209.15641%206.33515%209.44311C6.72176%209.72981%206.98022%2010.1208%207.11054%2010.616H5.88555C5.79433%2010.4248%205.66401%2010.2793%205.4946%2010.1794C5.32953%2010.0795%205.14056%2010.0295%204.92771%2010.0295C4.58454%2010.0295%204.30653%2010.149%204.09367%2010.3879C3.88082%2010.6268%203.77439%2010.9461%203.77439%2011.3458C3.77439%2011.7454%203.88082%2012.0647%204.09367%2012.3036C4.30653%2012.5425%204.58454%2012.662%204.92771%2012.662C5.14056%2012.662%205.32953%2012.612%205.4946%2012.5121C5.66401%2012.4122%205.79433%2012.2667%205.88555%2012.0755H7.11054C6.98022%2012.5708%206.72176%2012.9617%206.33515%2013.2484C5.94854%2013.5308%205.48374%2013.6719%204.94074%2013.6719C4.49766%2013.6719%204.10019%2013.5742%203.74833%2013.3787C3.40082%2013.1789%203.12932%2012.9031%202.93384%2012.5512C2.73836%2012.1993%202.64062%2011.7975%202.64062%2011.3458Z'%20fill='white'/%3e%3c/svg%3e";function Wt(){const{theme:e}=t0(me);return I.jsxs("div",{className:"tm-flex tm-gap-2 tm-pb-2.5 tm-text-xs tm-text-tc4 dark:tm-text-tc4-dark",children:[I.jsx("div",{children:"Powered by"}),I.jsx("img",{alt:"tomo",src:e==="dark"?$t:Dt})]})}function Ht(){const e=t0(he);return I.jsx("div",{className:"tm-pointer-events-none tm-absolute tm-bottom-20 tm-flex tm-w-full tm-flex-col tm-items-center tm-gap-4",children:[...e].reverse().map(t=>I.jsx(Zt,{msg:t},t.id))})}const Vt={success:I.jsx(kt,{className:"tm-size-4 tm-text-success"}),error:I.jsx(St,{className:"tm-size-4 tm-text-danger"}),warning:I.jsx(Ut,{className:"tm-size-4 tm-text-warning"})};function Zt({msg:e}){const[t,r]=R2.useState(!0),n=xe();return R2.useEffect(()=>{if(t){const o=setTimeout(()=>{n.remove(e.id)},e.duration);return()=>clearTimeout(o)}},[t]),I.jsxs("div",{className:"tm-pointer-events-auto tm-flex tm-max-w-[80%] tm-items-center tm-gap-2 tm-overflow-hidden tm-rounded-lg tm-bg-white tm-px-4 tm-py-2 tm-text-sm dark:tm-bg-white-dark animate__animated animate__fadeInUp animate__faster",onMouseOver:()=>{r(!1)},onMouseLeave:()=>{r(!0)},style:{boxShadow:"0 6px 16px 0 rgba(0, 0, 0, 0.08),0 3px 6px -4px rgba(0, 0, 0, 0.12),0 9px 28px 8px rgba(0, 0, 0, 0.05)"},children:[Vt[e.type||""],I.jsx("div",{className:"tm-flex-1 tm-overflow-hidden",children:e.title})]},e.id)}let Gt=1;function xe(){const e=g0(he);return R2.useMemo(()=>({remove:t=>{e(r=>r.filter(n=>n.id!==t))},removeSameMsg:t=>{e(r=>r.filter(n=>n.title!==t))},show:t=>{e(r=>[...r,{type:"success",...t,id:Gt++}])}}),[])}function Yt(){const e=n=>o=>{typeof o=="string"?o={duration:3e3,title:o,type:n}:o={...o,type:n},t.show(o)},t=xe(),r=n=>{typeof n=="string"&&(n={duration:3e3,title:n}),t.show(n)};return r.success=e("success"),r.warning=e("warning"),r.error=e("error"),r}function zt(){const e=navigator.userAgent;return/(tablet|ipad|playbook|silk)|(android(?!.*mobi))/i.test(e)?"tablet":/Mobile|Android|iP(hone|od)|IEMobile|BlackBerry|Kindle|Silk-Accelerated|(hpw|web)OS|Opera M(obi|ini)/.test(e)?"mobile":"desktop"}function qt({chainType:e}){return I.jsx(Xt,{type:"connect",chainType:e})}function Jt(){const e=c2(),t=t0(m0);return async r=>{try{new r.connectProvider({chains:[],...t.providerOptions})}catch{throw new Error("Wallet not installed")}await e.connect([r.id])}}function pr(e){const t=t0(m0);return R2.useMemo(()=>le(t).filter(r=>e?r.chainType===e:!0),[t,e])}function Kt(e){const t=t0(m0),[r,n]=R2.useState(),o=()=>{const s=le(t),a=zt()==="desktop";return s.filter(u=>e?u.chainType===e:!0).map(u=>{let p=!0;try{new u.connectProvider({chains:[],...t.providerOptions})}catch{p=!1}return u.isInstall=p,(u==null?void 0:u.type)==="injected"&&!a&&!p?null:u}).filter(u=>u?a?u.isInstall||u.type!=="injected":u.isInstall:!1)};return R2.useEffect(()=>{n(o())},[t,e]),r}function Xt(e){const{chainType:t,type:r}=e,[n,o]=Ot();Nt(n);const s=Jt(),a=Yt(),u=Kt(t)||[];return I.jsxs("div",{className:"tm-relative tm-flex tm-h-[700px] tm-w-[660px] tm-max-w-full tm-max-w-full tm-flex-col tm-justify-start tm-gap-5 tm-overflow-hidden tm-bg-white tm-pt-9 tm-text-tc1 dark:tm-bg-mbg-dark dark:tm-text-tc1-dark",children:[I.jsxs("div",{className:"tm-flex tm-flex-col tm-gap-5 tm-px-6 tm-pb-9",children:[I.jsx("div",{className:"tm-text-[24px]",children:"Select your wallet"}),I.jsxs("div",{children:["Connect a ",I.jsx("span",{className:"tm-capitalize",children:t})," Wallet"]})]}),I.jsx("div",{className:"tm-box-border tm-w-full tm-flex-1 tm-gap-5 tm-overflow-y-auto tm-pb-6 tm-pt-2",children:I.jsx("div",{className:"tm-grid tm-w-full tm-flex-1 tm-grid-cols-1 sm:tm-grid-cols-2 tm-gap-6 tm-px-6",children:u.map(p=>I.jsx(Qt,{wallet:p,onClick:()=>{o(async()=>{try{await s(p)}catch(d){a.error((d==null?void 0:d.message)||"Failed")}})}},`some-${p.id}`))})}),I.jsx("div",{className:"tm-bg-red tm-flex tm-flex-row tm-items-center tm-justify-center tm-text-center",children:I.jsx(Wt,{})})]})}function Qt({wallet:e,...t}){const{onClick:r,checked:n}=t,o=()=>{r&&r()};return I.jsxs("div",{className:n2("tm-flex tm-h-[58px] tm-cursor-pointer tm-justify-between tm-rounded-lg tm-bg-white dark:tm-bg-[#282828] tm-px-2 hover:tm-bg-tc1/5 dark:hover:tm-bg-opacity-60 tm-border tm-border-[rgba(94,96,97,0.30)] tm-transition",{"tm-border tm-border-primary":n}),onClick:o,children:[I.jsxs("div",{className:"tm-flex tm-items-center tm-gap-3.5 ",children:[I.jsx("div",{className:"tm-size-[34px]",children:I.jsx("img",{src:e==null?void 0:e.img,alt:e==null?void 0:e.name,className:"tm-h-full tm-w-full tm-rounded-lg"})}),I.jsx("div",{className:"tm-text-sm",children:e.name})]}),I.jsxs("div",{className:"tm-flex tm-items-center tm-gap-2",children:[e.type==="extension"&&e.isInstall&&I.jsx(g2,{children:"Installed"}),e.type==="qrcode"&&I.jsx(g2,{children:"QR code"}),e.type==="injected"&&I.jsx(g2,{children:"Injected"})]})]})}function g2({children:e}){return I.jsx("div",{className:"tm-rounded-full tm-bg-[#f6f7f3] tm-px-2.5 tm-py-1 tm-text-[10px] tm-text-[#666] dark:tm-bg-[#444] dark:tm-text-white",children:e})}function er({className:e,isModal:t,chainType:r}){var n;const o=t0(k2),s=ye(),a=o.filter(c=>c.type==="page").length,u=o.filter(c=>c.type==="page"),p=((n=u[u.length-1])==null?void 0:n.id)||0,d=o.filter(c=>c.type==="drawer");return I.jsxs("div",{className:n2("tomo-social tm-relative tm-flex tm-max-w-full tm-justify-start tm-overflow-hidden tm-rounded-3xl tm-bg-mbg dark:tm-bg-mbg-dark tm-text-tc1 dark:tm-text-tc1-dark",{"tm-rounded-b-none":t},e),style:{filter:"drop-shadow(0px 2px 5px rgba(0, 0, 0, 0.20))"},children:[I.jsxs("div",{className:"tm-flex tm-max-w-full",style:{transform:`translateX(-${a/(a+1)*100}%)`},children:[I.jsx("div",{className:"tm-h-fit tm-max-w-full tm-overflow-hidden",children:I.jsx(tr,{chainType:r})}),u.map(c=>I.jsx("div",{className:"tm-relative tm-overflow-hidden",children:I.jsx(R2.Suspense,{fallback:I.jsx(ge,{}),children:I.jsx(A2.Provider,{value:{id:c.id,page:c},children:c.jsx})})},c.id))]}),d.map(c=>{var m,_,v,S;const E=p!==c.openPageId;return I.jsx("div",{className:n2("tm-absolute tm-bottom-0 tm-left-0 tm-h-full tm-w-full tm-bg-tc1/70",{"tm-hidden":E,"animate__animated animate__fadeIn animate__faster":((m=c.opt)==null?void 0:m.animate)!==!1}),onClick:()=>{var x;((x=c.opt)==null?void 0:x.maskClosable)!==!1&&s.close(c.id)},children:I.jsx("div",{onClick:x=>{x.stopPropagation()},className:n2("tm-absolute tm-bottom-0 tm-left-0 tm-max-h-full tm-w-full tm-overflow-hidden",{"tm-bg-white dark:tm-bg-white-dark":!((_=c.opt)!=null&&_.noBg),"tm-h-full":(v=c.opt)==null?void 0:v.full,"animate__animated animate__fadeInUp animate__faster":((S=c.opt)==null?void 0:S.animate)!==!1}),children:I.jsx(A2.Provider,{value:{id:c.id,page:c},children:c.jsx})})},c.id)}),I.jsx(Ht,{})]})}function tr({chainType:e}){return t0(v0).state?I.jsx(qt,{chainType:e}):I.jsx("div",{className:"tm-flex tm-h-[700px] tm-w-[660px] tm-items-center tm-justify-center",children:I.jsx(we,{className:"tm-size-6 tm-animate-spin tm-text-tc1 dark:tm-text-tc1-dark"})})}function rr(){const e=t0(h0),t=t0(B2),r=nr(),{connected:n}=e[t.chainType]||{connected:!1};return R2.useEffect(()=>{n&&r.close({walletState:e})},[n,t.open]),t.open?reactDom.createPortal(I.jsx("div",{className:"tomo-social tm-fixed tm-left-0 tm-top-0 tm-z-40 tm-box-border tm-flex tm-h-screen tm-w-screen tm-overflow-auto tm-bg-tc1/30 tm-font-poppins",onClick:()=>{r.close(void 0)},children:I.jsxs("div",{className:"tm-absolute sm:tm-relative sm:tm-m-auto sm:tm-w-auto tm-bottom-0 tm-left-0 tm-w-full tm-overflow-hidden tm-rounded-t-3xl sm:tm-rounded-b-3xl animate__animated animate__fadeInUp animate__faster sm:tm-animate-none",style:{filter:"drop-shadow(0px 4px 20px rgba(0, 0, 0, 0.30))",animationDuration:"0.3s"},onClick:o=>o.stopPropagation(),children:[n?null:I.jsx("div",{className:"tm-absolute tm-right-0 tm-top-3 tm-z-10 tm-cursor-pointer tm-p-4 tm-text-tc1 dark:tm-text-tc1-dark hover:tm-text-opacity-70",onClick:()=>{r.close(void 0)},children:I.jsx(Mt,{})}),I.jsx(er,{isModal:!0,chainType:t.chainType})]})}),document.body):null}function nr(){const e=g0(B2);return{open:y0(R2.useCallback((t,r,n)=>{if(!t(h0)[n].connected)return new Promise(o=>{e({open:!0,resolve:o,chainType:n})})},[])),close:y0(R2.useCallback((t,r,n)=>{var o;const s=t(B2);(o=s.resolve)==null||o.call(s,n),e(a=>({...a,open:!1}))},[]))}}const J2={rounded:"medium",theme:"light",primaryColor:"#121212"},x2={rounded:{sizeList:[["--tms-rounded",4],["--tms-rounded-md",6],["--tms-rounded-lg",8],["--tms-rounded-xl",12],["--tms-rounded-2xl",16],["--tms-rounded-3xl",24],["--tms-rounded-full",9999]],scale:{none:0,small:.5,medium:1,large:2}}};function ir(e){const[t,r]=it(m0),n=g0(me),o={...J2,...e.style},s=e.uiOptions;R2.useEffect(()=>{r(a=>({...a,uiOptions:s}))},[JSON.stringify(s)]),R2.useEffect(()=>{x2.rounded.sizeList.forEach(([a,u])=>{let p=x2.rounded.scale[o==null?void 0:o.rounded];isNaN(p)&&(p=x2.rounded.scale.medium),document.documentElement.style.setProperty(a,`${u*p}px`)})},[o==null?void 0:o.rounded]),R2.useEffect(()=>{(o==null?void 0:o.theme)==="dark"?document.documentElement.classList.add("tm-dark"):document.documentElement.classList.remove("tm-dark"),n({theme:(o==null?void 0:o.theme)==="dark"?"dark":"light"})},[o==null?void 0:o.theme]),R2.useEffect(()=>{const a=!(o!=null&&o.primaryColor)||(o==null?void 0:o.primaryColor.toLowerCase())===J2.primaryColor;document.documentElement.style.setProperty("--tms-colors-primary-btn-text-dark",a?"#121212":"#ffffff"),document.documentElement.style.setProperty("--tms-colors-primary",or(a?"#121212":o.primaryColor)),document.documentElement.style.setProperty("--tms-colors-primary-dark",a?"#ffffffe9":o.primaryColor)},[o==null?void 0:o.primaryColor])}function or(e){if(!/^#?([a-fA-F0-9]{6}|[a-fA-F0-9]{3})$/.test(e))throw new Error("Invalid hex color format");e=e.replace(/^#/,"");let t=parseInt(e,16),r=t>>16&255,n=t>>8&255,o=t&255;return`${r} ${n} ${o}`}function hr({children:e,...t}){return I.jsxs(et,{children:[I.jsx(sr,{otherProps:t}),I.jsx(rr,{}),e]})}function sr({otherProps:e}){return Lt(e),Ft(),ir(e),null}function mr(){return t0(h0)}function Cr(){return t0(v0)}function yr(){const e=c2();return{switchChainType:e.switchChainType,disconnect:e.disconnect,switchChain:e.switchChain}}const ExternalWallets=({chainName:e,onError:t})=>{const r=Jt(),n=Kt(e),o=async s=>{try{await r(s)}catch(a){t==null||t(a)}};return jsxRuntime.jsxs("div",{className:"pt-10 text-accent-primary",children:[jsxRuntime.jsx(coreUi.Text,{className:"mb-4",children:"More wallets with Tomo Connect"}),jsxRuntime.jsx("div",{className:"grid grid-cols-4 md:grid-cols-7 gap-6 items-center justify-between border border-secondary-strokeLight rounded p-6",children:(n||[]).map(s=>jsxRuntime.jsxs("button",{disabled:!s.isInstall,className:tailwindMerge.twJoin("flex flex-col items-center gap-2.5",s.isInstall?"opacity-100":"opacity-50"),onClick:()=>o(s),children:[jsxRuntime.jsx("img",{className:"h-10 w-10 object-contain",src:s.img,alt:s.name}),jsxRuntime.jsx(coreUi.Text,{className:"leading-none whitespace-nowrap",variant:"body2",children:s.name})]},s.id))})]})};class Wallet{constructor({id:t,origin:r,name:n,icon:o,docs:s,networks:a,provider:u,label:p}){Fu(this,"id");Fu(this,"origin");Fu(this,"name");Fu(this,"icon");Fu(this,"docs");Fu(this,"networks");Fu(this,"provider",null);Fu(this,"_label");Fu(this,"account",null);this.id=t,this.origin=r,this.name=n,this.icon=o,this.docs=s,this.networks=a,this.provider=u,this._label=p}get installed(){return!!this.provider}get label(){return this._label??(this.installed?"Installed":"")}async connect(){if(!this.provider)throw Error("Provider not found");await this.provider.connectWallet();const[t,r]=await Promise.all([this.provider.getAddress(),this.provider.getPublicKeyHex()]);return this.account={address:t,publicKeyHex:r},this}clone(){return new Wallet({id:this.id,origin:this.origin,name:this.name,icon:this.icon,docs:this.docs,networks:this.networks,provider:this.provider})}}let createNanoEvents=()=>({emit(e,...t){for(let r=this.events[e]||[],n=0,o=r.length;n<o;n++)r[n](...t)},events:{},on(e,t){var r;return((r=this.events)[e]||(r[e]=[])).push(t),()=>{var n;this.events[e]=(n=this.events[e])==null?void 0:n.filter(o=>t!==o)}}});class WalletConnector{constructor(t,r,n,o,s){Fu(this,"_connectedWallet",null);Fu(this,"_ee",createNanoEvents());this.id=t,this.name=r,this.icon=n,this.wallets=o,this.config=s}get connectedWallet(){return this._connectedWallet}async connect(t){try{const r=typeof t=="string"?this.wallets.find(n=>n.id===t):t;if(!r)throw new Error("Wallet not found");return this._ee.emit("connecting",`Connecting ${r.name}`),await r.connect(),this._connectedWallet=r,this._ee.emit("connect",this._connectedWallet),this.connectedWallet}catch(r){return this._ee.emit("error",r),null}}async disconnect(){this._connectedWallet&&(this._ee.emit("disconnect",this._connectedWallet),this._connectedWallet=null)}clone(){return new WalletConnector(this.id,this.name,this.icon,this.wallets,this.config)}on(t,r){return this._ee.on(t,r)}}var Network=(e=>(e.MAINNET="mainnet",e.TESTNET="testnet",e.SIGNET="signet",e))(Network||{});const defaultWalletGetter=e=>t=>t[e],createWallet=async({metadata:e,context:t,config:r})=>{const{id:n,wallet:o,name:s,icon:a,docs:u="",networks:p=[],createProvider:d,label:c}=e,m={id:n,name:"",icon:"",origin:null,provider:null,docs:u,networks:p,label:c};if(o){const _=typeof o=="string"?defaultWalletGetter(o):o;m.origin=await _(t,r)??null,m.provider=m.origin?d(m.origin,r):null}else m.origin=null,m.provider=d(null,r);return typeof s=="string"?m.name=s??"":m.name=m.origin?await s(m.origin,r):"",typeof a=="string"?m.icon=a??"":m.icon=m.origin?await a(m.origin,r):"",new Wallet(m)},createExternalWallet=({id:e,name:t,icon:r,provider:n})=>new Wallet({id:e,origin:null,name:t,icon:r,docs:"",networks:[Network.MAINNET,Network.SIGNET],provider:n}),createWalletConnector=async({persistent:e,metadata:t,context:r,config:n,accountStorage:o})=>{const s=[],a=e?o.get(t.chain):void 0;for(const c of t.wallets)s.push(await createWallet({metadata:c,context:r,config:n}));const u=s.find(c=>c.id==="injectable"&&c.installed),p=s.filter(c=>c.name.toLowerCase()!==(u==null?void 0:u.name.toLowerCase())||c.id==="injectable"),d=new WalletConnector(t.chain,t.name,t.icon,p,n);return a&&s.some(c=>c.id===a)&&await d.connect(a),d},icon$1="data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='UTF-8'?%3e%3csvg%20id='Layer_1'%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%20800%20800'%3e%3cdefs%3e%3cstyle%3e.cls-1{fill:%23ce6533;fill-rule:evenodd;}%3c/style%3e%3c/defs%3e%3cpath%20class='cls-1'%20d='M66.5,198.56c-3.27-8.85-1.09-18.79,5.58-25.47l90.82-90.82c6.67-6.67,16.62-8.85,25.46-5.59l193.65,71.14c4.76,1.75,7.92,6.28,7.92,11.35v42.4c0,3.21-1.27,6.28-3.54,8.55l-47.14,47.13c-3.33,3.34-8.3,4.43-12.73,2.79l-52.02-19.18-57.16-21.09c-4.83-1.79-9.55,2.92-7.76,7.76l40.27,109.18c1.63,4.43,.55,9.4-2.79,12.73l-41.91,41.89c-4.72,4.72-4.72,12.38,0,17.1l42.13,42.13c3.34,3.34,4.43,8.31,2.79,12.73l-40.27,109.17c-1.79,4.84,2.92,9.55,7.76,7.76l109.18-40.28c4.43-1.63,9.4-.54,12.73,2.79l46.91,46.91c2.27,2.27,3.54,5.34,3.54,8.55v42.41c0,5.06-3.15,9.59-7.9,11.34l-193.42,71.36c-8.85,3.27-18.8,1.08-25.47-5.59l-90.83-90.83c-6.67-6.67-8.85-16.61-5.58-25.47l71.11-192.77c1.99-5.4,1.99-11.34,0-16.74L66.5,198.56Z'/%3e%3cpath%20class='cls-1'%20d='M733.5,601.44c3.27,8.85,1.09,18.79-5.58,25.47l-90.82,90.83c-6.67,6.67-16.61,8.85-25.46,5.59l-193.65-71.14c-4.76-1.75-7.92-6.28-7.92-11.35v-42.4c0-3.21,1.27-6.28,3.54-8.55l47.14-47.13c3.33-3.34,8.3-4.43,12.73-2.79l52.02,19.18,57.16,21.09c4.83,1.79,9.54-2.92,7.76-7.76l-40.27-109.18c-1.63-4.43-.55-9.4,2.79-12.73l41.91-41.89c4.72-4.72,4.72-12.38,0-17.1l-42.13-42.13c-3.34-3.34-4.43-8.31-2.79-12.73l40.27-109.17c1.79-4.84-2.92-9.55-7.76-7.76l-109.18,40.28c-4.43,1.63-9.4,.54-12.73-2.79l-46.91-46.91c-2.27-2.27-3.54-5.34-3.54-8.55v-42.41c0-5.06,3.15-9.59,7.9-11.34l193.42-71.36c8.85-3.27,18.79-1.08,25.47,5.59l90.82,90.83c6.68,6.67,8.86,16.61,5.59,25.47l-71.11,192.77c-2,5.4-2,11.34,0,16.74l71.34,193.37h0Z'/%3e%3c/svg%3e",metadata$b={id:"injectable",name:e=>{var t;return(t=e.getWalletProviderName)==null?void 0:t.call(e)},icon:e=>{var t;return(t=e.getWalletProviderIcon)==null?void 0:t.call(e)},docs:"",wallet:"bbnwallet",createProvider:e=>e,networks:[Network.MAINNET,Network.SIGNET],label:"Injectable"};var build$1={},keplr$1={},build={},currency={};Object.defineProperty(currency,"__esModule",{value:!0});var bech32={};Object.defineProperty(bech32,"__esModule",{value:!0});var bip44={};Object.defineProperty(bip44,"__esModule",{value:!0});var chainInfo={};Object.defineProperty(chainInfo,"__esModule",{value:!0});var wallet={},keplr={};Object.defineProperty(keplr,"__esModule",{value:!0});var eip6963={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.EIP6963EventNames=void 0,function(t){t.Announce="eip6963:announceProvider",t.Request="eip6963:requestProvider"}(e.EIP6963EventNames||(e.EIP6963EventNames={}))})(eip6963);var ethereum$1={};Object.defineProperty(ethereum$1,"__esModule",{value:!0});var starknet={};Object.defineProperty(starknet,"__esModule",{value:!0});(function(e){var t=commonjsGlobal&&commonjsGlobal.__createBinding||(Object.create?function(n,o,s,a){a===void 0&&(a=s);var u=Object.getOwnPropertyDescriptor(o,s);(!u||("get"in u?!o.__esModule:u.writable||u.configurable))&&(u={enumerable:!0,get:function(){return o[s]}}),Object.defineProperty(n,a,u)}:function(n,o,s,a){a===void 0&&(a=s),n[a]=o[s]}),r=commonjsGlobal&&commonjsGlobal.__exportStar||function(n,o){for(var s in n)s!=="default"&&!Object.prototype.hasOwnProperty.call(o,s)&&t(o,n,s)};Object.defineProperty(e,"__esModule",{value:!0}),r(keplr,e),r(eip6963,e),r(ethereum$1,e),r(starknet,e)})(wallet);var window$1={};Object.defineProperty(window$1,"__esModule",{value:!0});var ethereum={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.EthTxStatus=e.EthSignType=void 0,function(t){t.MESSAGE="message",t.TRANSACTION="transaction",t.EIP712="eip-712"}(e.EthSignType||(e.EthSignType={})),function(t){t.Success="0x1",t.Failure="0x0"}(e.EthTxStatus||(e.EthTxStatus={}))})(ethereum);var cosmjs$1={};Object.defineProperty(cosmjs$1,"__esModule",{value:!0});var cosmjsAlt={};Object.defineProperty(cosmjsAlt,"__esModule",{value:!0});var secretjs={};Object.defineProperty(secretjs,"__esModule",{value:!0});var settled={};Object.defineProperty(settled,"__esModule",{value:!0});(function(e){var t=commonjsGlobal&&commonjsGlobal.__createBinding||(Object.create?function(n,o,s,a){a===void 0&&(a=s);var u=Object.getOwnPropertyDescriptor(o,s);(!u||("get"in u?!o.__esModule:u.writable||u.configurable))&&(u={enumerable:!0,get:function(){return o[s]}}),Object.defineProperty(n,a,u)}:function(n,o,s,a){a===void 0&&(a=s),n[a]=o[s]}),r=commonjsGlobal&&commonjsGlobal.__exportStar||function(n,o){for(var s in n)s!=="default"&&!Object.prototype.hasOwnProperty.call(o,s)&&t(o,n,s)};Object.defineProperty(e,"__esModule",{value:!0}),r(currency,e),r(bech32,e),r(bip44,e),r(chainInfo,e),r(wallet,e),r(window$1,e),r(ethereum,e),r(cosmjs$1,e),r(cosmjsAlt,e),r(secretjs,e),r(settled,e)})(build);var uint8Array={},hex={};Object.defineProperty(hex,"__esModule",{value:!0});hex.fromHex=hex.toHex=void 0;function toHex(e){let t="";for(const r of e)t+=("0"+r.toString(16)).slice(-2);return t}hex.toHex=toHex;function fromHex(e){if(e.length%2!==0)throw new Error("hex string length must be a multiple of 2");const t=[];for(let r=0;r<e.length;r+=2){const n=e.substr(r,2);if(!n.match(/[0-9a-f]{2}/i))throw new Error("hex string contains invalid characters");t.push(parseInt(n,16))}return new Uint8Array(t)}hex.fromHex=fromHex;Object.defineProperty(uint8Array,"__esModule",{value:!0});uint8Array.JSONUint8Array=void 0;const hex_1=hex;class JSONUint8Array{static parse(t){return JSON.parse(t,(r,n)=>{if(r==="__proto__")throw new Error("__proto__ is disallowed");return n&&typeof n=="string"&&n.startsWith("__uint8array__")?(0,hex_1.fromHex)(n.replace("__uint8array__","")):typeof BigInt<"u"&&n&&typeof n=="string"&&n.startsWith("__bigint__")?BigInt(n.replace("__bigint__","")):n})}static stringify(t){return JSON.stringify(t,(r,n)=>{if(r==="__proto__")throw new Error("__proto__ is disallowed");if(n&&(n instanceof Uint8Array||typeof n=="object"&&"type"in n&&"data"in n&&n.type==="Buffer"&&Array.isArray(n.data))){const o=n instanceof Uint8Array?n:new Uint8Array(n.data);return`__uint8array__${(0,hex_1.toHex)(o)}`}return typeof n=="bigint"?`__bigint__${n.toString()}`:n})}static wrap(t){if(t!==void 0)return JSON.parse(JSONUint8Array.stringify(t))}static unwrap(t){if(t!==void 0)return JSONUint8Array.parse(JSONUint8Array.stringify(t))}}uint8Array.JSONUint8Array=JSONUint8Array;var isMergeableObject=function e(t){return isNonNullObject(t)&&!isSpecial(t)};function isNonNullObject(e){return!!e&&typeof e=="object"}function isSpecial(e){var t=Object.prototype.toString.call(e);return t==="[object RegExp]"||t==="[object Date]"||isReactElement(e)}var canUseSymbol=typeof Symbol=="function"&&Symbol.for,REACT_ELEMENT_TYPE=canUseSymbol?Symbol.for("react.element"):60103;function isReactElement(e){return e.$$typeof===REACT_ELEMENT_TYPE}function emptyTarget(e){return Array.isArray(e)?[]:{}}function cloneUnlessOtherwiseSpecified(e,t){return t.clone!==!1&&t.isMergeableObject(e)?deepmerge(emptyTarget(e),e,t):e}function defaultArrayMerge(e,t,r){return e.concat(t).map(function(n){return cloneUnlessOtherwiseSpecified(n,r)})}function getMergeFunction(e,t){if(!t.customMerge)return deepmerge;var r=t.customMerge(e);return typeof r=="function"?r:deepmerge}function getEnumerableOwnPropertySymbols(e){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(e).filter(function(t){return Object.propertyIsEnumerable.call(e,t)}):[]}function getKeys(e){return Object.keys(e).concat(getEnumerableOwnPropertySymbols(e))}function propertyIsOnObject(e,t){try{return t in e}catch{return!1}}function propertyIsUnsafe(e,t){return propertyIsOnObject(e,t)&&!(Object.hasOwnProperty.call(e,t)&&Object.propertyIsEnumerable.call(e,t))}function mergeObject(e,t,r){var n={};return r.isMergeableObject(e)&&getKeys(e).forEach(function(o){n[o]=cloneUnlessOtherwiseSpecified(e[o],r)}),getKeys(t).forEach(function(o){propertyIsUnsafe(e,o)||(propertyIsOnObject(e,o)&&r.isMergeableObject(t[o])?n[o]=getMergeFunction(o,r)(e[o],t[o],r):n[o]=cloneUnlessOtherwiseSpecified(t[o],r))}),n}function deepmerge(e,t,r){r=r||{},r.arrayMerge=r.arrayMerge||defaultArrayMerge,r.isMergeableObject=r.isMergeableObject||isMergeableObject,r.cloneUnlessOtherwiseSpecified=cloneUnlessOtherwiseSpecified;var n=Array.isArray(t),o=Array.isArray(e),s=n===o;return s?n?r.arrayMerge(e,t,r):mergeObject(e,t,r):cloneUnlessOtherwiseSpecified(t,r)}deepmerge.all=function e(t,r){if(!Array.isArray(t))throw new Error("first argument should be an array");return t.reduce(function(n,o){return deepmerge(n,o,r)},{})};var deepmerge_1$1=deepmerge,cjs=deepmerge_1$1,long=Long,wasm=null;try{wasm=new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([0,97,115,109,1,0,0,0,1,13,2,96,0,1,127,96,4,127,127,127,127,1,127,3,7,6,0,1,1,1,1,1,6,6,1,127,1,65,0,11,7,50,6,3,109,117,108,0,1,5,100,105,118,95,115,0,2,5,100,105,118,95,117,0,3,5,114,101,109,95,115,0,4,5,114,101,109,95,117,0,5,8,103,101,116,95,104,105,103,104,0,0,10,191,1,6,4,0,35,0,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,126,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,127,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,128,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,129,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,130,34,4,66,32,135,167,36,0,32,4,167,11])),{}).exports}catch(e){}function Long(e,t,r){this.low=e|0,this.high=t|0,this.unsigned=!!r}Long.prototype.__isLong__;Object.defineProperty(Long.prototype,"__isLong__",{value:!0});function isLong(e){return(e&&e.__isLong__)===!0}Long.isLong=isLong;var INT_CACHE={},UINT_CACHE={};function fromInt(e,t){var r,n,o;return t?(e>>>=0,(o=0<=e&&e<256)&&(n=UINT_CACHE[e],n)?n:(r=fromBits(e,(e|0)<0?-1:0,!0),o&&(UINT_CACHE[e]=r),r)):(e|=0,(o=-128<=e&&e<128)&&(n=INT_CACHE[e],n)?n:(r=fromBits(e,e<0?-1:0,!1),o&&(INT_CACHE[e]=r),r))}Long.fromInt=fromInt;function fromNumber(e,t){if(isNaN(e))return t?UZERO:ZERO$2;if(t){if(e<0)return UZERO;if(e>=TWO_PWR_64_DBL)return MAX_UNSIGNED_VALUE}else{if(e<=-TWO_PWR_63_DBL)return MIN_VALUE;if(e+1>=TWO_PWR_63_DBL)return MAX_VALUE}return e<0?fromNumber(-e,t).neg():fromBits(e%TWO_PWR_32_DBL|0,e/TWO_PWR_32_DBL|0,t)}Long.fromNumber=fromNumber;function fromBits(e,t,r){return new Long(e,t,r)}Long.fromBits=fromBits;var pow_dbl=Math.pow;function fromString(e,t,r){if(e.length===0)throw Error("empty string");if(e==="NaN"||e==="Infinity"||e==="+Infinity"||e==="-Infinity")return ZERO$2;if(typeof t=="number"?(r=t,t=!1):t=!!t,r=r||10,r<2||36<r)throw RangeError("radix");var n;if((n=e.indexOf("-"))>0)throw Error("interior hyphen");if(n===0)return fromString(e.substring(1),t,r).neg();for(var o=fromNumber(pow_dbl(r,8)),s=ZERO$2,a=0;a<e.length;a+=8){var u=Math.min(8,e.length-a),p=parseInt(e.substring(a,a+u),r);if(u<8){var d=fromNumber(pow_dbl(r,u));s=s.mul(d).add(fromNumber(p))}else s=s.mul(o),s=s.add(fromNumber(p))}return s.unsigned=t,s}Long.fromString=fromString;function fromValue(e,t){return typeof e=="number"?fromNumber(e,t):typeof e=="string"?fromString(e,t):fromBits(e.low,e.high,typeof t=="boolean"?t:e.unsigned)}Long.fromValue=fromValue;var TWO_PWR_16_DBL=65536,TWO_PWR_24_DBL=1<<24,TWO_PWR_32_DBL=TWO_PWR_16_DBL*TWO_PWR_16_DBL,TWO_PWR_64_DBL=TWO_PWR_32_DBL*TWO_PWR_32_DBL,TWO_PWR_63_DBL=TWO_PWR_64_DBL/2,TWO_PWR_24=fromInt(TWO_PWR_24_DBL),ZERO$2=fromInt(0);Long.ZERO=ZERO$2;var UZERO=fromInt(0,!0);Long.UZERO=UZERO;var ONE$1=fromInt(1);Long.ONE=ONE$1;var UONE=fromInt(1,!0);Long.UONE=UONE;var NEG_ONE=fromInt(-1);Long.NEG_ONE=NEG_ONE;var MAX_VALUE=fromBits(-1,2147483647,!1);Long.MAX_VALUE=MAX_VALUE;var MAX_UNSIGNED_VALUE=fromBits(-1,-1,!0);Long.MAX_UNSIGNED_VALUE=MAX_UNSIGNED_VALUE;var MIN_VALUE=fromBits(0,-2147483648,!1);Long.MIN_VALUE=MIN_VALUE;var LongPrototype=Long.prototype;LongPrototype.toInt=function e(){return this.unsigned?this.low>>>0:this.low};LongPrototype.toNumber=function e(){return this.unsigned?(this.high>>>0)*TWO_PWR_32_DBL+(this.low>>>0):this.high*TWO_PWR_32_DBL+(this.low>>>0)};LongPrototype.toString=function e(t){if(t=t||10,t<2||36<t)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative())if(this.eq(MIN_VALUE)){var r=fromNumber(t),n=this.div(r),o=n.mul(r).sub(this);return n.toString(t)+o.toInt().toString(t)}else return"-"+this.neg().toString(t);for(var s=fromNumber(pow_dbl(t,6),this.unsigned),a=this,u="";;){var p=a.div(s),d=a.sub(p.mul(s)).toInt()>>>0,c=d.toString(t);if(a=p,a.isZero())return c+u;for(;c.length<6;)c="0"+c;u=""+c+u}};LongPrototype.getHighBits=function e(){return this.high};LongPrototype.getHighBitsUnsigned=function e(){return this.high>>>0};LongPrototype.getLowBits=function e(){return this.low};LongPrototype.getLowBitsUnsigned=function e(){return this.low>>>0};LongPrototype.getNumBitsAbs=function e(){if(this.isNegative())return this.eq(MIN_VALUE)?64:this.neg().getNumBitsAbs();for(var t=this.high!=0?this.high:this.low,r=31;r>0&&!(t&1<<r);r--);return this.high!=0?r+33:r+1};LongPrototype.isZero=function e(){return this.high===0&&this.low===0};LongPrototype.eqz=LongPrototype.isZero;LongPrototype.isNegative=function e(){return!this.unsigned&&this.high<0};LongPrototype.isPositive=function e(){return this.unsigned||this.high>=0};LongPrototype.isOdd=function e(){return(this.low&1)===1};LongPrototype.isEven=function e(){return(this.low&1)===0};LongPrototype.equals=function e(t){return isLong(t)||(t=fromValue(t)),this.unsigned!==t.unsigned&&this.high>>>31===1&&t.high>>>31===1?!1:this.high===t.high&&this.low===t.low};LongPrototype.eq=LongPrototype.equals;LongPrototype.notEquals=function e(t){return!this.eq(t)};LongPrototype.neq=LongPrototype.notEquals;LongPrototype.ne=LongPrototype.notEquals;LongPrototype.lessThan=function e(t){return this.comp(t)<0};LongPrototype.lt=LongPrototype.lessThan;LongPrototype.lessThanOrEqual=function e(t){return this.comp(t)<=0};LongPrototype.lte=LongPrototype.lessThanOrEqual;LongPrototype.le=LongPrototype.lessThanOrEqual;LongPrototype.greaterThan=function e(t){return this.comp(t)>0};LongPrototype.gt=LongPrototype.greaterThan;LongPrototype.greaterThanOrEqual=function e(t){return this.comp(t)>=0};LongPrototype.gte=LongPrototype.greaterThanOrEqual;LongPrototype.ge=LongPrototype.greaterThanOrEqual;LongPrototype.compare=function e(t){if(isLong(t)||(t=fromValue(t)),this.eq(t))return 0;var r=this.isNegative(),n=t.isNegative();return r&&!n?-1:!r&&n?1:this.unsigned?t.high>>>0>this.high>>>0||t.high===this.high&&t.low>>>0>this.low>>>0?-1:1:this.sub(t).isNegative()?-1:1};LongPrototype.comp=LongPrototype.compare;LongPrototype.negate=function e(){return!this.unsigned&&this.eq(MIN_VALUE)?MIN_VALUE:this.not().add(ONE$1)};LongPrototype.neg=LongPrototype.negate;LongPrototype.add=function e(t){isLong(t)||(t=fromValue(t));var r=this.high>>>16,n=this.high&65535,o=this.low>>>16,s=this.low&65535,a=t.high>>>16,u=t.high&65535,p=t.low>>>16,d=t.low&65535,c=0,m=0,_=0,v=0;return v+=s+d,_+=v>>>16,v&=65535,_+=o+p,m+=_>>>16,_&=65535,m+=n+u,c+=m>>>16,m&=65535,c+=r+a,c&=65535,fromBits(_<<16|v,c<<16|m,this.unsigned)};LongPrototype.subtract=function e(t){return isLong(t)||(t=fromValue(t)),this.add(t.neg())};LongPrototype.sub=LongPrototype.subtract;LongPrototype.multiply=function e(t){if(this.isZero())return ZERO$2;if(isLong(t)||(t=fromValue(t)),wasm){var r=wasm.mul(this.low,this.high,t.low,t.high);return fromBits(r,wasm.get_high(),this.unsigned)}if(t.isZero())return ZERO$2;if(this.eq(MIN_VALUE))return t.isOdd()?MIN_VALUE:ZERO$2;if(t.eq(MIN_VALUE))return this.isOdd()?MIN_VALUE:ZERO$2;if(this.isNegative())return t.isNegative()?this.neg().mul(t.neg()):this.neg().mul(t).neg();if(t.isNegative())return this.mul(t.neg()).neg();if(this.lt(TWO_PWR_24)&&t.lt(TWO_PWR_24))return fromNumber(this.toNumber()*t.toNumber(),this.unsigned);var n=this.high>>>16,o=this.high&65535,s=this.low>>>16,a=this.low&65535,u=t.high>>>16,p=t.high&65535,d=t.low>>>16,c=t.low&65535,m=0,_=0,v=0,S=0;return S+=a*c,v+=S>>>16,S&=65535,v+=s*c,_+=v>>>16,v&=65535,v+=a*d,_+=v>>>16,v&=65535,_+=o*c,m+=_>>>16,_&=65535,_+=s*d,m+=_>>>16,_&=65535,_+=a*p,m+=_>>>16,_&=65535,m+=n*c+o*d+s*p+a*u,m&=65535,fromBits(v<<16|S,m<<16|_,this.unsigned)};LongPrototype.mul=LongPrototype.multiply;LongPrototype.divide=function e(t){if(isLong(t)||(t=fromValue(t)),t.isZero())throw Error("division by zero");if(wasm){if(!this.unsigned&&this.high===-2147483648&&t.low===-1&&t.high===-1)return this;var r=(this.unsigned?wasm.div_u:wasm.div_s)(this.low,this.high,t.low,t.high);return fromBits(r,wasm.get_high(),this.unsigned)}if(this.isZero())return this.unsigned?UZERO:ZERO$2;var n,o,s;if(this.unsigned){if(t.unsigned||(t=t.toUnsigned()),t.gt(this))return UZERO;if(t.gt(this.shru(1)))return UONE;s=UZERO}else{if(this.eq(MIN_VALUE)){if(t.eq(ONE$1)||t.eq(NEG_ONE))return MIN_VALUE;if(t.eq(MIN_VALUE))return ONE$1;var a=this.shr(1);return n=a.div(t).shl(1),n.eq(ZERO$2)?t.isNegative()?ONE$1:NEG_ONE:(o=this.sub(t.mul(n)),s=n.add(o.div(t)),s)}else if(t.eq(MIN_VALUE))return this.unsigned?UZERO:ZERO$2;if(this.isNegative())return t.isNegative()?this.neg().div(t.neg()):this.neg().div(t).neg();if(t.isNegative())return this.div(t.neg()).neg();s=ZERO$2}for(o=this;o.gte(t);){n=Math.max(1,Math.floor(o.toNumber()/t.toNumber()));for(var u=Math.ceil(Math.log(n)/Math.LN2),p=u<=48?1:pow_dbl(2,u-48),d=fromNumber(n),c=d.mul(t);c.isNegative()||c.gt(o);)n-=p,d=fromNumber(n,this.unsigned),c=d.mul(t);d.isZero()&&(d=ONE$1),s=s.add(d),o=o.sub(c)}return s};LongPrototype.div=LongPrototype.divide;LongPrototype.modulo=function e(t){if(isLong(t)||(t=fromValue(t)),wasm){var r=(this.unsigned?wasm.rem_u:wasm.rem_s)(this.low,this.high,t.low,t.high);return fromBits(r,wasm.get_high(),this.unsigned)}return this.sub(this.div(t).mul(t))};LongPrototype.mod=LongPrototype.modulo;LongPrototype.rem=LongPrototype.modulo;LongPrototype.not=function e(){return fromBits(~this.low,~this.high,this.unsigned)};LongPrototype.and=function e(t){return isLong(t)||(t=fromValue(t)),fromBits(this.low&t.low,this.high&t.high,this.unsigned)};LongPrototype.or=function e(t){return isLong(t)||(t=fromValue(t)),fromBits(this.low|t.low,this.high|t.high,this.unsigned)};LongPrototype.xor=function e(t){return isLong(t)||(t=fromValue(t)),fromBits(this.low^t.low,this.high^t.high,this.unsigned)};LongPrototype.shiftLeft=function e(t){return isLong(t)&&(t=t.toInt()),(t&=63)===0?this:t<32?fromBits(this.low<<t,this.high<<t|this.low>>>32-t,this.unsigned):fromBits(0,this.low<<t-32,this.unsigned)};LongPrototype.shl=LongPrototype.shiftLeft;LongPrototype.shiftRight=function e(t){return isLong(t)&&(t=t.toInt()),(t&=63)===0?this:t<32?fromBits(this.low>>>t|this.high<<32-t,this.high>>t,this.unsigned):fromBits(this.high>>t-32,this.high>=0?0:-1,this.unsigned)};LongPrototype.shr=LongPrototype.shiftRight;LongPrototype.shiftRightUnsigned=function e(t){if(isLong(t)&&(t=t.toInt()),t&=63,t===0)return this;var r=this.high;if(t<32){var n=this.low;return fromBits(n>>>t|r<<32-t,r>>>t,this.unsigned)}else return t===32?fromBits(r,0,this.unsigned):fromBits(r>>>t-32,0,this.unsigned)};LongPrototype.shru=LongPrototype.shiftRightUnsigned;LongPrototype.shr_u=LongPrototype.shiftRightUnsigned;LongPrototype.toSigned=function e(){return this.unsigned?fromBits(this.low,this.high,!1):this};LongPrototype.toUnsigned=function e(){return this.unsigned?this:fromBits(this.low,this.high,!0)};LongPrototype.toBytes=function e(t){return t?this.toBytesLE():this.toBytesBE()};LongPrototype.toBytesLE=function e(){var t=this.high,r=this.low;return[r&255,r>>>8&255,r>>>16&255,r>>>24,t&255,t>>>8&255,t>>>16&255,t>>>24]};LongPrototype.toBytesBE=function e(){var t=this.high,r=this.low;return[t>>>24,t>>>16&255,t>>>8&255,t&255,r>>>24,r>>>16&255,r>>>8&255,r&255]};Long.fromBytes=function e(t,r,n){return n?Long.fromBytesLE(t,r):Long.fromBytesBE(t,r)};Long.fromBytesLE=function e(t,r){return new Long(t[0]|t[1]<<8|t[2]<<16|t[3]<<24,t[4]|t[5]<<8|t[6]<<16|t[7]<<24,r)};Long.fromBytesBE=function e(t,r){return new Long(t[4]<<24|t[5]<<16|t[6]<<8|t[7],t[0]<<24|t[1]<<16|t[2]<<8|t[3],r)};var cosmjs={},__awaiter$3=commonjsGlobal&&commonjsGlobal.__awaiter||function(e,t,r,n){function o(s){return s instanceof r?s:new r(function(a){a(s)})}return new(r||(r=Promise))(function(s,a){function u(c){try{d(n.next(c))}catch(m){a(m)}}function p(c){try{d(n.throw(c))}catch(m){a(m)}}function d(c){c.done?s(c.value):o(c.value).then(u,p)}d((n=n.apply(e,t||[])).next())})};Object.defineProperty(cosmjs,"__esModule",{value:!0});cosmjs.CosmJSOfflineSigner=cosmjs.CosmJSOfflineSignerOnlyAmino=void 0;class CosmJSOfflineSignerOnlyAmino{constructor(t,r,n){this.chainId=t,this.keplr=r,this.signOptions=n}getAccounts(){return __awaiter$3(this,void 0,void 0,function*(){const t=yield this.keplr.getKey(this.chainId);return[{address:t.bech32Address,algo:"secp256k1",pubkey:t.pubKey}]})}signAmino(t,r){return __awaiter$3(this,void 0,void 0,function*(){if(this.chainId!==r.chain_id)throw new Error("Unmatched chain id with the offline signer");if((yield this.keplr.getKey(r.chain_id)).bech32Address!==t)throw new Error("Unknown signer address");return yield this.keplr.signAmino(this.chainId,t,r,this.signOptions)})}sign(t,r){return __awaiter$3(this,void 0,void 0,function*(){return yield this.signAmino(t,r)})}}cosmjs.CosmJSOfflineSignerOnlyAmino=CosmJSOfflineSignerOnlyAmino;class CosmJSOfflineSigner extends CosmJSOfflineSignerOnlyAmino{constructor(t,r,n){super(t,r,n)}signDirect(t,r){return __awaiter$3(this,void 0,void 0,function*(){if(this.chainId!==r.chainId)throw new Error("Unmatched chain id with the offline signer");if((yield this.keplr.getKey(r.chainId)).bech32Address!==t)throw new Error("Unknown signer address");return yield this.keplr.signDirect(this.chainId,t,r,this.signOptions)})}}cosmjs.CosmJSOfflineSigner=CosmJSOfflineSigner;var enigma={},__awaiter$2=commonjsGlobal&&commonjsGlobal.__awaiter||function(e,t,r,n){function o(s){return s instanceof r?s:new r(function(a){a(s)})}return new(r||(r=Promise))(function(s,a){function u(c){try{d(n.next(c))}catch(m){a(m)}}function p(c){try{d(n.throw(c))}catch(m){a(m)}}function d(c){c.done?s(c.value):o(c.value).then(u,p)}d((n=n.apply(e,t||[])).next())})};Object.defineProperty(enigma,"__esModule",{value:!0});enigma.KeplrEnigmaUtils=void 0;class KeplrEnigmaUtils{constructor(t,r){this.chainId=t,this.keplr=r}getPubkey(){return __awaiter$2(this,void 0,void 0,function*(){return yield this.keplr.getEnigmaPubKey(this.chainId)})}getTxEncryptionKey(t){return __awaiter$2(this,void 0,void 0,function*(){return yield this.keplr.getEnigmaTxEncryptionKey(this.chainId,t)})}encrypt(t,r){return __awaiter$2(this,void 0,void 0,function*(){return yield this.keplr.enigmaEncrypt(this.chainId,t,r)})}decrypt(t,r){return __awaiter$2(this,void 0,void 0,function*(){return yield this.keplr.enigmaDecrypt(this.chainId,t,r)})}}enigma.KeplrEnigmaUtils=KeplrEnigmaUtils;var version={};Object.defineProperty(version,"__esModule",{value:!0});version.BUILD_VERSION=void 0;version.BUILD_VERSION="0.12.204";var constants={};Object.defineProperty(constants,"__esModule",{value:!0});constants.metaId=constants.KeplrLogoBase64=void 0;constants.KeplrLogoBase64="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";constants.metaId="d_2hxd99brRo";var __awaiter$1=commonjsGlobal&&commonjsGlobal.__awaiter||function(e,t,r,n){function o(s){return s instanceof r?s:new r(function(a){a(s)})}return new(r||(r=Promise))(function(s,a){function u(c){try{d(n.next(c))}catch(m){a(m)}}function p(c){try{d(n.throw(c))}catch(m){a(m)}}function d(c){c.done?s(c.value):o(c.value).then(u,p)}d((n=n.apply(e,t||[])).next())})},__importDefault=commonjsGlobal&&commonjsGlobal.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(keplr$1,"__esModule",{value:!0});keplr$1.Keplr=keplr$1.EthereumProviderRpcError=void 0;const types_1$9=build,uint8_array_1=uint8Array,deepmerge_1=__importDefault(cjs),long_1=__importDefault(long),cosmjs_1=cosmjs,enigma_1=enigma,version_1=version,events_1=__importDefault(eventsExports),constants_1=constants;class EthereumProviderRpcError extends Error{constructor(t,r,n){super(r),this.code=t,this.data=n,Object.setPrototypeOf(this,EthereumProviderRpcError.prototype)}}keplr$1.EthereumProviderRpcError=EthereumProviderRpcError;class Keplr{constructor(){this.enigmaUtils=new Map,this.version=version_1.BUILD_VERSION,this.mode="extension",this.defaultOptions={},this.ethereum=new EthereumProvider(this),this.starknet=void 0}static staticRequestMethod(t,r){const n="ReactNativeWebView"in window,o=n?c=>{window.ReactNativeWebView.postMessage(JSON.stringify(c))}:c=>{window.postMessage(c,window.location.origin)},s=n?c=>{if(c&&typeof c=="string")try{return JSON.parse(c)}catch{}return c}:c=>c,a=new Uint8Array(8),u=Array.from(crypto.getRandomValues(a)).map(c=>c.toString(16)).join(""),d={type:window.keplrRequestMetaIdSupport?`proxy-request${constants_1.metaId?`-${constants_1.metaId}`:""}`:"proxy-request",id:u,method:t,args:uint8_array_1.JSONUint8Array.wrap(r)};return new Promise((c,m)=>{const _=v=>{const S=s(v.data);if(!S||S.type!=="proxy-request-response"||S.id!==u)return;window.removeEventListener("message",_);const E=uint8_array_1.JSONUint8Array.unwrap(S.result);if(!E){m(new Error("Result is null"));return}if(E.error){m(new Error(E.error));return}c(E.return)};window.addEventListener("message",_),o(d)})}requestMethod(t,r){return Keplr.staticRequestMethod(t,r)}static getKeplr(t=1500){return __awaiter$1(this,void 0,void 0,function*(){yield waitDocumentReady();const r="ReactNativeWebView"in window,n=typeof navigator<"u"&&"userAgent"in navigator?navigator.userAgent.includes("Firefox"):!1;if(!(!r&&!n&&window.keplrRequestMetaIdSupport==null))return new Promise((o,s)=>{const a=setTimeout(()=>{o(void 0)},t);Keplr.staticRequestMethod("ping",[]).then(()=>{clearTimeout(a),o(new Keplr)}).catch(u=>{var p;!((p=u==null?void 0:u.message)===null||p===void 0)&&p.includes("Invalid method: ping")?(clearTimeout(a),o(new Keplr)):s(u)})})})}ping(){return __awaiter$1(this,void 0,void 0,function*(){yield this.requestMethod("ping",[])})}enable(t){return __awaiter$1(this,void 0,void 0,function*(){yield this.requestMethod("enable",[t])})}disable(t){return __awaiter$1(this,void 0,void 0,function*(){yield this.requestMethod("disable",[t])})}experimentalSuggestChain(t){var r,n;return __awaiter$1(this,void 0,void 0,function*(){if(t.hideInUI)throw new Error("hideInUI is not allowed");(!((r=t.features)===null||r===void 0)&&r.includes("stargate")||!((n=t.features)===null||n===void 0)&&n.includes("no-legacy-stdTx"))&&console.warn("“stargate”, “no-legacy-stdTx” feature has been deprecated. The launchpad is no longer supported, thus works without the two features. We would keep the aforementioned two feature for a while, but the upcoming update would potentially cause errors. Remove the two feature."),yield this.requestMethod("experimentalSuggestChain",[t])})}getKey(t){return __awaiter$1(this,void 0,void 0,function*(){return yield this.requestMethod("getKey",[t])})}getKeysSettled(t){return __awaiter$1(this,void 0,void 0,function*(){return yield this.requestMethod("getKeysSettled",[t])})}sendTx(t,r,n){return __awaiter$1(this,void 0,void 0,function*(){return"length"in r||console.warn("Do not send legacy std tx via `sendTx` API. We now only support protobuf tx. The usage of legeacy std tx would throw an error in the near future."),yield this.requestMethod("sendTx",[t,r,n])})}signAmino(t,r,n,o={}){var s;return __awaiter$1(this,void 0,void 0,function*(){return yield this.requestMethod("signAmino",[t,r,n,(0,deepmerge_1.default)((s=this.defaultOptions.sign)!==null&&s!==void 0?s:{},o)])})}signDirect(t,r,n,o={}){var s;return __awaiter$1(this,void 0,void 0,function*(){const a=yield this.requestMethod("signDirect",[t,r,{bodyBytes:n.bodyBytes,authInfoBytes:n.authInfoBytes,chainId:n.chainId,accountNumber:n.accountNumber?n.accountNumber.toString():null},(0,deepmerge_1.default)((s=this.defaultOptions.sign)!==null&&s!==void 0?s:{},o)]),u=a.signed;return{signed:{bodyBytes:u.bodyBytes,authInfoBytes:u.authInfoBytes,chainId:u.chainId,accountNumber:long_1.default.fromString(u.accountNumber)},signature:a.signature}})}signDirectAux(t,r,n,o={}){var s;return __awaiter$1(this,void 0,void 0,function*(){const a=yield this.requestMethod("signDirectAux",[t,r,{bodyBytes:n.bodyBytes,publicKey:n.publicKey,chainId:n.chainId,accountNumber:n.accountNumber?n.accountNumber.toString():null,sequence:n.sequence?n.sequence.toString():null},(0,deepmerge_1.default)({preferNoSetMemo:(s=this.defaultOptions.sign)===null||s===void 0?void 0:s.preferNoSetMemo},o)]),u=a.signed;return{signed:{bodyBytes:u.bodyBytes,publicKey:u.publicKey||void 0,chainId:u.chainId,accountNumber:long_1.default.fromString(u.accountNumber),sequence:long_1.default.fromString(u.sequence)},signature:a.signature}})}signArbitrary(t,r,n){return __awaiter$1(this,void 0,void 0,function*(){return yield this.requestMethod("signArbitrary",[t,r,n])})}signICNSAdr36(t,r,n,o,s){return this.requestMethod("signICNSAdr36",[t,r,n,o,s])}verifyArbitrary(t,r,n,o){return __awaiter$1(this,void 0,void 0,function*(){return yield this.requestMethod("verifyArbitrary",[t,r,n,o])})}signEthereum(t,r,n,o){return __awaiter$1(this,void 0,void 0,function*(){return yield this.requestMethod("signEthereum",[t,r,n,o])})}getOfflineSigner(t,r){return new cosmjs_1.CosmJSOfflineSigner(t,this,r)}getOfflineSignerOnlyAmino(t,r){return new cosmjs_1.CosmJSOfflineSignerOnlyAmino(t,this,r)}getOfflineSignerAuto(t,r){return __awaiter$1(this,void 0,void 0,function*(){return(yield this.getKey(t)).isNanoLedger?new cosmjs_1.CosmJSOfflineSignerOnlyAmino(t,this,r):new cosmjs_1.CosmJSOfflineSigner(t,this,r)})}suggestToken(t,r,n){return __awaiter$1(this,void 0,void 0,function*(){return yield this.requestMethod("suggestToken",[t,r,n])})}getSecret20ViewingKey(t,r){return __awaiter$1(this,void 0,void 0,function*(){return yield this.requestMethod("getSecret20ViewingKey",[t,r])})}getEnigmaPubKey(t){return __awaiter$1(this,void 0,void 0,function*(){return yield this.requestMethod("getEnigmaPubKey",[t])})}getEnigmaTxEncryptionKey(t,r){return __awaiter$1(this,void 0,void 0,function*(){return yield this.requestMethod("getEnigmaTxEncryptionKey",[t,r])})}enigmaEncrypt(t,r,n){return __awaiter$1(this,void 0,void 0,function*(){return yield this.requestMethod("enigmaEncrypt",[t,r,n])})}enigmaDecrypt(t,r,n){return __awaiter$1(this,void 0,void 0,function*(){return yield this.requestMethod("enigmaDecrypt",[t,r,n])})}getEnigmaUtils(t){if(this.enigmaUtils.has(t))return this.enigmaUtils.get(t);const r=new enigma_1.KeplrEnigmaUtils(t,this);return this.enigmaUtils.set(t,r),r}experimentalSignEIP712CosmosTx_v0(t,r,n,o,s={}){var a;return __awaiter$1(this,void 0,void 0,function*(){return yield this.requestMethod("experimentalSignEIP712CosmosTx_v0",[t,r,n,o,(0,deepmerge_1.default)((a=this.defaultOptions.sign)!==null&&a!==void 0?a:{},s)])})}getChainInfosWithoutEndpoints(){return __awaiter$1(this,void 0,void 0,function*(){return yield this.requestMethod("getChainInfosWithoutEndpoints",[])})}changeKeyRingName({defaultName:t,editable:r=!0}){return __awaiter$1(this,void 0,void 0,function*(){return yield this.requestMethod("changeKeyRingName",[{defaultName:t,editable:r}])})}sendEthereumTx(t,r){return __awaiter$1(this,void 0,void 0,function*(){return yield this.requestMethod("sendEthereumTx",[t,r])})}suggestERC20(t,r){return __awaiter$1(this,void 0,void 0,function*(){return yield this.requestMethod("suggestERC20",[t,r])})}getChainInfoWithoutEndpoints(t){return __awaiter$1(this,void 0,void 0,function*(){return yield this.requestMethod("getChainInfoWithoutEndpoints",[t])})}getStarknetKey(t){return __awaiter$1(this,void 0,void 0,function*(){return yield this.requestMethod("getStarknetKey",[t])})}getStarknetKeysSettled(t){return __awaiter$1(this,void 0,void 0,function*(){return yield this.requestMethod("getStarknetKeysSettled",[t])})}signStarknetTx(t,r,n){return __awaiter$1(this,void 0,void 0,function*(){return yield this.requestMethod("signStarknetTx",[t,r,n])})}signStarknetDeployAccountTransaction(t,r){return __awaiter$1(this,void 0,void 0,function*(){return yield this.requestMethod("signStarknetDeployAccountTransaction",[t,r])})}}keplr$1.Keplr=Keplr;const waitDocumentReady=()=>document.readyState==="complete"?Promise.resolve():new Promise(e=>{const t=r=>{r.target&&r.target.readyState==="complete"&&(e(),document.removeEventListener("readystatechange",t))};document.addEventListener("readystatechange",t)});class EthereumProvider extends events_1.default{constructor(t){if(super(),this.keplr=t,this.eip6963ProviderInfo={uuid:crypto.randomUUID(),name:"Keplr",rdns:"app.keplr",icon:`data:image/png;base64,${constants_1.KeplrLogoBase64}`},this.chainId=null,this.networkVersion=null,this.selectedAddress=null,this.isKeplr=!0,this.isMetaMask=!0,this._isConnected=!1,this._currentChainId=null,window.addEventListener("keplr_keystorechange",()=>__awaiter$1(this,void 0,void 0,function*(){if(this._currentChainId&&(yield t.getChainInfoWithoutEndpoints(this._currentChainId))){const n=(yield t.getKey(this._currentChainId)).ethereumHexAddress;this.handleAccountsChanged(n)}})),window.addEventListener("keplr_chainChanged",r=>{if(r.detail.origin===window.location.origin){const o=r.detail.evmChainId;this.handleChainChanged(o)}}),window.addEventListener("keplr_ethSubscription",r=>{var n;const o=r.detail.origin,s=r.detail.providerId;if(o===window.location.origin&&s===((n=this.eip6963ProviderInfo)===null||n===void 0?void 0:n.uuid)){const a=r.detail.data;this.emit("message",{type:"eth_subscription",data:a})}}),this.eip6963ProviderInfo){const r=new CustomEvent(types_1$9.EIP6963EventNames.Announce,{detail:Object.freeze({info:this.eip6963ProviderInfo,provider:this})});window.addEventListener(types_1$9.EIP6963EventNames.Request,()=>window.dispatchEvent(r)),window.dispatchEvent(r)}}static requestMethod(t,r){return __awaiter$1(this,void 0,void 0,function*(){const n="ReactNativeWebView"in window,o=n?c=>{window.ReactNativeWebView.postMessage(JSON.stringify(c))}:c=>{window.postMessage(c,window.location.origin)},s=n?c=>{if(c&&typeof c=="string")try{return JSON.parse(c)}catch{}return c}:c=>c,a=new Uint8Array(8),u=Array.from(crypto.getRandomValues(a)).map(c=>c.toString(16)).join(""),d={type:window.keplrRequestMetaIdSupport?`proxy-request${constants_1.metaId?`-${constants_1.metaId}`:""}`:"proxy-request",id:u,method:"ethereum",args:uint8_array_1.JSONUint8Array.wrap(r),ethereumProviderMethod:t};return new Promise((c,m)=>{const _=v=>{const S=s(v.data);if(!S||S.type!=="proxy-request-response"||S.id!==u)return;window.removeEventListener("message",_);const E=uint8_array_1.JSONUint8Array.unwrap(S.result);if(!E){m(new Error("Result is null"));return}if(E.error){const x=E.error;m(x.code&&!x.module?new EthereumProviderRpcError(x.code,x.message,x.data):new Error(x));return}c(E.return)};window.addEventListener("message",_),o(d)})})}handleConnect(t){return __awaiter$1(this,void 0,void 0,function*(){if(!this._isConnected){const{currentEvmChainId:r,currentChainId:n,selectedAddress:o}=yield EthereumProvider.requestMethod("request",Object.assign({method:"keplr_connect"},t&&{params:[t]}));this._isConnected=!0,this._currentChainId=n,this.chainId=`0x${r.toString(16)}`,this.networkVersion=r.toString(10),this.selectedAddress=o,this.emit("connect",{chainId:this.chainId})}})}handleDisconnect(){return __awaiter$1(this,void 0,void 0,function*(){this._isConnected&&(yield EthereumProvider.requestMethod("request",{method:"keplr_disconnect"}),this._isConnected=!1,this.chainId=null,this.selectedAddress=null,this.networkVersion=null,this.emit("disconnect"))})}handleChainChanged(t){return __awaiter$1(this,void 0,void 0,function*(){yield this.handleConnect(t);const r=`0x${t.toString(16)}`;this.emit("chainChanged",r)})}handleAccountsChanged(t){return __awaiter$1(this,void 0,void 0,function*(){this._isConnected&&(this.selectedAddress=t,this.emit("accountsChanged",[t]))})}isConnected(){return this._isConnected}request({method:t,params:r,chainId:n}){var o;return __awaiter$1(this,void 0,void 0,function*(){if(!this._isConnected){if(t==="eth_accounts")return[];yield this.handleConnect()}return yield EthereumProvider.requestMethod("request",{method:t,params:r,providerId:(o=this.eip6963ProviderInfo)===null||o===void 0?void 0:o.uuid,chainId:n})})}enable(){return __awaiter$1(this,void 0,void 0,function*(){return yield EthereumProvider.requestMethod("request",{method:"eth_requestAccounts"})})}net_version(){return __awaiter$1(this,void 0,void 0,function*(){return yield EthereumProvider.requestMethod("request",{method:"net_version"})})}}var keplrFallback={},__awaiter=commonjsGlobal&&commonjsGlobal.__awaiter||function(e,t,r,n){function o(s){return s instanceof r?s:new r(function(a){a(s)})}return new(r||(r=Promise))(function(s,a){function u(c){try{d(n.next(c))}catch(m){a(m)}}function p(c){try{d(n.throw(c))}catch(m){a(m)}}function d(c){c.done?s(c.value):o(c.value).then(u,p)}d((n=n.apply(e,t||[])).next())})};Object.defineProperty(keplrFallback,"__esModule",{value:!0});keplrFallback.KeplrFallback=void 0;const keplr_1=keplr$1;class KeplrFallback extends keplr_1.Keplr{constructor(t){super(),this.onKeplrNotDetected=t,this.isKeplrDetected=null,this.onKeplrNotDetected&&keplr_1.Keplr.getKeplr(500).then(r=>{var n;r||(n=this.onKeplrNotDetected)===null||n===void 0||n.call(this)})}requestMethod(t,r){return __awaiter(this,void 0,void 0,function*(){if(this.isKeplrDetected==null&&((yield keplr_1.Keplr.getKeplr(500))?this.isKeplrDetected=!0:this.isKeplrDetected=!1),this.isKeplrDetected)return keplr_1.Keplr.staticRequestMethod(t,r);{const n=window.keplr;if(n)return n[t](...r);throw new Error("Can't detect keplr fallback")}})}}keplrFallback.KeplrFallback=KeplrFallback;(function(e){var t=commonjsGlobal&&commonjsGlobal.__createBinding||(Object.create?function(n,o,s,a){a===void 0&&(a=s);var u=Object.getOwnPropertyDescriptor(o,s);(!u||("get"in u?!o.__esModule:u.writable||u.configurable))&&(u={enumerable:!0,get:function(){return o[s]}}),Object.defineProperty(n,a,u)}:function(n,o,s,a){a===void 0&&(a=s),n[a]=o[s]}),r=commonjsGlobal&&commonjsGlobal.__exportStar||function(n,o){for(var s in n)s!=="default"&&!Object.prototype.hasOwnProperty.call(o,s)&&t(o,n,s)};Object.defineProperty(e,"__esModule",{value:!0}),r(keplr$1,e),r(keplrFallback,e)})(build$1);const logo$6="data:image/svg+xml,%3csvg%20width='42'%20height='42'%20viewBox='0%200%2042%2042'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20clip-path='url(%23clip0_425_5107)'%3e%3cpath%20d='M32.4545%200H9.54545C4.27365%200%200%204.27365%200%209.54545V32.4545C0%2037.7264%204.27365%2042%209.54545%2042H32.4545C37.7264%2042%2042%2037.7264%2042%2032.4545V9.54545C42%204.27365%2037.7264%200%2032.4545%200Z'%20fill='url(%23paint0_linear_425_5107)'/%3e%3cpath%20d='M32.4545%200H9.54545C4.27365%200%200%204.27365%200%209.54545V32.4545C0%2037.7264%204.27365%2042%209.54545%2042H32.4545C37.7264%2042%2042%2037.7264%2042%2032.4545V9.54545C42%204.27365%2037.7264%200%2032.4545%200Z'%20fill='url(%23paint1_radial_425_5107)'/%3e%3cpath%20d='M32.4545%200H9.54545C4.27365%200%200%204.27365%200%209.54545V32.4545C0%2037.7264%204.27365%2042%209.54545%2042H32.4545C37.7264%2042%2042%2037.7264%2042%2032.4545V9.54545C42%204.27365%2037.7264%200%2032.4545%200Z'%20fill='url(%23paint2_radial_425_5107)'/%3e%3cpath%20d='M32.4545%200H9.54545C4.27365%200%200%204.27365%200%209.54545V32.4545C0%2037.7264%204.27365%2042%209.54545%2042H32.4545C37.7264%2042%2042%2037.7264%2042%2032.4545V9.54545C42%204.27365%2037.7264%200%2032.4545%200Z'%20fill='url(%23paint3_radial_425_5107)'/%3e%3cpath%20d='M17.2526%2032.2614V22.5192L26.7185%2032.2614H31.9849V32.0079L21.0964%2020.9122L31.1469%2010.3857V10.2614H25.8464L17.2526%2019.5635V10.2614H12.9849V32.2614H17.2526Z'%20fill='white'/%3e%3c/g%3e%3cdefs%3e%3clinearGradient%20id='paint0_linear_425_5107'%20x1='21'%20y1='0'%20x2='21'%20y2='42'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%231FD1FF'/%3e%3cstop%20offset='1'%20stop-color='%231BB8FF'/%3e%3c/linearGradient%3e%3cradialGradient%20id='paint1_radial_425_5107'%20cx='0'%20cy='0'%20r='1'%20gradientUnits='userSpaceOnUse'%20gradientTransform='translate(2.00623%2040.4086)%20rotate(-45.1556)%20scale(67.3547%2068.3624)'%3e%3cstop%20stop-color='%23232DE3'/%3e%3cstop%20offset='1'%20stop-color='%23232DE3'%20stop-opacity='0'/%3e%3c/radialGradient%3e%3cradialGradient%20id='paint2_radial_425_5107'%20cx='0'%20cy='0'%20r='1'%20gradientUnits='userSpaceOnUse'%20gradientTransform='translate(39.7379%2041.7602)%20rotate(-138.45)%20scale(42.1137%2064.2116)'%3e%3cstop%20stop-color='%238B4DFF'/%3e%3cstop%20offset='1'%20stop-color='%238B4DFF'%20stop-opacity='0'/%3e%3c/radialGradient%3e%3cradialGradient%20id='paint3_radial_425_5107'%20cx='0'%20cy='0'%20r='1'%20gradientUnits='userSpaceOnUse'%20gradientTransform='translate(20.6501%200.311498)%20rotate(90)%20scale(33.1135%2080.3423)'%3e%3cstop%20stop-color='%2324D5FF'/%3e%3cstop%20offset='1'%20stop-color='%231BB8FF'%20stop-opacity='0'/%3e%3c/radialGradient%3e%3cclipPath%20id='clip0_425_5107'%3e%3crect%20width='42'%20height='42'%20fill='white'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e",WALLET_PROVIDER_NAME$6="Keplr";class KeplrProvider{constructor(t,r){Fu(this,"walletInfo");Fu(this,"chainId");Fu(this,"rpc");Fu(this,"chainData");Fu(this,"on",(t,r)=>{if(!this.walletInfo)throw new Error("Wallet not connected");t==="accountChanged"&&window.addEventListener("keplr_keystorechange",r)});Fu(this,"off",(t,r)=>{if(!this.walletInfo)throw new Error("Wallet not connected");t==="accountChanged"&&window.removeEventListener("keplr_keystorechange",r)});if(this.keplr=t,!t)throw new Error("Keplr extension not found");this.chainId=r.chainId,this.rpc=r.rpc,this.chainData=r.chainData}async connectWallet(){if(!this.chainId)throw new Error("Chain ID is not initialized");if(!this.rpc)throw new Error("RPC URL is not initialized");if(!this.keplr)throw new Error("Keplr extension not found");try{await this.keplr.enable(this.chainId)}catch(o){if(o!=null&&o.message.includes(this.chainId))try{await this.keplr.experimentalSuggestChain(this.chainData),await this.keplr.enable(this.chainId)}catch{throw new Error("Failed to add BBN chain")}else throw o!=null&&o.message.includes("rejected")?new Error("Keplr wallet connection request rejected"):o!=null&&o.message.includes("context invalidated")?new Error("Keplr extension context invalidated"):new Error((o==null?void 0:o.message)||"Failed to connect to Keplr")}const t=await this.keplr.getKey(this.chainId);if(!t)throw new Error("Failed to get Keplr key");const{bech32Address:r,pubKey:n}=t;if(r&&n)this.walletInfo={publicKeyHex:Buffer$1$1.from(t.pubKey).toString("hex"),address:r};else throw new Error("Could not connect to Keplr")}async getAddress(){if(!this.walletInfo)throw new Error("Wallet not connected");return this.walletInfo.address}async getPublicKeyHex(){if(!this.walletInfo)throw new Error("Wallet not connected");return this.walletInfo.publicKeyHex}async getWalletProviderName(){return WALLET_PROVIDER_NAME$6}async getWalletProviderIcon(){return logo$6}async getOfflineSigner(){if(!this.keplr)throw new Error("Keplr extension not found");if(!this.chainId)throw new Error("Chain ID is not initialized");try{return this.keplr.getOfflineSigner(this.chainId)}catch{throw new Error("Failed to get offline signer")}}async getOfflineSignerAuto(){if(!this.keplr)throw new Error("Keplr extension not found");if(!this.chainId)throw new Error("Chain ID is not initialized");try{return this.keplr.getOfflineSignerAuto(this.chainId)}catch{throw new Error("Failed to get offline signer auto")}}}const metadata$a={id:"keplr",name:WALLET_PROVIDER_NAME$6,icon:logo$6,docs:"https://www.keplr.app/",wallet:()=>build$1.Keplr.getKeplr(),createProvider:(e,t)=>new KeplrProvider(e,t),networks:[Network.MAINNET,Network.SIGNET]},logo$5="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='58'%20height='58'%3e%3cg%20fill='none'%20fill-rule='nonzero'%3e%3cpath%20fill='%2324A95A'%20stroke='%23138D3E'%20stroke-width='.039'%20d='M51.466%2036.118c0%204.001-2.44%206.816-6.403%208.631-3.963%201.816-9.446%202.631-15.522%202.631-6.077%200-11.595-.815-15.594-2.63-3.999-1.816-6.474-4.631-6.474-8.632%200-4.002%202.46-7.625%206.44-10.248%203.982-2.623%209.482-4.245%2015.556-4.245%206.075%200%2011.575%201.626%2015.556%204.25%203.981%202.625%206.441%206.248%206.441%2010.243Z'/%3e%3cpath%20fill='%2332DA6D'%20stroke='%23138D3E'%20stroke-width='.039'%20d='m35.608%2013.791.012.003.007-.009A7.686%207.686%200%200%201%2041.555%2011c4.236%200%207.675%203.421%207.675%207.634%200%201.385-.37%202.671-1.009%203.788l-.005.009.004.01a9.644%209.644%200%200%201%20.94%204.13c0%203.711-2.198%207.072-5.753%209.505-3.555%202.434-8.468%203.939-13.893%203.939-5.426%200-10.339-1.505-13.894-3.939-3.555-2.433-5.752-5.794-5.752-9.506%200-1.442.327-2.829.939-4.13l.004-.009-.005-.009a7.583%207.583%200%200%201-1.01-3.788c0-4.213%203.44-7.634%207.676-7.634a7.73%207.73%200%200%201%205.928%202.785l.007.01.012-.004a27.43%2027.43%200%200%201%206.095-.665c2.121%200%204.172.24%206.094.665Z'/%3e%3cpath%20fill='%23FFF'%20d='M16.845%2022.88c2.597%200%204.703-2.094%204.703-4.677%200-2.583-2.106-4.677-4.703-4.677-2.597%200-4.702%202.094-4.702%204.677%200%202.583%202.105%204.677%204.702%204.677ZM41.932%2022.88c2.597%200%204.702-2.094%204.702-4.677%200-2.583-2.105-4.677-4.702-4.677-2.598%200-4.703%202.094-4.703%204.677%200%202.583%202.105%204.677%204.703%204.677Z'/%3e%3cpath%20fill='%2332DA6D'%20stroke='%23138D3E'%20stroke-width='.039'%20d='M4.032%2044.13a.163.163%200%200%200%20.018-.008l-.002-.004-.004-.01-.017-.046-.066-.174a70.962%2070.962%200%200%201-1.02-2.947c-.6-1.87-1.295-4.301-1.669-6.54-.187-1.12-.293-2.192-.268-3.122.025-.93.181-1.716.52-2.266.337-.55.855-.865%201.608-.856.754.01%201.746.347%203.027%201.108%207.702%204.573%209.453%2012.176%209.866%2015.688.113.98-.676%201.85-1.676%201.85H2.308c-.794%200-1.084-1.037-.39-1.438l2.123-1.219.015-.008-.006-.016-.018.007ZM54.276%2044.123l.018.006a.481.481%200%200%201-.018-.006v-.001l.002-.003.003-.011.016-.045a44.607%2044.607%200%200%200%20.276-.83c.183-.56.433-1.356.705-2.291.543-1.871%201.17-4.302%201.507-6.541.169-1.12.265-2.192.242-3.122-.023-.93-.165-1.716-.47-2.267a1.677%201.677%200%200%200-.587-.637%201.587%201.587%200%200%200-.867-.218c-.681.01-1.577.346-2.736%201.107-6.946%204.573-8.541%2012.19-8.897%2015.69-.1.982.606%201.849%201.505%201.849h10.887c.352%200%20.596-.258.672-.569.077-.31-.014-.67-.326-.87l-1.932-1.241Zm0%200-.005.014.013.009%201.924%201.218-1.932-1.241Z'/%3e%3cpath%20fill='%23092511'%20d='M16.893%2021.02a2.805%202.805%200%201%200%200-5.61%202.805%202.805%200%200%200%200%205.61ZM41.98%2021.02a2.805%202.805%200%201%200%200-5.61%202.805%202.805%200%200%200%200%205.61ZM36.998%2029.488a7.536%207.536%200%200%201-10.976%206.042%207.534%207.534%200%200%201-4.037-7.334l7.507.646%207.506.646Z'/%3e%3c/g%3e%3c/svg%3e",WALLET_PROVIDER_NAME$5="Leap";class LeapProvider{constructor(t,r){Fu(this,"walletInfo");Fu(this,"chainId");Fu(this,"rpc");Fu(this,"chainData");Fu(this,"on",(t,r)=>{if(!this.walletInfo)throw new Error("Wallet not connected");t==="accountChanged"&&window.addEventListener("leap_keystorechange",r)});Fu(this,"off",(t,r)=>{if(!this.walletInfo)throw new Error("Wallet not connected");t==="accountChanged"&&window.removeEventListener("leap_keystorechange",r)});if(this.wallet=t,!t)throw new Error("Leap extension not found");this.chainId=r.chainId,this.rpc=r.rpc,this.chainData=r.chainData}async connectWallet(){if(!this.chainId)throw new Error("Chain ID is not initialized");if(!this.rpc)throw new Error("RPC URL is not initialized");if(!this.wallet)throw new Error("Leap extension not found");try{await this.wallet.enable(this.chainId)}catch(o){if(o!=null&&o.message.includes(this.chainId)||o!=null&&o.message.includes("chain id"))try{await this.wallet.experimentalSuggestChain(this.chainData),await this.wallet.enable(this.chainId)}catch{throw new Error("Failed to add BBN chain")}else throw o!=null&&o.message.includes("rejected")?new Error("Leap wallet connection request rejected"):o!=null&&o.message.includes("context invalidated")?new Error("Leap extension context invalidated"):new Error((o==null?void 0:o.message)||"Failed to connect to Leap")}const t=await this.wallet.getKey(this.chainId);if(!t)throw new Error("Failed to get Leap key");const{bech32Address:r,pubKey:n}=t;if(r&&n)this.walletInfo={publicKeyHex:Buffer$1$1.from(t.pubKey).toString("hex"),address:r};else throw new Error("Could not connect to Leap")}async getAddress(){if(!this.walletInfo)throw new Error("Wallet not connected");return this.walletInfo.address}async getPublicKeyHex(){if(!this.walletInfo)throw new Error("Wallet not connected");return this.walletInfo.publicKeyHex}async getWalletProviderName(){return WALLET_PROVIDER_NAME$5}async getWalletProviderIcon(){return logo$5}async getOfflineSigner(){if(!this.wallet)throw new Error("Leap extension not found");if(!this.chainId)throw new Error("Chain ID is not initialized");try{return this.wallet.getOfflineSigner(this.chainId)}catch{throw new Error("Failed to get offline signer")}}async getOfflineSignerAuto(){if(!this.wallet)throw new Error("Leap extension not found");if(!this.chainId)throw new Error("Chain ID is not initialized");try{return this.wallet.getOfflineSignerAuto(this.chainId)}catch{throw new Error("Failed to get offline signer auto")}}}const metadata$9={id:"leap",name:WALLET_PROVIDER_NAME$5,icon:logo$5,docs:"https://www.leapwallet.io/",wallet:"leap",createProvider:(e,t)=>new LeapProvider(e,t),networks:[Network.MAINNET,Network.SIGNET]},logo$4="data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='UTF-8'?%3e%3csvg%20width='225px'%20height='224px'%20viewBox='0%200%20225%20224'%20version='1.1'%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%3e%3ctitle%3eokx%3c/title%3e%3cg%20id='Page-1'%20stroke='none'%20strokeWidth='1'%20fill='none'%20fill-rule='evenodd'%3e%3cg%20id='okx'%20transform='translate(0.401000,%200.006000)'%20fill='%23000000'%20fill-rule='nonzero'%3e%3cpath%20d='M144.382,74.667%20L79.673,74.667%20C76.924,74.667%2074.695,76.895%2074.695,79.644%20L74.695,144.354%20C74.695,147.103%2076.924,149.332%2079.673,149.332%20L144.382,149.332%20C147.131,149.332%20149.36,147.103%20149.36,144.354%20L149.36,79.644%20C149.36,76.895%20147.131,74.667%20144.382,74.667%20Z'%20id='Path'%3e%3c/path%3e%3cpath%20d='M69.687,0%20L4.978,0%20C2.229,0%200,2.228%200,4.978%20L0,69.687%20C0,72.436%202.229,74.665%204.978,74.665%20L69.687,74.665%20C72.437,74.665%2074.665,72.436%2074.665,69.687%20L74.665,4.978%20C74.665,2.228%2072.437,0%2069.687,0%20Z'%20id='Path'%3e%3c/path%3e%3cpath%20d='M219.017,0%20L154.307,0%20C151.558,0%20149.329,2.228%20149.329,4.978%20L149.329,69.687%20C149.329,72.436%20151.558,74.665%20154.307,74.665%20L219.017,74.665%20C221.766,74.665%20223.994,72.436%20223.994,69.687%20L223.994,4.978%20C223.994,2.228%20221.766,0%20219.017,0%20Z'%20id='Path'%3e%3c/path%3e%3cpath%20d='M69.687,149.328%20L4.978,149.328%20C2.229,149.328%200,151.556%200,154.305%20L0,219.015%20C0,221.764%202.229,223.993%204.978,223.993%20L69.687,223.993%20C72.437,223.993%2074.665,221.764%2074.665,219.015%20L74.665,154.305%20C74.665,151.556%2072.437,149.328%2069.687,149.328%20Z'%20id='Path'%3e%3c/path%3e%3cpath%20d='M219.017,149.328%20L154.307,149.328%20C151.558,149.328%20149.329,151.556%20149.329,154.305%20L149.329,219.015%20C149.329,221.764%20151.558,223.993%20154.307,223.993%20L219.017,223.993%20C221.766,223.993%20223.994,221.764%20223.994,219.015%20L223.994,154.305%20C223.994,151.556%20221.766,149.328%20219.017,149.328%20Z'%20id='Path'%3e%3c/path%3e%3c/g%3e%3c/g%3e%3c/svg%3e",WALLET_PROVIDER_NAME$4="OKX";class OKXBabylonProvider{constructor(t,r){Fu(this,"walletInfo");Fu(this,"chainId");Fu(this,"rpc");Fu(this,"chainData");Fu(this,"on",(t,r)=>{if(!this.walletInfo)throw new Error("Wallet not connected");t==="accountChanged"&&window.addEventListener("okx_keystorechange",r)});Fu(this,"off",(t,r)=>{if(!this.walletInfo)throw new Error("Wallet not connected");t==="accountChanged"&&window.removeEventListener("okx_keystorechange",r)});if(this.wallet=t,!t||!t.keplr)throw new Error("OKX Wallet extension not found");this.chainId=r.chainId,this.rpc=r.rpc,this.chainData=r.chainData}async connectWallet(){if(!this.chainId)throw new Error("Chain ID is not initialized");if(!this.rpc)throw new Error("RPC URL is not initialized");if(!this.wallet.keplr)throw new Error("OKX Wallet extension not found");try{await this.wallet.keplr.enable(this.chainId)}catch(o){if(o!=null&&o.message.includes(this.chainId))try{await this.wallet.keplr.experimentalSuggestChain(this.chainData),await this.wallet.keplr.enable(this.chainId)}catch{throw new Error("Failed to add BBN chain")}else throw o!=null&&o.message.includes("rejected")?new Error("OKX Wallet connection request rejected"):o!=null&&o.message.includes("context invalidated")?new Error("OKX Wallet extension context invalidated"):new Error((o==null?void 0:o.message)||"Failed to connect to OKX Wallet")}const t=await this.wallet.keplr.getKey(this.chainId);if(!t)throw new Error("Failed to get OKX Wallet key");const{bech32Address:r,pubKey:n}=t;if(r&&n)this.walletInfo={publicKeyHex:Buffer$1$1.from(t.pubKey).toString("hex"),address:r};else throw new Error("Could not connect to OKX Wallet")}async getAddress(){if(!this.walletInfo)throw new Error("Wallet not connected");return this.walletInfo.address}async getPublicKeyHex(){if(!this.walletInfo)throw new Error("Wallet not connected");return this.walletInfo.publicKeyHex}async getWalletProviderName(){return WALLET_PROVIDER_NAME$4}async getWalletProviderIcon(){return logo$4}async getOfflineSigner(){if(!this.wallet.keplr)throw new Error("OKX Wallet extension not found");if(!this.chainId)throw new Error("Chain ID is not initialized");try{return this.wallet.keplr.getOfflineSigner(this.chainId)}catch{throw new Error("Failed to get offline signer")}}async getOfflineSignerAuto(){if(!this.wallet.keplr)throw new Error("OKX Wallet extension not found");if(!this.chainId)throw new Error("Chain ID is not initialized");try{return this.wallet.keplr.getOfflineSignerAuto(this.chainId)}catch{throw new Error("Failed to get offline signer auto")}}}const metadata$8={id:"okx",name:WALLET_PROVIDER_NAME$4,icon:logo$4,docs:"https://www.okx.com/web3",wallet:"okxwallet",createProvider:(e,t)=>new OKXBabylonProvider(e,t),networks:[Network.MAINNET,Network.SIGNET]},metadata$7={chain:"BBN",name:"Babylon Chain",icon:icon$1,wallets:[metadata$8,metadata$b,metadata$a,metadata$9]},icon="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='64'%20height='64'%3e%3cpath%20fill='%23f7931a'%20d='M63.04%2039.741c-4.275%2017.143-21.638%2027.576-38.783%2023.301C7.12%2058.768-3.313%2041.404.962%2024.262%205.234%207.117%2022.597-3.317%2039.737.957c17.144%204.274%2027.576%2021.64%2023.302%2038.784z'/%3e%3cpath%20fill='%23FFF'%20d='M46.11%2027.441c.636-4.258-2.606-6.547-7.039-8.074l1.438-5.768-3.51-.875-1.4%205.616c-.924-.23-1.872-.447-2.814-.662l1.41-5.653-3.509-.875-1.439%205.766c-.764-.174-1.514-.346-2.242-.527l.004-.018-4.842-1.209-.934%203.75s2.605.597%202.55.634c1.422.355%201.68%201.296%201.636%202.042l-1.638%206.571c.098.025.225.061.365.117l-.37-.092-2.297%209.205c-.174.432-.615%201.08-1.609.834.035.051-2.552-.637-2.552-.637l-1.743%204.019%204.57%201.139c.85.213%201.682.436%202.502.646l-1.453%205.834%203.507.875%201.44-5.772c.957.26%201.887.5%202.797.726l-1.434%205.745%203.511.875%201.453-5.823c5.987%201.133%2010.49.676%2012.384-4.739%201.527-4.36-.076-6.875-3.226-8.515%202.294-.529%204.022-2.038%204.483-5.155zM38.086%2038.69c-1.085%204.36-8.426%202.003-10.806%201.412l1.928-7.729c2.38.594%2010.012%201.77%208.878%206.317zm1.086-11.312c-.99%203.966-7.1%201.951-9.082%201.457l1.748-7.01c1.982.494%208.365%201.416%207.334%205.553z'/%3e%3c/svg%3e",metadata$6={id:"injectable",name:e=>{var t;return(t=e.getWalletProviderName)==null?void 0:t.call(e)},icon:e=>{var t;return(t=e.getWalletProviderIcon)==null?void 0:t.call(e)},docs:"",wallet:"btcwallet",createProvider:e=>e,networks:[Network.MAINNET,Network.SIGNET],label:"Injectable"},logo$3="data:image/svg+xml,%3csvg%20width='160'%20height='160'%20viewBox='0%200%20160%20160'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M30%2025H90L50%20110H20L30%2025Z'%20fill='black'/%3e%3cpath%20d='M130%20135L70%20135L110%2050L140%2050L130%20135Z'%20fill='%23F5870A'/%3e%3c/svg%3e";var bip341={},ecc_lib={};Object.defineProperty(ecc_lib,"__esModule",{value:!0});ecc_lib.getEccLib=ecc_lib.initEccLib=void 0;const _ECCLIB_CACHE={};function initEccLib(e){e?e!==_ECCLIB_CACHE.eccLib&&(verifyEcc(e),_ECCLIB_CACHE.eccLib=e):_ECCLIB_CACHE.eccLib=e}ecc_lib.initEccLib=initEccLib;function getEccLib(){if(!_ECCLIB_CACHE.eccLib)throw new Error("No ECC Library provided. You must call initEccLib() with a valid TinySecp256k1Interface instance");return _ECCLIB_CACHE.eccLib}ecc_lib.getEccLib=getEccLib;const h=e=>Buffer$e.from(e,"hex");function verifyEcc(e){assert(typeof e.isXOnlyPoint=="function"),assert(e.isXOnlyPoint(h("79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"))),assert(e.isXOnlyPoint(h("fffffffffffffffffffffffffffffffffffffffffffffffffffffffeeffffc2e"))),assert(e.isXOnlyPoint(h("f9308a019258c31049344f85f89d5229b531c845836f99b08601f113bce036f9"))),assert(e.isXOnlyPoint(h("0000000000000000000000000000000000000000000000000000000000000001"))),assert(!e.isXOnlyPoint(h("0000000000000000000000000000000000000000000000000000000000000000"))),assert(!e.isXOnlyPoint(h("fffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"))),assert(typeof e.xOnlyPointAddTweak=="function"),tweakAddVectors.forEach(t=>{const r=e.xOnlyPointAddTweak(h(t.pubkey),h(t.tweak));t.result===null?assert(r===null):(assert(r!==null),assert(r.parity===t.parity),assert(Buffer$e.from(r.xOnlyPubkey).equals(h(t.result))))})}function assert(e){if(!e)throw new Error("ecc library invalid")}const tweakAddVectors=[{pubkey:"79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798",tweak:"fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364140",parity:-1,result:null},{pubkey:"1617d38ed8d8657da4d4761e8057bc396ea9e4b9d29776d4be096016dbd2509b",tweak:"a8397a935f0dfceba6ba9618f6451ef4d80637abf4e6af2669fbc9de6a8fd2ac",parity:1,result:"e478f99dab91052ab39a33ea35fd5e6e4933f4d28023cd597c9a1f6760346adf"},{pubkey:"2c0b7cf95324a07d05398b240174dc0c2be444d96b159aa6c7f7b1e668680991",tweak:"823c3cd2142744b075a87eade7e1b8678ba308d566226a0056ca2b7a76f86b47",parity:0,result:"9534f8dc8c6deda2dc007655981c78b49c5d96c778fbf363462a11ec9dfd948c"}];var crypto$1={},ripemd160={};Object.defineProperty(ripemd160,"__esModule",{value:!0});ripemd160.ripemd160=ripemd160.RIPEMD160=void 0;const _md_js_1$1=_md$2,utils_js_1$1=utils$q,Rho=new Uint8Array([7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8]),Id=new Uint8Array(new Array(16).fill(0).map((e,t)=>t)),Pi=Id.map(e=>(9*e+5)%16);let idxL=[Id],idxR=[Pi];for(let e=0;e<4;e++)for(let t of[idxL,idxR])t.push(t[e].map(r=>Rho[r]));const shifts=[[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8],[12,13,11,15,6,9,9,7,12,15,11,13,7,8,7,7],[13,15,14,11,7,7,6,8,13,14,13,12,5,5,6,9],[14,11,12,14,8,6,5,5,15,12,15,14,9,9,8,6],[15,12,13,13,9,5,8,6,14,11,12,11,8,6,5,5]].map(e=>new Uint8Array(e)),shiftsL=idxL.map((e,t)=>e.map(r=>shifts[t][r])),shiftsR=idxR.map((e,t)=>e.map(r=>shifts[t][r])),Kl=new Uint32Array([0,1518500249,1859775393,2400959708,2840853838]),Kr=new Uint32Array([1352829926,1548603684,1836072691,2053994217,0]);function f(e,t,r,n){return e===0?t^r^n:e===1?t&r|~t&n:e===2?(t|~r)^n:e===3?t&n|r&~n:t^(r|~n)}const R_BUF=new Uint32Array(16);class RIPEMD160 extends _md_js_1$1.HashMD{constructor(){super(64,20,8,!0),this.h0=1732584193,this.h1=-271733879,this.h2=-1732584194,this.h3=271733878,this.h4=-1009589776}get(){const{h0:t,h1:r,h2:n,h3:o,h4:s}=this;return[t,r,n,o,s]}set(t,r,n,o,s){this.h0=t|0,this.h1=r|0,this.h2=n|0,this.h3=o|0,this.h4=s|0}process(t,r){for(let v=0;v<16;v++,r+=4)R_BUF[v]=t.getUint32(r,!0);let n=this.h0|0,o=n,s=this.h1|0,a=s,u=this.h2|0,p=u,d=this.h3|0,c=d,m=this.h4|0,_=m;for(let v=0;v<5;v++){const S=4-v,E=Kl[v],x=Kr[v],O=idxL[v],q=idxR[v],U=shiftsL[v],L=shiftsR[v];for(let z=0;z<16;z++){const F=(0,utils_js_1$1.rotl)(n+f(v,s,u,d)+R_BUF[O[z]]+E,U[z])+m|0;n=m,m=d,d=(0,utils_js_1$1.rotl)(u,10)|0,u=s,s=F}for(let z=0;z<16;z++){const F=(0,utils_js_1$1.rotl)(o+f(S,a,p,c)+R_BUF[q[z]]+x,L[z])+_|0;o=_,_=c,c=(0,utils_js_1$1.rotl)(p,10)|0,p=a,a=F}}this.set(this.h1+u+c|0,this.h2+d+_|0,this.h3+m+o|0,this.h4+n+a|0,this.h0+s+p|0)}roundClean(){R_BUF.fill(0)}destroy(){this.destroyed=!0,this.buffer.fill(0),this.set(0,0,0,0,0)}}ripemd160.RIPEMD160=RIPEMD160;ripemd160.ripemd160=(0,utils_js_1$1.wrapConstructor)(()=>new RIPEMD160);var sha1={};Object.defineProperty(sha1,"__esModule",{value:!0});sha1.sha1=sha1.SHA1=void 0;const _md_js_1=_md$2,utils_js_1=utils$q,SHA1_IV=new Uint32Array([1732584193,4023233417,2562383102,271733878,3285377520]),SHA1_W=new Uint32Array(80);class SHA1 extends _md_js_1.HashMD{constructor(){super(64,20,8,!1),this.A=SHA1_IV[0]|0,this.B=SHA1_IV[1]|0,this.C=SHA1_IV[2]|0,this.D=SHA1_IV[3]|0,this.E=SHA1_IV[4]|0}get(){const{A:t,B:r,C:n,D:o,E:s}=this;return[t,r,n,o,s]}set(t,r,n,o,s){this.A=t|0,this.B=r|0,this.C=n|0,this.D=o|0,this.E=s|0}process(t,r){for(let p=0;p<16;p++,r+=4)SHA1_W[p]=t.getUint32(r,!1);for(let p=16;p<80;p++)SHA1_W[p]=(0,utils_js_1.rotl)(SHA1_W[p-3]^SHA1_W[p-8]^SHA1_W[p-14]^SHA1_W[p-16],1);let{A:n,B:o,C:s,D:a,E:u}=this;for(let p=0;p<80;p++){let d,c;p<20?(d=(0,_md_js_1.Chi)(o,s,a),c=1518500249):p<40?(d=o^s^a,c=1859775393):p<60?(d=(0,_md_js_1.Maj)(o,s,a),c=2400959708):(d=o^s^a,c=3395469782);const m=(0,utils_js_1.rotl)(n,5)+d+u+c+SHA1_W[p]|0;u=a,a=s,s=(0,utils_js_1.rotl)(o,30),o=n,n=m}n=n+this.A|0,o=o+this.B|0,s=s+this.C|0,a=a+this.D|0,u=u+this.E|0,this.set(n,o,s,a,u)}roundClean(){SHA1_W.fill(0)}destroy(){this.set(0,0,0,0,0),this.buffer.fill(0)}}sha1.SHA1=SHA1;sha1.sha1=(0,utils_js_1.wrapConstructor)(()=>new SHA1);(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.taggedHash=e.TAGGED_HASH_PREFIXES=e.TAGS=e.hash256=e.hash160=e.sha256=e.sha1=e.ripemd160=void 0;const t=ripemd160,r=sha1,n=sha256$7;function o(c){return Buffer$e.from((0,t.ripemd160)(Uint8Array.from(c)))}e.ripemd160=o;function s(c){return Buffer$e.from((0,r.sha1)(Uint8Array.from(c)))}e.sha1=s;function a(c){return Buffer$e.from((0,n.sha256)(Uint8Array.from(c)))}e.sha256=a;function u(c){return Buffer$e.from((0,t.ripemd160)((0,n.sha256)(Uint8Array.from(c))))}e.hash160=u;function p(c){return Buffer$e.from((0,n.sha256)((0,n.sha256)(Uint8Array.from(c))))}e.hash256=p,e.TAGS=["BIP0340/challenge","BIP0340/aux","BIP0340/nonce","TapLeaf","TapBranch","TapSighash","TapTweak","KeyAgg list","KeyAgg coefficient"],e.TAGGED_HASH_PREFIXES={"BIP0340/challenge":Buffer$e.from([123,181,45,122,159,239,88,50,62,177,191,122,64,125,179,130,210,243,242,216,27,177,34,79,73,254,81,143,109,72,211,124,123,181,45,122,159,239,88,50,62,177,191,122,64,125,179,130,210,243,242,216,27,177,34,79,73,254,81,143,109,72,211,124]),"BIP0340/aux":Buffer$e.from([241,239,78,94,192,99,202,218,109,148,202,250,157,152,126,160,105,38,88,57,236,193,31,151,45,119,165,46,216,193,204,144,241,239,78,94,192,99,202,218,109,148,202,250,157,152,126,160,105,38,88,57,236,193,31,151,45,119,165,46,216,193,204,144]),"BIP0340/nonce":Buffer$e.from([7,73,119,52,167,155,203,53,91,155,140,125,3,79,18,28,244,52,215,62,247,45,218,25,135,0,97,251,82,191,235,47,7,73,119,52,167,155,203,53,91,155,140,125,3,79,18,28,244,52,215,62,247,45,218,25,135,0,97,251,82,191,235,47]),TapLeaf:Buffer$e.from([174,234,143,220,66,8,152,49,5,115,75,88,8,29,30,38,56,211,95,28,181,64,8,212,211,87,202,3,190,120,233,238,174,234,143,220,66,8,152,49,5,115,75,88,8,29,30,38,56,211,95,28,181,64,8,212,211,87,202,3,190,120,233,238]),TapBranch:Buffer$e.from([25,65,161,242,229,110,185,95,162,169,241,148,190,92,1,247,33,111,51,237,130,176,145,70,52,144,208,91,245,22,160,21,25,65,161,242,229,110,185,95,162,169,241,148,190,92,1,247,33,111,51,237,130,176,145,70,52,144,208,91,245,22,160,21]),TapSighash:Buffer$e.from([244,10,72,223,75,42,112,200,180,146,75,242,101,70,97,237,61,149,253,102,163,19,235,135,35,117,151,198,40,228,160,49,244,10,72,223,75,42,112,200,180,146,75,242,101,70,97,237,61,149,253,102,163,19,235,135,35,117,151,198,40,228,160,49]),TapTweak:Buffer$e.from([232,15,225,99,156,156,160,80,227,175,27,57,193,67,198,62,66,156,188,235,21,217,64,251,181,197,161,244,175,87,197,233,232,15,225,99,156,156,160,80,227,175,27,57,193,67,198,62,66,156,188,235,21,217,64,251,181,197,161,244,175,87,197,233]),"KeyAgg list":Buffer$e.from([72,28,151,28,60,11,70,215,240,178,117,174,89,141,78,44,126,215,49,156,89,74,92,110,199,158,160,212,153,2,148,240,72,28,151,28,60,11,70,215,240,178,117,174,89,141,78,44,126,215,49,156,89,74,92,110,199,158,160,212,153,2,148,240]),"KeyAgg coefficient":Buffer$e.from([191,201,4,3,77,28,136,232,200,14,34,229,61,36,86,109,100,130,78,214,66,114,129,192,145,0,249,77,205,82,201,129,191,201,4,3,77,28,136,232,200,14,34,229,61,36,86,109,100,130,78,214,66,114,129,192,145,0,249,77,205,82,201,129])};function d(c,m){return a(Buffer$e.concat([e.TAGGED_HASH_PREFIXES[c],m]))}e.taggedHash=d})(crypto$1);var bufferutils={},types$4={},types$3={Array:function(e){return e!=null&&e.constructor===Array},Boolean:function(e){return typeof e=="boolean"},Function:function(e){return typeof e=="function"},Nil:function(e){return e==null},Number:function(e){return typeof e=="number"},Object:function(e){return typeof e=="object"},String:function(e){return typeof e=="string"},"":function(){return!0}};types$3.Null=types$3.Nil;for(var typeName$1 in types$3)types$3[typeName$1].toJSON=(function(e){return e}).bind(null,typeName$1);var native$2=types$3,native$1=native$2;function getTypeName(e){return e.name||e.toString().match(/function (.*?)\s*\(/)[1]}function getValueTypeName$1(e){return native$1.Nil(e)?"":getTypeName(e.constructor)}function getValue(e){return native$1.Function(e)?"":native$1.String(e)?JSON.stringify(e):e&&native$1.Object(e)?"":e}function captureStackTrace(e,t){Error.captureStackTrace&&Error.captureStackTrace(e,t)}function tfJSON$1(e){return native$1.Function(e)?e.toJSON?e.toJSON():getTypeName(e):native$1.Array(e)?"Array":e&&native$1.Object(e)?"Object":e!==void 0?e:""}function tfErrorString(e,t,r){var n=getValue(t);return"Expected "+tfJSON$1(e)+", got"+(r!==""?" "+r:"")+(n!==""?" "+n:"")}function TfTypeError$1(e,t,r){r=r||getValueTypeName$1(t),this.message=tfErrorString(e,t,r),captureStackTrace(this,TfTypeError$1),this.__type=e,this.__value=t,this.__valueTypeName=r}TfTypeError$1.prototype=Object.create(Error.prototype);TfTypeError$1.prototype.constructor=TfTypeError$1;function tfPropertyErrorString(e,t,r,n,o){var s='" of type ';return t==="key"&&(s='" with key type '),tfErrorString('property "'+tfJSON$1(r)+s+tfJSON$1(e),n,o)}function TfPropertyTypeError$1(e,t,r,n,o){e?(o=o||getValueTypeName$1(n),this.message=tfPropertyErrorString(e,r,t,n,o)):this.message='Unexpected property "'+t+'"',captureStackTrace(this,TfTypeError$1),this.__label=r,this.__property=t,this.__type=e,this.__value=n,this.__valueTypeName=o}TfPropertyTypeError$1.prototype=Object.create(Error.prototype);TfPropertyTypeError$1.prototype.constructor=TfTypeError$1;function tfCustomError(e,t){return new TfTypeError$1(e,{},t)}function tfSubError$1(e,t,r){return e instanceof TfPropertyTypeError$1?(t=t+"."+e.__property,e=new TfPropertyTypeError$1(e.__type,t,e.__label,e.__value,e.__valueTypeName)):e instanceof TfTypeError$1&&(e=new TfPropertyTypeError$1(e.__type,t,r,e.__value,e.__valueTypeName)),captureStackTrace(e),e}var errors={TfTypeError:TfTypeError$1,TfPropertyTypeError:TfPropertyTypeError$1,tfCustomError,tfSubError:tfSubError$1,tfJSON:tfJSON$1,getValueTypeName:getValueTypeName$1},extra,hasRequiredExtra;function requireExtra(){if(hasRequiredExtra)return extra;hasRequiredExtra=1;var e=native$2,t=errors;function r(F){return Buffer$e.isBuffer(F)}function n(F){return typeof F=="string"&&/^([0-9a-f]{2})+$/i.test(F)}function o(F,y){var T=F.toJSON();function D(G){if(!F(G))return!1;if(G.length===y)return!0;throw t.tfCustomError(T+"(Length: "+y+")",T+"(Length: "+G.length+")")}return D.toJSON=function(){return T},D}var s=o.bind(null,e.Array),a=o.bind(null,r),u=o.bind(null,n),p=o.bind(null,e.String);function d(F,y,T){T=T||e.Number;function D(G,C){return T(G,C)&&G>F&&G<y}return D.toJSON=function(){return`${T.toJSON()} between [${F}, ${y}]`},D}var c=Math.pow(2,53)-1;function m(F){return typeof F=="number"&&isFinite(F)}function _(F){return F<<24>>24===F}function v(F){return F<<16>>16===F}function S(F){return(F|0)===F}function E(F){return typeof F=="number"&&F>=-c&&F<=c&&Math.floor(F)===F}function x(F){return(F&255)===F}function O(F){return(F&65535)===F}function q(F){return F>>>0===F}function U(F){return typeof F=="number"&&F>=0&&F<=c&&Math.floor(F)===F}var L={ArrayN:s,Buffer:r,BufferN:a,Finite:m,Hex:n,HexN:u,Int8:_,Int16:v,Int32:S,Int53:E,Range:d,StringN:p,UInt8:x,UInt16:O,UInt32:q,UInt53:U};for(var z in L)L[z].toJSON=(function(F){return F}).bind(null,z);return extra=L,extra}var ERRORS=errors,NATIVE=native$2,tfJSON=ERRORS.tfJSON,TfTypeError=ERRORS.TfTypeError,TfPropertyTypeError=ERRORS.TfPropertyTypeError,tfSubError=ERRORS.tfSubError,getValueTypeName=ERRORS.getValueTypeName,TYPES={arrayOf:function e(t,r){t=compile(t),r=r||{};function n(o,s){return!NATIVE.Array(o)||NATIVE.Nil(o)||r.minLength!==void 0&&o.length<r.minLength||r.maxLength!==void 0&&o.length>r.maxLength||r.length!==void 0&&o.length!==r.length?!1:o.every(function(a,u){try{return typeforce$3(t,a,s)}catch(p){throw tfSubError(p,u)}})}return n.toJSON=function(){var o="["+tfJSON(t)+"]";return r.length!==void 0?o+="{"+r.length+"}":(r.minLength!==void 0||r.maxLength!==void 0)&&(o+="{"+(r.minLength===void 0?0:r.minLength)+","+(r.maxLength===void 0?1/0:r.maxLength)+"}"),o},n},maybe:function e(t){t=compile(t);function r(n,o){return NATIVE.Nil(n)||t(n,o,e)}return r.toJSON=function(){return"?"+tfJSON(t)},r},map:function e(t,r){t=compile(t),r&&(r=compile(r));function n(o,s){if(!NATIVE.Object(o)||NATIVE.Nil(o))return!1;for(var a in o){try{r&&typeforce$3(r,a,s)}catch(p){throw tfSubError(p,a,"key")}try{var u=o[a];typeforce$3(t,u,s)}catch(p){throw tfSubError(p,a)}}return!0}return r?n.toJSON=function(){return"{"+tfJSON(r)+": "+tfJSON(t)+"}"}:n.toJSON=function(){return"{"+tfJSON(t)+"}"},n},object:function e(t){var r={};for(var n in t)r[n]=compile(t[n]);function o(s,a){if(!NATIVE.Object(s)||NATIVE.Nil(s))return!1;var u;try{for(u in r){var p=r[u],d=s[u];typeforce$3(p,d,a)}}catch(c){throw tfSubError(c,u)}if(a){for(u in s)if(!r[u])throw new TfPropertyTypeError(void 0,u)}return!0}return o.toJSON=function(){return tfJSON(r)},o},anyOf:function e(){var t=[].slice.call(arguments).map(compile);function r(n,o){return t.some(function(s){try{return typeforce$3(s,n,o)}catch{return!1}})}return r.toJSON=function(){return t.map(tfJSON).join("|")},r},allOf:function e(){var t=[].slice.call(arguments).map(compile);function r(n,o){return t.every(function(s){try{return typeforce$3(s,n,o)}catch{return!1}})}return r.toJSON=function(){return t.map(tfJSON).join(" & ")},r},quacksLike:function e(t){function r(n){return t===getValueTypeName(n)}return r.toJSON=function(){return t},r},tuple:function e(){var t=[].slice.call(arguments).map(compile);function r(n,o){return NATIVE.Nil(n)||NATIVE.Nil(n.length)||o&&n.length!==t.length?!1:t.every(function(s,a){try{return typeforce$3(s,n[a],o)}catch(u){throw tfSubError(u,a)}})}return r.toJSON=function(){return"("+t.map(tfJSON).join(", ")+")"},r},value:function e(t){function r(n){return n===t}return r.toJSON=function(){return t},r}};TYPES.oneOf=TYPES.anyOf;function compile(e){if(NATIVE.String(e))return e[0]==="?"?TYPES.maybe(e.slice(1)):NATIVE[e]||TYPES.quacksLike(e);if(e&&NATIVE.Object(e)){if(NATIVE.Array(e)){if(e.length!==1)throw new TypeError("Expected compile() parameter of type Array of length 1");return TYPES.arrayOf(e[0])}return TYPES.object(e)}else if(NATIVE.Function(e))return e;return TYPES.value(e)}function typeforce$3(e,t,r,n){if(NATIVE.Function(e)){if(e(t,r))return!0;throw new TfTypeError(n||e,t)}return typeforce$3(compile(e),t,r)}for(var typeName in NATIVE)typeforce$3[typeName]=NATIVE[typeName];for(typeName in TYPES)typeforce$3[typeName]=TYPES[typeName];var EXTRA=requireExtra();for(typeName in EXTRA)typeforce$3[typeName]=EXTRA[typeName];typeforce$3.compile=compile;typeforce$3.TfTypeError=TfTypeError;typeforce$3.TfPropertyTypeError=TfPropertyTypeError;var typeforce_1=typeforce$3;(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.oneOf=e.Null=e.BufferN=e.Function=e.UInt32=e.UInt8=e.tuple=e.maybe=e.Hex=e.Buffer=e.String=e.Boolean=e.Array=e.Number=e.Hash256bit=e.Hash160bit=e.Buffer256bit=e.isTaptree=e.isTapleaf=e.TAPLEAF_VERSION_MASK=e.Network=e.ECPoint=e.Satoshi=e.Signer=e.BIP32Path=e.UInt31=e.isPoint=e.typeforce=void 0;const t=require$$0$3;e.typeforce=typeforce_1;const r=t.Buffer.alloc(32,0),n=t.Buffer.from("fffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f","hex");function o(v){if(!t.Buffer.isBuffer(v)||v.length<33)return!1;const S=v[0],E=v.slice(1,33);if(E.compare(r)===0||E.compare(n)>=0)return!1;if((S===2||S===3)&&v.length===33)return!0;const x=v.slice(33);return x.compare(r)===0||x.compare(n)>=0?!1:S===4&&v.length===65}e.isPoint=o;const s=Math.pow(2,31)-1;function a(v){return e.typeforce.UInt32(v)&&v<=s}e.UInt31=a;function u(v){return e.typeforce.String(v)&&!!v.match(/^(m\/)?(\d+'?\/)*\d+'?$/)}e.BIP32Path=u,u.toJSON=()=>"BIP32 derivation path";function p(v){return(e.typeforce.Buffer(v.publicKey)||typeof v.getPublicKey=="function")&&typeof v.sign=="function"}e.Signer=p;const d=21*1e14;function c(v){return e.typeforce.UInt53(v)&&v<=d}e.Satoshi=c,e.ECPoint=e.typeforce.quacksLike("Point"),e.Network=e.typeforce.compile({messagePrefix:e.typeforce.oneOf(e.typeforce.Buffer,e.typeforce.String),bip32:{public:e.typeforce.UInt32,private:e.typeforce.UInt32},pubKeyHash:e.typeforce.UInt8,scriptHash:e.typeforce.UInt8,wif:e.typeforce.UInt8}),e.TAPLEAF_VERSION_MASK=254;function m(v){return!v||!("output"in v)||!t.Buffer.isBuffer(v.output)?!1:v.version!==void 0?(v.version&e.TAPLEAF_VERSION_MASK)===v.version:!0}e.isTapleaf=m;function _(v){return(0,e.Array)(v)?v.length!==2?!1:v.every(S=>_(S)):m(v)}e.isTaptree=_,e.Buffer256bit=e.typeforce.BufferN(32),e.Hash160bit=e.typeforce.BufferN(20),e.Hash256bit=e.typeforce.BufferN(32),e.Number=e.typeforce.Number,e.Array=e.typeforce.Array,e.Boolean=e.typeforce.Boolean,e.String=e.typeforce.String,e.Buffer=e.typeforce.Buffer,e.Hex=e.typeforce.Hex,e.maybe=e.typeforce.maybe,e.tuple=e.typeforce.tuple,e.UInt8=e.typeforce.UInt8,e.UInt32=e.typeforce.UInt32,e.Function=e.typeforce.Function,e.BufferN=e.typeforce.BufferN,e.Null=e.typeforce.Null,e.oneOf=e.typeforce.oneOf})(types$4);var Buffer=safeBufferExports.Buffer,MAX_SAFE_INTEGER$1=9007199254740991;function checkUInt53$1(e){if(e<0||e>MAX_SAFE_INTEGER$1||e%1!==0)throw new RangeError("value out of range")}function encode$5(e,t,r){if(checkUInt53$1(e),t||(t=Buffer.allocUnsafe(encodingLength$2(e))),!Buffer.isBuffer(t))throw new TypeError("buffer must be a Buffer instance");return r||(r=0),e<253?(t.writeUInt8(e,r),encode$5.bytes=1):e<=65535?(t.writeUInt8(253,r),t.writeUInt16LE(e,r+1),encode$5.bytes=3):e<=4294967295?(t.writeUInt8(254,r),t.writeUInt32LE(e,r+1),encode$5.bytes=5):(t.writeUInt8(255,r),t.writeUInt32LE(e>>>0,r+1),t.writeUInt32LE(e/4294967296|0,r+5),encode$5.bytes=9),t}function decode$5(e,t){if(!Buffer.isBuffer(e))throw new TypeError("buffer must be a Buffer instance");t||(t=0);var r=e.readUInt8(t);if(r<253)return decode$5.bytes=1,r;if(r===253)return decode$5.bytes=3,e.readUInt16LE(t+1);if(r===254)return decode$5.bytes=5,e.readUInt32LE(t+1);decode$5.bytes=9;var n=e.readUInt32LE(t+1),o=e.readUInt32LE(t+5),s=o*4294967296+n;return checkUInt53$1(s),s}function encodingLength$2(e){return checkUInt53$1(e),e<253?1:e<=65535?3:e<=4294967295?5:9}var varuintBitcoin={encode:encode$5,decode:decode$5,encodingLength:encodingLength$2};Object.defineProperty(bufferutils,"__esModule",{value:!0});bufferutils.BufferReader=bufferutils.BufferWriter=bufferutils.cloneBuffer=bufferutils.reverseBuffer=bufferutils.writeUInt64LE=bufferutils.readUInt64LE=bufferutils.varuint=void 0;const types$2=types$4,{typeforce:typeforce$2}=types$2,varuint$1=varuintBitcoin;bufferutils.varuint=varuint$1;function verifuint(e,t){if(typeof e!="number")throw new Error("cannot write a non-number as a number");if(e<0)throw new Error("specified a negative value for writing an unsigned value");if(e>t)throw new Error("RangeError: value out of range");if(Math.floor(e)!==e)throw new Error("value has a fractional component")}function readUInt64LE(e,t){const r=e.readUInt32LE(t);let n=e.readUInt32LE(t+4);return n*=4294967296,verifuint(n+r,9007199254740991),n+r}bufferutils.readUInt64LE=readUInt64LE;function writeUInt64LE(e,t,r){return verifuint(t,9007199254740991),e.writeInt32LE(t&-1,r),e.writeUInt32LE(Math.floor(t/4294967296),r+4),r+8}bufferutils.writeUInt64LE=writeUInt64LE;function reverseBuffer(e){if(e.length<1)return e;let t=e.length-1,r=0;for(let n=0;n<e.length/2;n++)r=e[n],e[n]=e[t],e[t]=r,t--;return e}bufferutils.reverseBuffer=reverseBuffer;function cloneBuffer(e){const t=Buffer$e.allocUnsafe(e.length);return e.copy(t),t}bufferutils.cloneBuffer=cloneBuffer;class BufferWriter{static withCapacity(t){return new BufferWriter(Buffer$e.alloc(t))}constructor(t,r=0){this.buffer=t,this.offset=r,typeforce$2(types$2.tuple(types$2.Buffer,types$2.UInt32),[t,r])}writeUInt8(t){this.offset=this.buffer.writeUInt8(t,this.offset)}writeInt32(t){this.offset=this.buffer.writeInt32LE(t,this.offset)}writeUInt32(t){this.offset=this.buffer.writeUInt32LE(t,this.offset)}writeUInt64(t){this.offset=writeUInt64LE(this.buffer,t,this.offset)}writeVarInt(t){varuint$1.encode(t,this.buffer,this.offset),this.offset+=varuint$1.encode.bytes}writeSlice(t){if(this.buffer.length<this.offset+t.length)throw new Error("Cannot write slice out of bounds");this.offset+=t.copy(this.buffer,this.offset)}writeVarSlice(t){this.writeVarInt(t.length),this.writeSlice(t)}writeVector(t){this.writeVarInt(t.length),t.forEach(r=>this.writeVarSlice(r))}end(){if(this.buffer.length===this.offset)return this.buffer;throw new Error(`buffer size ${this.buffer.length}, offset ${this.offset}`)}}bufferutils.BufferWriter=BufferWriter;class BufferReader{constructor(t,r=0){this.buffer=t,this.offset=r,typeforce$2(types$2.tuple(types$2.Buffer,types$2.UInt32),[t,r])}readUInt8(){const t=this.buffer.readUInt8(this.offset);return this.offset++,t}readInt32(){const t=this.buffer.readInt32LE(this.offset);return this.offset+=4,t}readUInt32(){const t=this.buffer.readUInt32LE(this.offset);return this.offset+=4,t}readUInt64(){const t=readUInt64LE(this.buffer,this.offset);return this.offset+=8,t}readVarInt(){const t=varuint$1.decode(this.buffer,this.offset);return this.offset+=varuint$1.decode.bytes,t}readSlice(t){if(this.buffer.length<this.offset+t)throw new Error("Cannot read slice out of bounds");const r=this.buffer.slice(this.offset,this.offset+t);return this.offset+=t,r}readVarSlice(){return this.readSlice(this.readVarInt())}readVector(){const t=this.readVarInt(),r=[];for(let n=0;n<t;n++)r.push(this.readVarSlice());return r}}bufferutils.BufferReader=BufferReader;(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.tweakKey=e.tapTweakHash=e.tapleafHash=e.findScriptPath=e.toHashTree=e.rootHashFromPath=e.MAX_TAPTREE_DEPTH=e.LEAF_VERSION_TAPSCRIPT=void 0;const t=require$$0$3,r=ecc_lib,n=crypto$1,o=bufferutils,s=types$4;e.LEAF_VERSION_TAPSCRIPT=192,e.MAX_TAPTREE_DEPTH=128;const a=E=>"left"in E&&"right"in E;function u(E,x){if(E.length<33)throw new TypeError(`The control-block length is too small. Got ${E.length}, expected min 33.`);const O=(E.length-33)/32;let q=x;for(let U=0;U<O;U++){const L=E.slice(33+32*U,65+32*U);q.compare(L)<0?q=v(q,L):q=v(L,q)}return q}e.rootHashFromPath=u;function p(E){if((0,s.isTapleaf)(E))return{hash:c(E)};const x=[p(E[0]),p(E[1])];x.sort((U,L)=>U.hash.compare(L.hash));const[O,q]=x;return{hash:v(O.hash,q.hash),left:O,right:q}}e.toHashTree=p;function d(E,x){if(a(E)){const O=d(E.left,x);if(O!==void 0)return[...O,E.right.hash];const q=d(E.right,x);if(q!==void 0)return[...q,E.left.hash]}else if(E.hash.equals(x))return[]}e.findScriptPath=d;function c(E){const x=E.version||e.LEAF_VERSION_TAPSCRIPT;return n.taggedHash("TapLeaf",t.Buffer.concat([t.Buffer.from([x]),S(E.output)]))}e.tapleafHash=c;function m(E,x){return n.taggedHash("TapTweak",t.Buffer.concat(x?[E,x]:[E]))}e.tapTweakHash=m;function _(E,x){if(!t.Buffer.isBuffer(E)||E.length!==32||x&&x.length!==32)return null;const O=m(E,x),q=(0,r.getEccLib)().xOnlyPointAddTweak(E,O);return!q||q.xOnlyPubkey===null?null:{parity:q.parity,x:t.Buffer.from(q.xOnlyPubkey)}}e.tweakKey=_;function v(E,x){return n.taggedHash("TapBranch",t.Buffer.concat([E,x]))}function S(E){const x=o.varuint.encodingLength(E.length),O=t.Buffer.allocUnsafe(x);return o.varuint.encode(E.length,O),t.Buffer.concat([O,E])}})(bip341);var bip371={},transaction={},script={},bip66$1={};Object.defineProperty(bip66$1,"__esModule",{value:!0});bip66$1.encode=bip66$1.decode=bip66$1.check=void 0;function check(e){if(e.length<8||e.length>72||e[0]!==48||e[1]!==e.length-2||e[2]!==2)return!1;const t=e[3];if(t===0||5+t>=e.length||e[4+t]!==2)return!1;const r=e[5+t];return!(r===0||6+t+r!==e.length||e[4]&128||t>1&&e[4]===0&&!(e[5]&128)||e[t+6]&128||r>1&&e[t+6]===0&&!(e[t+7]&128))}bip66$1.check=check;function decode$4(e){if(e.length<8)throw new Error("DER sequence length is too short");if(e.length>72)throw new Error("DER sequence length is too long");if(e[0]!==48)throw new Error("Expected DER sequence");if(e[1]!==e.length-2)throw new Error("DER sequence length is invalid");if(e[2]!==2)throw new Error("Expected DER integer");const t=e[3];if(t===0)throw new Error("R length is zero");if(5+t>=e.length)throw new Error("R length is too long");if(e[4+t]!==2)throw new Error("Expected DER integer (2)");const r=e[5+t];if(r===0)throw new Error("S length is zero");if(6+t+r!==e.length)throw new Error("S length is invalid");if(e[4]&128)throw new Error("R value is negative");if(t>1&&e[4]===0&&!(e[5]&128))throw new Error("R value excessively padded");if(e[t+6]&128)throw new Error("S value is negative");if(r>1&&e[t+6]===0&&!(e[t+7]&128))throw new Error("S value excessively padded");return{r:e.slice(4,4+t),s:e.slice(6+t)}}bip66$1.decode=decode$4;function encode$4(e,t){const r=e.length,n=t.length;if(r===0)throw new Error("R length is zero");if(n===0)throw new Error("S length is zero");if(r>33)throw new Error("R length is too long");if(n>33)throw new Error("S length is too long");if(e[0]&128)throw new Error("R value is negative");if(t[0]&128)throw new Error("S value is negative");if(r>1&&e[0]===0&&!(e[1]&128))throw new Error("R value excessively padded");if(n>1&&t[0]===0&&!(t[1]&128))throw new Error("S value excessively padded");const o=Buffer$e.allocUnsafe(6+r+n);return o[0]=48,o[1]=o.length-2,o[2]=2,o[3]=e.length,e.copy(o,4),o[4+r]=2,o[5+r]=t.length,t.copy(o,6+r),o}bip66$1.encode=encode$4;var ops={};Object.defineProperty(ops,"__esModule",{value:!0});ops.REVERSE_OPS=ops.OPS=void 0;const OPS$8={OP_FALSE:0,OP_0:0,OP_PUSHDATA1:76,OP_PUSHDATA2:77,OP_PUSHDATA4:78,OP_1NEGATE:79,OP_RESERVED:80,OP_TRUE:81,OP_1:81,OP_2:82,OP_3:83,OP_4:84,OP_5:85,OP_6:86,OP_7:87,OP_8:88,OP_9:89,OP_10:90,OP_11:91,OP_12:92,OP_13:93,OP_14:94,OP_15:95,OP_16:96,OP_NOP:97,OP_VER:98,OP_IF:99,OP_NOTIF:100,OP_VERIF:101,OP_VERNOTIF:102,OP_ELSE:103,OP_ENDIF:104,OP_VERIFY:105,OP_RETURN:106,OP_TOALTSTACK:107,OP_FROMALTSTACK:108,OP_2DROP:109,OP_2DUP:110,OP_3DUP:111,OP_2OVER:112,OP_2ROT:113,OP_2SWAP:114,OP_IFDUP:115,OP_DEPTH:116,OP_DROP:117,OP_DUP:118,OP_NIP:119,OP_OVER:120,OP_PICK:121,OP_ROLL:122,OP_ROT:123,OP_SWAP:124,OP_TUCK:125,OP_CAT:126,OP_SUBSTR:127,OP_LEFT:128,OP_RIGHT:129,OP_SIZE:130,OP_INVERT:131,OP_AND:132,OP_OR:133,OP_XOR:134,OP_EQUAL:135,OP_EQUALVERIFY:136,OP_RESERVED1:137,OP_RESERVED2:138,OP_1ADD:139,OP_1SUB:140,OP_2MUL:141,OP_2DIV:142,OP_NEGATE:143,OP_ABS:144,OP_NOT:145,OP_0NOTEQUAL:146,OP_ADD:147,OP_SUB:148,OP_MUL:149,OP_DIV:150,OP_MOD:151,OP_LSHIFT:152,OP_RSHIFT:153,OP_BOOLAND:154,OP_BOOLOR:155,OP_NUMEQUAL:156,OP_NUMEQUALVERIFY:157,OP_NUMNOTEQUAL:158,OP_LESSTHAN:159,OP_GREATERTHAN:160,OP_LESSTHANOREQUAL:161,OP_GREATERTHANOREQUAL:162,OP_MIN:163,OP_MAX:164,OP_WITHIN:165,OP_RIPEMD160:166,OP_SHA1:167,OP_SHA256:168,OP_HASH160:169,OP_HASH256:170,OP_CODESEPARATOR:171,OP_CHECKSIG:172,OP_CHECKSIGVERIFY:173,OP_CHECKMULTISIG:174,OP_CHECKMULTISIGVERIFY:175,OP_NOP1:176,OP_NOP2:177,OP_CHECKLOCKTIMEVERIFY:177,OP_NOP3:178,OP_CHECKSEQUENCEVERIFY:178,OP_NOP4:179,OP_NOP5:180,OP_NOP6:181,OP_NOP7:182,OP_NOP8:183,OP_NOP9:184,OP_NOP10:185,OP_CHECKSIGADD:186,OP_PUBKEYHASH:253,OP_PUBKEY:254,OP_INVALIDOPCODE:255};ops.OPS=OPS$8;const REVERSE_OPS={};ops.REVERSE_OPS=REVERSE_OPS;for(const e of Object.keys(OPS$8)){const t=OPS$8[e];REVERSE_OPS[t]=e}var push_data={};Object.defineProperty(push_data,"__esModule",{value:!0});push_data.decode=push_data.encode=push_data.encodingLength=void 0;const ops_1=ops;function encodingLength$1(e){return e<ops_1.OPS.OP_PUSHDATA1?1:e<=255?2:e<=65535?3:5}push_data.encodingLength=encodingLength$1;function encode$3(e,t,r){const n=encodingLength$1(t);return n===1?e.writeUInt8(t,r):n===2?(e.writeUInt8(ops_1.OPS.OP_PUSHDATA1,r),e.writeUInt8(t,r+1)):n===3?(e.writeUInt8(ops_1.OPS.OP_PUSHDATA2,r),e.writeUInt16LE(t,r+1)):(e.writeUInt8(ops_1.OPS.OP_PUSHDATA4,r),e.writeUInt32LE(t,r+1)),n}push_data.encode=encode$3;function decode$3(e,t){const r=e.readUInt8(t);let n,o;if(r<ops_1.OPS.OP_PUSHDATA1)n=r,o=1;else if(r===ops_1.OPS.OP_PUSHDATA1){if(t+2>e.length)return null;n=e.readUInt8(t+1),o=2}else if(r===ops_1.OPS.OP_PUSHDATA2){if(t+3>e.length)return null;n=e.readUInt16LE(t+1),o=3}else{if(t+5>e.length)return null;if(r!==ops_1.OPS.OP_PUSHDATA4)throw new Error("Unexpected opcode");n=e.readUInt32LE(t+1),o=5}return{opcode:r,number:n,size:o}}push_data.decode=decode$3;var script_number={};Object.defineProperty(script_number,"__esModule",{value:!0});script_number.encode=script_number.decode=void 0;function decode$2(e,t,r){t=t||4,r=r===void 0?!0:r;const n=e.length;if(n===0)return 0;if(n>t)throw new TypeError("Script number overflow");if(r&&!(e[n-1]&127)&&(n<=1||!(e[n-2]&128)))throw new Error("Non-minimally encoded script number");if(n===5){const s=e.readUInt32LE(0),a=e.readUInt8(4);return a&128?-((a&-129)*4294967296+s):a*4294967296+s}let o=0;for(let s=0;s<n;++s)o|=e[s]<<8*s;return e[n-1]&128?-(o&~(128<<8*(n-1))):o}script_number.decode=decode$2;function scriptNumSize(e){return e>2147483647?5:e>8388607?4:e>32767?3:e>127?2:e>0?1:0}function encode$2(e){let t=Math.abs(e);const r=scriptNumSize(t),n=Buffer$e.allocUnsafe(r),o=e<0;for(let s=0;s<r;++s)n.writeUInt8(t&255,s),t>>=8;return n[r-1]&128?n.writeUInt8(o?128:0,r-1):o&&(n[r-1]|=128),n}script_number.encode=encode$2;var script_signature={};Object.defineProperty(script_signature,"__esModule",{value:!0});script_signature.encode=script_signature.decode=void 0;const bip66=bip66$1,types$1=types$4,{typeforce:typeforce$1}=types$1,ZERO$1=Buffer$e.alloc(1,0);function toDER(e){let t=0;for(;e[t]===0;)++t;return t===e.length?ZERO$1:(e=e.slice(t),e[0]&128?Buffer$e.concat([ZERO$1,e],1+e.length):e)}function fromDER(e){e[0]===0&&(e=e.slice(1));const t=Buffer$e.alloc(32,0),r=Math.max(0,32-e.length);return e.copy(t,r),t}function decode$1(e){const t=e.readUInt8(e.length-1),r=t&-129;if(r<=0||r>=4)throw new Error("Invalid hashType "+t);const n=bip66.decode(e.slice(0,-1)),o=fromDER(n.r),s=fromDER(n.s);return{signature:Buffer$e.concat([o,s],64),hashType:t}}script_signature.decode=decode$1;function encode$1(e,t){typeforce$1({signature:types$1.BufferN(64),hashType:types$1.UInt8},{signature:e,hashType:t});const r=t&-129;if(r<=0||r>=4)throw new Error("Invalid hashType "+t);const n=Buffer$e.allocUnsafe(1);n.writeUInt8(t,0);const o=toDER(e.slice(0,32)),s=toDER(e.slice(32,64));return Buffer$e.concat([bip66.encode(o,s),n])}script_signature.encode=encode$1;(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.signature=e.number=e.isCanonicalScriptSignature=e.isDefinedHashType=e.isCanonicalPubKey=e.toStack=e.fromASM=e.toASM=e.decompile=e.compile=e.countNonPushOnlyOPs=e.isPushOnly=e.OPS=void 0;const t=bip66$1,r=ops;Object.defineProperty(e,"OPS",{enumerable:!0,get:function(){return r.OPS}});const n=push_data,o=script_number,s=script_signature,a=types$4,{typeforce:u}=a,p=r.OPS.OP_RESERVED;function d(D){return a.Number(D)&&(D===r.OPS.OP_0||D>=r.OPS.OP_1&&D<=r.OPS.OP_16||D===r.OPS.OP_1NEGATE)}function c(D){return a.Buffer(D)||d(D)}function m(D){return a.Array(D)&&D.every(c)}e.isPushOnly=m;function _(D){return D.length-D.filter(c).length}e.countNonPushOnlyOPs=_;function v(D){if(D.length===0)return r.OPS.OP_0;if(D.length===1){if(D[0]>=1&&D[0]<=16)return p+D[0];if(D[0]===129)return r.OPS.OP_1NEGATE}}function S(D){return Buffer$e.isBuffer(D)}function E(D){return a.Array(D)}function x(D){return Buffer$e.isBuffer(D)}function O(D){if(S(D))return D;u(a.Array,D);const G=D.reduce((A,w)=>x(w)?w.length===1&&v(w)!==void 0?A+1:A+n.encodingLength(w.length)+w.length:A+1,0),C=Buffer$e.allocUnsafe(G);let l=0;if(D.forEach(A=>{if(x(A)){const w=v(A);if(w!==void 0){C.writeUInt8(w,l),l+=1;return}l+=n.encode(C,A.length,l),A.copy(C,l),l+=A.length}else C.writeUInt8(A,l),l+=1}),l!==C.length)throw new Error("Could not decode chunks");return C}e.compile=O;function q(D){if(E(D))return D;u(a.Buffer,D);const G=[];let C=0;for(;C<D.length;){const l=D[C];if(l>r.OPS.OP_0&&l<=r.OPS.OP_PUSHDATA4){const A=n.decode(D,C);if(A===null||(C+=A.size,C+A.number>D.length))return null;const w=D.slice(C,C+A.number);C+=A.number;const B=v(w);B!==void 0?G.push(B):G.push(w)}else G.push(l),C+=1}return G}e.decompile=q;function U(D){return S(D)&&(D=q(D)),D.map(G=>{if(x(G)){const C=v(G);if(C===void 0)return G.toString("hex");G=C}return r.REVERSE_OPS[G]}).join(" ")}e.toASM=U;function L(D){return u(a.String,D),O(D.split(" ").map(G=>r.OPS[G]!==void 0?r.OPS[G]:(u(a.Hex,G),Buffer$e.from(G,"hex"))))}e.fromASM=L;function z(D){return D=q(D),u(m,D),D.map(G=>x(G)?G:G===r.OPS.OP_0?Buffer$e.allocUnsafe(0):o.encode(G-p))}e.toStack=z;function F(D){return a.isPoint(D)}e.isCanonicalPubKey=F;function y(D){const G=D&-129;return G>0&&G<4}e.isDefinedHashType=y;function T(D){return!Buffer$e.isBuffer(D)||!y(D[D.length-1])?!1:t.check(D.slice(0,-1))}e.isCanonicalScriptSignature=T,e.number=o,e.signature=s})(script);Object.defineProperty(transaction,"__esModule",{value:!0});transaction.Transaction=void 0;const bufferutils_1=bufferutils,bcrypto$4=crypto$1,bscript$9=script,script_1=script,types=types$4,{typeforce}=types;function varSliceSize(e){const t=e.length;return bufferutils_1.varuint.encodingLength(t)+t}function vectorSize(e){const t=e.length;return bufferutils_1.varuint.encodingLength(t)+e.reduce((r,n)=>r+varSliceSize(n),0)}const EMPTY_BUFFER$2=Buffer$e.allocUnsafe(0),EMPTY_WITNESS=[],ZERO=Buffer$e.from("0000000000000000000000000000000000000000000000000000000000000000","hex"),ONE=Buffer$e.from("0000000000000000000000000000000000000000000000000000000000000001","hex"),VALUE_UINT64_MAX=Buffer$e.from("ffffffffffffffff","hex"),BLANK_OUTPUT={script:EMPTY_BUFFER$2,valueBuffer:VALUE_UINT64_MAX};function isOutput(e){return e.value!==void 0}class Transaction{constructor(){this.version=1,this.locktime=0,this.ins=[],this.outs=[]}static fromBuffer(t,r){const n=new bufferutils_1.BufferReader(t),o=new Transaction;o.version=n.readInt32();const s=n.readUInt8(),a=n.readUInt8();let u=!1;s===Transaction.ADVANCED_TRANSACTION_MARKER&&a===Transaction.ADVANCED_TRANSACTION_FLAG?u=!0:n.offset-=2;const p=n.readVarInt();for(let c=0;c<p;++c)o.ins.push({hash:n.readSlice(32),index:n.readUInt32(),script:n.readVarSlice(),sequence:n.readUInt32(),witness:EMPTY_WITNESS});const d=n.readVarInt();for(let c=0;c<d;++c)o.outs.push({value:n.readUInt64(),script:n.readVarSlice()});if(u){for(let c=0;c<p;++c)o.ins[c].witness=n.readVector();if(!o.hasWitnesses())throw new Error("Transaction has superfluous witness data")}if(o.locktime=n.readUInt32(),r)return o;if(n.offset!==t.length)throw new Error("Transaction has unexpected data");return o}static fromHex(t){return Transaction.fromBuffer(Buffer$e.from(t,"hex"),!1)}static isCoinbaseHash(t){typeforce(types.Hash256bit,t);for(let r=0;r<32;++r)if(t[r]!==0)return!1;return!0}isCoinbase(){return this.ins.length===1&&Transaction.isCoinbaseHash(this.ins[0].hash)}addInput(t,r,n,o){return typeforce(types.tuple(types.Hash256bit,types.UInt32,types.maybe(types.UInt32),types.maybe(types.Buffer)),arguments),types.Null(n)&&(n=Transaction.DEFAULT_SEQUENCE),this.ins.push({hash:t,index:r,script:o||EMPTY_BUFFER$2,sequence:n,witness:EMPTY_WITNESS})-1}addOutput(t,r){return typeforce(types.tuple(types.Buffer,types.Satoshi),arguments),this.outs.push({script:t,value:r})-1}hasWitnesses(){return this.ins.some(t=>t.witness.length!==0)}weight(){const t=this.byteLength(!1),r=this.byteLength(!0);return t*3+r}virtualSize(){return Math.ceil(this.weight()/4)}byteLength(t=!0){const r=t&&this.hasWitnesses();return(r?10:8)+bufferutils_1.varuint.encodingLength(this.ins.length)+bufferutils_1.varuint.encodingLength(this.outs.length)+this.ins.reduce((n,o)=>n+40+varSliceSize(o.script),0)+this.outs.reduce((n,o)=>n+8+varSliceSize(o.script),0)+(r?this.ins.reduce((n,o)=>n+vectorSize(o.witness),0):0)}clone(){const t=new Transaction;return t.version=this.version,t.locktime=this.locktime,t.ins=this.ins.map(r=>({hash:r.hash,index:r.index,script:r.script,sequence:r.sequence,witness:r.witness})),t.outs=this.outs.map(r=>({script:r.script,value:r.value})),t}hashForSignature(t,r,n){if(typeforce(types.tuple(types.UInt32,types.Buffer,types.Number),arguments),t>=this.ins.length)return ONE;const o=bscript$9.compile(bscript$9.decompile(r).filter(u=>u!==script_1.OPS.OP_CODESEPARATOR)),s=this.clone();if((n&31)===Transaction.SIGHASH_NONE)s.outs=[],s.ins.forEach((u,p)=>{p!==t&&(u.sequence=0)});else if((n&31)===Transaction.SIGHASH_SINGLE){if(t>=this.outs.length)return ONE;s.outs.length=t+1;for(let u=0;u<t;u++)s.outs[u]=BLANK_OUTPUT;s.ins.forEach((u,p)=>{p!==t&&(u.sequence=0)})}n&Transaction.SIGHASH_ANYONECANPAY?(s.ins=[s.ins[t]],s.ins[0].script=o):(s.ins.forEach(u=>{u.script=EMPTY_BUFFER$2}),s.ins[t].script=o);const a=Buffer$e.allocUnsafe(s.byteLength(!1)+4);return a.writeInt32LE(n,a.length-4),s.__toBuffer(a,0,!1),bcrypto$4.hash256(a)}hashForWitnessV1(t,r,n,o,s,a){if(typeforce(types.tuple(types.UInt32,typeforce.arrayOf(types.Buffer),typeforce.arrayOf(types.Satoshi),types.UInt32),arguments),n.length!==this.ins.length||r.length!==this.ins.length)throw new Error("Must supply prevout script and value for all inputs");const u=o===Transaction.SIGHASH_DEFAULT?Transaction.SIGHASH_ALL:o&Transaction.SIGHASH_OUTPUT_MASK,d=(o&Transaction.SIGHASH_INPUT_MASK)===Transaction.SIGHASH_ANYONECANPAY,c=u===Transaction.SIGHASH_NONE,m=u===Transaction.SIGHASH_SINGLE;let _=EMPTY_BUFFER$2,v=EMPTY_BUFFER$2,S=EMPTY_BUFFER$2,E=EMPTY_BUFFER$2,x=EMPTY_BUFFER$2;if(!d){let L=bufferutils_1.BufferWriter.withCapacity(36*this.ins.length);this.ins.forEach(z=>{L.writeSlice(z.hash),L.writeUInt32(z.index)}),_=bcrypto$4.sha256(L.end()),L=bufferutils_1.BufferWriter.withCapacity(8*this.ins.length),n.forEach(z=>L.writeUInt64(z)),v=bcrypto$4.sha256(L.end()),L=bufferutils_1.BufferWriter.withCapacity(r.map(varSliceSize).reduce((z,F)=>z+F)),r.forEach(z=>L.writeVarSlice(z)),S=bcrypto$4.sha256(L.end()),L=bufferutils_1.BufferWriter.withCapacity(4*this.ins.length),this.ins.forEach(z=>L.writeUInt32(z.sequence)),E=bcrypto$4.sha256(L.end())}if(c||m){if(m&&t<this.outs.length){const L=this.outs[t],z=bufferutils_1.BufferWriter.withCapacity(8+varSliceSize(L.script));z.writeUInt64(L.value),z.writeVarSlice(L.script),x=bcrypto$4.sha256(z.end())}}else{const L=this.outs.map(F=>8+varSliceSize(F.script)).reduce((F,y)=>F+y),z=bufferutils_1.BufferWriter.withCapacity(L);this.outs.forEach(F=>{z.writeUInt64(F.value),z.writeVarSlice(F.script)}),x=bcrypto$4.sha256(z.end())}const O=(s?2:0)+(a?1:0),q=174-(d?49:0)-(c?32:0)+(a?32:0)+(s?37:0),U=bufferutils_1.BufferWriter.withCapacity(q);if(U.writeUInt8(o),U.writeInt32(this.version),U.writeUInt32(this.locktime),U.writeSlice(_),U.writeSlice(v),U.writeSlice(S),U.writeSlice(E),c||m||U.writeSlice(x),U.writeUInt8(O),d){const L=this.ins[t];U.writeSlice(L.hash),U.writeUInt32(L.index),U.writeUInt64(n[t]),U.writeVarSlice(r[t]),U.writeUInt32(L.sequence)}else U.writeUInt32(t);if(a){const L=bufferutils_1.BufferWriter.withCapacity(varSliceSize(a));L.writeVarSlice(a),U.writeSlice(bcrypto$4.sha256(L.end()))}return m&&U.writeSlice(x),s&&(U.writeSlice(s),U.writeUInt8(0),U.writeUInt32(4294967295)),bcrypto$4.taggedHash("TapSighash",Buffer$e.concat([Buffer$e.from([0]),U.end()]))}hashForWitnessV0(t,r,n,o){typeforce(types.tuple(types.UInt32,types.Buffer,types.Satoshi,types.UInt32),arguments);let s=Buffer$e.from([]),a,u=ZERO,p=ZERO,d=ZERO;if(o&Transaction.SIGHASH_ANYONECANPAY||(s=Buffer$e.allocUnsafe(36*this.ins.length),a=new bufferutils_1.BufferWriter(s,0),this.ins.forEach(m=>{a.writeSlice(m.hash),a.writeUInt32(m.index)}),p=bcrypto$4.hash256(s)),!(o&Transaction.SIGHASH_ANYONECANPAY)&&(o&31)!==Transaction.SIGHASH_SINGLE&&(o&31)!==Transaction.SIGHASH_NONE&&(s=Buffer$e.allocUnsafe(4*this.ins.length),a=new bufferutils_1.BufferWriter(s,0),this.ins.forEach(m=>{a.writeUInt32(m.sequence)}),d=bcrypto$4.hash256(s)),(o&31)!==Transaction.SIGHASH_SINGLE&&(o&31)!==Transaction.SIGHASH_NONE){const m=this.outs.reduce((_,v)=>_+8+varSliceSize(v.script),0);s=Buffer$e.allocUnsafe(m),a=new bufferutils_1.BufferWriter(s,0),this.outs.forEach(_=>{a.writeUInt64(_.value),a.writeVarSlice(_.script)}),u=bcrypto$4.hash256(s)}else if((o&31)===Transaction.SIGHASH_SINGLE&&t<this.outs.length){const m=this.outs[t];s=Buffer$e.allocUnsafe(8+varSliceSize(m.script)),a=new bufferutils_1.BufferWriter(s,0),a.writeUInt64(m.value),a.writeVarSlice(m.script),u=bcrypto$4.hash256(s)}s=Buffer$e.allocUnsafe(156+varSliceSize(r)),a=new bufferutils_1.BufferWriter(s,0);const c=this.ins[t];return a.writeInt32(this.version),a.writeSlice(p),a.writeSlice(d),a.writeSlice(c.hash),a.writeUInt32(c.index),a.writeVarSlice(r),a.writeUInt64(n),a.writeUInt32(c.sequence),a.writeSlice(u),a.writeUInt32(this.locktime),a.writeUInt32(o),bcrypto$4.hash256(s)}getHash(t){return t&&this.isCoinbase()?Buffer$e.alloc(32,0):bcrypto$4.hash256(this.__toBuffer(void 0,void 0,t))}getId(){return(0,bufferutils_1.reverseBuffer)(this.getHash(!1)).toString("hex")}toBuffer(t,r){return this.__toBuffer(t,r,!0)}toHex(){return this.toBuffer(void 0,void 0).toString("hex")}setInputScript(t,r){typeforce(types.tuple(types.Number,types.Buffer),arguments),this.ins[t].script=r}setWitness(t,r){typeforce(types.tuple(types.Number,[types.Buffer]),arguments),this.ins[t].witness=r}__toBuffer(t,r,n=!1){t||(t=Buffer$e.allocUnsafe(this.byteLength(n)));const o=new bufferutils_1.BufferWriter(t,r||0);o.writeInt32(this.version);const s=n&&this.hasWitnesses();return s&&(o.writeUInt8(Transaction.ADVANCED_TRANSACTION_MARKER),o.writeUInt8(Transaction.ADVANCED_TRANSACTION_FLAG)),o.writeVarInt(this.ins.length),this.ins.forEach(a=>{o.writeSlice(a.hash),o.writeUInt32(a.index),o.writeVarSlice(a.script),o.writeUInt32(a.sequence)}),o.writeVarInt(this.outs.length),this.outs.forEach(a=>{isOutput(a)?o.writeUInt64(a.value):o.writeSlice(a.valueBuffer),o.writeVarSlice(a.script)}),s&&this.ins.forEach(a=>{o.writeVector(a.witness)}),o.writeUInt32(this.locktime),r!==void 0?t.slice(r,o.offset):t}}transaction.Transaction=Transaction;Transaction.DEFAULT_SEQUENCE=4294967295;Transaction.SIGHASH_DEFAULT=0;Transaction.SIGHASH_ALL=1;Transaction.SIGHASH_NONE=2;Transaction.SIGHASH_SINGLE=3;Transaction.SIGHASH_ANYONECANPAY=128;Transaction.SIGHASH_OUTPUT_MASK=3;Transaction.SIGHASH_INPUT_MASK=128;Transaction.ADVANCED_TRANSACTION_MARKER=0;Transaction.ADVANCED_TRANSACTION_FLAG=1;var psbtutils={},varint={};Object.defineProperty(varint,"__esModule",{value:!0});const MAX_SAFE_INTEGER=9007199254740991;function checkUInt53(e){if(e<0||e>MAX_SAFE_INTEGER||e%1!==0)throw new RangeError("value out of range")}function encode(e,t,r){if(checkUInt53(e),t||(t=Buffer$e.allocUnsafe(encodingLength(e))),!Buffer$e.isBuffer(t))throw new TypeError("buffer must be a Buffer instance");return r||(r=0),e<253?(t.writeUInt8(e,r),Object.assign(encode,{bytes:1})):e<=65535?(t.writeUInt8(253,r),t.writeUInt16LE(e,r+1),Object.assign(encode,{bytes:3})):e<=4294967295?(t.writeUInt8(254,r),t.writeUInt32LE(e,r+1),Object.assign(encode,{bytes:5})):(t.writeUInt8(255,r),t.writeUInt32LE(e>>>0,r+1),t.writeUInt32LE(e/4294967296|0,r+5),Object.assign(encode,{bytes:9})),t}varint.encode=encode;function decode(e,t){if(!Buffer$e.isBuffer(e))throw new TypeError("buffer must be a Buffer instance");t||(t=0);const r=e.readUInt8(t);if(r<253)return Object.assign(decode,{bytes:1}),r;if(r===253)return Object.assign(decode,{bytes:3}),e.readUInt16LE(t+1);if(r===254)return Object.assign(decode,{bytes:5}),e.readUInt32LE(t+1);{Object.assign(decode,{bytes:9});const n=e.readUInt32LE(t+1),s=e.readUInt32LE(t+5)*4294967296+n;return checkUInt53(s),s}}varint.decode=decode;function encodingLength(e){return checkUInt53(e),e<253?1:e<=65535?3:e<=4294967295?5:9}varint.encodingLength=encodingLength;var payments$1={},embed={},networks={};Object.defineProperty(networks,"__esModule",{value:!0});networks.testnet=networks.regtest=networks.bitcoin=void 0;networks.bitcoin={messagePrefix:`Bitcoin Signed Message:
|
|
92
|
+
<%s key={someKey} {...props} />`,Lu,Tu,ju,Tu),cu[Tu+Lu]=!0}}return hu===n?tu(Au):ti(Au),Au}}function mu(hu,Pu,Su){return Eu(hu,Pu,Su,!0)}function Ru(hu,Pu,Su){return Eu(hu,Pu,Su,!1)}var Hu=Ru,Bu=mu;V0.Fragment=n,V0.jsx=Hu,V0.jsxs=Bu}()),V0}process$1.env.NODE_ENV==="production"?v2.exports=Ve():v2.exports=Ze();var I=v2.exports;const p0={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1};let Ge=0;function c0(e,t){const r=`atom${++Ge}`,n={toString(){return(p0?"production":void 0)!=="production"&&this.debugLabel?r+":"+this.debugLabel:r}};return typeof e=="function"?n.read=e:(n.init=e,n.read=Ye,n.write=ze),t&&(n.write=t),n}function Ye(e){return e(this)}function ze(e,t,r){return t(this,typeof r=="function"?r(e(this)):r)}const V2=(e,t)=>e.unstable_is?e.unstable_is(t):t===e,h2=e=>"init"in e,m2=e=>!!e.write,i2=new WeakMap,E2=e=>{var t;return _2(e)&&!((t=i2.get(e))!=null&&t[1])},qe=(e,t)=>{const r=i2.get(e);if(r)r[1]=!0,r[0].forEach(n=>n(t));else if((p0?"production":void 0)!=="production")throw new Error("[Bug] cancelable promise not found")},Je=e=>{if(i2.has(e))return;const t=[new Set,!1];i2.set(e,t);const r=()=>{t[1]=!0};e.then(r,r),e.onCancel=n=>{t[0].add(n)}},_2=e=>typeof(e==null?void 0:e.then)=="function",Z2=e=>"v"in e||"e"in e,r2=e=>{if("e"in e)throw e.e;if((p0?"production":void 0)!=="production"&&!("v"in e))throw new Error("[Bug] atom state is not initialized");return e.v},ee=(e,t,r)=>{r.p.has(e)||(r.p.add(e),t.then(()=>{r.p.delete(e)},()=>{r.p.delete(e)}))},G2=(e,t,r,n,o)=>{var s;if((p0?"production":void 0)!=="production"&&n===t)throw new Error("[Bug] atom cannot depend on itself");r.d.set(n,o.n),E2(r.v)&&ee(t,r.v,o),(s=o.m)==null||s.t.add(t),e&&Ke(e,n,t)},j0=()=>[new Map,new Map,new Set],C2=(e,t,r)=>{e[0].has(t)||e[0].set(t,new Set),e[1].set(t,r)},Ke=(e,t,r)=>{const n=e[0].get(t);n&&n.add(r)},Xe=(e,t)=>e[0].get(t),Y2=(e,t)=>{e[2].add(t)},T0=e=>{for(;e[1].size||e[2].size;){e[0].clear();const t=new Set(e[1].values());e[1].clear();const r=new Set(e[2]);e[2].clear(),t.forEach(n=>{var o;return(o=n.m)==null?void 0:o.l.forEach(s=>s())}),r.forEach(n=>n())}},te=e=>{let t;(p0?"production":void 0)!=="production"&&(t=new Set);const r=(v,S,E)=>{const x="v"in S,O=S.v,q=E2(S.v)?S.v:null;if(_2(E)){Je(E);for(const U of S.d.keys())ee(v,E,e(U,S));S.v=E,delete S.e}else S.v=E,delete S.e;(!x||!Object.is(O,S.v))&&(++S.n,q&&qe(q,E))},n=(v,S,E,x)=>{var O;if(Z2(E)&&(E.m&&!(x!=null&&x.has(S))||Array.from(E.d).every(([y,T])=>n(v,y,e(y,E),x).n===T)))return E;E.d.clear();let q=!0;const U=y=>{if(V2(S,y)){const D=e(y,E);if(!Z2(D))if(h2(y))r(y,D,y.init);else throw new Error("no atom init");return r2(D)}const T=n(v,y,e(y,E),x);if(q)G2(v,S,E,y,T);else{const D=j0();G2(D,S,E,y,T),d(D,S,E),T0(D)}return r2(T)};let L,z;const F={get signal(){return L||(L=new AbortController),L.signal},get setSelf(){return(p0?"production":void 0)!=="production"&&!m2(S)&&console.warn("setSelf function cannot be used with read-only atom"),!z&&m2(S)&&(z=(...y)=>{if((p0?"production":void 0)!=="production"&&q&&console.warn("setSelf function cannot be called in sync"),!q)return p(S,...y)}),z}};try{const y=S.read(U,F);if(r(S,E,y),_2(y)){(O=y.onCancel)==null||O.call(y,()=>L==null?void 0:L.abort());const T=()=>{if(E.m){const D=j0();d(D,S,E),T0(D)}};y.then(T,T)}return E}catch(y){return delete E.v,E.e=y,++E.n,E}finally{q=!1}},o=v=>r2(n(void 0,v,e(v))),s=(v,S,E)=>{var x,O;const q=new Map;for(const U of((x=E.m)==null?void 0:x.t)||[])q.set(U,e(U,E));for(const U of E.p)q.set(U,e(U,E));return(O=Xe(v,S))==null||O.forEach(U=>{q.set(U,e(U,E))}),q},a=(v,S,E)=>{const x=[],O=new Set,q=(L,z)=>{if(!O.has(L)){O.add(L);for(const[F,y]of s(v,L,z))L!==F&&q(F,y);x.push([L,z,z.n])}};q(S,E);const U=new Set([S]);for(let L=x.length-1;L>=0;--L){const[z,F,y]=x[L];let T=!1;for(const D of F.d.keys())if(D!==z&&U.has(D)){T=!0;break}T&&(n(v,z,F,O),d(v,z,F),y!==F.n&&(C2(v,z,F),U.add(z))),O.delete(z)}},u=(v,S,E,...x)=>{const O=U=>r2(n(v,U,e(U,E))),q=(U,...L)=>{const z=e(U,E);let F;if(V2(S,U)){if(!h2(U))throw new Error("atom not writable");const y="v"in z,T=z.v,D=L[0];r(U,z,D),d(v,U,z),(!y||!Object.is(T,z.v))&&(C2(v,U,z),a(v,U,z))}else F=u(v,U,z,...L);return T0(v),F};return S.write(O,q,...x)},p=(v,...S)=>{const E=j0(),x=u(E,v,e(v),...S);return T0(E),x},d=(v,S,E)=>{if(E.m&&!E2(E.v)){for(const x of E.d.keys())E.m.d.has(x)||(c(v,x,e(x,E)).t.add(S),E.m.d.add(x));for(const x of E.m.d||[])if(!E.d.has(x)){E.m.d.delete(x);const O=m(v,x,e(x,E));O==null||O.t.delete(S)}}},c=(v,S,E)=>{if(!E.m){n(v,S,E);for(const x of E.d.keys())c(v,x,e(x,E)).t.add(S);if(E.m={l:new Set,d:new Set(E.d.keys()),t:new Set},(p0?"production":void 0)!=="production"&&t.add(S),m2(S)&&S.onMount){const x=E.m,{onMount:O}=S;Y2(v,()=>{const q=O((...U)=>u(v,S,E,...U));q&&(x.u=q)})}}return E.m},m=(v,S,E)=>{if(E.m&&!E.m.l.size&&!Array.from(E.m.t).some(x=>{var O;return(O=e(x,E).m)==null?void 0:O.d.has(S)})){const x=E.m.u;x&&Y2(v,x),delete E.m,(p0?"production":void 0)!=="production"&&t.delete(S);for(const O of E.d.keys()){const q=m(v,O,e(O,E));q==null||q.t.delete(S)}return}return E.m},_={get:o,set:p,sub:(v,S)=>{const E=j0(),x=e(v),O=c(E,v,x);T0(E);const q=O.l;return q.add(S),()=>{q.delete(S);const U=j0();m(U,v,x),T0(U)}},unstable_derive:v=>te(...v(e))};return(p0?"production":void 0)!=="production"&&Object.assign(_,{dev4_get_internal_weak_map:()=>({get:v=>{const S=e(v);if(S.n!==0)return S}}),dev4_get_mounted_atoms:()=>t,dev4_restore_atoms:v=>{const S=j0();for(const[E,x]of v)if(h2(E)){const O=e(E),q="v"in O,U=O.v;r(E,O,x),d(S,E,O),(!q||!Object.is(U,O.v))&&(C2(S,E,O),a(S,E,O))}T0(S)}}),_},re=()=>{const e=new WeakMap;return te(t=>{let r=e.get(t);return r||(r={d:new Map,p:new Set,n:0},e.set(t,r)),r})};let Z0;const Qe=()=>(Z0||(Z0=re(),(p0?"production":void 0)!=="production"&&(globalThis.__JOTAI_DEFAULT_STORE__||(globalThis.__JOTAI_DEFAULT_STORE__=Z0),globalThis.__JOTAI_DEFAULT_STORE__!==Z0&&console.warn("Detected multiple Jotai instances. It may cause unexpected behavior with the default store. https://github.com/pmndrs/jotai/discussions/2044"))),Z0),ne={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1},ie=R2.createContext(void 0),oe=e=>R2.useContext(ie)||Qe(),et=({children:e,store:t})=>{const r=R2.useRef();return!t&&!r.current&&(r.current=re()),R2.createElement(ie.Provider,{value:t||r.current},e)},se=e=>typeof(e==null?void 0:e.then)=="function",tt=e=>{e.status="pending",e.then(t=>{e.status="fulfilled",e.value=t},t=>{e.status="rejected",e.reason=t})},rt=R2.use||(e=>{if(e.status==="pending")throw e;if(e.status==="fulfilled")return e.value;throw e.status==="rejected"?e.reason:(tt(e),e)}),w2=new WeakMap,nt=e=>{let t=w2.get(e);return t||(t=new Promise((r,n)=>{let o=e;const s=p=>d=>{o===p&&r(d)},a=p=>d=>{o===p&&n(d)},u=p=>{"onCancel"in p&&typeof p.onCancel=="function"&&p.onCancel(d=>{if((ne?"production":void 0)!=="production"&&d===p)throw new Error("[Bug] p is not updated even after cancelation");se(d)?(w2.set(d,t),o=d,d.then(s(d),a(d)),u(d)):r(d)})};e.then(s(e),a(e)),u(e)}),w2.set(e,t)),t};function t0(e,t){const r=oe(),[[n,o,s],a]=R2.useReducer(p=>{const d=r.get(e);return Object.is(p[0],d)&&p[1]===r&&p[2]===e?p:[d,r,e]},void 0,()=>[r.get(e),r,e]);let u=n;if((o!==r||s!==e)&&(a(),u=r.get(e)),R2.useEffect(()=>{const p=r.sub(e,()=>{a()});return a(),p},[r,e,void 0]),R2.useDebugValue(u),se(u)){const p=nt(u);return rt(p)}return u}function g0(e,t){const r=oe();return R2.useCallback((...n)=>{if((ne?"production":void 0)!=="production"&&!("write"in e))throw new Error("not writable atom");return r.set(e,...n)},[r,e])}function it(e,t){return[t0(e),g0(e)]}class ot extends Me{constructor(t){var r;const n=(r=we$1(t))==null?void 0:r.injectedTomo,o=n==null?void 0:n.bitcoin;if(!o)throw new Error("Injected Tomo Wallet not found");super(t,o),t2(this,"injectedTomo"),t2(this,"connectWallet",async()=>{var s;const a=(await((s=this.bitcoinNetworkProvider)==null?void 0:s.requestAccounts()))[0],u=await this.getPublicKeyHex();if(!a||!u)throw new Error("Could not connect to injected Wallet");return this}),b2.img=n.info.logo,b2.name=n.info.name,this.injectedTomo=n}getWalletProviderName(){var t,r;return Promise.resolve((r=(t=this.injectedTomo)==null?void 0:t.info)==null?void 0:r.name)}getWalletProviderIcon(){var t,r;return Promise.resolve((r=(t=this.injectedTomo)==null?void 0:t.info)==null?void 0:r.logo)}}class st extends Mt$1{constructor(t){var r;const n=(r=we$1(t))==null?void 0:r.injectedTomo,o=n==null?void 0:n.cosmos;if(!o)throw new Error("Injected Tomo Wallet not found");super(t,o),t2(this,"injectedTomo"),I2.img=n.info.logo,I2.name=n.info.name,this.injectedTomo=n}getWalletProviderName(){var t,r;return Promise.resolve((r=(t=this.injectedTomo)==null?void 0:t.info)==null?void 0:r.name)}getWalletProviderIcon(){var t,r;return Promise.resolve((r=(t=this.injectedTomo)==null?void 0:t.info)==null?void 0:r.logo)}}const b2={id:"bitcoin_tomo_auto",img:"",name:"Tomo Injected",chainType:"bitcoin",connectProvider:ot,type:"injected"},I2={id:"cosmos_tomo_auto",img:"",name:"Tomo Injected",chainType:"cosmos",connectProvider:st,type:"injected"},ce=[b2,I2,..._f,...$f],ct=ce.reduce((e,t)=>(e[t.id]=t,e),{}),ae=ce.map(e=>e.id);function o2(e,t){var r;return((r=t.additionalWallets)==null?void 0:r.find(n=>n.id===e))||ct[e]}function le(e){let t=(e.indexWallets||[]).map(r=>o2(r,e)).filter(r=>!!r);return(!e.indexWallets||e.indexWallets===ae)&&e.additionalWallets&&(t=[...t.filter(r=>{var n;return(n=e.additionalWallets)==null?void 0:n.every(o=>o.id!==r.id)}),...e.additionalWallets]),t}const at="data:image/svg+xml,%3csvg%20width='32'%20height='32'%20viewBox='0%200%2032%2032'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20id='Token'%3e%3cpath%20id='Network%20Icon%20Background'%20d='M16%2032C24.8366%2032%2032%2024.8366%2032%2016C32%207.16344%2024.8366%200%2016%200C7.16344%200%200%207.16344%200%2016C0%2024.8366%207.16344%2032%2016%2032Z'%20fill='%23F7931A'/%3e%3cpath%20id='Vector'%20d='M23.3198%2014.1189C23.6398%2012.1016%2022.0122%2011.0169%2019.7884%2010.2932L20.51%207.55978L18.7489%207.14593L18.0457%209.80711C17.583%209.69739%2017.1081%209.59537%2016.6342%209.49335L17.3425%206.81484L15.5814%206.40002L14.8599%209.13243C14.4767%209.04966%2014.0996%208.96882%2013.7347%208.88219L13.7368%208.87353L11.3071%208.30087L10.8383%2010.0776C10.8383%2010.0776%2012.1459%2010.3605%2012.1184%2010.3778C12.8318%2010.5463%2012.9602%2010.9919%2012.9388%2011.3461L12.1173%2014.4596C12.1663%2014.4712%2012.2295%2014.4885%2012.3008%2014.5145L12.1143%2014.4712L10.9627%2018.833C10.875%2019.037%2010.6539%2019.3441%2010.1545%2019.2276C10.1728%2019.2517%208.87443%2018.9264%208.87443%2018.9264L8%2020.8301L10.2931%2021.37C10.7191%2021.4711%2011.1369%2021.577%2011.5476%2021.6761L10.819%2024.4403L12.579%2024.8541L13.3006%2022.1208C13.7816%2022.243%2014.2484%2022.3566%2014.705%2022.4643L13.9854%2025.1862L15.7465%2025.6L16.4752%2022.8416C19.4796%2023.3787%2021.7381%2023.1621%2022.6889%2020.5962C23.4553%2018.5308%2022.6512%2017.3383%2021.0705%2016.5616C22.2222%2016.3114%2023.0884%2015.5963%2023.3198%2014.1189ZM19.2942%2019.449C18.751%2021.5154%2015.0667%2020.398%2013.8723%2020.1179L14.8405%2016.4557C16.0349%2016.7377%2019.8639%2017.295%2019.2942%2019.449ZM19.8394%2014.0891C19.3431%2015.9687%2016.2775%2015.013%2015.2838%2014.7792L16.1603%2011.4587C17.154%2011.6926%2020.3571%2012.1286%2019.8394%2014.0891Z'%20fill='white'/%3e%3c/g%3e%3c/svg%3e",lt="data:image/svg+xml,%3csvg%20width='40'%20height='40'%20viewBox='0%200%2040%2040'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M20%2040C31.0457%2040%2040%2031.0457%2040%2020C40%208.9543%2031.0457%200%2020%200C8.9543%200%200%208.9543%200%2020C0%2031.0457%208.9543%2040%2020%2040Z'%20fill='%23AE219E'/%3e%3cpath%20d='M29.1497%2017.6486C29.5497%2015.127%2027.5153%2013.7711%2024.7356%2012.8664L25.6375%209.4497L23.4361%208.93238L22.5571%2012.2589C21.9788%2012.1217%2021.3851%2011.9942%2020.7927%2011.8667L21.6781%208.51852L19.4768%208L18.5748%2011.4155C18.0958%2011.312%2017.6245%2011.211%2017.1684%2011.1027L17.171%2011.0919L14.1339%2010.3761L13.5479%2012.5969C13.5479%2012.5969%2015.1824%2012.9506%2015.148%2012.9723C16.0397%2013.1828%2016.2002%2013.7398%2016.1735%2014.1826L15.1467%2018.0745C15.2078%2018.0889%2015.2868%2018.1106%2015.376%2018.1431L15.1429%2018.0889L13.7033%2023.5412C13.5938%2023.7963%2013.3173%2024.1801%2012.6931%2024.0345C12.716%2024.0646%2011.093%2023.6579%2011.093%2023.6579L10%2026.0376L12.8663%2026.7125C13.3988%2026.8388%2013.9212%2026.9712%2014.4346%2027.0951L13.5237%2030.5503L15.7238%2031.0676L16.6257%2027.6509C17.227%2027.8037%2017.8105%2027.9457%2018.3812%2028.0804L17.4818%2031.4827L19.6831%2032L20.594%2028.552C24.3496%2029.2233%2027.1726%2028.9526%2028.3612%2025.7453C29.3192%2023.1635%2028.314%2021.6729%2026.3382%2020.702C27.7777%2020.3892%2028.8605%2019.4953%2029.1497%2017.6486V17.6486ZM24.1177%2024.3112C23.4387%2026.8942%2018.8334%2025.4974%2017.3404%2025.1473L18.5506%2020.5697C20.0437%2020.9222%2024.8298%2021.6187%2024.1177%2024.3112ZM24.7993%2017.6113C24.1788%2019.9609%2020.3469%2018.7663%2019.1048%2018.4739L20.2004%2014.3233C21.4424%2014.6157%2025.4464%2015.1607%2024.7993%2017.6113Z'%20fill='white'/%3e%3c/svg%3e",ut="data:image/svg+xml,%3csvg%20width='1024'%20height='1024'%20viewBox='0%200%201024%201024'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3ccircle%20cx='512'%20cy='512'%20r='512'%20fill='url(%23paint0_radial)'/%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M559.489%20834.999C575.149%20766.673%20586.037%20671.007%20588.667%20562.846L612.66%20563.429C610.005%20672.632%20599.01%20769.997%20582.883%20840.361C574.842%20875.446%20565.383%20904.46%20554.695%20924.986C549.359%20935.233%20543.415%20943.961%20536.702%20950.27C529.942%20956.624%20521.636%20961.2%20512%20961.2C500.94%20961.2%20491.681%20955.206%20484.372%20947.318C477.039%20939.402%20470.522%20928.41%20464.667%20915.38C452.92%20889.241%20442.683%20852.265%20434.371%20807.75L457.963%20803.345C466.127%20847.065%20475.94%20881.915%20486.558%20905.543C491.885%20917.397%20497.13%20925.774%20501.978%20931.006C506.851%20936.266%20510.194%20937.2%20512%20937.2C513.589%20937.2%20516.306%20936.503%20520.265%20932.783C524.27%20929.017%20528.739%20922.868%20533.408%20913.902C542.727%20896.005%20551.637%20869.259%20559.489%20834.999Z'%20fill='url(%23paint1_linear)'/%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M472.024%20159.599C457.662%20209.824%20446.256%20281.346%20440%20365.329L416.066%20363.546C422.388%20278.678%20433.97%20205.382%20448.949%20153.001C456.413%20126.9%20464.908%20105.31%20474.426%2089.9811C483.479%2075.4018%20495.808%2062.8003%20511.998%2062.8003C521.634%2062.8003%20529.94%2067.3757%20536.7%2073.7298C543.412%2080.0394%20549.357%2088.7673%20554.692%2099.0135C565.381%20119.54%20574.839%20148.554%20582.881%20183.639C599.008%20254.003%20610.003%20351.368%20612.657%20460.571L588.665%20461.154C586.035%20352.993%20575.147%20257.327%20559.487%20189.001C551.635%20154.741%20542.725%20127.995%20533.405%20110.098C528.737%20101.132%20524.268%2094.9826%20520.262%2091.2174C516.304%2087.4967%20513.586%2086.8003%20511.998%2086.8003C509.194%2086.8003%20503.102%2089.2971%20494.815%20102.642C486.994%20115.237%20479.231%20134.397%20472.024%20159.599Z'%20fill='url(%23paint2_linear)'/%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M440.002%20365.329C436.591%20411.12%20434.719%20460.503%20434.719%20512C434.719%20624.426%20443.64%20726.638%20457.963%20803.345L434.37%20807.75C419.716%20729.271%20410.719%20625.538%20410.719%20512C410.719%20459.931%20412.611%20409.952%20416.068%20363.546L440.002%20365.329Z'%20fill='url(%23paint3_linear)'/%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M428.801%20552.768C350.948%20505.24%20283.687%20457.047%20233.733%20414.458L218.162%20432.722C269.286%20476.307%20337.624%20525.225%20416.296%20573.252L428.801%20552.768Z'%20fill='url(%23paint4_linear)'/%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M767.494%20714.63C700.498%20694.032%20612.212%20655.633%20517.234%20603.835L505.743%20624.905C601.636%20677.202%20691.446%20716.357%20760.441%20737.57C794.843%20748.147%20824.697%20754.462%20847.816%20755.468C859.356%20755.97%20869.886%20755.186%20878.706%20752.527C887.588%20749.849%20895.703%20744.944%20900.521%20736.6C908.648%20722.523%20903.832%20705.465%20895.658%20690.267C887.059%20674.28%20872.482%20656.027%20853.448%20636.401C815.251%20597.014%20757.103%20550.07%20686.25%20501.935L672.763%20521.787C742.879%20569.422%20799.58%20615.329%20836.219%20653.109C854.604%20672.066%20867.443%20688.477%20874.521%20701.636C882.024%20715.585%20881.146%20722.158%20879.736%20724.6C878.942%20725.975%20876.98%20727.98%20871.779%20729.548C866.516%20731.135%20858.957%20731.93%20848.859%20731.491C828.702%20730.613%20801.087%20724.958%20767.494%20714.63Z'%20fill='url(%23paint5_linear)'/%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M550.142%20445.073C594.052%20470.424%20635.28%20496.323%20672.762%20521.787L686.249%20501.935C648.265%20476.13%20606.54%20449.922%20562.142%20424.288C457.09%20363.637%20356.566%20317.459%20278.943%20291.673C240.225%20278.812%20206.608%20270.82%20180.71%20268.863C167.793%20267.887%20156.102%20268.352%20146.399%20270.883C136.678%20273.419%20127.677%20278.403%20122.483%20287.4C116.91%20297.053%20117.522%20308.162%20120.767%20318.51C124.025%20328.902%20130.394%20340.143%20138.889%20351.844C155.934%20375.32%20183.256%20402.964%20218.161%20432.722L233.731%20414.459C199.44%20385.224%20173.744%20359%20158.31%20337.744C150.567%20327.079%20145.833%20318.237%20143.667%20311.33C141.488%20304.381%20142.358%20300.976%20143.267%20299.4C144.118%20297.927%20146.344%20295.701%20152.457%20294.106C158.588%20292.507%20167.34%20291.921%20178.901%20292.795C201.959%20294.537%20233.439%20301.847%20271.377%20314.45C347.064%20339.592%20446.084%20384.995%20550.142%20445.073Z'%20fill='url(%23paint6_linear)'/%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M520.48%20418.94C601.097%20375.105%20676.844%20340.946%20738.738%20319.198L730.782%20296.555C667.411%20318.822%20590.478%20353.561%20509.016%20397.855L520.48%20418.94Z'%20fill='url(%23paint7_linear)'/%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M208.476%20632.887C259.443%20585.405%20336.327%20528.414%20428.139%20472.245L415.614%20451.773C322.917%20508.484%20244.615%20566.418%20192.116%20615.326C165.939%20639.713%20145.692%20662.301%20133.359%20681.732C127.202%20691.432%20122.654%20700.906%20120.571%20709.841C118.473%20718.842%20118.68%20728.286%20123.48%20736.6C131.596%20750.657%20148.739%20755.021%20165.952%20755.552C184.057%20756.111%20207.098%20752.635%20233.547%20745.995C286.627%20732.669%20356.187%20705.881%20433.135%20668.71L422.696%20647.099C346.549%20683.883%20278.611%20709.937%20227.704%20722.717C202.16%20729.13%20181.585%20732.023%20166.692%20731.564C150.909%20731.077%20145.672%20727.037%20144.265%20724.6C143.473%20723.229%20142.72%20720.542%20143.945%20715.29C145.184%20709.973%20148.241%20703.07%20153.622%20694.593C164.363%20677.669%20182.919%20656.695%20208.476%20632.887Z'%20fill='url(%23paint8_linear)'/%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M551.138%20578.927C506.978%20604.423%20463.696%20627.293%20422.695%20647.099L433.135%20668.709C474.685%20648.638%20518.488%20625.491%20563.138%20599.711C668.19%20539.06%20758.443%20475.093%20819.586%20420.762C850.083%20393.662%20873.812%20368.545%20888.456%20347.094C895.76%20336.397%20901.203%20326.039%20903.862%20316.37C906.527%20306.684%20906.711%20296.397%20901.516%20287.4C896.007%20277.858%20886.239%20272.837%20875.802%20270.442C865.332%20268.039%20852.623%20267.871%20838.494%20269.285C810.15%20272.121%20773.234%20281.637%20730.78%20296.555L738.736%20319.197C780.427%20304.548%20815.286%20295.727%20840.884%20293.166C853.726%20291.881%20863.531%20292.25%20870.433%20293.834C877.369%20295.426%20879.832%20297.842%20880.732%20299.4C881.582%20300.873%20882.398%20303.914%20880.722%20310.005C879.041%20316.115%20875.173%20323.986%20868.635%20333.562C855.597%20352.659%20833.527%20376.267%20803.644%20402.821C744.026%20455.797%20655.196%20518.849%20551.138%20578.927Z'%20fill='url(%23paint9_linear)'/%3e%3ccircle%20cx='449.975'%20cy='804.495'%20r='31.3505'%20fill='white'/%3e%3ccircle%20r='31.3505'%20transform='matrix(0.5%20-0.866025%20-0.866025%20-0.5%20227.181%20419.466)'%20fill='white'/%3e%3ccircle%20r='31.3505'%20transform='matrix(0.5%200.866025%200.866025%20-0.5%20734.794%20312.039)'%20fill='white'/%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M512.012%20457.433C542.156%20457.433%20566.592%20481.869%20566.592%20512.012C566.592%20542.156%20542.156%20566.592%20512.012%20566.592C481.869%20566.592%20457.433%20542.156%20457.433%20512.012C457.433%20481.869%20481.869%20457.433%20512.012%20457.433Z'%20fill='white'/%3e%3cdefs%3e%3cradialGradient%20id='paint0_radial'%20cx='0'%20cy='0'%20r='1'%20gradientUnits='userSpaceOnUse'%20gradientTransform='translate(512%20512)%20rotate(90)%20scale(512)'%3e%3cstop%20offset='0.0909055'%20stop-color='%237C7C7C'/%3e%3cstop%20offset='0.233848'%20stop-color='%233E3E3E'/%3e%3cstop%20offset='0.817221'/%3e%3c/radialGradient%3e%3clinearGradient%20id='paint1_linear'%20x1='523.515'%20y1='961.2'%20x2='639.469'%20y2='570.809'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20offset='0.377307'%20stop-color='white'%20stop-opacity='0.6'/%3e%3cstop%20offset='0.992239'%20stop-color='white'%20stop-opacity='0'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint2_linear'%20x1='514.362'%20y1='62.8003'%20x2='663.926'%20y2='441'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20offset='0.634963'%20stop-color='white'%20stop-opacity='0.81'/%3e%3cstop%20offset='1'%20stop-color='white'%20stop-opacity='0'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint3_linear'%20x1='457.499'%20y1='363.546'%20x2='457.499'%20y2='808.261'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='white'%20stop-opacity='0.81'/%3e%3cstop%20offset='0.646422'%20stop-color='white'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint4_linear'%20x1='234.384'%20y1='411.354'%20x2='430.501'%20y2='549.696'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='white'%20stop-opacity='0.6'/%3e%3cstop%20offset='1'%20stop-color='white'%20stop-opacity='0'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint5_linear'%20x1='923.391'%20y1='735.037'%20x2='488.534'%20y2='662.67'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20offset='0.60731'%20stop-color='white'%20stop-opacity='0.81'/%3e%3cstop%20offset='1'%20stop-color='white'%20stop-opacity='0'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint6_linear'%20x1='674.619'%20y1='497.805'%20x2='110.127'%20y2='288.499'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='white'%20stop-opacity='0.81'/%3e%3cstop%20offset='0.478389'%20stop-color='white'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint7_linear'%20x1='743.225'%20y1='320.878'%20x2='508.048'%20y2='430.154'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='white'%20stop-opacity='0.6'/%3e%3cstop%20offset='1'%20stop-color='white'%20stop-opacity='0'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint8_linear'%20x1='110.421'%20y1='738.194'%20x2='404.819'%20y2='431.181'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20offset='0.54518'%20stop-color='white'%20stop-opacity='0.81'/%3e%3cstop%20offset='1'%20stop-color='white'%20stop-opacity='0'/%3e%3c/linearGradient%3e%3clinearGradient%20id='paint9_linear'%20x1='913.606'%20y1='276.28'%20x2='438.264'%20y2='671.645'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20offset='0.518582'%20stop-color='white'/%3e%3cstop%20offset='1'%20stop-color='white'%20stop-opacity='0.81'/%3e%3c/linearGradient%3e%3c/defs%3e%3c/svg%3e",ft={id:1,name:"Bitcoin",network:"mainnet",type:"bitcoin",logo:at},dt={id:2,name:"Bitcoin Signet",type:"bitcoin",network:"signet",logo:lt},pt={id:1,name:"Cosmos",type:"cosmos",network:"cosmoshub-4",logo:ut},ht=[ft,dt],mt=[pt];var ue={},s2={};s2.byteLength=yt;s2.toByteArray=xt;s2.fromByteArray=_t;var w0=[],u0=[],Ct=typeof Uint8Array<"u"?Uint8Array:Array,y2="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(var O0=0,wt=y2.length;O0<wt;++O0)w0[O0]=y2[O0],u0[y2.charCodeAt(O0)]=O0;u0[45]=62;u0[95]=63;function fe(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");r===-1&&(r=t);var n=r===t?0:4-r%4;return[r,n]}function yt(e){var t=fe(e),r=t[0],n=t[1];return(r+n)*3/4-n}function gt(e,t,r){return(t+r)*3/4-r}function xt(e){var t,r=fe(e),n=r[0],o=r[1],s=new Ct(gt(e,n,o)),a=0,u=o>0?n-4:n,p;for(p=0;p<u;p+=4)t=u0[e.charCodeAt(p)]<<18|u0[e.charCodeAt(p+1)]<<12|u0[e.charCodeAt(p+2)]<<6|u0[e.charCodeAt(p+3)],s[a++]=t>>16&255,s[a++]=t>>8&255,s[a++]=t&255;return o===2&&(t=u0[e.charCodeAt(p)]<<2|u0[e.charCodeAt(p+1)]>>4,s[a++]=t&255),o===1&&(t=u0[e.charCodeAt(p)]<<10|u0[e.charCodeAt(p+1)]<<4|u0[e.charCodeAt(p+2)]>>2,s[a++]=t>>8&255,s[a++]=t&255),s}function vt(e){return w0[e>>18&63]+w0[e>>12&63]+w0[e>>6&63]+w0[e&63]}function Et(e,t,r){for(var n,o=[],s=t;s<r;s+=3)n=(e[s]<<16&16711680)+(e[s+1]<<8&65280)+(e[s+2]&255),o.push(vt(n));return o.join("")}function _t(e){for(var t,r=e.length,n=r%3,o=[],s=16383,a=0,u=r-n;a<u;a+=s)o.push(Et(e,a,a+s>u?u:a+s));return n===1?(t=e[r-1],o.push(w0[t>>2]+w0[t<<4&63]+"==")):n===2&&(t=(e[r-2]<<8)+e[r-1],o.push(w0[t>>10]+w0[t>>4&63]+w0[t<<2&63]+"=")),o.join("")}var F2={};F2.read=function(e,t,r,n,o){var s,a,u=o*8-n-1,p=(1<<u)-1,d=p>>1,c=-7,m=r?o-1:0,_=r?-1:1,v=e[t+m];for(m+=_,s=v&(1<<-c)-1,v>>=-c,c+=u;c>0;s=s*256+e[t+m],m+=_,c-=8);for(a=s&(1<<-c)-1,s>>=-c,c+=n;c>0;a=a*256+e[t+m],m+=_,c-=8);if(s===0)s=1-d;else{if(s===p)return a?NaN:(v?-1:1)*(1/0);a=a+Math.pow(2,n),s=s-d}return(v?-1:1)*a*Math.pow(2,s-n)};F2.write=function(e,t,r,n,o,s){var a,u,p,d=s*8-o-1,c=(1<<d)-1,m=c>>1,_=o===23?Math.pow(2,-24)-Math.pow(2,-77):0,v=n?0:s-1,S=n?1:-1,E=t<0||t===0&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(u=isNaN(t)?1:0,a=c):(a=Math.floor(Math.log(t)/Math.LN2),t*(p=Math.pow(2,-a))<1&&(a--,p*=2),a+m>=1?t+=_/p:t+=_*Math.pow(2,1-m),t*p>=2&&(a++,p/=2),a+m>=c?(u=0,a=c):a+m>=1?(u=(t*p-1)*Math.pow(2,o),a=a+m):(u=t*Math.pow(2,m-1)*Math.pow(2,o),a=0));o>=8;e[r+v]=u&255,v+=S,u/=256,o-=8);for(a=a<<o|u,d+=o;d>0;e[r+v]=a&255,v+=S,a/=256,d-=8);e[r+v-S]|=E*128};(function(e){const t=s2,r=F2,n=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;e.Buffer=u,e.SlowBuffer=q,e.INSPECT_MAX_BYTES=50;const o=2147483647;e.kMaxLength=o,u.TYPED_ARRAY_SUPPORT=s(),!u.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 s(){try{const j=new Uint8Array(1),Y={foo:function(){return 42}};return Object.setPrototypeOf(Y,Uint8Array.prototype),Object.setPrototypeOf(j,Y),j.foo()===42}catch{return!1}}Object.defineProperty(u.prototype,"parent",{enumerable:!0,get:function(){if(u.isBuffer(this))return this.buffer}}),Object.defineProperty(u.prototype,"offset",{enumerable:!0,get:function(){if(u.isBuffer(this))return this.byteOffset}});function a(j){if(j>o)throw new RangeError('The value "'+j+'" is invalid for option "size"');const Y=new Uint8Array(j);return Object.setPrototypeOf(Y,u.prototype),Y}function u(j,Y,be){if(typeof j=="number"){if(typeof Y=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return m(j)}return p(j,Y,be)}u.poolSize=8192;function p(j,Y,be){if(typeof j=="string")return _(j,Y);if(ArrayBuffer.isView(j))return S(j);if(j==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof j);if(_u(j,ArrayBuffer)||j&&_u(j.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(_u(j,SharedArrayBuffer)||j&&_u(j.buffer,SharedArrayBuffer)))return E(j,Y,be);if(typeof j=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');const Q=j.valueOf&&j.valueOf();if(Q!=null&&Q!==j)return u.from(Q,Y,be);const X=x(j);if(X)return X;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof j[Symbol.toPrimitive]=="function")return u.from(j[Symbol.toPrimitive]("string"),Y,be);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof j)}u.from=function(j,Y,be){return p(j,Y,be)},Object.setPrototypeOf(u.prototype,Uint8Array.prototype),Object.setPrototypeOf(u,Uint8Array);function d(j){if(typeof j!="number")throw new TypeError('"size" argument must be of type number');if(j<0)throw new RangeError('The value "'+j+'" is invalid for option "size"')}function c(j,Y,be){return d(j),j<=0?a(j):Y!==void 0?typeof be=="string"?a(j).fill(Y,be):a(j).fill(Y):a(j)}u.alloc=function(j,Y,be){return c(j,Y,be)};function m(j){return d(j),a(j<0?0:O(j)|0)}u.allocUnsafe=function(j){return m(j)},u.allocUnsafeSlow=function(j){return m(j)};function _(j,Y){if((typeof Y!="string"||Y==="")&&(Y="utf8"),!u.isEncoding(Y))throw new TypeError("Unknown encoding: "+Y);const be=U(j,Y)|0;let Q=a(be);const X=Q.write(j,Y);return X!==be&&(Q=Q.slice(0,X)),Q}function v(j){const Y=j.length<0?0:O(j.length)|0,be=a(Y);for(let Q=0;Q<Y;Q+=1)be[Q]=j[Q]&255;return be}function S(j){if(_u(j,Uint8Array)){const Y=new Uint8Array(j);return E(Y.buffer,Y.byteOffset,Y.byteLength)}return v(j)}function E(j,Y,be){if(Y<0||j.byteLength<Y)throw new RangeError('"offset" is outside of buffer bounds');if(j.byteLength<Y+(be||0))throw new RangeError('"length" is outside of buffer bounds');let Q;return Y===void 0&&be===void 0?Q=new Uint8Array(j):be===void 0?Q=new Uint8Array(j,Y):Q=new Uint8Array(j,Y,be),Object.setPrototypeOf(Q,u.prototype),Q}function x(j){if(u.isBuffer(j)){const Y=O(j.length)|0,be=a(Y);return be.length===0||j.copy(be,0,0,Y),be}if(j.length!==void 0)return typeof j.length!="number"||Nu(j.length)?a(0):v(j);if(j.type==="Buffer"&&Array.isArray(j.data))return v(j.data)}function O(j){if(j>=o)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+o.toString(16)+" bytes");return j|0}function q(j){return+j!=j&&(j=0),u.alloc(+j)}u.isBuffer=function(j){return j!=null&&j._isBuffer===!0&&j!==u.prototype},u.compare=function(j,Y){if(_u(j,Uint8Array)&&(j=u.from(j,j.offset,j.byteLength)),_u(Y,Uint8Array)&&(Y=u.from(Y,Y.offset,Y.byteLength)),!u.isBuffer(j)||!u.isBuffer(Y))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(j===Y)return 0;let be=j.length,Q=Y.length;for(let X=0,ke=Math.min(be,Q);X<ke;++X)if(j[X]!==Y[X]){be=j[X],Q=Y[X];break}return be<Q?-1:Q<be?1:0},u.isEncoding=function(j){switch(String(j).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},u.concat=function(j,Y){if(!Array.isArray(j))throw new TypeError('"list" argument must be an Array of Buffers');if(j.length===0)return u.alloc(0);let be;if(Y===void 0)for(Y=0,be=0;be<j.length;++be)Y+=j[be].length;const Q=u.allocUnsafe(Y);let X=0;for(be=0;be<j.length;++be){let ke=j[be];if(_u(ke,Uint8Array))X+ke.length>Q.length?(u.isBuffer(ke)||(ke=u.from(ke)),ke.copy(Q,X)):Uint8Array.prototype.set.call(Q,ke,X);else if(u.isBuffer(ke))ke.copy(Q,X);else throw new TypeError('"list" argument must be an Array of Buffers');X+=ke.length}return Q};function U(j,Y){if(u.isBuffer(j))return j.length;if(ArrayBuffer.isView(j)||_u(j,ArrayBuffer))return j.byteLength;if(typeof j!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof j);const be=j.length,Q=arguments.length>2&&arguments[2]===!0;if(!Q&&be===0)return 0;let X=!1;for(;;)switch(Y){case"ascii":case"latin1":case"binary":return be;case"utf8":case"utf-8":return du(j).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return be*2;case"hex":return be>>>1;case"base64":return $u(j).length;default:if(X)return Q?-1:du(j).length;Y=(""+Y).toLowerCase(),X=!0}}u.byteLength=U;function L(j,Y,be){let Q=!1;if((Y===void 0||Y<0)&&(Y=0),Y>this.length||((be===void 0||be>this.length)&&(be=this.length),be<=0)||(be>>>=0,Y>>>=0,be<=Y))return"";for(j||(j="utf8");;)switch(j){case"hex":return N(this,Y,be);case"utf8":case"utf-8":return w(this,Y,be);case"ascii":return H(this,Y,be);case"latin1":case"binary":return V(this,Y,be);case"base64":return A(this,Y,be);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return b(this,Y,be);default:if(Q)throw new TypeError("Unknown encoding: "+j);j=(j+"").toLowerCase(),Q=!0}}u.prototype._isBuffer=!0;function z(j,Y,be){const Q=j[Y];j[Y]=j[be],j[be]=Q}u.prototype.swap16=function(){const j=this.length;if(j%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let Y=0;Y<j;Y+=2)z(this,Y,Y+1);return this},u.prototype.swap32=function(){const j=this.length;if(j%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let Y=0;Y<j;Y+=4)z(this,Y,Y+3),z(this,Y+1,Y+2);return this},u.prototype.swap64=function(){const j=this.length;if(j%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let Y=0;Y<j;Y+=8)z(this,Y,Y+7),z(this,Y+1,Y+6),z(this,Y+2,Y+5),z(this,Y+3,Y+4);return this},u.prototype.toString=function(){const j=this.length;return j===0?"":arguments.length===0?w(this,0,j):L.apply(this,arguments)},u.prototype.toLocaleString=u.prototype.toString,u.prototype.equals=function(j){if(!u.isBuffer(j))throw new TypeError("Argument must be a Buffer");return this===j?!0:u.compare(this,j)===0},u.prototype.inspect=function(){let j="";const Y=e.INSPECT_MAX_BYTES;return j=this.toString("hex",0,Y).replace(/(.{2})/g,"$1 ").trim(),this.length>Y&&(j+=" ... "),"<Buffer "+j+">"},n&&(u.prototype[n]=u.prototype.inspect),u.prototype.compare=function(j,Y,be,Q,X){if(_u(j,Uint8Array)&&(j=u.from(j,j.offset,j.byteLength)),!u.isBuffer(j))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof j);if(Y===void 0&&(Y=0),be===void 0&&(be=j?j.length:0),Q===void 0&&(Q=0),X===void 0&&(X=this.length),Y<0||be>j.length||Q<0||X>this.length)throw new RangeError("out of range index");if(Q>=X&&Y>=be)return 0;if(Q>=X)return-1;if(Y>=be)return 1;if(Y>>>=0,be>>>=0,Q>>>=0,X>>>=0,this===j)return 0;let ke=X-Q,Jr=be-Y;const eu=Math.min(ke,Jr),vu=this.slice(Q,X),lu=j.slice(Y,be);for(let bu=0;bu<eu;++bu)if(vu[bu]!==lu[bu]){ke=vu[bu],Jr=lu[bu];break}return ke<Jr?-1:Jr<ke?1:0};function F(j,Y,be,Q,X){if(j.length===0)return-1;if(typeof be=="string"?(Q=be,be=0):be>2147483647?be=2147483647:be<-2147483648&&(be=-2147483648),be=+be,Nu(be)&&(be=X?0:j.length-1),be<0&&(be=j.length+be),be>=j.length){if(X)return-1;be=j.length-1}else if(be<0)if(X)be=0;else return-1;if(typeof Y=="string"&&(Y=u.from(Y,Q)),u.isBuffer(Y))return Y.length===0?-1:y(j,Y,be,Q,X);if(typeof Y=="number")return Y=Y&255,typeof Uint8Array.prototype.indexOf=="function"?X?Uint8Array.prototype.indexOf.call(j,Y,be):Uint8Array.prototype.lastIndexOf.call(j,Y,be):y(j,[Y],be,Q,X);throw new TypeError("val must be string, number or Buffer")}function y(j,Y,be,Q,X){let ke=1,Jr=j.length,eu=Y.length;if(Q!==void 0&&(Q=String(Q).toLowerCase(),Q==="ucs2"||Q==="ucs-2"||Q==="utf16le"||Q==="utf-16le")){if(j.length<2||Y.length<2)return-1;ke=2,Jr/=2,eu/=2,be/=2}function vu(bu,ku){return ke===1?bu[ku]:bu.readUInt16BE(ku*ke)}let lu;if(X){let bu=-1;for(lu=be;lu<Jr;lu++)if(vu(j,lu)===vu(Y,bu===-1?0:lu-bu)){if(bu===-1&&(bu=lu),lu-bu+1===eu)return bu*ke}else bu!==-1&&(lu-=lu-bu),bu=-1}else for(be+eu>Jr&&(be=Jr-eu),lu=be;lu>=0;lu--){let bu=!0;for(let ku=0;ku<eu;ku++)if(vu(j,lu+ku)!==vu(Y,ku)){bu=!1;break}if(bu)return lu}return-1}u.prototype.includes=function(j,Y,be){return this.indexOf(j,Y,be)!==-1},u.prototype.indexOf=function(j,Y,be){return F(this,j,Y,be,!0)},u.prototype.lastIndexOf=function(j,Y,be){return F(this,j,Y,be,!1)};function T(j,Y,be,Q){be=Number(be)||0;const X=j.length-be;Q?(Q=Number(Q),Q>X&&(Q=X)):Q=X;const ke=Y.length;Q>ke/2&&(Q=ke/2);let Jr;for(Jr=0;Jr<Q;++Jr){const eu=parseInt(Y.substr(Jr*2,2),16);if(Nu(eu))return Jr;j[be+Jr]=eu}return Jr}function D(j,Y,be,Q){return gu(du(Y,j.length-be),j,be,Q)}function G(j,Y,be,Q){return gu(au(Y),j,be,Q)}function C(j,Y,be,Q){return gu($u(Y),j,be,Q)}function l(j,Y,be,Q){return gu(iu(Y,j.length-be),j,be,Q)}u.prototype.write=function(j,Y,be,Q){if(Y===void 0)Q="utf8",be=this.length,Y=0;else if(be===void 0&&typeof Y=="string")Q=Y,be=this.length,Y=0;else if(isFinite(Y))Y=Y>>>0,isFinite(be)?(be=be>>>0,Q===void 0&&(Q="utf8")):(Q=be,be=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");const X=this.length-Y;if((be===void 0||be>X)&&(be=X),j.length>0&&(be<0||Y<0)||Y>this.length)throw new RangeError("Attempt to write outside buffer bounds");Q||(Q="utf8");let ke=!1;for(;;)switch(Q){case"hex":return T(this,j,Y,be);case"utf8":case"utf-8":return D(this,j,Y,be);case"ascii":case"latin1":case"binary":return G(this,j,Y,be);case"base64":return C(this,j,Y,be);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return l(this,j,Y,be);default:if(ke)throw new TypeError("Unknown encoding: "+Q);Q=(""+Q).toLowerCase(),ke=!0}},u.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function A(j,Y,be){return Y===0&&be===j.length?t.fromByteArray(j):t.fromByteArray(j.slice(Y,be))}function w(j,Y,be){be=Math.min(j.length,be);const Q=[];let X=Y;for(;X<be;){const ke=j[X];let Jr=null,eu=ke>239?4:ke>223?3:ke>191?2:1;if(X+eu<=be){let vu,lu,bu,ku;switch(eu){case 1:ke<128&&(Jr=ke);break;case 2:vu=j[X+1],(vu&192)===128&&(ku=(ke&31)<<6|vu&63,ku>127&&(Jr=ku));break;case 3:vu=j[X+1],lu=j[X+2],(vu&192)===128&&(lu&192)===128&&(ku=(ke&15)<<12|(vu&63)<<6|lu&63,ku>2047&&(ku<55296||ku>57343)&&(Jr=ku));break;case 4:vu=j[X+1],lu=j[X+2],bu=j[X+3],(vu&192)===128&&(lu&192)===128&&(bu&192)===128&&(ku=(ke&15)<<18|(vu&63)<<12|(lu&63)<<6|bu&63,ku>65535&&ku<1114112&&(Jr=ku))}}Jr===null?(Jr=65533,eu=1):Jr>65535&&(Jr-=65536,Q.push(Jr>>>10&1023|55296),Jr=56320|Jr&1023),Q.push(Jr),X+=eu}return P(Q)}const B=4096;function P(j){const Y=j.length;if(Y<=B)return String.fromCharCode.apply(String,j);let be="",Q=0;for(;Q<Y;)be+=String.fromCharCode.apply(String,j.slice(Q,Q+=B));return be}function H(j,Y,be){let Q="";be=Math.min(j.length,be);for(let X=Y;X<be;++X)Q+=String.fromCharCode(j[X]&127);return Q}function V(j,Y,be){let Q="";be=Math.min(j.length,be);for(let X=Y;X<be;++X)Q+=String.fromCharCode(j[X]);return Q}function N(j,Y,be){const Q=j.length;(!Y||Y<0)&&(Y=0),(!be||be<0||be>Q)&&(be=Q);let X="";for(let ke=Y;ke<be;++ke)X+=su[j[ke]];return X}function b(j,Y,be){const Q=j.slice(Y,be);let X="";for(let ke=0;ke<Q.length-1;ke+=2)X+=String.fromCharCode(Q[ke]+Q[ke+1]*256);return X}u.prototype.slice=function(j,Y){const be=this.length;j=~~j,Y=Y===void 0?be:~~Y,j<0?(j+=be,j<0&&(j=0)):j>be&&(j=be),Y<0?(Y+=be,Y<0&&(Y=0)):Y>be&&(Y=be),Y<j&&(Y=j);const Q=this.subarray(j,Y);return Object.setPrototypeOf(Q,u.prototype),Q};function k(j,Y,be){if(j%1!==0||j<0)throw new RangeError("offset is not uint");if(j+Y>be)throw new RangeError("Trying to access beyond buffer length")}u.prototype.readUintLE=u.prototype.readUIntLE=function(j,Y,be){j=j>>>0,Y=Y>>>0,be||k(j,Y,this.length);let Q=this[j],X=1,ke=0;for(;++ke<Y&&(X*=256);)Q+=this[j+ke]*X;return Q},u.prototype.readUintBE=u.prototype.readUIntBE=function(j,Y,be){j=j>>>0,Y=Y>>>0,be||k(j,Y,this.length);let Q=this[j+--Y],X=1;for(;Y>0&&(X*=256);)Q+=this[j+--Y]*X;return Q},u.prototype.readUint8=u.prototype.readUInt8=function(j,Y){return j=j>>>0,Y||k(j,1,this.length),this[j]},u.prototype.readUint16LE=u.prototype.readUInt16LE=function(j,Y){return j=j>>>0,Y||k(j,2,this.length),this[j]|this[j+1]<<8},u.prototype.readUint16BE=u.prototype.readUInt16BE=function(j,Y){return j=j>>>0,Y||k(j,2,this.length),this[j]<<8|this[j+1]},u.prototype.readUint32LE=u.prototype.readUInt32LE=function(j,Y){return j=j>>>0,Y||k(j,4,this.length),(this[j]|this[j+1]<<8|this[j+2]<<16)+this[j+3]*16777216},u.prototype.readUint32BE=u.prototype.readUInt32BE=function(j,Y){return j=j>>>0,Y||k(j,4,this.length),this[j]*16777216+(this[j+1]<<16|this[j+2]<<8|this[j+3])},u.prototype.readBigUInt64LE=yu(function(j){j=j>>>0,Fr(j,"offset");const Y=this[j],be=this[j+7];(Y===void 0||be===void 0)&&zs(j,this.length-8);const Q=Y+this[++j]*2**8+this[++j]*2**16+this[++j]*2**24,X=this[++j]+this[++j]*2**8+this[++j]*2**16+be*2**24;return BigInt(Q)+(BigInt(X)<<BigInt(32))}),u.prototype.readBigUInt64BE=yu(function(j){j=j>>>0,Fr(j,"offset");const Y=this[j],be=this[j+7];(Y===void 0||be===void 0)&&zs(j,this.length-8);const Q=Y*2**24+this[++j]*2**16+this[++j]*2**8+this[++j],X=this[++j]*2**24+this[++j]*2**16+this[++j]*2**8+be;return(BigInt(Q)<<BigInt(32))+BigInt(X)}),u.prototype.readIntLE=function(j,Y,be){j=j>>>0,Y=Y>>>0,be||k(j,Y,this.length);let Q=this[j],X=1,ke=0;for(;++ke<Y&&(X*=256);)Q+=this[j+ke]*X;return X*=128,Q>=X&&(Q-=Math.pow(2,8*Y)),Q},u.prototype.readIntBE=function(j,Y,be){j=j>>>0,Y=Y>>>0,be||k(j,Y,this.length);let Q=Y,X=1,ke=this[j+--Q];for(;Q>0&&(X*=256);)ke+=this[j+--Q]*X;return X*=128,ke>=X&&(ke-=Math.pow(2,8*Y)),ke},u.prototype.readInt8=function(j,Y){return j=j>>>0,Y||k(j,1,this.length),this[j]&128?(255-this[j]+1)*-1:this[j]},u.prototype.readInt16LE=function(j,Y){j=j>>>0,Y||k(j,2,this.length);const be=this[j]|this[j+1]<<8;return be&32768?be|4294901760:be},u.prototype.readInt16BE=function(j,Y){j=j>>>0,Y||k(j,2,this.length);const be=this[j+1]|this[j]<<8;return be&32768?be|4294901760:be},u.prototype.readInt32LE=function(j,Y){return j=j>>>0,Y||k(j,4,this.length),this[j]|this[j+1]<<8|this[j+2]<<16|this[j+3]<<24},u.prototype.readInt32BE=function(j,Y){return j=j>>>0,Y||k(j,4,this.length),this[j]<<24|this[j+1]<<16|this[j+2]<<8|this[j+3]},u.prototype.readBigInt64LE=yu(function(j){j=j>>>0,Fr(j,"offset");const Y=this[j],be=this[j+7];(Y===void 0||be===void 0)&&zs(j,this.length-8);const Q=this[j+4]+this[j+5]*2**8+this[j+6]*2**16+(be<<24);return(BigInt(Q)<<BigInt(32))+BigInt(Y+this[++j]*2**8+this[++j]*2**16+this[++j]*2**24)}),u.prototype.readBigInt64BE=yu(function(j){j=j>>>0,Fr(j,"offset");const Y=this[j],be=this[j+7];(Y===void 0||be===void 0)&&zs(j,this.length-8);const Q=(Y<<24)+this[++j]*2**16+this[++j]*2**8+this[++j];return(BigInt(Q)<<BigInt(32))+BigInt(this[++j]*2**24+this[++j]*2**16+this[++j]*2**8+be)}),u.prototype.readFloatLE=function(j,Y){return j=j>>>0,Y||k(j,4,this.length),r.read(this,j,!0,23,4)},u.prototype.readFloatBE=function(j,Y){return j=j>>>0,Y||k(j,4,this.length),r.read(this,j,!1,23,4)},u.prototype.readDoubleLE=function(j,Y){return j=j>>>0,Y||k(j,8,this.length),r.read(this,j,!0,52,8)},u.prototype.readDoubleBE=function(j,Y){return j=j>>>0,Y||k(j,8,this.length),r.read(this,j,!1,52,8)};function J(j,Y,be,Q,X,ke){if(!u.isBuffer(j))throw new TypeError('"buffer" argument must be a Buffer instance');if(Y>X||Y<ke)throw new RangeError('"value" argument is out of bounds');if(be+Q>j.length)throw new RangeError("Index out of range")}u.prototype.writeUintLE=u.prototype.writeUIntLE=function(j,Y,be,Q){if(j=+j,Y=Y>>>0,be=be>>>0,!Q){const Jr=Math.pow(2,8*be)-1;J(this,j,Y,be,Jr,0)}let X=1,ke=0;for(this[Y]=j&255;++ke<be&&(X*=256);)this[Y+ke]=j/X&255;return Y+be},u.prototype.writeUintBE=u.prototype.writeUIntBE=function(j,Y,be,Q){if(j=+j,Y=Y>>>0,be=be>>>0,!Q){const Jr=Math.pow(2,8*be)-1;J(this,j,Y,be,Jr,0)}let X=be-1,ke=1;for(this[Y+X]=j&255;--X>=0&&(ke*=256);)this[Y+X]=j/ke&255;return Y+be},u.prototype.writeUint8=u.prototype.writeUInt8=function(j,Y,be){return j=+j,Y=Y>>>0,be||J(this,j,Y,1,255,0),this[Y]=j&255,Y+1},u.prototype.writeUint16LE=u.prototype.writeUInt16LE=function(j,Y,be){return j=+j,Y=Y>>>0,be||J(this,j,Y,2,65535,0),this[Y]=j&255,this[Y+1]=j>>>8,Y+2},u.prototype.writeUint16BE=u.prototype.writeUInt16BE=function(j,Y,be){return j=+j,Y=Y>>>0,be||J(this,j,Y,2,65535,0),this[Y]=j>>>8,this[Y+1]=j&255,Y+2},u.prototype.writeUint32LE=u.prototype.writeUInt32LE=function(j,Y,be){return j=+j,Y=Y>>>0,be||J(this,j,Y,4,4294967295,0),this[Y+3]=j>>>24,this[Y+2]=j>>>16,this[Y+1]=j>>>8,this[Y]=j&255,Y+4},u.prototype.writeUint32BE=u.prototype.writeUInt32BE=function(j,Y,be){return j=+j,Y=Y>>>0,be||J(this,j,Y,4,4294967295,0),this[Y]=j>>>24,this[Y+1]=j>>>16,this[Y+2]=j>>>8,this[Y+3]=j&255,Y+4};function De(j,Y,be,Q,X){Z(Y,Q,X,j,be,7);let ke=Number(Y&BigInt(4294967295));j[be++]=ke,ke=ke>>8,j[be++]=ke,ke=ke>>8,j[be++]=ke,ke=ke>>8,j[be++]=ke;let Jr=Number(Y>>BigInt(32)&BigInt(4294967295));return j[be++]=Jr,Jr=Jr>>8,j[be++]=Jr,Jr=Jr>>8,j[be++]=Jr,Jr=Jr>>8,j[be++]=Jr,be}function Ue(j,Y,be,Q,X){Z(Y,Q,X,j,be,7);let ke=Number(Y&BigInt(4294967295));j[be+7]=ke,ke=ke>>8,j[be+6]=ke,ke=ke>>8,j[be+5]=ke,ke=ke>>8,j[be+4]=ke;let Jr=Number(Y>>BigInt(32)&BigInt(4294967295));return j[be+3]=Jr,Jr=Jr>>8,j[be+2]=Jr,Jr=Jr>>8,j[be+1]=Jr,Jr=Jr>>8,j[be]=Jr,be+8}u.prototype.writeBigUInt64LE=yu(function(j,Y=0){return De(this,j,Y,BigInt(0),BigInt("0xffffffffffffffff"))}),u.prototype.writeBigUInt64BE=yu(function(j,Y=0){return Ue(this,j,Y,BigInt(0),BigInt("0xffffffffffffffff"))}),u.prototype.writeIntLE=function(j,Y,be,Q){if(j=+j,Y=Y>>>0,!Q){const eu=Math.pow(2,8*be-1);J(this,j,Y,be,eu-1,-eu)}let X=0,ke=1,Jr=0;for(this[Y]=j&255;++X<be&&(ke*=256);)j<0&&Jr===0&&this[Y+X-1]!==0&&(Jr=1),this[Y+X]=(j/ke>>0)-Jr&255;return Y+be},u.prototype.writeIntBE=function(j,Y,be,Q){if(j=+j,Y=Y>>>0,!Q){const eu=Math.pow(2,8*be-1);J(this,j,Y,be,eu-1,-eu)}let X=be-1,ke=1,Jr=0;for(this[Y+X]=j&255;--X>=0&&(ke*=256);)j<0&&Jr===0&&this[Y+X+1]!==0&&(Jr=1),this[Y+X]=(j/ke>>0)-Jr&255;return Y+be},u.prototype.writeInt8=function(j,Y,be){return j=+j,Y=Y>>>0,be||J(this,j,Y,1,127,-128),j<0&&(j=255+j+1),this[Y]=j&255,Y+1},u.prototype.writeInt16LE=function(j,Y,be){return j=+j,Y=Y>>>0,be||J(this,j,Y,2,32767,-32768),this[Y]=j&255,this[Y+1]=j>>>8,Y+2},u.prototype.writeInt16BE=function(j,Y,be){return j=+j,Y=Y>>>0,be||J(this,j,Y,2,32767,-32768),this[Y]=j>>>8,this[Y+1]=j&255,Y+2},u.prototype.writeInt32LE=function(j,Y,be){return j=+j,Y=Y>>>0,be||J(this,j,Y,4,2147483647,-2147483648),this[Y]=j&255,this[Y+1]=j>>>8,this[Y+2]=j>>>16,this[Y+3]=j>>>24,Y+4},u.prototype.writeInt32BE=function(j,Y,be){return j=+j,Y=Y>>>0,be||J(this,j,Y,4,2147483647,-2147483648),j<0&&(j=4294967295+j+1),this[Y]=j>>>24,this[Y+1]=j>>>16,this[Y+2]=j>>>8,this[Y+3]=j&255,Y+4},u.prototype.writeBigInt64LE=yu(function(j,Y=0){return De(this,j,Y,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),u.prototype.writeBigInt64BE=yu(function(j,Y=0){return Ue(this,j,Y,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function Ks(j,Y,be,Q,X,ke){if(be+Q>j.length)throw new RangeError("Index out of range");if(be<0)throw new RangeError("Index out of range")}function rn(j,Y,be,Q,X){return Y=+Y,be=be>>>0,X||Ks(j,Y,be,4),r.write(j,Y,be,Q,23,4),be+4}u.prototype.writeFloatLE=function(j,Y,be){return rn(this,j,Y,!0,be)},u.prototype.writeFloatBE=function(j,Y,be){return rn(this,j,Y,!1,be)};function Ur(j,Y,be,Q,X){return Y=+Y,be=be>>>0,X||Ks(j,Y,be,8),r.write(j,Y,be,Q,52,8),be+8}u.prototype.writeDoubleLE=function(j,Y,be){return Ur(this,j,Y,!0,be)},u.prototype.writeDoubleBE=function(j,Y,be){return Ur(this,j,Y,!1,be)},u.prototype.copy=function(j,Y,be,Q){if(!u.isBuffer(j))throw new TypeError("argument should be a Buffer");if(be||(be=0),!Q&&Q!==0&&(Q=this.length),Y>=j.length&&(Y=j.length),Y||(Y=0),Q>0&&Q<be&&(Q=be),Q===be||j.length===0||this.length===0)return 0;if(Y<0)throw new RangeError("targetStart out of bounds");if(be<0||be>=this.length)throw new RangeError("Index out of range");if(Q<0)throw new RangeError("sourceEnd out of bounds");Q>this.length&&(Q=this.length),j.length-Y<Q-be&&(Q=j.length-Y+be);const X=Q-be;return this===j&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(Y,be,Q):Uint8Array.prototype.set.call(j,this.subarray(be,Q),Y),X},u.prototype.fill=function(j,Y,be,Q){if(typeof j=="string"){if(typeof Y=="string"?(Q=Y,Y=0,be=this.length):typeof be=="string"&&(Q=be,be=this.length),Q!==void 0&&typeof Q!="string")throw new TypeError("encoding must be a string");if(typeof Q=="string"&&!u.isEncoding(Q))throw new TypeError("Unknown encoding: "+Q);if(j.length===1){const ke=j.charCodeAt(0);(Q==="utf8"&&ke<128||Q==="latin1")&&(j=ke)}}else typeof j=="number"?j=j&255:typeof j=="boolean"&&(j=Number(j));if(Y<0||this.length<Y||this.length<be)throw new RangeError("Out of range index");if(be<=Y)return this;Y=Y>>>0,be=be===void 0?this.length:be>>>0,j||(j=0);let X;if(typeof j=="number")for(X=Y;X<be;++X)this[X]=j;else{const ke=u.isBuffer(j)?j:u.from(j,Q),Jr=ke.length;if(Jr===0)throw new TypeError('The value "'+j+'" is invalid for argument "value"');for(X=0;X<be-Y;++X)this[X+Y]=ke[X%Jr]}return this};const js={};function Gs(j,Y,be){js[j]=class extends be{constructor(){super(),Object.defineProperty(this,"message",{value:Y.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${j}]`,this.stack,delete this.name}get code(){return j}set code(Q){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:Q,writable:!0})}toString(){return`${this.name} [${j}]: ${this.message}`}}}Gs("ERR_BUFFER_OUT_OF_BOUNDS",function(j){return j?`${j} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),Gs("ERR_INVALID_ARG_TYPE",function(j,Y){return`The "${j}" argument must be of type number. Received type ${typeof Y}`},TypeError),Gs("ERR_OUT_OF_RANGE",function(j,Y,be){let Q=`The value of "${j}" is out of range.`,X=be;return Number.isInteger(be)&&Math.abs(be)>2**32?X=je(String(be)):typeof be=="bigint"&&(X=String(be),(be>BigInt(2)**BigInt(32)||be<-(BigInt(2)**BigInt(32)))&&(X=je(X)),X+="n"),Q+=` It must be ${Y}. Received ${X}`,Q},RangeError);function je(j){let Y="",be=j.length;const Q=j[0]==="-"?1:0;for(;be>=Q+4;be-=3)Y=`_${j.slice(be-3,be)}${Y}`;return`${j.slice(0,be)}${Y}`}function Ee(j,Y,be){Fr(Y,"offset"),(j[Y]===void 0||j[Y+be]===void 0)&&zs(Y,j.length-(be+1))}function Z(j,Y,be,Q,X,ke){if(j>be||j<Y){const Jr=typeof Y=="bigint"?"n":"";let eu;throw Y===0||Y===BigInt(0)?eu=`>= 0${Jr} and < 2${Jr} ** ${(ke+1)*8}${Jr}`:eu=`>= -(2${Jr} ** ${(ke+1)*8-1}${Jr}) and < 2 ** ${(ke+1)*8-1}${Jr}`,new js.ERR_OUT_OF_RANGE("value",eu,j)}Ee(Q,X,ke)}function Fr(j,Y){if(typeof j!="number")throw new js.ERR_INVALID_ARG_TYPE(Y,"number",j)}function zs(j,Y,be){throw Math.floor(j)!==j?(Fr(j,be),new js.ERR_OUT_OF_RANGE("offset","an integer",j)):Y<0?new js.ERR_BUFFER_OUT_OF_BOUNDS:new js.ERR_OUT_OF_RANGE("offset",`>= 0 and <= ${Y}`,j)}const Ys=/[^+/0-9A-Za-z-_]/g;function nu(j){if(j=j.split("=")[0],j=j.trim().replace(Ys,""),j.length<2)return"";for(;j.length%4!==0;)j=j+"=";return j}function du(j,Y){Y=Y||1/0;let be;const Q=j.length;let X=null;const ke=[];for(let Jr=0;Jr<Q;++Jr){if(be=j.charCodeAt(Jr),be>55295&&be<57344){if(!X){if(be>56319){(Y-=3)>-1&&ke.push(239,191,189);continue}else if(Jr+1===Q){(Y-=3)>-1&&ke.push(239,191,189);continue}X=be;continue}if(be<56320){(Y-=3)>-1&&ke.push(239,191,189),X=be;continue}be=(X-55296<<10|be-56320)+65536}else X&&(Y-=3)>-1&&ke.push(239,191,189);if(X=null,be<128){if((Y-=1)<0)break;ke.push(be)}else if(be<2048){if((Y-=2)<0)break;ke.push(be>>6|192,be&63|128)}else if(be<65536){if((Y-=3)<0)break;ke.push(be>>12|224,be>>6&63|128,be&63|128)}else if(be<1114112){if((Y-=4)<0)break;ke.push(be>>18|240,be>>12&63|128,be>>6&63|128,be&63|128)}else throw new Error("Invalid code point")}return ke}function au(j){const Y=[];for(let be=0;be<j.length;++be)Y.push(j.charCodeAt(be)&255);return Y}function iu(j,Y){let be,Q,X;const ke=[];for(let Jr=0;Jr<j.length&&!((Y-=2)<0);++Jr)be=j.charCodeAt(Jr),Q=be>>8,X=be%256,ke.push(X),ke.push(Q);return ke}function $u(j){return t.toByteArray(nu(j))}function gu(j,Y,be,Q){let X;for(X=0;X<Q&&!(X+be>=Y.length||X>=j.length);++X)Y[X+be]=j[X];return X}function _u(j,Y){return j instanceof Y||j!=null&&j.constructor!=null&&j.constructor.name!=null&&j.constructor.name===Y.name}function Nu(j){return j!==j}const su=function(){const j="0123456789abcdef",Y=new Array(256);for(let be=0;be<16;++be){const Q=be*16;for(let X=0;X<16;++X)Y[Q+X]=j[be]+j[X]}return Y}();function yu(j){return typeof BigInt>"u"?Ws:j}function Ws(){throw new Error("BigInt not supported")}})(ue);typeof window<"u"&&(window.Buffer=ue.Buffer);const M2=[];function bt(e,t){if(typeof window>"u")return c0(t);const r=localStorage.getItem(e),n=c0(r==="undefined"||r===null?t:JSON.parse(r));return c0(o=>o(n),(o,s,a)=>{let u=a;return typeof a=="function"&&(u=a(o(n))),localStorage.setItem(e,JSON.stringify(u)),s(n,u),u})}const de=["bitcoin","cosmos"],pe={isConnected:!1,bitcoin:{connected:!1,chainType:"bitcoin"},cosmos:{connected:!1,chainType:"cosmos"}},h0=bt("tomo_wallet_state",pe),v0=c0({state:0}),z2=c0(M2),k2=c0([]);c0(e=>e(k2).findLast(t=>t.type==="page"));const It={bitcoinChains:ht,cosmosChains:mt,chainTypes:de,socialTypes:[],indexWallets:ae,onlySocial:!1,useServerSettings:!1},m0=c0(It);c0(void 0);const B2=c0({open:!1,chainType:"bitcoin"}),he=c0(M2),me=c0({theme:"light"});function y0(e,t){const r=R2.useMemo(()=>c0(null,(n,o,...s)=>e(n,o,...s)),[e]);return g0(r)}var T2={exports:{}};(function(e,t){Object.defineProperty(t,"__esModule",{value:!0});function r(y){return typeof y=="object"&&!("toString"in y)?Object.prototype.toString.call(y).slice(8,-1):y}var n=typeof process$1=="object"&&process$1.env.NODE_ENV==="production";function o(y,T){if(!y)throw n?new Error("Invariant failed"):new Error(T())}t.invariant=o;var s=Object.prototype.hasOwnProperty,a=Array.prototype.splice,u=Object.prototype.toString;function p(y){return u.call(y).slice(8,-1)}var d=Object.assign||function(y,T){return c(T).forEach(function(D){s.call(T,D)&&(y[D]=T[D])}),y},c=typeof Object.getOwnPropertySymbols=="function"?function(y){return Object.keys(y).concat(Object.getOwnPropertySymbols(y))}:function(y){return Object.keys(y)};function m(y){return Array.isArray(y)?d(y.constructor(y.length),y):p(y)==="Map"?new Map(y):p(y)==="Set"?new Set(y):y&&typeof y=="object"?d(Object.create(Object.getPrototypeOf(y)),y):y}var _=function(){function y(){this.commands=d({},v),this.update=this.update.bind(this),this.update.extend=this.extend=this.extend.bind(this),this.update.isEquals=function(T,D){return T===D},this.update.newContext=function(){return new y().update}}return Object.defineProperty(y.prototype,"isEquals",{get:function(){return this.update.isEquals},set:function(T){this.update.isEquals=T},enumerable:!0,configurable:!0}),y.prototype.extend=function(T,D){this.commands[T]=D},y.prototype.update=function(T,D){var G=this,C=typeof D=="function"?{$apply:D}:D;Array.isArray(T)&&Array.isArray(C)||o(!Array.isArray(C),function(){return"update(): You provided an invalid spec to update(). The spec may not contain an array except as the value of $set, $push, $unshift, $splice or any custom command allowing an array value."}),o(typeof C=="object"&&C!==null,function(){return"update(): You provided an invalid spec to update(). The spec and every included key path must be plain objects containing one of the "+("following commands: "+Object.keys(G.commands).join(", ")+".")});var l=T;return c(C).forEach(function(A){if(s.call(G.commands,A)){var w=T===l;l=G.commands[A](C[A],l,C,T),w&&G.isEquals(l,T)&&(l=T)}else{var B=p(T)==="Map"?G.update(T.get(A),C[A]):G.update(T[A],C[A]),P=p(l)==="Map"?l.get(A):l[A];(!G.isEquals(B,P)||typeof B>"u"&&!s.call(T,A))&&(l===T&&(l=m(T)),p(l)==="Map"?l.set(A,B):l[A]=B)}}),l},y}();t.Context=_;var v={$push:function(y,T,D){return E(T,D,"$push"),y.length?T.concat(y):T},$unshift:function(y,T,D){return E(T,D,"$unshift"),y.length?y.concat(T):T},$splice:function(y,T,D,G){return O(T,D),y.forEach(function(C){q(C),T===G&&C.length&&(T=m(G)),a.apply(T,C)}),T},$set:function(y,T,D){return L(D),y},$toggle:function(y,T){x(y,"$toggle");var D=y.length?m(T):T;return y.forEach(function(G){D[G]=!T[G]}),D},$unset:function(y,T,D,G){return x(y,"$unset"),y.forEach(function(C){Object.hasOwnProperty.call(T,C)&&(T===G&&(T=m(G)),delete T[C])}),T},$add:function(y,T,D,G){return F(T,"$add"),x(y,"$add"),p(T)==="Map"?y.forEach(function(C){var l=C[0],A=C[1];T===G&&T.get(l)!==A&&(T=m(G)),T.set(l,A)}):y.forEach(function(C){T===G&&!T.has(C)&&(T=m(G)),T.add(C)}),T},$remove:function(y,T,D,G){return F(T,"$remove"),x(y,"$remove"),y.forEach(function(C){T===G&&T.has(C)&&(T=m(G)),T.delete(C)}),T},$merge:function(y,T,D,G){return z(T,y),c(y).forEach(function(C){y[C]!==T[C]&&(T===G&&(T=m(G)),T[C]=y[C])}),T},$apply:function(y,T){return U(y),y(T)}},S=new _;t.isEquals=S.update.isEquals,t.extend=S.extend,t.default=S.update,t.default.default=e.exports=d(t.default,t);function E(y,T,D){o(Array.isArray(y),function(){return"update(): expected target of "+r(D)+" to be an array; got "+r(y)+"."}),x(T[D],D)}function x(y,T){o(Array.isArray(y),function(){return"update(): expected spec of "+r(T)+" to be an array; got "+r(y)+". Did you forget to wrap your parameter in an array?"})}function O(y,T){o(Array.isArray(y),function(){return"Expected $splice target to be an array; got "+r(y)}),q(T.$splice)}function q(y){o(Array.isArray(y),function(){return"update(): expected spec of $splice to be an array of arrays; got "+r(y)+". Did you forget to wrap your parameters in an array?"})}function U(y){o(typeof y=="function",function(){return"update(): expected spec of $apply to be a function; got "+r(y)+"."})}function L(y){o(Object.keys(y).length===1,function(){return"Cannot have more than one key in an object with $set"})}function z(y,T){o(T&&typeof T=="object",function(){return"update(): $merge expects a spec of type 'object'; got "+r(T)}),o(y&&typeof y=="object",function(){return"update(): $merge expects a target of type 'object'; got "+r(y)})}function F(y,T){var D=p(y);o(D==="Map"||D==="Set",function(){return"update(): "+r(T)+" expects a target of type Set or Map; got "+r(D)})}})(T2,T2.exports);var Bt=T2.exports;const N0=He(Bt),Tt=[{wallet:"cosmos_keplr",messageRegex:/There is no modular chain info for/},{wallet:"cosmos_leap",messageRegex:/Invalid chain id/},{wallet:"cosmos_cosmostation",messageRegex:/There is no chain info for/}];function At(e,t){return e[t+"Chains"]}function c2(){const e=g0(h0),t=g0(v0),r=y0(R2.useCallback(async(a,u,p)=>{const{chainType:d}=p,c=await a(v0)[`${d}Provider`].getAddress();e(m=>N0(m,{[d]:{address:{$set:c}}}))},[])),n=y0(R2.useCallback(async(a,u,p,d={})=>{var c;const m=a(v0),_=a(m0),v=a(h0);try{const S=m[`${p}Provider`];if(!S)throw new Error(`Unsupported Chain: ${p}`);try{await S.connectWallet()}catch(O){if(p!=="cosmos"||!((c=S==null?void 0:S.provider)!=null&&c.experimentalSuggestChain))throw O;const q=Tt.find(L=>{var z;return L.wallet===((z=v.cosmos)==null?void 0:z.walletId)});if(!q||!q.messageRegex.test(O.message||""))throw O;const U=_.cosmosChains[0].modularData;if(!U)throw O;await S.provider.experimentalSuggestChain(U),await S.connectWallet()}const E=await S.getNetwork();let x=_[`${p}Chains`].find(O=>O.network===E);if(!x){const O=At(_,p);if(!(O!=null&&O.length))throw new Error("Unsupported network");x=O[0],await o(x);return}await r({chainType:p}),e(O=>N0(O,{[p]:{$merge:{network:E,chainId:x.id}}}))}catch(S){throw S}},[])),o=y0(R2.useCallback(async(a,u,p)=>{const d=a(v0)[`${p.type}Provider`];if(!d||!d.switchNetwork)throw new Error(`switchNetwork error: ${p.type}`);await d.switchNetwork(p.network);const c=await(d==null?void 0:d.getAddress()),m=await(d==null?void 0:d.getNetwork());e(_=>N0(_,{[p.type]:{$merge:{network:m,chainId:p.id,address:c}}}))},[])),s=y0(R2.useCallback((a,u,p)=>{const d=a(m0),c={},m=o2(p,d);if(!m)throw new Error("Wallet does not exist");const _=c[`${m.chainType}Provider`]=new m.connectProvider({chains:d[`${m.chainType}Chains`],...d.providerOptions});return t(v=>({...v,...c})),_},[]));return{initProvider:s,switchChainType:n,switchChain:o,reloadAddress:r,disconnect:y0(R2.useCallback(async(a,u)=>{const p=a(m0);e(Ce(pe,p))},[])),connect:y0(R2.useCallback(async(a,u,p)=>{var d;const c=a(m0);for(const _ of p){const v=o2(_,c);if(!v)throw new Error("Wallet does not exist");e(S=>N0(S,{[v.chainType]:{$merge:{walletId:_}}})),s(_),await n(v.chainType),e(S=>N0(S,{[v.chainType]:{$merge:{connected:!0}}}))}const m=a(h0);(d=c.chainTypes)!=null&&d.every(_=>m[_].connected)&&e(_=>({..._,isConnected:!0}))},[]))}}const Rt=e=>{if(window.ethereum){let t=[];const r=n=>{const o=[n.detail];t=t.concat(o),e(t||[])};window.addEventListener("eip6963:announceProvider",r),window.dispatchEvent(new Event("eip6963:requestProvider")),window.removeEventListener("eip6963:announceProvider",r)}else e([])};function Pt(e){return e?e==null?void 0:e.map(t=>t):[]}function Ce(e,t){let r=e;return t.chainTypes.forEach(n=>{r[n]||(r={...r,[n]:{connected:!1,chainType:n}})}),r}function Lt(e){const t=t0(z2),r=c2(),n=g0(z2);R2.useEffect(()=>{Rt(n)},[]);const o=y0(R2.useCallback(async(s,a)=>{var u,p;const d={...s(m0),...e};de.forEach(_=>{d[`${_}Chains`]=Pt(d[`${_}Chains`])}),a(h0,_=>Ce(_,d)),a(m0,d);const c=()=>{a(h0,_=>{var v;return(v=d.chainTypes)==null||v.forEach(S=>{_=N0(_,{[S]:{connected:{$set:!1}}})}),{..._,isConnected:!1}})},m=s(h0);if((u=d.chainTypes)==null||u.forEach(_=>{const v=m[_].walletId;if(v){const S=o2(v,d);if(S)try{new S.connectProvider({chains:d[`${_}Chains`],...d.providerOptions})}catch{}}}),m.isConnected&&d.autoReconnect!==!1)try{if((p=d.chainTypes)!=null&&p.some(v=>!m[v].connected))throw new Error("chain not connected");const _=d.chainTypes;for(const v of _){const S=m[v].walletId;r.initProvider(S),await r.switchChainType(v,{type:"init"})}}catch{a(h0,_=>({..._,isConnected:!1})),c()}else c();a(v0,_=>({..._,state:1}))},[]));return R2.useEffect(()=>{t!==M2&&o()},[t]),null}function Ft(){const e=t0(v0),t=c2(),r=t0(h0);R2.useEffect(()=>{var n,o;if(!r.bitcoin.connected)return;const s=async()=>{await t.reloadAddress({chainType:"bitcoin"})};return(o=(n=e.bitcoinProvider)==null?void 0:n.on)==null||o.call(n,"accountsChanged",s),()=>{var a,u;(u=(a=e.bitcoinProvider)==null?void 0:a.off)==null||u.call(a,"accountsChanged",s)}},[e.bitcoinProvider,r.bitcoin.connected]),R2.useEffect(()=>{var n,o;if(!r.cosmos.connected)return;const s=async()=>{await t.reloadAddress({chainType:"cosmos"})};return(o=(n=e.cosmosProvider)==null?void 0:n.on)==null||o.call(n,"accountChanged",s),()=>{var a,u;(u=(a=e.cosmosProvider)==null?void 0:a.off)==null||u.call(a,"accountChanged",s)}},[e.cosmosProvider,r.cosmos.connected])}function Mt(e){return I.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",...e,children:I.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M7.41425 6.00025L11.7072 1.70725C12.0982 1.31625 12.0982 0.68425 11.7072 0.29325C11.3162 -0.09775 10.6842 -0.09775 10.2933 0.29325L6.00025 4.58625L1.70725 0.29325C1.31625 -0.09775 0.68425 -0.09775 0.29325 0.29325C-0.09775 0.68425 -0.09775 1.31625 0.29325 1.70725L4.58625 6.00025L0.29325 10.2933C-0.09775 10.6842 -0.09775 11.3162 0.29325 11.7072C0.48825 11.9022 0.74425 12.0002 1.00025 12.0002C1.25625 12.0002 1.51225 11.9022 1.70725 11.7072L6.00025 7.41425L10.2933 11.7072C10.4882 11.9022 10.7443 12.0002 11.0002 12.0002C11.2562 12.0002 11.5122 11.9022 11.7072 11.7072C12.0982 11.3162 12.0982 10.6842 11.7072 10.2933L7.41425 6.00025Z",fill:"currentColor",fillOpacity:"0.4"})})}function we(e){return I.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",...e,children:[I.jsx("g",{clipPath:"url(#clip0_1_1460)",children:I.jsx("path",{d:"M14.6672 7.33284C14.2985 7.33284 14.0001 7.63127 14.0001 8.00002C14.0001 11.3078 11.3079 14 8.00005 14C6.59849 14 5.2813 13.525 4.22661 12.6672H5.33442C5.70317 12.6672 6.00161 12.3688 6.00161 12C6.00161 11.6313 5.70317 11.3328 5.33442 11.3328H2.66724C2.66099 11.3328 2.65474 11.3344 2.64849 11.3344C2.62661 11.3344 2.60474 11.3375 2.58442 11.3406C2.56255 11.3438 2.54067 11.3453 2.5188 11.35C2.50005 11.3547 2.4813 11.361 2.46255 11.3672C2.43911 11.375 2.41724 11.3813 2.39536 11.3922C2.37974 11.4 2.36411 11.4094 2.34849 11.4172C2.32505 11.4297 2.30317 11.4422 2.2813 11.4578C2.27661 11.461 2.27192 11.4625 2.2688 11.4656C2.25786 11.4735 2.25005 11.4844 2.23911 11.4922C2.22036 11.5078 2.20161 11.525 2.18442 11.5422C2.17036 11.5578 2.15786 11.5735 2.1438 11.5906C2.12974 11.6078 2.11724 11.625 2.1063 11.6438C2.0938 11.6625 2.08442 11.6813 2.07505 11.7016C2.06567 11.7203 2.0563 11.7391 2.04849 11.7594C2.04067 11.7813 2.03442 11.8031 2.02817 11.825C2.02349 11.8438 2.01724 11.8625 2.01411 11.8828C2.00942 11.9078 2.00786 11.9344 2.0063 11.961C2.0063 11.9735 2.00317 11.986 2.00317 11.9985V14.6656C2.00317 15.0344 2.30161 15.3328 2.67036 15.3328C3.03911 15.3328 3.33755 15.0344 3.33755 14.6656V13.6594C4.63599 14.736 6.26724 15.3313 8.00474 15.3313C12.0485 15.3313 15.3376 12.0422 15.3376 7.99846C15.3329 7.63127 15.0344 7.33284 14.6672 7.33284ZM8.00005 2.00002C9.40161 2.00002 10.7188 2.47502 11.7735 3.33284H10.6657C10.2969 3.33284 9.99849 3.63127 9.99849 4.00002C9.99849 4.36877 10.2969 4.66721 10.6657 4.66721H13.3329C13.3391 4.66721 13.3438 4.66565 13.3501 4.66565C13.3735 4.66565 13.3954 4.66096 13.4188 4.6594C13.4391 4.65627 13.461 4.65471 13.4813 4.65002C13.5016 4.64534 13.5204 4.63752 13.5407 4.63127C13.5625 4.62346 13.5844 4.61721 13.6063 4.60784C13.6235 4.60002 13.6391 4.59065 13.6547 4.58127C13.6766 4.56877 13.7 4.55627 13.7204 4.54221C13.725 4.53909 13.7297 4.53752 13.7344 4.5344C13.7454 4.52502 13.7547 4.51565 13.7657 4.50627C13.7844 4.49065 13.8016 4.47502 13.8188 4.45784C13.8344 4.44221 13.8469 4.42502 13.8594 4.40784C13.8719 4.39065 13.886 4.37502 13.8969 4.35627C13.9094 4.33752 13.9188 4.31721 13.9282 4.2969C13.9376 4.27815 13.9469 4.2594 13.9532 4.24065C13.961 4.21877 13.9672 4.1969 13.9735 4.17502C13.9782 4.15627 13.9844 4.13752 13.9876 4.11877C13.9922 4.09221 13.9938 4.06565 13.9954 4.04065C13.9954 4.02815 13.9985 4.01721 13.9985 4.00315V1.33284C13.9985 0.964087 13.7001 0.665649 13.3313 0.665649C12.9626 0.665649 12.6641 0.964087 12.6641 1.33284V2.33909C11.3657 1.26252 9.73442 0.667212 7.99692 0.667212C3.9563 0.667212 0.667236 3.95627 0.667236 8.00002C0.667236 8.36877 0.965674 8.66721 1.33442 8.66721C1.70317 8.66721 2.00005 8.36877 2.00005 8.00002C2.00005 4.69221 4.69224 2.00002 8.00005 2.00002Z",fill:"currentColor"})}),I.jsx("defs",{children:I.jsx("clipPath",{id:"clip0_1_1460",children:I.jsx("rect",{width:"16",height:"16",fill:"white"})})})]})}function kt(e){return I.jsx("svg",{viewBox:"64 64 896 896",focusable:"false","data-icon":"check-circle",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true",...e,children:I.jsx("path",{d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm193.5 301.7l-210.6 292a31.8 31.8 0 01-51.7 0L318.5 484.9c-3.8-5.3 0-12.7 6.5-12.7h46.9c10.2 0 19.9 4.9 25.9 13.3l71.2 98.8 157.2-218c6-8.3 15.6-13.3 25.9-13.3H699c6.5 0 10.3 7.4 6.5 12.7z"})})}function Ut(e){return I.jsx("svg",{viewBox:"64 64 896 896",focusable:"false","data-icon":"exclamation-circle",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true",...e,children:I.jsx("path",{d:"M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm-32 232c0-4.4 3.6-8 8-8h48c4.4 0 8 3.6 8 8v272c0 4.4-3.6 8-8 8h-48c-4.4 0-8-3.6-8-8V296zm32 440a48.01 48.01 0 010-96 48.01 48.01 0 010 96z"})})}function St(e){return I.jsx("svg",{fillRule:"evenodd",viewBox:"64 64 896 896",focusable:"false","data-icon":"close-circle",width:"1em",height:"1em",fill:"currentColor","aria-hidden":"true",...e,children:I.jsx("path",{d:"M512 64c247.4 0 448 200.6 448 448S759.4 960 512 960 64 759.4 64 512 264.6 64 512 64zm127.98 274.82h-.04l-.08.06L512 466.75 384.14 338.88c-.04-.05-.06-.06-.08-.06a.12.12 0 00-.07 0c-.03 0-.05.01-.09.05l-45.02 45.02a.2.2 0 00-.05.09.12.12 0 000 .07v.02a.27.27 0 00.06.06L466.75 512 338.88 639.86c-.05.04-.06.06-.06.08a.12.12 0 000 .07c0 .03.01.05.05.09l45.02 45.02a.2.2 0 00.09.05.12.12 0 00.07 0c.02 0 .04-.01.08-.05L512 557.25l127.86 127.87c.04.04.06.05.08.05a.12.12 0 00.07 0c.03 0 .05-.01.09-.05l45.02-45.02a.2.2 0 00.05-.09.12.12 0 000-.07v-.02a.27.27 0 00-.05-.06L557.25 512l127.87-127.86c.04-.04.05-.06.05-.08a.12.12 0 000-.07c0-.03-.01-.05-.05-.09l-45.02-45.02a.2.2 0 00-.09-.05.12.12 0 00-.07 0z"})})}let jt=1;function ye(){const e=g0(k2),t=R2.useContext(A2);return{open:(r,n)=>{const{type:o="page",showClose:s=!0,...a}=n||{},u=jt++,p=new Promise(d=>{e(c=>[...c,{jsx:r,resolve:d,type:o,showClose:s,openPageId:o==="drawer"?t.page.type==="drawer"?t.page.openPageId:t.id:void 0,id:u,opt:a}])});return p._pageId=u,p},close:(r,n)=>{e(o=>{const s=o.find(a=>a.id===r);return s&&s.resolve(n),o.filter(a=>a.id!==r)})}}}const A2=R2.createContext({id:0,page:{}}),q2={getNextState(e,t){return(!e||typeof e=="boolean")&&(e=0),e+t},createFn(e){return async function(t){if(typeof t=="boolean"){e(t?1:-1);return}e(1);let r;try{typeof t=="function"?r=await t():r=await t}catch(n){throw e(-1),n}return e(-1),r}}};function Ot(e=!1){const[t,r]=R2.useState(e);return[!!t,q2.createFn(n=>{r(o=>q2.getNextState(o,n))})]}function Nt(e){const t=ye();R2.useEffect(()=>{if(e){const r=t.open(I.jsx(ge,{}),{type:"drawer",noBg:!0,full:!0,animate:!1});return()=>{t.close(r._pageId)}}},[e])}function ge(){return I.jsx("div",{className:"tm-flex tm-h-full tm-w-full tm-items-center tm-justify-center",children:I.jsx("div",{className:"tm-flex tm-size-16 tm-items-center tm-justify-center tm-rounded-lg tm-bg-white dark:tm-bg-white-dark",children:I.jsx(we,{className:"tm-size-7 tm-animate-spin tm-text-tc1 dark:tm-text-tc1-dark"})})})}const $t="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='38'%20height='16'%20viewBox='0%200%2038%2016'%20fill='none'%3e%3crect%20width='37.0683'%20height='16.0002'%20rx='1.11164'%20fill='%23666666'/%3e%3cpath%20d='M19.946%207.50648C19.5159%207.50648%2019.1206%207.40657%2018.7601%207.20674C18.4039%207.00692%2018.1194%206.72891%2017.9065%206.37271C17.698%206.01216%2017.5938%205.60817%2017.5938%205.16075C17.5938%204.71332%2017.698%204.31151%2017.9065%203.9553C18.1194%203.5991%2018.4039%203.32109%2018.7601%203.12127C19.1206%202.92144%2019.5159%202.82153%2019.946%202.82153C20.376%202.82153%2020.7692%202.92144%2021.1254%203.12127C21.4859%203.32109%2021.7683%203.5991%2021.9724%203.9553C22.181%204.31151%2022.2852%204.71332%2022.2852%205.16075C22.2852%205.60817%2022.181%206.01216%2021.9724%206.37271C21.7639%206.72891%2021.4816%207.00692%2021.1254%207.20674C20.7692%207.40657%2020.376%207.50648%2019.946%207.50648ZM19.946%206.48999C20.3109%206.48999%2020.6019%206.36836%2020.8191%206.1251C21.0407%205.88184%2021.1514%205.56039%2021.1514%205.16075C21.1514%204.75676%2021.0407%204.43531%2020.8191%204.19639C20.6019%203.95313%2020.3109%203.8315%2019.946%203.8315C19.5768%203.8315%2019.2814%203.95096%2019.0598%204.18988C18.8426%204.42879%2018.734%204.75242%2018.734%205.16075C18.734%205.56473%2018.8426%205.88836%2019.0598%206.13162C19.2814%206.37054%2019.5768%206.48999%2019.946%206.48999Z'%20fill='%23121212'/%3e%3cpath%20d='M16.9809%202.88672V7.46089H15.8667V4.71769L14.8437%207.46089H13.9445L12.915%204.71118V7.46089H11.8008V2.88672H13.117L14.4006%206.05345L15.6712%202.88672H16.9809Z'%20fill='%23121212'/%3e%3cpath%20d='M8.84248%207.50648C8.41243%207.50648%208.01713%207.40657%207.65658%207.20674C7.30038%207.00692%207.01585%206.72891%206.803%206.37271C6.59449%206.01216%206.49023%205.60817%206.49023%205.16075C6.49023%204.71332%206.59449%204.31151%206.803%203.9553C7.01585%203.5991%207.30038%203.32109%207.65658%203.12127C8.01713%202.92144%208.41243%202.82153%208.84248%202.82153C9.27253%202.82153%209.66566%202.92144%2010.0219%203.12127C10.3824%203.32109%2010.6648%203.5991%2010.8689%203.9553C11.0774%204.31151%2011.1817%204.71332%2011.1817%205.16075C11.1817%205.60817%2011.0774%206.01216%2010.8689%206.37271C10.6604%206.72891%2010.3781%207.00692%2010.0219%207.20674C9.66566%207.40657%209.27253%207.50648%208.84248%207.50648ZM8.84248%206.48999C9.20737%206.48999%209.49842%206.36836%209.71561%206.1251C9.93715%205.88184%2010.0479%205.56039%2010.0479%205.16075C10.0479%204.75676%209.93715%204.43531%209.71561%204.19639C9.49842%203.95313%209.20737%203.8315%208.84248%203.8315C8.47324%203.8315%208.17786%203.95096%207.95632%204.18988C7.73912%204.42879%207.63052%204.75242%207.63052%205.16075C7.63052%205.56473%207.73912%205.88836%207.95632%206.13162C8.17786%206.37054%208.47324%206.48999%208.84248%206.48999Z'%20fill='%23121212'/%3e%3cpath%20d='M6.12017%202.88672V3.7794H4.90821V7.46089H3.79399V3.7794H2.58203V2.88672H6.12017Z'%20fill='%23121212'/%3e%3cpath%20d='M34.4932%209.06519V9.95787H33.2813V13.6394H32.167V9.95787H30.9551V9.06519H34.4932Z'%20fill='%23121212'/%3e%3cpath%20d='M26.0508%2011.3458C26.0508%2010.894%2026.1485%2010.4922%2026.344%2010.1403C26.5395%209.78411%2026.811%209.50827%2027.1585%209.31279C27.5103%209.11297%2027.9078%209.01306%2028.3509%209.01306C28.8939%209.01306%2029.3587%209.15641%2029.7453%209.44311C30.1319%209.72981%2030.3904%2010.1208%2030.5207%2010.616H29.2957C29.2045%2010.4248%2029.0742%2010.2793%2028.9048%2010.1794C28.7397%2010.0795%2028.5507%2010.0295%2028.3379%2010.0295C27.9947%2010.0295%2027.7167%2010.149%2027.5038%2010.3879C27.291%2010.6268%2027.1846%2010.9461%2027.1846%2011.3458C27.1846%2011.7454%2027.291%2012.0647%2027.5038%2012.3036C27.7167%2012.5425%2027.9947%2012.662%2028.3379%2012.662C28.5507%2012.662%2028.7397%2012.612%2028.9048%2012.5121C29.0742%2012.4122%2029.2045%2012.2667%2029.2957%2012.0755H30.5207C30.3904%2012.5708%2030.1319%2012.9617%2029.7453%2013.2484C29.3587%2013.5308%2028.8939%2013.6719%2028.3509%2013.6719C27.9078%2013.6719%2027.5103%2013.5742%2027.1585%2013.3787C26.811%2013.1789%2026.5395%2012.9031%2026.344%2012.5512C26.1485%2012.1993%2026.0508%2011.7975%2026.0508%2011.3458Z'%20fill='%23121212'/%3e%3cpath%20d='M23.8291%209.95787V10.8831H25.3212V11.7432H23.8291V12.7467H25.5167V13.6394H22.7148V9.06519H25.5167V9.95787H23.8291Z'%20fill='%23121212'/%3e%3cpath%20d='M21.9064%2013.6394H20.7922L18.9287%2010.818V13.6394H17.8145V9.06519H18.9287L20.7922%2011.8996V9.06519H21.9064V13.6394Z'%20fill='%23121212'/%3e%3cpath%20d='M17.008%2013.6394H15.8938L14.0302%2010.818V13.6394H12.916V9.06519H14.0302L15.8938%2011.8996V9.06519H17.008V13.6394Z'%20fill='%23121212'/%3e%3cpath%20d='M9.95576%2013.6849C9.52571%2013.6849%209.13041%2013.585%208.76986%2013.3852C8.41366%2013.1854%208.12913%2012.9074%207.91628%2012.5512C7.70777%2012.1906%207.60352%2011.7866%207.60352%2011.3392C7.60352%2010.8918%207.70777%2010.49%207.91628%2010.1338C8.12913%209.77757%208.41366%209.49955%208.76986%209.29973C9.13041%209.09991%209.52571%209%209.95576%209C10.3858%209%2010.7789%209.09991%2011.1351%209.29973C11.4957%209.49955%2011.778%209.77757%2011.9822%2010.1338C12.1907%2010.49%2012.295%2010.8918%2012.295%2011.3392C12.295%2011.7866%2012.1907%2012.1906%2011.9822%2012.5512C11.7737%2012.9074%2011.4913%2013.1854%2011.1351%2013.3852C10.7789%2013.585%2010.3858%2013.6849%209.95576%2013.6849ZM9.95576%2012.6685C10.3207%2012.6685%2010.6117%2012.5468%2010.8289%2012.3036C11.0504%2012.0603%2011.1612%2011.7389%2011.1612%2011.3392C11.1612%2010.9352%2011.0504%2010.6138%2010.8289%2010.3749C10.6117%2010.1316%2010.3207%2010.01%209.95576%2010.01C9.58653%2010.01%209.29114%2010.1294%209.0696%2010.3683C8.8524%2010.6073%208.7438%2010.9309%208.7438%2011.3392C8.7438%2011.7432%208.8524%2012.0668%209.0696%2012.3101C9.29114%2012.549%209.58653%2012.6685%209.95576%2012.6685Z'%20fill='%23121212'/%3e%3cpath%20d='M2.64062%2011.3458C2.64062%2010.894%202.73836%2010.4922%202.93384%2010.1403C3.12932%209.78411%203.40082%209.50827%203.74833%209.31279C4.10019%209.11297%204.49766%209.01306%204.94074%209.01306C5.48374%209.01306%205.94854%209.15641%206.33515%209.44311C6.72176%209.72981%206.98022%2010.1208%207.11054%2010.616H5.88555C5.79433%2010.4248%205.66401%2010.2793%205.4946%2010.1794C5.32953%2010.0795%205.14056%2010.0295%204.92771%2010.0295C4.58454%2010.0295%204.30653%2010.149%204.09367%2010.3879C3.88082%2010.6268%203.77439%2010.9461%203.77439%2011.3458C3.77439%2011.7454%203.88082%2012.0647%204.09367%2012.3036C4.30653%2012.5425%204.58454%2012.662%204.92771%2012.662C5.14056%2012.662%205.32953%2012.612%205.4946%2012.5121C5.66401%2012.4122%205.79433%2012.2667%205.88555%2012.0755H7.11054C6.98022%2012.5708%206.72176%2012.9617%206.33515%2013.2484C5.94854%2013.5308%205.48374%2013.6719%204.94074%2013.6719C4.49766%2013.6719%204.10019%2013.5742%203.74833%2013.3787C3.40082%2013.1789%203.12932%2012.9031%202.93384%2012.5512C2.73836%2012.1993%202.64062%2011.7975%202.64062%2011.3458Z'%20fill='%23121212'/%3e%3c/svg%3e",Dt="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='38'%20height='16'%20viewBox='0%200%2038%2016'%20fill='none'%3e%3crect%20width='37.0683'%20height='16.0002'%20rx='1.11164'%20fill='black'/%3e%3cpath%20d='M19.946%207.50648C19.5159%207.50648%2019.1206%207.40657%2018.7601%207.20674C18.4039%207.00692%2018.1194%206.72891%2017.9065%206.37271C17.698%206.01216%2017.5938%205.60817%2017.5938%205.16075C17.5938%204.71332%2017.698%204.31151%2017.9065%203.9553C18.1194%203.5991%2018.4039%203.32109%2018.7601%203.12127C19.1206%202.92144%2019.5159%202.82153%2019.946%202.82153C20.376%202.82153%2020.7692%202.92144%2021.1254%203.12127C21.4859%203.32109%2021.7683%203.5991%2021.9724%203.9553C22.181%204.31151%2022.2852%204.71332%2022.2852%205.16075C22.2852%205.60817%2022.181%206.01216%2021.9724%206.37271C21.7639%206.72891%2021.4816%207.00692%2021.1254%207.20674C20.7692%207.40657%2020.376%207.50648%2019.946%207.50648ZM19.946%206.48999C20.3109%206.48999%2020.6019%206.36836%2020.8191%206.1251C21.0407%205.88184%2021.1514%205.56039%2021.1514%205.16075C21.1514%204.75676%2021.0407%204.43531%2020.8191%204.19639C20.6019%203.95313%2020.3109%203.8315%2019.946%203.8315C19.5768%203.8315%2019.2814%203.95096%2019.0598%204.18988C18.8426%204.42879%2018.734%204.75242%2018.734%205.16075C18.734%205.56473%2018.8426%205.88836%2019.0598%206.13162C19.2814%206.37054%2019.5768%206.48999%2019.946%206.48999Z'%20fill='white'/%3e%3cpath%20d='M16.9809%202.88672V7.46089H15.8667V4.71769L14.8437%207.46089H13.9445L12.915%204.71118V7.46089H11.8008V2.88672H13.117L14.4006%206.05345L15.6712%202.88672H16.9809Z'%20fill='white'/%3e%3cpath%20d='M8.84248%207.50648C8.41243%207.50648%208.01713%207.40657%207.65658%207.20674C7.30038%207.00692%207.01585%206.72891%206.803%206.37271C6.59449%206.01216%206.49023%205.60817%206.49023%205.16075C6.49023%204.71332%206.59449%204.31151%206.803%203.9553C7.01585%203.5991%207.30038%203.32109%207.65658%203.12127C8.01713%202.92144%208.41243%202.82153%208.84248%202.82153C9.27253%202.82153%209.66566%202.92144%2010.0219%203.12127C10.3824%203.32109%2010.6648%203.5991%2010.8689%203.9553C11.0774%204.31151%2011.1817%204.71332%2011.1817%205.16075C11.1817%205.60817%2011.0774%206.01216%2010.8689%206.37271C10.6604%206.72891%2010.3781%207.00692%2010.0219%207.20674C9.66566%207.40657%209.27253%207.50648%208.84248%207.50648ZM8.84248%206.48999C9.20737%206.48999%209.49842%206.36836%209.71561%206.1251C9.93715%205.88184%2010.0479%205.56039%2010.0479%205.16075C10.0479%204.75676%209.93715%204.43531%209.71561%204.19639C9.49842%203.95313%209.20737%203.8315%208.84248%203.8315C8.47324%203.8315%208.17786%203.95096%207.95632%204.18988C7.73912%204.42879%207.63052%204.75242%207.63052%205.16075C7.63052%205.56473%207.73912%205.88836%207.95632%206.13162C8.17786%206.37054%208.47324%206.48999%208.84248%206.48999Z'%20fill='white'/%3e%3cpath%20d='M6.12017%202.88672V3.7794H4.90821V7.46089H3.79399V3.7794H2.58203V2.88672H6.12017Z'%20fill='white'/%3e%3cpath%20d='M34.4932%209.06519V9.95787H33.2813V13.6394H32.167V9.95787H30.9551V9.06519H34.4932Z'%20fill='white'/%3e%3cpath%20d='M26.0508%2011.3458C26.0508%2010.894%2026.1485%2010.4922%2026.344%2010.1403C26.5395%209.78411%2026.811%209.50827%2027.1585%209.31279C27.5103%209.11297%2027.9078%209.01306%2028.3509%209.01306C28.8939%209.01306%2029.3587%209.15641%2029.7453%209.44311C30.1319%209.72981%2030.3904%2010.1208%2030.5207%2010.616H29.2957C29.2045%2010.4248%2029.0742%2010.2793%2028.9048%2010.1794C28.7397%2010.0795%2028.5507%2010.0295%2028.3379%2010.0295C27.9947%2010.0295%2027.7167%2010.149%2027.5038%2010.3879C27.291%2010.6268%2027.1846%2010.9461%2027.1846%2011.3458C27.1846%2011.7454%2027.291%2012.0647%2027.5038%2012.3036C27.7167%2012.5425%2027.9947%2012.662%2028.3379%2012.662C28.5507%2012.662%2028.7397%2012.612%2028.9048%2012.5121C29.0742%2012.4122%2029.2045%2012.2667%2029.2957%2012.0755H30.5207C30.3904%2012.5708%2030.1319%2012.9617%2029.7453%2013.2484C29.3587%2013.5308%2028.8939%2013.6719%2028.3509%2013.6719C27.9078%2013.6719%2027.5103%2013.5742%2027.1585%2013.3787C26.811%2013.1789%2026.5395%2012.9031%2026.344%2012.5512C26.1485%2012.1993%2026.0508%2011.7975%2026.0508%2011.3458Z'%20fill='white'/%3e%3cpath%20d='M23.8291%209.95787V10.8831H25.3212V11.7432H23.8291V12.7467H25.5167V13.6394H22.7148V9.06519H25.5167V9.95787H23.8291Z'%20fill='white'/%3e%3cpath%20d='M21.9064%2013.6394H20.7922L18.9287%2010.818V13.6394H17.8145V9.06519H18.9287L20.7922%2011.8996V9.06519H21.9064V13.6394Z'%20fill='white'/%3e%3cpath%20d='M17.008%2013.6394H15.8938L14.0302%2010.818V13.6394H12.916V9.06519H14.0302L15.8938%2011.8996V9.06519H17.008V13.6394Z'%20fill='white'/%3e%3cpath%20d='M9.95576%2013.6849C9.52571%2013.6849%209.13041%2013.585%208.76986%2013.3852C8.41366%2013.1854%208.12913%2012.9074%207.91628%2012.5512C7.70777%2012.1906%207.60352%2011.7866%207.60352%2011.3392C7.60352%2010.8918%207.70777%2010.49%207.91628%2010.1338C8.12913%209.77757%208.41366%209.49955%208.76986%209.29973C9.13041%209.09991%209.52571%209%209.95576%209C10.3858%209%2010.7789%209.09991%2011.1351%209.29973C11.4957%209.49955%2011.778%209.77757%2011.9822%2010.1338C12.1907%2010.49%2012.295%2010.8918%2012.295%2011.3392C12.295%2011.7866%2012.1907%2012.1906%2011.9822%2012.5512C11.7737%2012.9074%2011.4913%2013.1854%2011.1351%2013.3852C10.7789%2013.585%2010.3858%2013.6849%209.95576%2013.6849ZM9.95576%2012.6685C10.3207%2012.6685%2010.6117%2012.5468%2010.8289%2012.3036C11.0504%2012.0603%2011.1612%2011.7389%2011.1612%2011.3392C11.1612%2010.9352%2011.0504%2010.6138%2010.8289%2010.3749C10.6117%2010.1316%2010.3207%2010.01%209.95576%2010.01C9.58653%2010.01%209.29114%2010.1294%209.0696%2010.3683C8.8524%2010.6073%208.7438%2010.9309%208.7438%2011.3392C8.7438%2011.7432%208.8524%2012.0668%209.0696%2012.3101C9.29114%2012.549%209.58653%2012.6685%209.95576%2012.6685Z'%20fill='white'/%3e%3cpath%20d='M2.64062%2011.3458C2.64062%2010.894%202.73836%2010.4922%202.93384%2010.1403C3.12932%209.78411%203.40082%209.50827%203.74833%209.31279C4.10019%209.11297%204.49766%209.01306%204.94074%209.01306C5.48374%209.01306%205.94854%209.15641%206.33515%209.44311C6.72176%209.72981%206.98022%2010.1208%207.11054%2010.616H5.88555C5.79433%2010.4248%205.66401%2010.2793%205.4946%2010.1794C5.32953%2010.0795%205.14056%2010.0295%204.92771%2010.0295C4.58454%2010.0295%204.30653%2010.149%204.09367%2010.3879C3.88082%2010.6268%203.77439%2010.9461%203.77439%2011.3458C3.77439%2011.7454%203.88082%2012.0647%204.09367%2012.3036C4.30653%2012.5425%204.58454%2012.662%204.92771%2012.662C5.14056%2012.662%205.32953%2012.612%205.4946%2012.5121C5.66401%2012.4122%205.79433%2012.2667%205.88555%2012.0755H7.11054C6.98022%2012.5708%206.72176%2012.9617%206.33515%2013.2484C5.94854%2013.5308%205.48374%2013.6719%204.94074%2013.6719C4.49766%2013.6719%204.10019%2013.5742%203.74833%2013.3787C3.40082%2013.1789%203.12932%2012.9031%202.93384%2012.5512C2.73836%2012.1993%202.64062%2011.7975%202.64062%2011.3458Z'%20fill='white'/%3e%3c/svg%3e";function Wt(){const{theme:e}=t0(me);return I.jsxs("div",{className:"tm-flex tm-gap-2 tm-pb-2.5 tm-text-xs tm-text-tc4 dark:tm-text-tc4-dark",children:[I.jsx("div",{children:"Powered by"}),I.jsx("img",{alt:"tomo",src:e==="dark"?$t:Dt})]})}function Ht(){const e=t0(he);return I.jsx("div",{className:"tm-pointer-events-none tm-absolute tm-bottom-20 tm-flex tm-w-full tm-flex-col tm-items-center tm-gap-4",children:[...e].reverse().map(t=>I.jsx(Zt,{msg:t},t.id))})}const Vt={success:I.jsx(kt,{className:"tm-size-4 tm-text-success"}),error:I.jsx(St,{className:"tm-size-4 tm-text-danger"}),warning:I.jsx(Ut,{className:"tm-size-4 tm-text-warning"})};function Zt({msg:e}){const[t,r]=R2.useState(!0),n=xe();return R2.useEffect(()=>{if(t){const o=setTimeout(()=>{n.remove(e.id)},e.duration);return()=>clearTimeout(o)}},[t]),I.jsxs("div",{className:"tm-pointer-events-auto tm-flex tm-max-w-[80%] tm-items-center tm-gap-2 tm-overflow-hidden tm-rounded-lg tm-bg-white tm-px-4 tm-py-2 tm-text-sm dark:tm-bg-white-dark animate__animated animate__fadeInUp animate__faster",onMouseOver:()=>{r(!1)},onMouseLeave:()=>{r(!0)},style:{boxShadow:"0 6px 16px 0 rgba(0, 0, 0, 0.08),0 3px 6px -4px rgba(0, 0, 0, 0.12),0 9px 28px 8px rgba(0, 0, 0, 0.05)"},children:[Vt[e.type||""],I.jsx("div",{className:"tm-flex-1 tm-overflow-hidden",children:e.title})]},e.id)}let Gt=1;function xe(){const e=g0(he);return R2.useMemo(()=>({remove:t=>{e(r=>r.filter(n=>n.id!==t))},removeSameMsg:t=>{e(r=>r.filter(n=>n.title!==t))},show:t=>{e(r=>[...r,{type:"success",...t,id:Gt++}])}}),[])}function Yt(){const e=n=>o=>{typeof o=="string"?o={duration:3e3,title:o,type:n}:o={...o,type:n},t.show(o)},t=xe(),r=n=>{typeof n=="string"&&(n={duration:3e3,title:n}),t.show(n)};return r.success=e("success"),r.warning=e("warning"),r.error=e("error"),r}function zt(){const e=navigator.userAgent;return/(tablet|ipad|playbook|silk)|(android(?!.*mobi))/i.test(e)?"tablet":/Mobile|Android|iP(hone|od)|IEMobile|BlackBerry|Kindle|Silk-Accelerated|(hpw|web)OS|Opera M(obi|ini)/.test(e)?"mobile":"desktop"}function qt({chainType:e}){return I.jsx(Xt,{type:"connect",chainType:e})}function Jt(){const e=c2(),t=t0(m0);return async r=>{try{new r.connectProvider({chains:[],...t.providerOptions})}catch{throw new Error("Wallet not installed")}await e.connect([r.id])}}function pr(e){const t=t0(m0);return R2.useMemo(()=>le(t).filter(r=>e?r.chainType===e:!0),[t,e])}function Kt(e){const t=t0(m0),[r,n]=R2.useState(),o=()=>{const s=le(t);let a=!1;const u=zt()==="desktop";return s.filter(p=>e?p.chainType===e:!0).map(p=>{let d=!0;try{new p.connectProvider({chains:[],...t.providerOptions})}catch{d=!1}if(p.isInstall=d,(p==null?void 0:p.type)==="injected"&&!u)if(d)a=!0;else return null;return p}).filter(p=>p?u?p.isInstall||p.type!=="injected":p.isInstall||!a:!1)};return R2.useEffect(()=>{n(o())},[t,e]),r}function Xt(e){const{chainType:t,type:r}=e,[n,o]=Ot();Nt(n);const s=Jt(),a=Yt(),u=Kt(t)||[];return I.jsxs("div",{className:"tm-relative tm-flex tm-h-[700px] tm-w-[660px] tm-max-w-full tm-max-w-full tm-flex-col tm-justify-start tm-gap-5 tm-overflow-hidden tm-bg-white tm-pt-9 tm-text-tc1 dark:tm-bg-mbg-dark dark:tm-text-tc1-dark",children:[I.jsxs("div",{className:"tm-flex tm-flex-col tm-gap-5 tm-px-6 tm-pb-9",children:[I.jsx("div",{className:"tm-text-[24px]",children:"Select your wallet"}),I.jsxs("div",{children:["Connect a ",I.jsx("span",{className:"tm-capitalize",children:t})," Wallet"]})]}),I.jsx("div",{className:"tm-box-border tm-w-full tm-flex-1 tm-gap-5 tm-overflow-y-auto tm-pb-6 tm-pt-2",children:I.jsx("div",{className:"tm-grid tm-w-full tm-flex-1 tm-grid-cols-1 sm:tm-grid-cols-2 tm-gap-6 tm-px-6",children:u.map(p=>I.jsx(Qt,{wallet:p,onClick:()=>{o(async()=>{try{await s(p)}catch(d){a.error((d==null?void 0:d.message)||"Failed")}})}},`some-${p.id}`))})}),I.jsx("div",{className:"tm-bg-red tm-flex tm-flex-row tm-items-center tm-justify-center tm-text-center",children:I.jsx(Wt,{})})]})}function Qt({wallet:e,...t}){const{onClick:r,checked:n}=t,o=()=>{r&&r()};return I.jsxs("div",{className:n2("tm-flex tm-h-[58px] tm-cursor-pointer tm-justify-between tm-rounded-lg tm-bg-white dark:tm-bg-[#282828] tm-px-2 hover:tm-bg-tc1/5 dark:hover:tm-bg-opacity-60 tm-border tm-border-[rgba(94,96,97,0.30)] tm-transition",{"tm-border tm-border-primary":n}),onClick:o,children:[I.jsxs("div",{className:"tm-flex tm-items-center tm-gap-3.5 ",children:[I.jsx("div",{className:"tm-size-[34px]",children:I.jsx("img",{src:e==null?void 0:e.img,alt:e==null?void 0:e.name,className:"tm-h-full tm-w-full tm-rounded-lg"})}),I.jsx("div",{className:"tm-text-sm",children:e.name})]}),I.jsxs("div",{className:"tm-flex tm-items-center tm-gap-2",children:[e.type==="extension"&&e.isInstall&&I.jsx(g2,{children:"Installed"}),e.type==="qrcode"&&I.jsx(g2,{children:"QR code"}),e.type==="injected"&&I.jsx(g2,{children:"Injected"})]})]})}function g2({children:e}){return I.jsx("div",{className:"tm-rounded-full tm-bg-[#f6f7f3] tm-px-2.5 tm-py-1 tm-text-[10px] tm-text-[#666] dark:tm-bg-[#444] dark:tm-text-white",children:e})}function er({className:e,isModal:t,chainType:r}){var n;const o=t0(k2),s=ye(),a=o.filter(c=>c.type==="page").length,u=o.filter(c=>c.type==="page"),p=((n=u[u.length-1])==null?void 0:n.id)||0,d=o.filter(c=>c.type==="drawer");return I.jsxs("div",{className:n2("tomo-social tm-relative tm-flex tm-max-w-full tm-justify-start tm-overflow-hidden tm-rounded-3xl tm-bg-mbg dark:tm-bg-mbg-dark tm-text-tc1 dark:tm-text-tc1-dark",{"tm-rounded-b-none":t},e),style:{filter:"drop-shadow(0px 2px 5px rgba(0, 0, 0, 0.20))"},children:[I.jsxs("div",{className:"tm-flex tm-max-w-full",style:{transform:`translateX(-${a/(a+1)*100}%)`},children:[I.jsx("div",{className:"tm-h-fit tm-max-w-full tm-overflow-hidden",children:I.jsx(tr,{chainType:r})}),u.map(c=>I.jsx("div",{className:"tm-relative tm-overflow-hidden",children:I.jsx(R2.Suspense,{fallback:I.jsx(ge,{}),children:I.jsx(A2.Provider,{value:{id:c.id,page:c},children:c.jsx})})},c.id))]}),d.map(c=>{var m,_,v,S;const E=p!==c.openPageId;return I.jsx("div",{className:n2("tm-absolute tm-bottom-0 tm-left-0 tm-h-full tm-w-full tm-bg-tc1/70",{"tm-hidden":E,"animate__animated animate__fadeIn animate__faster":((m=c.opt)==null?void 0:m.animate)!==!1}),onClick:()=>{var x;((x=c.opt)==null?void 0:x.maskClosable)!==!1&&s.close(c.id)},children:I.jsx("div",{onClick:x=>{x.stopPropagation()},className:n2("tm-absolute tm-bottom-0 tm-left-0 tm-max-h-full tm-w-full tm-overflow-hidden",{"tm-bg-white dark:tm-bg-white-dark":!((_=c.opt)!=null&&_.noBg),"tm-h-full":(v=c.opt)==null?void 0:v.full,"animate__animated animate__fadeInUp animate__faster":((S=c.opt)==null?void 0:S.animate)!==!1}),children:I.jsx(A2.Provider,{value:{id:c.id,page:c},children:c.jsx})})},c.id)}),I.jsx(Ht,{})]})}function tr({chainType:e}){return t0(v0).state?I.jsx(qt,{chainType:e}):I.jsx("div",{className:"tm-flex tm-h-[700px] tm-w-[660px] tm-items-center tm-justify-center",children:I.jsx(we,{className:"tm-size-6 tm-animate-spin tm-text-tc1 dark:tm-text-tc1-dark"})})}function rr(){const e=t0(h0),t=t0(B2),r=nr(),{connected:n}=e[t.chainType]||{connected:!1};return R2.useEffect(()=>{n&&r.close({walletState:e})},[n,t.open]),t.open?reactDom.createPortal(I.jsx("div",{className:"tomo-social tm-fixed tm-left-0 tm-top-0 tm-z-40 tm-box-border tm-flex tm-h-screen tm-w-screen tm-overflow-auto tm-bg-tc1/30 tm-font-poppins",onClick:()=>{r.close(void 0)},children:I.jsxs("div",{className:"tm-absolute sm:tm-relative sm:tm-m-auto sm:tm-w-auto tm-bottom-0 tm-left-0 tm-w-full tm-overflow-hidden tm-rounded-t-3xl sm:tm-rounded-b-3xl animate__animated animate__fadeInUp animate__faster sm:tm-animate-none",style:{filter:"drop-shadow(0px 4px 20px rgba(0, 0, 0, 0.30))",animationDuration:"0.3s"},onClick:o=>o.stopPropagation(),children:[n?null:I.jsx("div",{className:"tm-absolute tm-right-0 tm-top-3 tm-z-10 tm-cursor-pointer tm-p-4 tm-text-tc1 dark:tm-text-tc1-dark hover:tm-text-opacity-70",onClick:()=>{r.close(void 0)},children:I.jsx(Mt,{})}),I.jsx(er,{isModal:!0,chainType:t.chainType})]})}),document.body):null}function nr(){const e=g0(B2);return{open:y0(R2.useCallback((t,r,n)=>{if(!t(h0)[n].connected)return new Promise(o=>{e({open:!0,resolve:o,chainType:n})})},[])),close:y0(R2.useCallback((t,r,n)=>{var o;const s=t(B2);(o=s.resolve)==null||o.call(s,n),e(a=>({...a,open:!1}))},[]))}}const J2={rounded:"medium",theme:"light",primaryColor:"#121212"},x2={rounded:{sizeList:[["--tms-rounded",4],["--tms-rounded-md",6],["--tms-rounded-lg",8],["--tms-rounded-xl",12],["--tms-rounded-2xl",16],["--tms-rounded-3xl",24],["--tms-rounded-full",9999]],scale:{none:0,small:.5,medium:1,large:2}}};function ir(e){const[t,r]=it(m0),n=g0(me),o={...J2,...e.style},s=e.uiOptions;R2.useEffect(()=>{r(a=>({...a,uiOptions:s}))},[JSON.stringify(s)]),R2.useEffect(()=>{x2.rounded.sizeList.forEach(([a,u])=>{let p=x2.rounded.scale[o==null?void 0:o.rounded];isNaN(p)&&(p=x2.rounded.scale.medium),document.documentElement.style.setProperty(a,`${u*p}px`)})},[o==null?void 0:o.rounded]),R2.useEffect(()=>{(o==null?void 0:o.theme)==="dark"?document.documentElement.classList.add("tm-dark"):document.documentElement.classList.remove("tm-dark"),n({theme:(o==null?void 0:o.theme)==="dark"?"dark":"light"})},[o==null?void 0:o.theme]),R2.useEffect(()=>{const a=!(o!=null&&o.primaryColor)||(o==null?void 0:o.primaryColor.toLowerCase())===J2.primaryColor;document.documentElement.style.setProperty("--tms-colors-primary-btn-text-dark",a?"#121212":"#ffffff"),document.documentElement.style.setProperty("--tms-colors-primary",or(a?"#121212":o.primaryColor)),document.documentElement.style.setProperty("--tms-colors-primary-dark",a?"#ffffffe9":o.primaryColor)},[o==null?void 0:o.primaryColor])}function or(e){if(!/^#?([a-fA-F0-9]{6}|[a-fA-F0-9]{3})$/.test(e))throw new Error("Invalid hex color format");e=e.replace(/^#/,"");let t=parseInt(e,16),r=t>>16&255,n=t>>8&255,o=t&255;return`${r} ${n} ${o}`}function hr({children:e,...t}){return I.jsxs(et,{children:[I.jsx(sr,{otherProps:t}),I.jsx(rr,{}),e]})}function sr({otherProps:e}){return Lt(e),Ft(),ir(e),null}function mr(){return t0(h0)}function Cr(){return t0(v0)}function yr(){const e=c2();return{switchChainType:e.switchChainType,disconnect:e.disconnect,switchChain:e.switchChain}}const ExternalWallets=({chainName:e,onError:t})=>{const r=Jt(),n=Kt(e),o=async s=>{try{await r(s)}catch(a){t==null||t(a)}};return jsxRuntime.jsxs("div",{className:"pt-10 text-accent-primary",children:[jsxRuntime.jsx(coreUi.Text,{className:"mb-4",children:"More wallets with Tomo Connect"}),jsxRuntime.jsx("div",{className:"grid grid-cols-3 md:grid-cols-7 gap-6 items-center justify-between border border-secondary-strokeLight rounded p-6",children:(n||[]).map(s=>jsxRuntime.jsxs("button",{disabled:!s.isInstall,className:tailwindMerge.twJoin("flex flex-col items-center gap-2.5",s.isInstall?"opacity-100":"opacity-50"),onClick:()=>o(s),children:[jsxRuntime.jsx("img",{className:"h-10 w-10 object-contain",src:s.img,alt:s.name}),jsxRuntime.jsx(coreUi.Text,{className:"leading-none whitespace-nowrap",variant:"body2",children:s.name})]},s.id))})]})};class Wallet{constructor({id:t,origin:r,name:n,icon:o,docs:s,networks:a,provider:u,label:p}){Fu(this,"id");Fu(this,"origin");Fu(this,"name");Fu(this,"icon");Fu(this,"docs");Fu(this,"networks");Fu(this,"provider",null);Fu(this,"_label");Fu(this,"account",null);this.id=t,this.origin=r,this.name=n,this.icon=o,this.docs=s,this.networks=a,this.provider=u,this._label=p}get installed(){return!!this.provider}get label(){return this._label??(this.installed?"Installed":"")}async connect(){if(!this.provider)throw Error("Provider not found");await this.provider.connectWallet();const[t,r]=await Promise.all([this.provider.getAddress(),this.provider.getPublicKeyHex()]);return this.account={address:t,publicKeyHex:r},this}clone(){return new Wallet({id:this.id,origin:this.origin,name:this.name,icon:this.icon,docs:this.docs,networks:this.networks,provider:this.provider})}}let createNanoEvents=()=>({emit(e,...t){for(let r=this.events[e]||[],n=0,o=r.length;n<o;n++)r[n](...t)},events:{},on(e,t){var r;return((r=this.events)[e]||(r[e]=[])).push(t),()=>{var n;this.events[e]=(n=this.events[e])==null?void 0:n.filter(o=>t!==o)}}});class WalletConnector{constructor(t,r,n,o,s){Fu(this,"_connectedWallet",null);Fu(this,"_ee",createNanoEvents());this.id=t,this.name=r,this.icon=n,this.wallets=o,this.config=s}get connectedWallet(){return this._connectedWallet}async connect(t){try{const r=typeof t=="string"?this.wallets.find(n=>n.id===t):t;if(!r)throw new Error("Wallet not found");return this._ee.emit("connecting",`Connecting ${r.name}`),await r.connect(),this._connectedWallet=r,this._ee.emit("connect",this._connectedWallet),this.connectedWallet}catch(r){return this._ee.emit("error",r),null}}async disconnect(){this._connectedWallet&&(this._ee.emit("disconnect",this._connectedWallet),this._connectedWallet=null)}clone(){return new WalletConnector(this.id,this.name,this.icon,this.wallets,this.config)}on(t,r){return this._ee.on(t,r)}}var Network=(e=>(e.MAINNET="mainnet",e.TESTNET="testnet",e.SIGNET="signet",e))(Network||{});const defaultWalletGetter=e=>t=>t[e],createWallet=async({metadata:e,context:t,config:r})=>{const{id:n,wallet:o,name:s,icon:a,docs:u="",networks:p=[],createProvider:d,label:c}=e,m={id:n,name:"",icon:"",origin:null,provider:null,docs:u,networks:p,label:c};if(o){const _=typeof o=="string"?defaultWalletGetter(o):o;m.origin=await _(t,r)??null,m.provider=m.origin?d(m.origin,r):null}else m.origin=null,m.provider=d(null,r);return typeof s=="string"?m.name=s??"":m.name=m.origin?await s(m.origin,r):"",typeof a=="string"?m.icon=a??"":m.icon=m.origin?await a(m.origin,r):"",new Wallet(m)},createExternalWallet=({id:e,name:t,icon:r,provider:n})=>new Wallet({id:e,origin:null,name:t,icon:r,docs:"",networks:[Network.MAINNET,Network.SIGNET],provider:n}),createWalletConnector=async({persistent:e,metadata:t,context:r,config:n,accountStorage:o})=>{const s=[],a=e?o.get(t.chain):void 0;for(const c of t.wallets)s.push(await createWallet({metadata:c,context:r,config:n}));const u=s.find(c=>c.id==="injectable"&&c.installed),p=s.filter(c=>c.name.toLowerCase()!==(u==null?void 0:u.name.toLowerCase())||c.id==="injectable"),d=new WalletConnector(t.chain,t.name,t.icon,p,n);return a&&s.some(c=>c.id===a)&&await d.connect(a),d},icon$1="data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='UTF-8'?%3e%3csvg%20id='Layer_1'%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%20800%20800'%3e%3cdefs%3e%3cstyle%3e.cls-1{fill:%23ce6533;fill-rule:evenodd;}%3c/style%3e%3c/defs%3e%3cpath%20class='cls-1'%20d='M66.5,198.56c-3.27-8.85-1.09-18.79,5.58-25.47l90.82-90.82c6.67-6.67,16.62-8.85,25.46-5.59l193.65,71.14c4.76,1.75,7.92,6.28,7.92,11.35v42.4c0,3.21-1.27,6.28-3.54,8.55l-47.14,47.13c-3.33,3.34-8.3,4.43-12.73,2.79l-52.02-19.18-57.16-21.09c-4.83-1.79-9.55,2.92-7.76,7.76l40.27,109.18c1.63,4.43,.55,9.4-2.79,12.73l-41.91,41.89c-4.72,4.72-4.72,12.38,0,17.1l42.13,42.13c3.34,3.34,4.43,8.31,2.79,12.73l-40.27,109.17c-1.79,4.84,2.92,9.55,7.76,7.76l109.18-40.28c4.43-1.63,9.4-.54,12.73,2.79l46.91,46.91c2.27,2.27,3.54,5.34,3.54,8.55v42.41c0,5.06-3.15,9.59-7.9,11.34l-193.42,71.36c-8.85,3.27-18.8,1.08-25.47-5.59l-90.83-90.83c-6.67-6.67-8.85-16.61-5.58-25.47l71.11-192.77c1.99-5.4,1.99-11.34,0-16.74L66.5,198.56Z'/%3e%3cpath%20class='cls-1'%20d='M733.5,601.44c3.27,8.85,1.09,18.79-5.58,25.47l-90.82,90.83c-6.67,6.67-16.61,8.85-25.46,5.59l-193.65-71.14c-4.76-1.75-7.92-6.28-7.92-11.35v-42.4c0-3.21,1.27-6.28,3.54-8.55l47.14-47.13c3.33-3.34,8.3-4.43,12.73-2.79l52.02,19.18,57.16,21.09c4.83,1.79,9.54-2.92,7.76-7.76l-40.27-109.18c-1.63-4.43-.55-9.4,2.79-12.73l41.91-41.89c4.72-4.72,4.72-12.38,0-17.1l-42.13-42.13c-3.34-3.34-4.43-8.31-2.79-12.73l40.27-109.17c1.79-4.84-2.92-9.55-7.76-7.76l-109.18,40.28c-4.43,1.63-9.4,.54-12.73-2.79l-46.91-46.91c-2.27-2.27-3.54-5.34-3.54-8.55v-42.41c0-5.06,3.15-9.59,7.9-11.34l193.42-71.36c8.85-3.27,18.79-1.08,25.47,5.59l90.82,90.83c6.68,6.67,8.86,16.61,5.59,25.47l-71.11,192.77c-2,5.4-2,11.34,0,16.74l71.34,193.37h0Z'/%3e%3c/svg%3e",metadata$b={id:"injectable",name:e=>{var t;return(t=e.getWalletProviderName)==null?void 0:t.call(e)},icon:e=>{var t;return(t=e.getWalletProviderIcon)==null?void 0:t.call(e)},docs:"",wallet:"bbnwallet",createProvider:e=>e,networks:[Network.MAINNET,Network.SIGNET],label:"Injectable"};var build$1={},keplr$1={},build={},currency={};Object.defineProperty(currency,"__esModule",{value:!0});var bech32={};Object.defineProperty(bech32,"__esModule",{value:!0});var bip44={};Object.defineProperty(bip44,"__esModule",{value:!0});var chainInfo={};Object.defineProperty(chainInfo,"__esModule",{value:!0});var wallet={},keplr={};Object.defineProperty(keplr,"__esModule",{value:!0});var eip6963={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.EIP6963EventNames=void 0,function(t){t.Announce="eip6963:announceProvider",t.Request="eip6963:requestProvider"}(e.EIP6963EventNames||(e.EIP6963EventNames={}))})(eip6963);var ethereum$1={};Object.defineProperty(ethereum$1,"__esModule",{value:!0});var starknet={};Object.defineProperty(starknet,"__esModule",{value:!0});(function(e){var t=commonjsGlobal&&commonjsGlobal.__createBinding||(Object.create?function(n,o,s,a){a===void 0&&(a=s);var u=Object.getOwnPropertyDescriptor(o,s);(!u||("get"in u?!o.__esModule:u.writable||u.configurable))&&(u={enumerable:!0,get:function(){return o[s]}}),Object.defineProperty(n,a,u)}:function(n,o,s,a){a===void 0&&(a=s),n[a]=o[s]}),r=commonjsGlobal&&commonjsGlobal.__exportStar||function(n,o){for(var s in n)s!=="default"&&!Object.prototype.hasOwnProperty.call(o,s)&&t(o,n,s)};Object.defineProperty(e,"__esModule",{value:!0}),r(keplr,e),r(eip6963,e),r(ethereum$1,e),r(starknet,e)})(wallet);var window$1={};Object.defineProperty(window$1,"__esModule",{value:!0});var ethereum={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.EthTxStatus=e.EthSignType=void 0,function(t){t.MESSAGE="message",t.TRANSACTION="transaction",t.EIP712="eip-712"}(e.EthSignType||(e.EthSignType={})),function(t){t.Success="0x1",t.Failure="0x0"}(e.EthTxStatus||(e.EthTxStatus={}))})(ethereum);var cosmjs$1={};Object.defineProperty(cosmjs$1,"__esModule",{value:!0});var cosmjsAlt={};Object.defineProperty(cosmjsAlt,"__esModule",{value:!0});var secretjs={};Object.defineProperty(secretjs,"__esModule",{value:!0});var settled={};Object.defineProperty(settled,"__esModule",{value:!0});(function(e){var t=commonjsGlobal&&commonjsGlobal.__createBinding||(Object.create?function(n,o,s,a){a===void 0&&(a=s);var u=Object.getOwnPropertyDescriptor(o,s);(!u||("get"in u?!o.__esModule:u.writable||u.configurable))&&(u={enumerable:!0,get:function(){return o[s]}}),Object.defineProperty(n,a,u)}:function(n,o,s,a){a===void 0&&(a=s),n[a]=o[s]}),r=commonjsGlobal&&commonjsGlobal.__exportStar||function(n,o){for(var s in n)s!=="default"&&!Object.prototype.hasOwnProperty.call(o,s)&&t(o,n,s)};Object.defineProperty(e,"__esModule",{value:!0}),r(currency,e),r(bech32,e),r(bip44,e),r(chainInfo,e),r(wallet,e),r(window$1,e),r(ethereum,e),r(cosmjs$1,e),r(cosmjsAlt,e),r(secretjs,e),r(settled,e)})(build);var uint8Array={},hex={};Object.defineProperty(hex,"__esModule",{value:!0});hex.fromHex=hex.toHex=void 0;function toHex(e){let t="";for(const r of e)t+=("0"+r.toString(16)).slice(-2);return t}hex.toHex=toHex;function fromHex(e){if(e.length%2!==0)throw new Error("hex string length must be a multiple of 2");const t=[];for(let r=0;r<e.length;r+=2){const n=e.substr(r,2);if(!n.match(/[0-9a-f]{2}/i))throw new Error("hex string contains invalid characters");t.push(parseInt(n,16))}return new Uint8Array(t)}hex.fromHex=fromHex;Object.defineProperty(uint8Array,"__esModule",{value:!0});uint8Array.JSONUint8Array=void 0;const hex_1=hex;class JSONUint8Array{static parse(t){return JSON.parse(t,(r,n)=>{if(r==="__proto__")throw new Error("__proto__ is disallowed");return n&&typeof n=="string"&&n.startsWith("__uint8array__")?(0,hex_1.fromHex)(n.replace("__uint8array__","")):typeof BigInt<"u"&&n&&typeof n=="string"&&n.startsWith("__bigint__")?BigInt(n.replace("__bigint__","")):n})}static stringify(t){return JSON.stringify(t,(r,n)=>{if(r==="__proto__")throw new Error("__proto__ is disallowed");if(n&&(n instanceof Uint8Array||typeof n=="object"&&"type"in n&&"data"in n&&n.type==="Buffer"&&Array.isArray(n.data))){const o=n instanceof Uint8Array?n:new Uint8Array(n.data);return`__uint8array__${(0,hex_1.toHex)(o)}`}return typeof n=="bigint"?`__bigint__${n.toString()}`:n})}static wrap(t){if(t!==void 0)return JSON.parse(JSONUint8Array.stringify(t))}static unwrap(t){if(t!==void 0)return JSONUint8Array.parse(JSONUint8Array.stringify(t))}}uint8Array.JSONUint8Array=JSONUint8Array;var isMergeableObject=function e(t){return isNonNullObject(t)&&!isSpecial(t)};function isNonNullObject(e){return!!e&&typeof e=="object"}function isSpecial(e){var t=Object.prototype.toString.call(e);return t==="[object RegExp]"||t==="[object Date]"||isReactElement(e)}var canUseSymbol=typeof Symbol=="function"&&Symbol.for,REACT_ELEMENT_TYPE=canUseSymbol?Symbol.for("react.element"):60103;function isReactElement(e){return e.$$typeof===REACT_ELEMENT_TYPE}function emptyTarget(e){return Array.isArray(e)?[]:{}}function cloneUnlessOtherwiseSpecified(e,t){return t.clone!==!1&&t.isMergeableObject(e)?deepmerge(emptyTarget(e),e,t):e}function defaultArrayMerge(e,t,r){return e.concat(t).map(function(n){return cloneUnlessOtherwiseSpecified(n,r)})}function getMergeFunction(e,t){if(!t.customMerge)return deepmerge;var r=t.customMerge(e);return typeof r=="function"?r:deepmerge}function getEnumerableOwnPropertySymbols(e){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(e).filter(function(t){return Object.propertyIsEnumerable.call(e,t)}):[]}function getKeys(e){return Object.keys(e).concat(getEnumerableOwnPropertySymbols(e))}function propertyIsOnObject(e,t){try{return t in e}catch{return!1}}function propertyIsUnsafe(e,t){return propertyIsOnObject(e,t)&&!(Object.hasOwnProperty.call(e,t)&&Object.propertyIsEnumerable.call(e,t))}function mergeObject(e,t,r){var n={};return r.isMergeableObject(e)&&getKeys(e).forEach(function(o){n[o]=cloneUnlessOtherwiseSpecified(e[o],r)}),getKeys(t).forEach(function(o){propertyIsUnsafe(e,o)||(propertyIsOnObject(e,o)&&r.isMergeableObject(t[o])?n[o]=getMergeFunction(o,r)(e[o],t[o],r):n[o]=cloneUnlessOtherwiseSpecified(t[o],r))}),n}function deepmerge(e,t,r){r=r||{},r.arrayMerge=r.arrayMerge||defaultArrayMerge,r.isMergeableObject=r.isMergeableObject||isMergeableObject,r.cloneUnlessOtherwiseSpecified=cloneUnlessOtherwiseSpecified;var n=Array.isArray(t),o=Array.isArray(e),s=n===o;return s?n?r.arrayMerge(e,t,r):mergeObject(e,t,r):cloneUnlessOtherwiseSpecified(t,r)}deepmerge.all=function e(t,r){if(!Array.isArray(t))throw new Error("first argument should be an array");return t.reduce(function(n,o){return deepmerge(n,o,r)},{})};var deepmerge_1$1=deepmerge,cjs=deepmerge_1$1,long=Long,wasm=null;try{wasm=new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([0,97,115,109,1,0,0,0,1,13,2,96,0,1,127,96,4,127,127,127,127,1,127,3,7,6,0,1,1,1,1,1,6,6,1,127,1,65,0,11,7,50,6,3,109,117,108,0,1,5,100,105,118,95,115,0,2,5,100,105,118,95,117,0,3,5,114,101,109,95,115,0,4,5,114,101,109,95,117,0,5,8,103,101,116,95,104,105,103,104,0,0,10,191,1,6,4,0,35,0,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,126,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,127,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,128,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,129,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,130,34,4,66,32,135,167,36,0,32,4,167,11])),{}).exports}catch(e){}function Long(e,t,r){this.low=e|0,this.high=t|0,this.unsigned=!!r}Long.prototype.__isLong__;Object.defineProperty(Long.prototype,"__isLong__",{value:!0});function isLong(e){return(e&&e.__isLong__)===!0}Long.isLong=isLong;var INT_CACHE={},UINT_CACHE={};function fromInt(e,t){var r,n,o;return t?(e>>>=0,(o=0<=e&&e<256)&&(n=UINT_CACHE[e],n)?n:(r=fromBits(e,(e|0)<0?-1:0,!0),o&&(UINT_CACHE[e]=r),r)):(e|=0,(o=-128<=e&&e<128)&&(n=INT_CACHE[e],n)?n:(r=fromBits(e,e<0?-1:0,!1),o&&(INT_CACHE[e]=r),r))}Long.fromInt=fromInt;function fromNumber(e,t){if(isNaN(e))return t?UZERO:ZERO$2;if(t){if(e<0)return UZERO;if(e>=TWO_PWR_64_DBL)return MAX_UNSIGNED_VALUE}else{if(e<=-TWO_PWR_63_DBL)return MIN_VALUE;if(e+1>=TWO_PWR_63_DBL)return MAX_VALUE}return e<0?fromNumber(-e,t).neg():fromBits(e%TWO_PWR_32_DBL|0,e/TWO_PWR_32_DBL|0,t)}Long.fromNumber=fromNumber;function fromBits(e,t,r){return new Long(e,t,r)}Long.fromBits=fromBits;var pow_dbl=Math.pow;function fromString(e,t,r){if(e.length===0)throw Error("empty string");if(e==="NaN"||e==="Infinity"||e==="+Infinity"||e==="-Infinity")return ZERO$2;if(typeof t=="number"?(r=t,t=!1):t=!!t,r=r||10,r<2||36<r)throw RangeError("radix");var n;if((n=e.indexOf("-"))>0)throw Error("interior hyphen");if(n===0)return fromString(e.substring(1),t,r).neg();for(var o=fromNumber(pow_dbl(r,8)),s=ZERO$2,a=0;a<e.length;a+=8){var u=Math.min(8,e.length-a),p=parseInt(e.substring(a,a+u),r);if(u<8){var d=fromNumber(pow_dbl(r,u));s=s.mul(d).add(fromNumber(p))}else s=s.mul(o),s=s.add(fromNumber(p))}return s.unsigned=t,s}Long.fromString=fromString;function fromValue(e,t){return typeof e=="number"?fromNumber(e,t):typeof e=="string"?fromString(e,t):fromBits(e.low,e.high,typeof t=="boolean"?t:e.unsigned)}Long.fromValue=fromValue;var TWO_PWR_16_DBL=65536,TWO_PWR_24_DBL=1<<24,TWO_PWR_32_DBL=TWO_PWR_16_DBL*TWO_PWR_16_DBL,TWO_PWR_64_DBL=TWO_PWR_32_DBL*TWO_PWR_32_DBL,TWO_PWR_63_DBL=TWO_PWR_64_DBL/2,TWO_PWR_24=fromInt(TWO_PWR_24_DBL),ZERO$2=fromInt(0);Long.ZERO=ZERO$2;var UZERO=fromInt(0,!0);Long.UZERO=UZERO;var ONE$1=fromInt(1);Long.ONE=ONE$1;var UONE=fromInt(1,!0);Long.UONE=UONE;var NEG_ONE=fromInt(-1);Long.NEG_ONE=NEG_ONE;var MAX_VALUE=fromBits(-1,2147483647,!1);Long.MAX_VALUE=MAX_VALUE;var MAX_UNSIGNED_VALUE=fromBits(-1,-1,!0);Long.MAX_UNSIGNED_VALUE=MAX_UNSIGNED_VALUE;var MIN_VALUE=fromBits(0,-2147483648,!1);Long.MIN_VALUE=MIN_VALUE;var LongPrototype=Long.prototype;LongPrototype.toInt=function e(){return this.unsigned?this.low>>>0:this.low};LongPrototype.toNumber=function e(){return this.unsigned?(this.high>>>0)*TWO_PWR_32_DBL+(this.low>>>0):this.high*TWO_PWR_32_DBL+(this.low>>>0)};LongPrototype.toString=function e(t){if(t=t||10,t<2||36<t)throw RangeError("radix");if(this.isZero())return"0";if(this.isNegative())if(this.eq(MIN_VALUE)){var r=fromNumber(t),n=this.div(r),o=n.mul(r).sub(this);return n.toString(t)+o.toInt().toString(t)}else return"-"+this.neg().toString(t);for(var s=fromNumber(pow_dbl(t,6),this.unsigned),a=this,u="";;){var p=a.div(s),d=a.sub(p.mul(s)).toInt()>>>0,c=d.toString(t);if(a=p,a.isZero())return c+u;for(;c.length<6;)c="0"+c;u=""+c+u}};LongPrototype.getHighBits=function e(){return this.high};LongPrototype.getHighBitsUnsigned=function e(){return this.high>>>0};LongPrototype.getLowBits=function e(){return this.low};LongPrototype.getLowBitsUnsigned=function e(){return this.low>>>0};LongPrototype.getNumBitsAbs=function e(){if(this.isNegative())return this.eq(MIN_VALUE)?64:this.neg().getNumBitsAbs();for(var t=this.high!=0?this.high:this.low,r=31;r>0&&!(t&1<<r);r--);return this.high!=0?r+33:r+1};LongPrototype.isZero=function e(){return this.high===0&&this.low===0};LongPrototype.eqz=LongPrototype.isZero;LongPrototype.isNegative=function e(){return!this.unsigned&&this.high<0};LongPrototype.isPositive=function e(){return this.unsigned||this.high>=0};LongPrototype.isOdd=function e(){return(this.low&1)===1};LongPrototype.isEven=function e(){return(this.low&1)===0};LongPrototype.equals=function e(t){return isLong(t)||(t=fromValue(t)),this.unsigned!==t.unsigned&&this.high>>>31===1&&t.high>>>31===1?!1:this.high===t.high&&this.low===t.low};LongPrototype.eq=LongPrototype.equals;LongPrototype.notEquals=function e(t){return!this.eq(t)};LongPrototype.neq=LongPrototype.notEquals;LongPrototype.ne=LongPrototype.notEquals;LongPrototype.lessThan=function e(t){return this.comp(t)<0};LongPrototype.lt=LongPrototype.lessThan;LongPrototype.lessThanOrEqual=function e(t){return this.comp(t)<=0};LongPrototype.lte=LongPrototype.lessThanOrEqual;LongPrototype.le=LongPrototype.lessThanOrEqual;LongPrototype.greaterThan=function e(t){return this.comp(t)>0};LongPrototype.gt=LongPrototype.greaterThan;LongPrototype.greaterThanOrEqual=function e(t){return this.comp(t)>=0};LongPrototype.gte=LongPrototype.greaterThanOrEqual;LongPrototype.ge=LongPrototype.greaterThanOrEqual;LongPrototype.compare=function e(t){if(isLong(t)||(t=fromValue(t)),this.eq(t))return 0;var r=this.isNegative(),n=t.isNegative();return r&&!n?-1:!r&&n?1:this.unsigned?t.high>>>0>this.high>>>0||t.high===this.high&&t.low>>>0>this.low>>>0?-1:1:this.sub(t).isNegative()?-1:1};LongPrototype.comp=LongPrototype.compare;LongPrototype.negate=function e(){return!this.unsigned&&this.eq(MIN_VALUE)?MIN_VALUE:this.not().add(ONE$1)};LongPrototype.neg=LongPrototype.negate;LongPrototype.add=function e(t){isLong(t)||(t=fromValue(t));var r=this.high>>>16,n=this.high&65535,o=this.low>>>16,s=this.low&65535,a=t.high>>>16,u=t.high&65535,p=t.low>>>16,d=t.low&65535,c=0,m=0,_=0,v=0;return v+=s+d,_+=v>>>16,v&=65535,_+=o+p,m+=_>>>16,_&=65535,m+=n+u,c+=m>>>16,m&=65535,c+=r+a,c&=65535,fromBits(_<<16|v,c<<16|m,this.unsigned)};LongPrototype.subtract=function e(t){return isLong(t)||(t=fromValue(t)),this.add(t.neg())};LongPrototype.sub=LongPrototype.subtract;LongPrototype.multiply=function e(t){if(this.isZero())return ZERO$2;if(isLong(t)||(t=fromValue(t)),wasm){var r=wasm.mul(this.low,this.high,t.low,t.high);return fromBits(r,wasm.get_high(),this.unsigned)}if(t.isZero())return ZERO$2;if(this.eq(MIN_VALUE))return t.isOdd()?MIN_VALUE:ZERO$2;if(t.eq(MIN_VALUE))return this.isOdd()?MIN_VALUE:ZERO$2;if(this.isNegative())return t.isNegative()?this.neg().mul(t.neg()):this.neg().mul(t).neg();if(t.isNegative())return this.mul(t.neg()).neg();if(this.lt(TWO_PWR_24)&&t.lt(TWO_PWR_24))return fromNumber(this.toNumber()*t.toNumber(),this.unsigned);var n=this.high>>>16,o=this.high&65535,s=this.low>>>16,a=this.low&65535,u=t.high>>>16,p=t.high&65535,d=t.low>>>16,c=t.low&65535,m=0,_=0,v=0,S=0;return S+=a*c,v+=S>>>16,S&=65535,v+=s*c,_+=v>>>16,v&=65535,v+=a*d,_+=v>>>16,v&=65535,_+=o*c,m+=_>>>16,_&=65535,_+=s*d,m+=_>>>16,_&=65535,_+=a*p,m+=_>>>16,_&=65535,m+=n*c+o*d+s*p+a*u,m&=65535,fromBits(v<<16|S,m<<16|_,this.unsigned)};LongPrototype.mul=LongPrototype.multiply;LongPrototype.divide=function e(t){if(isLong(t)||(t=fromValue(t)),t.isZero())throw Error("division by zero");if(wasm){if(!this.unsigned&&this.high===-2147483648&&t.low===-1&&t.high===-1)return this;var r=(this.unsigned?wasm.div_u:wasm.div_s)(this.low,this.high,t.low,t.high);return fromBits(r,wasm.get_high(),this.unsigned)}if(this.isZero())return this.unsigned?UZERO:ZERO$2;var n,o,s;if(this.unsigned){if(t.unsigned||(t=t.toUnsigned()),t.gt(this))return UZERO;if(t.gt(this.shru(1)))return UONE;s=UZERO}else{if(this.eq(MIN_VALUE)){if(t.eq(ONE$1)||t.eq(NEG_ONE))return MIN_VALUE;if(t.eq(MIN_VALUE))return ONE$1;var a=this.shr(1);return n=a.div(t).shl(1),n.eq(ZERO$2)?t.isNegative()?ONE$1:NEG_ONE:(o=this.sub(t.mul(n)),s=n.add(o.div(t)),s)}else if(t.eq(MIN_VALUE))return this.unsigned?UZERO:ZERO$2;if(this.isNegative())return t.isNegative()?this.neg().div(t.neg()):this.neg().div(t).neg();if(t.isNegative())return this.div(t.neg()).neg();s=ZERO$2}for(o=this;o.gte(t);){n=Math.max(1,Math.floor(o.toNumber()/t.toNumber()));for(var u=Math.ceil(Math.log(n)/Math.LN2),p=u<=48?1:pow_dbl(2,u-48),d=fromNumber(n),c=d.mul(t);c.isNegative()||c.gt(o);)n-=p,d=fromNumber(n,this.unsigned),c=d.mul(t);d.isZero()&&(d=ONE$1),s=s.add(d),o=o.sub(c)}return s};LongPrototype.div=LongPrototype.divide;LongPrototype.modulo=function e(t){if(isLong(t)||(t=fromValue(t)),wasm){var r=(this.unsigned?wasm.rem_u:wasm.rem_s)(this.low,this.high,t.low,t.high);return fromBits(r,wasm.get_high(),this.unsigned)}return this.sub(this.div(t).mul(t))};LongPrototype.mod=LongPrototype.modulo;LongPrototype.rem=LongPrototype.modulo;LongPrototype.not=function e(){return fromBits(~this.low,~this.high,this.unsigned)};LongPrototype.and=function e(t){return isLong(t)||(t=fromValue(t)),fromBits(this.low&t.low,this.high&t.high,this.unsigned)};LongPrototype.or=function e(t){return isLong(t)||(t=fromValue(t)),fromBits(this.low|t.low,this.high|t.high,this.unsigned)};LongPrototype.xor=function e(t){return isLong(t)||(t=fromValue(t)),fromBits(this.low^t.low,this.high^t.high,this.unsigned)};LongPrototype.shiftLeft=function e(t){return isLong(t)&&(t=t.toInt()),(t&=63)===0?this:t<32?fromBits(this.low<<t,this.high<<t|this.low>>>32-t,this.unsigned):fromBits(0,this.low<<t-32,this.unsigned)};LongPrototype.shl=LongPrototype.shiftLeft;LongPrototype.shiftRight=function e(t){return isLong(t)&&(t=t.toInt()),(t&=63)===0?this:t<32?fromBits(this.low>>>t|this.high<<32-t,this.high>>t,this.unsigned):fromBits(this.high>>t-32,this.high>=0?0:-1,this.unsigned)};LongPrototype.shr=LongPrototype.shiftRight;LongPrototype.shiftRightUnsigned=function e(t){if(isLong(t)&&(t=t.toInt()),t&=63,t===0)return this;var r=this.high;if(t<32){var n=this.low;return fromBits(n>>>t|r<<32-t,r>>>t,this.unsigned)}else return t===32?fromBits(r,0,this.unsigned):fromBits(r>>>t-32,0,this.unsigned)};LongPrototype.shru=LongPrototype.shiftRightUnsigned;LongPrototype.shr_u=LongPrototype.shiftRightUnsigned;LongPrototype.toSigned=function e(){return this.unsigned?fromBits(this.low,this.high,!1):this};LongPrototype.toUnsigned=function e(){return this.unsigned?this:fromBits(this.low,this.high,!0)};LongPrototype.toBytes=function e(t){return t?this.toBytesLE():this.toBytesBE()};LongPrototype.toBytesLE=function e(){var t=this.high,r=this.low;return[r&255,r>>>8&255,r>>>16&255,r>>>24,t&255,t>>>8&255,t>>>16&255,t>>>24]};LongPrototype.toBytesBE=function e(){var t=this.high,r=this.low;return[t>>>24,t>>>16&255,t>>>8&255,t&255,r>>>24,r>>>16&255,r>>>8&255,r&255]};Long.fromBytes=function e(t,r,n){return n?Long.fromBytesLE(t,r):Long.fromBytesBE(t,r)};Long.fromBytesLE=function e(t,r){return new Long(t[0]|t[1]<<8|t[2]<<16|t[3]<<24,t[4]|t[5]<<8|t[6]<<16|t[7]<<24,r)};Long.fromBytesBE=function e(t,r){return new Long(t[4]<<24|t[5]<<16|t[6]<<8|t[7],t[0]<<24|t[1]<<16|t[2]<<8|t[3],r)};var cosmjs={},__awaiter$3=commonjsGlobal&&commonjsGlobal.__awaiter||function(e,t,r,n){function o(s){return s instanceof r?s:new r(function(a){a(s)})}return new(r||(r=Promise))(function(s,a){function u(c){try{d(n.next(c))}catch(m){a(m)}}function p(c){try{d(n.throw(c))}catch(m){a(m)}}function d(c){c.done?s(c.value):o(c.value).then(u,p)}d((n=n.apply(e,t||[])).next())})};Object.defineProperty(cosmjs,"__esModule",{value:!0});cosmjs.CosmJSOfflineSigner=cosmjs.CosmJSOfflineSignerOnlyAmino=void 0;class CosmJSOfflineSignerOnlyAmino{constructor(t,r,n){this.chainId=t,this.keplr=r,this.signOptions=n}getAccounts(){return __awaiter$3(this,void 0,void 0,function*(){const t=yield this.keplr.getKey(this.chainId);return[{address:t.bech32Address,algo:"secp256k1",pubkey:t.pubKey}]})}signAmino(t,r){return __awaiter$3(this,void 0,void 0,function*(){if(this.chainId!==r.chain_id)throw new Error("Unmatched chain id with the offline signer");if((yield this.keplr.getKey(r.chain_id)).bech32Address!==t)throw new Error("Unknown signer address");return yield this.keplr.signAmino(this.chainId,t,r,this.signOptions)})}sign(t,r){return __awaiter$3(this,void 0,void 0,function*(){return yield this.signAmino(t,r)})}}cosmjs.CosmJSOfflineSignerOnlyAmino=CosmJSOfflineSignerOnlyAmino;class CosmJSOfflineSigner extends CosmJSOfflineSignerOnlyAmino{constructor(t,r,n){super(t,r,n)}signDirect(t,r){return __awaiter$3(this,void 0,void 0,function*(){if(this.chainId!==r.chainId)throw new Error("Unmatched chain id with the offline signer");if((yield this.keplr.getKey(r.chainId)).bech32Address!==t)throw new Error("Unknown signer address");return yield this.keplr.signDirect(this.chainId,t,r,this.signOptions)})}}cosmjs.CosmJSOfflineSigner=CosmJSOfflineSigner;var enigma={},__awaiter$2=commonjsGlobal&&commonjsGlobal.__awaiter||function(e,t,r,n){function o(s){return s instanceof r?s:new r(function(a){a(s)})}return new(r||(r=Promise))(function(s,a){function u(c){try{d(n.next(c))}catch(m){a(m)}}function p(c){try{d(n.throw(c))}catch(m){a(m)}}function d(c){c.done?s(c.value):o(c.value).then(u,p)}d((n=n.apply(e,t||[])).next())})};Object.defineProperty(enigma,"__esModule",{value:!0});enigma.KeplrEnigmaUtils=void 0;class KeplrEnigmaUtils{constructor(t,r){this.chainId=t,this.keplr=r}getPubkey(){return __awaiter$2(this,void 0,void 0,function*(){return yield this.keplr.getEnigmaPubKey(this.chainId)})}getTxEncryptionKey(t){return __awaiter$2(this,void 0,void 0,function*(){return yield this.keplr.getEnigmaTxEncryptionKey(this.chainId,t)})}encrypt(t,r){return __awaiter$2(this,void 0,void 0,function*(){return yield this.keplr.enigmaEncrypt(this.chainId,t,r)})}decrypt(t,r){return __awaiter$2(this,void 0,void 0,function*(){return yield this.keplr.enigmaDecrypt(this.chainId,t,r)})}}enigma.KeplrEnigmaUtils=KeplrEnigmaUtils;var version={};Object.defineProperty(version,"__esModule",{value:!0});version.BUILD_VERSION=void 0;version.BUILD_VERSION="0.12.204";var constants={};Object.defineProperty(constants,"__esModule",{value:!0});constants.metaId=constants.KeplrLogoBase64=void 0;constants.KeplrLogoBase64="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";constants.metaId="d_2hxd99brRo";var __awaiter$1=commonjsGlobal&&commonjsGlobal.__awaiter||function(e,t,r,n){function o(s){return s instanceof r?s:new r(function(a){a(s)})}return new(r||(r=Promise))(function(s,a){function u(c){try{d(n.next(c))}catch(m){a(m)}}function p(c){try{d(n.throw(c))}catch(m){a(m)}}function d(c){c.done?s(c.value):o(c.value).then(u,p)}d((n=n.apply(e,t||[])).next())})},__importDefault=commonjsGlobal&&commonjsGlobal.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(keplr$1,"__esModule",{value:!0});keplr$1.Keplr=keplr$1.EthereumProviderRpcError=void 0;const types_1$9=build,uint8_array_1=uint8Array,deepmerge_1=__importDefault(cjs),long_1=__importDefault(long),cosmjs_1=cosmjs,enigma_1=enigma,version_1=version,events_1=__importDefault(eventsExports),constants_1=constants;class EthereumProviderRpcError extends Error{constructor(t,r,n){super(r),this.code=t,this.data=n,Object.setPrototypeOf(this,EthereumProviderRpcError.prototype)}}keplr$1.EthereumProviderRpcError=EthereumProviderRpcError;class Keplr{constructor(){this.enigmaUtils=new Map,this.version=version_1.BUILD_VERSION,this.mode="extension",this.defaultOptions={},this.ethereum=new EthereumProvider(this),this.starknet=void 0}static staticRequestMethod(t,r){const n="ReactNativeWebView"in window,o=n?c=>{window.ReactNativeWebView.postMessage(JSON.stringify(c))}:c=>{window.postMessage(c,window.location.origin)},s=n?c=>{if(c&&typeof c=="string")try{return JSON.parse(c)}catch{}return c}:c=>c,a=new Uint8Array(8),u=Array.from(crypto.getRandomValues(a)).map(c=>c.toString(16)).join(""),d={type:window.keplrRequestMetaIdSupport?`proxy-request${constants_1.metaId?`-${constants_1.metaId}`:""}`:"proxy-request",id:u,method:t,args:uint8_array_1.JSONUint8Array.wrap(r)};return new Promise((c,m)=>{const _=v=>{const S=s(v.data);if(!S||S.type!=="proxy-request-response"||S.id!==u)return;window.removeEventListener("message",_);const E=uint8_array_1.JSONUint8Array.unwrap(S.result);if(!E){m(new Error("Result is null"));return}if(E.error){m(new Error(E.error));return}c(E.return)};window.addEventListener("message",_),o(d)})}requestMethod(t,r){return Keplr.staticRequestMethod(t,r)}static getKeplr(t=1500){return __awaiter$1(this,void 0,void 0,function*(){yield waitDocumentReady();const r="ReactNativeWebView"in window,n=typeof navigator<"u"&&"userAgent"in navigator?navigator.userAgent.includes("Firefox"):!1;if(!(!r&&!n&&window.keplrRequestMetaIdSupport==null))return new Promise((o,s)=>{const a=setTimeout(()=>{o(void 0)},t);Keplr.staticRequestMethod("ping",[]).then(()=>{clearTimeout(a),o(new Keplr)}).catch(u=>{var p;!((p=u==null?void 0:u.message)===null||p===void 0)&&p.includes("Invalid method: ping")?(clearTimeout(a),o(new Keplr)):s(u)})})})}ping(){return __awaiter$1(this,void 0,void 0,function*(){yield this.requestMethod("ping",[])})}enable(t){return __awaiter$1(this,void 0,void 0,function*(){yield this.requestMethod("enable",[t])})}disable(t){return __awaiter$1(this,void 0,void 0,function*(){yield this.requestMethod("disable",[t])})}experimentalSuggestChain(t){var r,n;return __awaiter$1(this,void 0,void 0,function*(){if(t.hideInUI)throw new Error("hideInUI is not allowed");(!((r=t.features)===null||r===void 0)&&r.includes("stargate")||!((n=t.features)===null||n===void 0)&&n.includes("no-legacy-stdTx"))&&console.warn("“stargate”, “no-legacy-stdTx” feature has been deprecated. The launchpad is no longer supported, thus works without the two features. We would keep the aforementioned two feature for a while, but the upcoming update would potentially cause errors. Remove the two feature."),yield this.requestMethod("experimentalSuggestChain",[t])})}getKey(t){return __awaiter$1(this,void 0,void 0,function*(){return yield this.requestMethod("getKey",[t])})}getKeysSettled(t){return __awaiter$1(this,void 0,void 0,function*(){return yield this.requestMethod("getKeysSettled",[t])})}sendTx(t,r,n){return __awaiter$1(this,void 0,void 0,function*(){return"length"in r||console.warn("Do not send legacy std tx via `sendTx` API. We now only support protobuf tx. The usage of legeacy std tx would throw an error in the near future."),yield this.requestMethod("sendTx",[t,r,n])})}signAmino(t,r,n,o={}){var s;return __awaiter$1(this,void 0,void 0,function*(){return yield this.requestMethod("signAmino",[t,r,n,(0,deepmerge_1.default)((s=this.defaultOptions.sign)!==null&&s!==void 0?s:{},o)])})}signDirect(t,r,n,o={}){var s;return __awaiter$1(this,void 0,void 0,function*(){const a=yield this.requestMethod("signDirect",[t,r,{bodyBytes:n.bodyBytes,authInfoBytes:n.authInfoBytes,chainId:n.chainId,accountNumber:n.accountNumber?n.accountNumber.toString():null},(0,deepmerge_1.default)((s=this.defaultOptions.sign)!==null&&s!==void 0?s:{},o)]),u=a.signed;return{signed:{bodyBytes:u.bodyBytes,authInfoBytes:u.authInfoBytes,chainId:u.chainId,accountNumber:long_1.default.fromString(u.accountNumber)},signature:a.signature}})}signDirectAux(t,r,n,o={}){var s;return __awaiter$1(this,void 0,void 0,function*(){const a=yield this.requestMethod("signDirectAux",[t,r,{bodyBytes:n.bodyBytes,publicKey:n.publicKey,chainId:n.chainId,accountNumber:n.accountNumber?n.accountNumber.toString():null,sequence:n.sequence?n.sequence.toString():null},(0,deepmerge_1.default)({preferNoSetMemo:(s=this.defaultOptions.sign)===null||s===void 0?void 0:s.preferNoSetMemo},o)]),u=a.signed;return{signed:{bodyBytes:u.bodyBytes,publicKey:u.publicKey||void 0,chainId:u.chainId,accountNumber:long_1.default.fromString(u.accountNumber),sequence:long_1.default.fromString(u.sequence)},signature:a.signature}})}signArbitrary(t,r,n){return __awaiter$1(this,void 0,void 0,function*(){return yield this.requestMethod("signArbitrary",[t,r,n])})}signICNSAdr36(t,r,n,o,s){return this.requestMethod("signICNSAdr36",[t,r,n,o,s])}verifyArbitrary(t,r,n,o){return __awaiter$1(this,void 0,void 0,function*(){return yield this.requestMethod("verifyArbitrary",[t,r,n,o])})}signEthereum(t,r,n,o){return __awaiter$1(this,void 0,void 0,function*(){return yield this.requestMethod("signEthereum",[t,r,n,o])})}getOfflineSigner(t,r){return new cosmjs_1.CosmJSOfflineSigner(t,this,r)}getOfflineSignerOnlyAmino(t,r){return new cosmjs_1.CosmJSOfflineSignerOnlyAmino(t,this,r)}getOfflineSignerAuto(t,r){return __awaiter$1(this,void 0,void 0,function*(){return(yield this.getKey(t)).isNanoLedger?new cosmjs_1.CosmJSOfflineSignerOnlyAmino(t,this,r):new cosmjs_1.CosmJSOfflineSigner(t,this,r)})}suggestToken(t,r,n){return __awaiter$1(this,void 0,void 0,function*(){return yield this.requestMethod("suggestToken",[t,r,n])})}getSecret20ViewingKey(t,r){return __awaiter$1(this,void 0,void 0,function*(){return yield this.requestMethod("getSecret20ViewingKey",[t,r])})}getEnigmaPubKey(t){return __awaiter$1(this,void 0,void 0,function*(){return yield this.requestMethod("getEnigmaPubKey",[t])})}getEnigmaTxEncryptionKey(t,r){return __awaiter$1(this,void 0,void 0,function*(){return yield this.requestMethod("getEnigmaTxEncryptionKey",[t,r])})}enigmaEncrypt(t,r,n){return __awaiter$1(this,void 0,void 0,function*(){return yield this.requestMethod("enigmaEncrypt",[t,r,n])})}enigmaDecrypt(t,r,n){return __awaiter$1(this,void 0,void 0,function*(){return yield this.requestMethod("enigmaDecrypt",[t,r,n])})}getEnigmaUtils(t){if(this.enigmaUtils.has(t))return this.enigmaUtils.get(t);const r=new enigma_1.KeplrEnigmaUtils(t,this);return this.enigmaUtils.set(t,r),r}experimentalSignEIP712CosmosTx_v0(t,r,n,o,s={}){var a;return __awaiter$1(this,void 0,void 0,function*(){return yield this.requestMethod("experimentalSignEIP712CosmosTx_v0",[t,r,n,o,(0,deepmerge_1.default)((a=this.defaultOptions.sign)!==null&&a!==void 0?a:{},s)])})}getChainInfosWithoutEndpoints(){return __awaiter$1(this,void 0,void 0,function*(){return yield this.requestMethod("getChainInfosWithoutEndpoints",[])})}changeKeyRingName({defaultName:t,editable:r=!0}){return __awaiter$1(this,void 0,void 0,function*(){return yield this.requestMethod("changeKeyRingName",[{defaultName:t,editable:r}])})}sendEthereumTx(t,r){return __awaiter$1(this,void 0,void 0,function*(){return yield this.requestMethod("sendEthereumTx",[t,r])})}suggestERC20(t,r){return __awaiter$1(this,void 0,void 0,function*(){return yield this.requestMethod("suggestERC20",[t,r])})}getChainInfoWithoutEndpoints(t){return __awaiter$1(this,void 0,void 0,function*(){return yield this.requestMethod("getChainInfoWithoutEndpoints",[t])})}getStarknetKey(t){return __awaiter$1(this,void 0,void 0,function*(){return yield this.requestMethod("getStarknetKey",[t])})}getStarknetKeysSettled(t){return __awaiter$1(this,void 0,void 0,function*(){return yield this.requestMethod("getStarknetKeysSettled",[t])})}signStarknetTx(t,r,n){return __awaiter$1(this,void 0,void 0,function*(){return yield this.requestMethod("signStarknetTx",[t,r,n])})}signStarknetDeployAccountTransaction(t,r){return __awaiter$1(this,void 0,void 0,function*(){return yield this.requestMethod("signStarknetDeployAccountTransaction",[t,r])})}}keplr$1.Keplr=Keplr;const waitDocumentReady=()=>document.readyState==="complete"?Promise.resolve():new Promise(e=>{const t=r=>{r.target&&r.target.readyState==="complete"&&(e(),document.removeEventListener("readystatechange",t))};document.addEventListener("readystatechange",t)});class EthereumProvider extends events_1.default{constructor(t){if(super(),this.keplr=t,this.eip6963ProviderInfo={uuid:crypto.randomUUID(),name:"Keplr",rdns:"app.keplr",icon:`data:image/png;base64,${constants_1.KeplrLogoBase64}`},this.chainId=null,this.networkVersion=null,this.selectedAddress=null,this.isKeplr=!0,this.isMetaMask=!0,this._isConnected=!1,this._currentChainId=null,window.addEventListener("keplr_keystorechange",()=>__awaiter$1(this,void 0,void 0,function*(){if(this._currentChainId&&(yield t.getChainInfoWithoutEndpoints(this._currentChainId))){const n=(yield t.getKey(this._currentChainId)).ethereumHexAddress;this.handleAccountsChanged(n)}})),window.addEventListener("keplr_chainChanged",r=>{if(r.detail.origin===window.location.origin){const o=r.detail.evmChainId;this.handleChainChanged(o)}}),window.addEventListener("keplr_ethSubscription",r=>{var n;const o=r.detail.origin,s=r.detail.providerId;if(o===window.location.origin&&s===((n=this.eip6963ProviderInfo)===null||n===void 0?void 0:n.uuid)){const a=r.detail.data;this.emit("message",{type:"eth_subscription",data:a})}}),this.eip6963ProviderInfo){const r=new CustomEvent(types_1$9.EIP6963EventNames.Announce,{detail:Object.freeze({info:this.eip6963ProviderInfo,provider:this})});window.addEventListener(types_1$9.EIP6963EventNames.Request,()=>window.dispatchEvent(r)),window.dispatchEvent(r)}}static requestMethod(t,r){return __awaiter$1(this,void 0,void 0,function*(){const n="ReactNativeWebView"in window,o=n?c=>{window.ReactNativeWebView.postMessage(JSON.stringify(c))}:c=>{window.postMessage(c,window.location.origin)},s=n?c=>{if(c&&typeof c=="string")try{return JSON.parse(c)}catch{}return c}:c=>c,a=new Uint8Array(8),u=Array.from(crypto.getRandomValues(a)).map(c=>c.toString(16)).join(""),d={type:window.keplrRequestMetaIdSupport?`proxy-request${constants_1.metaId?`-${constants_1.metaId}`:""}`:"proxy-request",id:u,method:"ethereum",args:uint8_array_1.JSONUint8Array.wrap(r),ethereumProviderMethod:t};return new Promise((c,m)=>{const _=v=>{const S=s(v.data);if(!S||S.type!=="proxy-request-response"||S.id!==u)return;window.removeEventListener("message",_);const E=uint8_array_1.JSONUint8Array.unwrap(S.result);if(!E){m(new Error("Result is null"));return}if(E.error){const x=E.error;m(x.code&&!x.module?new EthereumProviderRpcError(x.code,x.message,x.data):new Error(x));return}c(E.return)};window.addEventListener("message",_),o(d)})})}handleConnect(t){return __awaiter$1(this,void 0,void 0,function*(){if(!this._isConnected){const{currentEvmChainId:r,currentChainId:n,selectedAddress:o}=yield EthereumProvider.requestMethod("request",Object.assign({method:"keplr_connect"},t&&{params:[t]}));this._isConnected=!0,this._currentChainId=n,this.chainId=`0x${r.toString(16)}`,this.networkVersion=r.toString(10),this.selectedAddress=o,this.emit("connect",{chainId:this.chainId})}})}handleDisconnect(){return __awaiter$1(this,void 0,void 0,function*(){this._isConnected&&(yield EthereumProvider.requestMethod("request",{method:"keplr_disconnect"}),this._isConnected=!1,this.chainId=null,this.selectedAddress=null,this.networkVersion=null,this.emit("disconnect"))})}handleChainChanged(t){return __awaiter$1(this,void 0,void 0,function*(){yield this.handleConnect(t);const r=`0x${t.toString(16)}`;this.emit("chainChanged",r)})}handleAccountsChanged(t){return __awaiter$1(this,void 0,void 0,function*(){this._isConnected&&(this.selectedAddress=t,this.emit("accountsChanged",[t]))})}isConnected(){return this._isConnected}request({method:t,params:r,chainId:n}){var o;return __awaiter$1(this,void 0,void 0,function*(){if(!this._isConnected){if(t==="eth_accounts")return[];yield this.handleConnect()}return yield EthereumProvider.requestMethod("request",{method:t,params:r,providerId:(o=this.eip6963ProviderInfo)===null||o===void 0?void 0:o.uuid,chainId:n})})}enable(){return __awaiter$1(this,void 0,void 0,function*(){return yield EthereumProvider.requestMethod("request",{method:"eth_requestAccounts"})})}net_version(){return __awaiter$1(this,void 0,void 0,function*(){return yield EthereumProvider.requestMethod("request",{method:"net_version"})})}}var keplrFallback={},__awaiter=commonjsGlobal&&commonjsGlobal.__awaiter||function(e,t,r,n){function o(s){return s instanceof r?s:new r(function(a){a(s)})}return new(r||(r=Promise))(function(s,a){function u(c){try{d(n.next(c))}catch(m){a(m)}}function p(c){try{d(n.throw(c))}catch(m){a(m)}}function d(c){c.done?s(c.value):o(c.value).then(u,p)}d((n=n.apply(e,t||[])).next())})};Object.defineProperty(keplrFallback,"__esModule",{value:!0});keplrFallback.KeplrFallback=void 0;const keplr_1=keplr$1;class KeplrFallback extends keplr_1.Keplr{constructor(t){super(),this.onKeplrNotDetected=t,this.isKeplrDetected=null,this.onKeplrNotDetected&&keplr_1.Keplr.getKeplr(500).then(r=>{var n;r||(n=this.onKeplrNotDetected)===null||n===void 0||n.call(this)})}requestMethod(t,r){return __awaiter(this,void 0,void 0,function*(){if(this.isKeplrDetected==null&&((yield keplr_1.Keplr.getKeplr(500))?this.isKeplrDetected=!0:this.isKeplrDetected=!1),this.isKeplrDetected)return keplr_1.Keplr.staticRequestMethod(t,r);{const n=window.keplr;if(n)return n[t](...r);throw new Error("Can't detect keplr fallback")}})}}keplrFallback.KeplrFallback=KeplrFallback;(function(e){var t=commonjsGlobal&&commonjsGlobal.__createBinding||(Object.create?function(n,o,s,a){a===void 0&&(a=s);var u=Object.getOwnPropertyDescriptor(o,s);(!u||("get"in u?!o.__esModule:u.writable||u.configurable))&&(u={enumerable:!0,get:function(){return o[s]}}),Object.defineProperty(n,a,u)}:function(n,o,s,a){a===void 0&&(a=s),n[a]=o[s]}),r=commonjsGlobal&&commonjsGlobal.__exportStar||function(n,o){for(var s in n)s!=="default"&&!Object.prototype.hasOwnProperty.call(o,s)&&t(o,n,s)};Object.defineProperty(e,"__esModule",{value:!0}),r(keplr$1,e),r(keplrFallback,e)})(build$1);const logo$6="data:image/svg+xml,%3csvg%20width='42'%20height='42'%20viewBox='0%200%2042%2042'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cg%20clip-path='url(%23clip0_425_5107)'%3e%3cpath%20d='M32.4545%200H9.54545C4.27365%200%200%204.27365%200%209.54545V32.4545C0%2037.7264%204.27365%2042%209.54545%2042H32.4545C37.7264%2042%2042%2037.7264%2042%2032.4545V9.54545C42%204.27365%2037.7264%200%2032.4545%200Z'%20fill='url(%23paint0_linear_425_5107)'/%3e%3cpath%20d='M32.4545%200H9.54545C4.27365%200%200%204.27365%200%209.54545V32.4545C0%2037.7264%204.27365%2042%209.54545%2042H32.4545C37.7264%2042%2042%2037.7264%2042%2032.4545V9.54545C42%204.27365%2037.7264%200%2032.4545%200Z'%20fill='url(%23paint1_radial_425_5107)'/%3e%3cpath%20d='M32.4545%200H9.54545C4.27365%200%200%204.27365%200%209.54545V32.4545C0%2037.7264%204.27365%2042%209.54545%2042H32.4545C37.7264%2042%2042%2037.7264%2042%2032.4545V9.54545C42%204.27365%2037.7264%200%2032.4545%200Z'%20fill='url(%23paint2_radial_425_5107)'/%3e%3cpath%20d='M32.4545%200H9.54545C4.27365%200%200%204.27365%200%209.54545V32.4545C0%2037.7264%204.27365%2042%209.54545%2042H32.4545C37.7264%2042%2042%2037.7264%2042%2032.4545V9.54545C42%204.27365%2037.7264%200%2032.4545%200Z'%20fill='url(%23paint3_radial_425_5107)'/%3e%3cpath%20d='M17.2526%2032.2614V22.5192L26.7185%2032.2614H31.9849V32.0079L21.0964%2020.9122L31.1469%2010.3857V10.2614H25.8464L17.2526%2019.5635V10.2614H12.9849V32.2614H17.2526Z'%20fill='white'/%3e%3c/g%3e%3cdefs%3e%3clinearGradient%20id='paint0_linear_425_5107'%20x1='21'%20y1='0'%20x2='21'%20y2='42'%20gradientUnits='userSpaceOnUse'%3e%3cstop%20stop-color='%231FD1FF'/%3e%3cstop%20offset='1'%20stop-color='%231BB8FF'/%3e%3c/linearGradient%3e%3cradialGradient%20id='paint1_radial_425_5107'%20cx='0'%20cy='0'%20r='1'%20gradientUnits='userSpaceOnUse'%20gradientTransform='translate(2.00623%2040.4086)%20rotate(-45.1556)%20scale(67.3547%2068.3624)'%3e%3cstop%20stop-color='%23232DE3'/%3e%3cstop%20offset='1'%20stop-color='%23232DE3'%20stop-opacity='0'/%3e%3c/radialGradient%3e%3cradialGradient%20id='paint2_radial_425_5107'%20cx='0'%20cy='0'%20r='1'%20gradientUnits='userSpaceOnUse'%20gradientTransform='translate(39.7379%2041.7602)%20rotate(-138.45)%20scale(42.1137%2064.2116)'%3e%3cstop%20stop-color='%238B4DFF'/%3e%3cstop%20offset='1'%20stop-color='%238B4DFF'%20stop-opacity='0'/%3e%3c/radialGradient%3e%3cradialGradient%20id='paint3_radial_425_5107'%20cx='0'%20cy='0'%20r='1'%20gradientUnits='userSpaceOnUse'%20gradientTransform='translate(20.6501%200.311498)%20rotate(90)%20scale(33.1135%2080.3423)'%3e%3cstop%20stop-color='%2324D5FF'/%3e%3cstop%20offset='1'%20stop-color='%231BB8FF'%20stop-opacity='0'/%3e%3c/radialGradient%3e%3cclipPath%20id='clip0_425_5107'%3e%3crect%20width='42'%20height='42'%20fill='white'/%3e%3c/clipPath%3e%3c/defs%3e%3c/svg%3e",WALLET_PROVIDER_NAME$6="Keplr";class KeplrProvider{constructor(t,r){Fu(this,"walletInfo");Fu(this,"chainId");Fu(this,"rpc");Fu(this,"chainData");Fu(this,"on",(t,r)=>{if(!this.walletInfo)throw new Error("Wallet not connected");t==="accountChanged"&&window.addEventListener("keplr_keystorechange",r)});Fu(this,"off",(t,r)=>{if(!this.walletInfo)throw new Error("Wallet not connected");t==="accountChanged"&&window.removeEventListener("keplr_keystorechange",r)});if(this.keplr=t,!t)throw new Error("Keplr extension not found");this.chainId=r.chainId,this.rpc=r.rpc,this.chainData=r.chainData}async connectWallet(){if(!this.chainId)throw new Error("Chain ID is not initialized");if(!this.rpc)throw new Error("RPC URL is not initialized");if(!this.keplr)throw new Error("Keplr extension not found");try{await this.keplr.enable(this.chainId)}catch(o){if(o!=null&&o.message.includes(this.chainId))try{await this.keplr.experimentalSuggestChain(this.chainData),await this.keplr.enable(this.chainId)}catch{throw new Error("Failed to add BBN chain")}else throw o!=null&&o.message.includes("rejected")?new Error("Keplr wallet connection request rejected"):o!=null&&o.message.includes("context invalidated")?new Error("Keplr extension context invalidated"):new Error((o==null?void 0:o.message)||"Failed to connect to Keplr")}const t=await this.keplr.getKey(this.chainId);if(!t)throw new Error("Failed to get Keplr key");const{bech32Address:r,pubKey:n}=t;if(r&&n)this.walletInfo={publicKeyHex:Buffer$1$1.from(t.pubKey).toString("hex"),address:r};else throw new Error("Could not connect to Keplr")}async getAddress(){if(!this.walletInfo)throw new Error("Wallet not connected");return this.walletInfo.address}async getPublicKeyHex(){if(!this.walletInfo)throw new Error("Wallet not connected");return this.walletInfo.publicKeyHex}async getWalletProviderName(){return WALLET_PROVIDER_NAME$6}async getWalletProviderIcon(){return logo$6}async getOfflineSigner(){if(!this.keplr)throw new Error("Keplr extension not found");if(!this.chainId)throw new Error("Chain ID is not initialized");try{return this.keplr.getOfflineSigner(this.chainId)}catch{throw new Error("Failed to get offline signer")}}async getOfflineSignerAuto(){if(!this.keplr)throw new Error("Keplr extension not found");if(!this.chainId)throw new Error("Chain ID is not initialized");try{return this.keplr.getOfflineSignerAuto(this.chainId)}catch{throw new Error("Failed to get offline signer auto")}}}const metadata$a={id:"keplr",name:WALLET_PROVIDER_NAME$6,icon:logo$6,docs:"https://www.keplr.app/",wallet:()=>build$1.Keplr.getKeplr(),createProvider:(e,t)=>new KeplrProvider(e,t),networks:[Network.MAINNET,Network.SIGNET]},logo$5="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='58'%20height='58'%3e%3cg%20fill='none'%20fill-rule='nonzero'%3e%3cpath%20fill='%2324A95A'%20stroke='%23138D3E'%20stroke-width='.039'%20d='M51.466%2036.118c0%204.001-2.44%206.816-6.403%208.631-3.963%201.816-9.446%202.631-15.522%202.631-6.077%200-11.595-.815-15.594-2.63-3.999-1.816-6.474-4.631-6.474-8.632%200-4.002%202.46-7.625%206.44-10.248%203.982-2.623%209.482-4.245%2015.556-4.245%206.075%200%2011.575%201.626%2015.556%204.25%203.981%202.625%206.441%206.248%206.441%2010.243Z'/%3e%3cpath%20fill='%2332DA6D'%20stroke='%23138D3E'%20stroke-width='.039'%20d='m35.608%2013.791.012.003.007-.009A7.686%207.686%200%200%201%2041.555%2011c4.236%200%207.675%203.421%207.675%207.634%200%201.385-.37%202.671-1.009%203.788l-.005.009.004.01a9.644%209.644%200%200%201%20.94%204.13c0%203.711-2.198%207.072-5.753%209.505-3.555%202.434-8.468%203.939-13.893%203.939-5.426%200-10.339-1.505-13.894-3.939-3.555-2.433-5.752-5.794-5.752-9.506%200-1.442.327-2.829.939-4.13l.004-.009-.005-.009a7.583%207.583%200%200%201-1.01-3.788c0-4.213%203.44-7.634%207.676-7.634a7.73%207.73%200%200%201%205.928%202.785l.007.01.012-.004a27.43%2027.43%200%200%201%206.095-.665c2.121%200%204.172.24%206.094.665Z'/%3e%3cpath%20fill='%23FFF'%20d='M16.845%2022.88c2.597%200%204.703-2.094%204.703-4.677%200-2.583-2.106-4.677-4.703-4.677-2.597%200-4.702%202.094-4.702%204.677%200%202.583%202.105%204.677%204.702%204.677ZM41.932%2022.88c2.597%200%204.702-2.094%204.702-4.677%200-2.583-2.105-4.677-4.702-4.677-2.598%200-4.703%202.094-4.703%204.677%200%202.583%202.105%204.677%204.703%204.677Z'/%3e%3cpath%20fill='%2332DA6D'%20stroke='%23138D3E'%20stroke-width='.039'%20d='M4.032%2044.13a.163.163%200%200%200%20.018-.008l-.002-.004-.004-.01-.017-.046-.066-.174a70.962%2070.962%200%200%201-1.02-2.947c-.6-1.87-1.295-4.301-1.669-6.54-.187-1.12-.293-2.192-.268-3.122.025-.93.181-1.716.52-2.266.337-.55.855-.865%201.608-.856.754.01%201.746.347%203.027%201.108%207.702%204.573%209.453%2012.176%209.866%2015.688.113.98-.676%201.85-1.676%201.85H2.308c-.794%200-1.084-1.037-.39-1.438l2.123-1.219.015-.008-.006-.016-.018.007ZM54.276%2044.123l.018.006a.481.481%200%200%201-.018-.006v-.001l.002-.003.003-.011.016-.045a44.607%2044.607%200%200%200%20.276-.83c.183-.56.433-1.356.705-2.291.543-1.871%201.17-4.302%201.507-6.541.169-1.12.265-2.192.242-3.122-.023-.93-.165-1.716-.47-2.267a1.677%201.677%200%200%200-.587-.637%201.587%201.587%200%200%200-.867-.218c-.681.01-1.577.346-2.736%201.107-6.946%204.573-8.541%2012.19-8.897%2015.69-.1.982.606%201.849%201.505%201.849h10.887c.352%200%20.596-.258.672-.569.077-.31-.014-.67-.326-.87l-1.932-1.241Zm0%200-.005.014.013.009%201.924%201.218-1.932-1.241Z'/%3e%3cpath%20fill='%23092511'%20d='M16.893%2021.02a2.805%202.805%200%201%200%200-5.61%202.805%202.805%200%200%200%200%205.61ZM41.98%2021.02a2.805%202.805%200%201%200%200-5.61%202.805%202.805%200%200%200%200%205.61ZM36.998%2029.488a7.536%207.536%200%200%201-10.976%206.042%207.534%207.534%200%200%201-4.037-7.334l7.507.646%207.506.646Z'/%3e%3c/g%3e%3c/svg%3e",WALLET_PROVIDER_NAME$5="Leap";class LeapProvider{constructor(t,r){Fu(this,"walletInfo");Fu(this,"chainId");Fu(this,"rpc");Fu(this,"chainData");Fu(this,"on",(t,r)=>{if(!this.walletInfo)throw new Error("Wallet not connected");t==="accountChanged"&&window.addEventListener("leap_keystorechange",r)});Fu(this,"off",(t,r)=>{if(!this.walletInfo)throw new Error("Wallet not connected");t==="accountChanged"&&window.removeEventListener("leap_keystorechange",r)});if(this.wallet=t,!t)throw new Error("Leap extension not found");this.chainId=r.chainId,this.rpc=r.rpc,this.chainData=r.chainData}async connectWallet(){if(!this.chainId)throw new Error("Chain ID is not initialized");if(!this.rpc)throw new Error("RPC URL is not initialized");if(!this.wallet)throw new Error("Leap extension not found");try{await this.wallet.enable(this.chainId)}catch(o){if(o!=null&&o.message.includes(this.chainId)||o!=null&&o.message.includes("chain id"))try{await this.wallet.experimentalSuggestChain(this.chainData),await this.wallet.enable(this.chainId)}catch{throw new Error("Failed to add BBN chain")}else throw o!=null&&o.message.includes("rejected")?new Error("Leap wallet connection request rejected"):o!=null&&o.message.includes("context invalidated")?new Error("Leap extension context invalidated"):new Error((o==null?void 0:o.message)||"Failed to connect to Leap")}const t=await this.wallet.getKey(this.chainId);if(!t)throw new Error("Failed to get Leap key");const{bech32Address:r,pubKey:n}=t;if(r&&n)this.walletInfo={publicKeyHex:Buffer$1$1.from(t.pubKey).toString("hex"),address:r};else throw new Error("Could not connect to Leap")}async getAddress(){if(!this.walletInfo)throw new Error("Wallet not connected");return this.walletInfo.address}async getPublicKeyHex(){if(!this.walletInfo)throw new Error("Wallet not connected");return this.walletInfo.publicKeyHex}async getWalletProviderName(){return WALLET_PROVIDER_NAME$5}async getWalletProviderIcon(){return logo$5}async getOfflineSigner(){if(!this.wallet)throw new Error("Leap extension not found");if(!this.chainId)throw new Error("Chain ID is not initialized");try{return this.wallet.getOfflineSigner(this.chainId)}catch{throw new Error("Failed to get offline signer")}}async getOfflineSignerAuto(){if(!this.wallet)throw new Error("Leap extension not found");if(!this.chainId)throw new Error("Chain ID is not initialized");try{return this.wallet.getOfflineSignerAuto(this.chainId)}catch{throw new Error("Failed to get offline signer auto")}}}const metadata$9={id:"leap",name:WALLET_PROVIDER_NAME$5,icon:logo$5,docs:"https://www.leapwallet.io/",wallet:"leap",createProvider:(e,t)=>new LeapProvider(e,t),networks:[Network.MAINNET,Network.SIGNET]},logo$4="data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='UTF-8'?%3e%3csvg%20width='225px'%20height='224px'%20viewBox='0%200%20225%20224'%20version='1.1'%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%3e%3ctitle%3eokx%3c/title%3e%3cg%20id='Page-1'%20stroke='none'%20strokeWidth='1'%20fill='none'%20fill-rule='evenodd'%3e%3cg%20id='okx'%20transform='translate(0.401000,%200.006000)'%20fill='%23000000'%20fill-rule='nonzero'%3e%3cpath%20d='M144.382,74.667%20L79.673,74.667%20C76.924,74.667%2074.695,76.895%2074.695,79.644%20L74.695,144.354%20C74.695,147.103%2076.924,149.332%2079.673,149.332%20L144.382,149.332%20C147.131,149.332%20149.36,147.103%20149.36,144.354%20L149.36,79.644%20C149.36,76.895%20147.131,74.667%20144.382,74.667%20Z'%20id='Path'%3e%3c/path%3e%3cpath%20d='M69.687,0%20L4.978,0%20C2.229,0%200,2.228%200,4.978%20L0,69.687%20C0,72.436%202.229,74.665%204.978,74.665%20L69.687,74.665%20C72.437,74.665%2074.665,72.436%2074.665,69.687%20L74.665,4.978%20C74.665,2.228%2072.437,0%2069.687,0%20Z'%20id='Path'%3e%3c/path%3e%3cpath%20d='M219.017,0%20L154.307,0%20C151.558,0%20149.329,2.228%20149.329,4.978%20L149.329,69.687%20C149.329,72.436%20151.558,74.665%20154.307,74.665%20L219.017,74.665%20C221.766,74.665%20223.994,72.436%20223.994,69.687%20L223.994,4.978%20C223.994,2.228%20221.766,0%20219.017,0%20Z'%20id='Path'%3e%3c/path%3e%3cpath%20d='M69.687,149.328%20L4.978,149.328%20C2.229,149.328%200,151.556%200,154.305%20L0,219.015%20C0,221.764%202.229,223.993%204.978,223.993%20L69.687,223.993%20C72.437,223.993%2074.665,221.764%2074.665,219.015%20L74.665,154.305%20C74.665,151.556%2072.437,149.328%2069.687,149.328%20Z'%20id='Path'%3e%3c/path%3e%3cpath%20d='M219.017,149.328%20L154.307,149.328%20C151.558,149.328%20149.329,151.556%20149.329,154.305%20L149.329,219.015%20C149.329,221.764%20151.558,223.993%20154.307,223.993%20L219.017,223.993%20C221.766,223.993%20223.994,221.764%20223.994,219.015%20L223.994,154.305%20C223.994,151.556%20221.766,149.328%20219.017,149.328%20Z'%20id='Path'%3e%3c/path%3e%3c/g%3e%3c/g%3e%3c/svg%3e",WALLET_PROVIDER_NAME$4="OKX";class OKXBabylonProvider{constructor(t,r){Fu(this,"walletInfo");Fu(this,"chainId");Fu(this,"rpc");Fu(this,"chainData");Fu(this,"on",(t,r)=>{if(!this.walletInfo)throw new Error("Wallet not connected");t==="accountChanged"&&window.addEventListener("okx_keystorechange",r)});Fu(this,"off",(t,r)=>{if(!this.walletInfo)throw new Error("Wallet not connected");t==="accountChanged"&&window.removeEventListener("okx_keystorechange",r)});if(this.wallet=t,!t||!t.keplr)throw new Error("OKX Wallet extension not found");this.chainId=r.chainId,this.rpc=r.rpc,this.chainData=r.chainData}async connectWallet(){if(!this.chainId)throw new Error("Chain ID is not initialized");if(!this.rpc)throw new Error("RPC URL is not initialized");if(!this.wallet.keplr)throw new Error("OKX Wallet extension not found");try{await this.wallet.keplr.enable(this.chainId)}catch(o){if(o!=null&&o.message.includes(this.chainId))try{await this.wallet.keplr.experimentalSuggestChain(this.chainData),await this.wallet.keplr.enable(this.chainId)}catch{throw new Error("Failed to add BBN chain")}else throw o!=null&&o.message.includes("rejected")?new Error("OKX Wallet connection request rejected"):o!=null&&o.message.includes("context invalidated")?new Error("OKX Wallet extension context invalidated"):new Error((o==null?void 0:o.message)||"Failed to connect to OKX Wallet")}const t=await this.wallet.keplr.getKey(this.chainId);if(!t)throw new Error("Failed to get OKX Wallet key");const{bech32Address:r,pubKey:n}=t;if(r&&n)this.walletInfo={publicKeyHex:Buffer$1$1.from(t.pubKey).toString("hex"),address:r};else throw new Error("Could not connect to OKX Wallet")}async getAddress(){if(!this.walletInfo)throw new Error("Wallet not connected");return this.walletInfo.address}async getPublicKeyHex(){if(!this.walletInfo)throw new Error("Wallet not connected");return this.walletInfo.publicKeyHex}async getWalletProviderName(){return WALLET_PROVIDER_NAME$4}async getWalletProviderIcon(){return logo$4}async getOfflineSigner(){if(!this.wallet.keplr)throw new Error("OKX Wallet extension not found");if(!this.chainId)throw new Error("Chain ID is not initialized");try{return this.wallet.keplr.getOfflineSigner(this.chainId)}catch{throw new Error("Failed to get offline signer")}}async getOfflineSignerAuto(){if(!this.wallet.keplr)throw new Error("OKX Wallet extension not found");if(!this.chainId)throw new Error("Chain ID is not initialized");try{return this.wallet.keplr.getOfflineSignerAuto(this.chainId)}catch{throw new Error("Failed to get offline signer auto")}}}const metadata$8={id:"okx",name:WALLET_PROVIDER_NAME$4,icon:logo$4,docs:"https://www.okx.com/web3",wallet:"okxwallet",createProvider:(e,t)=>new OKXBabylonProvider(e,t),networks:[Network.MAINNET,Network.SIGNET]},metadata$7={chain:"BBN",name:"Babylon Chain",icon:icon$1,wallets:[metadata$8,metadata$b,metadata$a,metadata$9]},icon="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='64'%20height='64'%3e%3cpath%20fill='%23f7931a'%20d='M63.04%2039.741c-4.275%2017.143-21.638%2027.576-38.783%2023.301C7.12%2058.768-3.313%2041.404.962%2024.262%205.234%207.117%2022.597-3.317%2039.737.957c17.144%204.274%2027.576%2021.64%2023.302%2038.784z'/%3e%3cpath%20fill='%23FFF'%20d='M46.11%2027.441c.636-4.258-2.606-6.547-7.039-8.074l1.438-5.768-3.51-.875-1.4%205.616c-.924-.23-1.872-.447-2.814-.662l1.41-5.653-3.509-.875-1.439%205.766c-.764-.174-1.514-.346-2.242-.527l.004-.018-4.842-1.209-.934%203.75s2.605.597%202.55.634c1.422.355%201.68%201.296%201.636%202.042l-1.638%206.571c.098.025.225.061.365.117l-.37-.092-2.297%209.205c-.174.432-.615%201.08-1.609.834.035.051-2.552-.637-2.552-.637l-1.743%204.019%204.57%201.139c.85.213%201.682.436%202.502.646l-1.453%205.834%203.507.875%201.44-5.772c.957.26%201.887.5%202.797.726l-1.434%205.745%203.511.875%201.453-5.823c5.987%201.133%2010.49.676%2012.384-4.739%201.527-4.36-.076-6.875-3.226-8.515%202.294-.529%204.022-2.038%204.483-5.155zM38.086%2038.69c-1.085%204.36-8.426%202.003-10.806%201.412l1.928-7.729c2.38.594%2010.012%201.77%208.878%206.317zm1.086-11.312c-.99%203.966-7.1%201.951-9.082%201.457l1.748-7.01c1.982.494%208.365%201.416%207.334%205.553z'/%3e%3c/svg%3e",metadata$6={id:"injectable",name:e=>{var t;return(t=e.getWalletProviderName)==null?void 0:t.call(e)},icon:e=>{var t;return(t=e.getWalletProviderIcon)==null?void 0:t.call(e)},docs:"",wallet:"btcwallet",createProvider:e=>e,networks:[Network.MAINNET,Network.SIGNET],label:"Injectable"},logo$3="data:image/svg+xml,%3csvg%20width='160'%20height='160'%20viewBox='0%200%20160%20160'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20d='M30%2025H90L50%20110H20L30%2025Z'%20fill='black'/%3e%3cpath%20d='M130%20135L70%20135L110%2050L140%2050L130%20135Z'%20fill='%23F5870A'/%3e%3c/svg%3e";var bip341={},ecc_lib={};Object.defineProperty(ecc_lib,"__esModule",{value:!0});ecc_lib.getEccLib=ecc_lib.initEccLib=void 0;const _ECCLIB_CACHE={};function initEccLib(e){e?e!==_ECCLIB_CACHE.eccLib&&(verifyEcc(e),_ECCLIB_CACHE.eccLib=e):_ECCLIB_CACHE.eccLib=e}ecc_lib.initEccLib=initEccLib;function getEccLib(){if(!_ECCLIB_CACHE.eccLib)throw new Error("No ECC Library provided. You must call initEccLib() with a valid TinySecp256k1Interface instance");return _ECCLIB_CACHE.eccLib}ecc_lib.getEccLib=getEccLib;const h=e=>Buffer$e.from(e,"hex");function verifyEcc(e){assert(typeof e.isXOnlyPoint=="function"),assert(e.isXOnlyPoint(h("79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"))),assert(e.isXOnlyPoint(h("fffffffffffffffffffffffffffffffffffffffffffffffffffffffeeffffc2e"))),assert(e.isXOnlyPoint(h("f9308a019258c31049344f85f89d5229b531c845836f99b08601f113bce036f9"))),assert(e.isXOnlyPoint(h("0000000000000000000000000000000000000000000000000000000000000001"))),assert(!e.isXOnlyPoint(h("0000000000000000000000000000000000000000000000000000000000000000"))),assert(!e.isXOnlyPoint(h("fffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"))),assert(typeof e.xOnlyPointAddTweak=="function"),tweakAddVectors.forEach(t=>{const r=e.xOnlyPointAddTweak(h(t.pubkey),h(t.tweak));t.result===null?assert(r===null):(assert(r!==null),assert(r.parity===t.parity),assert(Buffer$e.from(r.xOnlyPubkey).equals(h(t.result))))})}function assert(e){if(!e)throw new Error("ecc library invalid")}const tweakAddVectors=[{pubkey:"79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798",tweak:"fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364140",parity:-1,result:null},{pubkey:"1617d38ed8d8657da4d4761e8057bc396ea9e4b9d29776d4be096016dbd2509b",tweak:"a8397a935f0dfceba6ba9618f6451ef4d80637abf4e6af2669fbc9de6a8fd2ac",parity:1,result:"e478f99dab91052ab39a33ea35fd5e6e4933f4d28023cd597c9a1f6760346adf"},{pubkey:"2c0b7cf95324a07d05398b240174dc0c2be444d96b159aa6c7f7b1e668680991",tweak:"823c3cd2142744b075a87eade7e1b8678ba308d566226a0056ca2b7a76f86b47",parity:0,result:"9534f8dc8c6deda2dc007655981c78b49c5d96c778fbf363462a11ec9dfd948c"}];var crypto$1={},ripemd160={};Object.defineProperty(ripemd160,"__esModule",{value:!0});ripemd160.ripemd160=ripemd160.RIPEMD160=void 0;const _md_js_1$1=_md$2,utils_js_1$1=utils$q,Rho=new Uint8Array([7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8]),Id=new Uint8Array(new Array(16).fill(0).map((e,t)=>t)),Pi=Id.map(e=>(9*e+5)%16);let idxL=[Id],idxR=[Pi];for(let e=0;e<4;e++)for(let t of[idxL,idxR])t.push(t[e].map(r=>Rho[r]));const shifts=[[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8],[12,13,11,15,6,9,9,7,12,15,11,13,7,8,7,7],[13,15,14,11,7,7,6,8,13,14,13,12,5,5,6,9],[14,11,12,14,8,6,5,5,15,12,15,14,9,9,8,6],[15,12,13,13,9,5,8,6,14,11,12,11,8,6,5,5]].map(e=>new Uint8Array(e)),shiftsL=idxL.map((e,t)=>e.map(r=>shifts[t][r])),shiftsR=idxR.map((e,t)=>e.map(r=>shifts[t][r])),Kl=new Uint32Array([0,1518500249,1859775393,2400959708,2840853838]),Kr=new Uint32Array([1352829926,1548603684,1836072691,2053994217,0]);function f(e,t,r,n){return e===0?t^r^n:e===1?t&r|~t&n:e===2?(t|~r)^n:e===3?t&n|r&~n:t^(r|~n)}const R_BUF=new Uint32Array(16);class RIPEMD160 extends _md_js_1$1.HashMD{constructor(){super(64,20,8,!0),this.h0=1732584193,this.h1=-271733879,this.h2=-1732584194,this.h3=271733878,this.h4=-1009589776}get(){const{h0:t,h1:r,h2:n,h3:o,h4:s}=this;return[t,r,n,o,s]}set(t,r,n,o,s){this.h0=t|0,this.h1=r|0,this.h2=n|0,this.h3=o|0,this.h4=s|0}process(t,r){for(let v=0;v<16;v++,r+=4)R_BUF[v]=t.getUint32(r,!0);let n=this.h0|0,o=n,s=this.h1|0,a=s,u=this.h2|0,p=u,d=this.h3|0,c=d,m=this.h4|0,_=m;for(let v=0;v<5;v++){const S=4-v,E=Kl[v],x=Kr[v],O=idxL[v],q=idxR[v],U=shiftsL[v],L=shiftsR[v];for(let z=0;z<16;z++){const F=(0,utils_js_1$1.rotl)(n+f(v,s,u,d)+R_BUF[O[z]]+E,U[z])+m|0;n=m,m=d,d=(0,utils_js_1$1.rotl)(u,10)|0,u=s,s=F}for(let z=0;z<16;z++){const F=(0,utils_js_1$1.rotl)(o+f(S,a,p,c)+R_BUF[q[z]]+x,L[z])+_|0;o=_,_=c,c=(0,utils_js_1$1.rotl)(p,10)|0,p=a,a=F}}this.set(this.h1+u+c|0,this.h2+d+_|0,this.h3+m+o|0,this.h4+n+a|0,this.h0+s+p|0)}roundClean(){R_BUF.fill(0)}destroy(){this.destroyed=!0,this.buffer.fill(0),this.set(0,0,0,0,0)}}ripemd160.RIPEMD160=RIPEMD160;ripemd160.ripemd160=(0,utils_js_1$1.wrapConstructor)(()=>new RIPEMD160);var sha1={};Object.defineProperty(sha1,"__esModule",{value:!0});sha1.sha1=sha1.SHA1=void 0;const _md_js_1=_md$2,utils_js_1=utils$q,SHA1_IV=new Uint32Array([1732584193,4023233417,2562383102,271733878,3285377520]),SHA1_W=new Uint32Array(80);class SHA1 extends _md_js_1.HashMD{constructor(){super(64,20,8,!1),this.A=SHA1_IV[0]|0,this.B=SHA1_IV[1]|0,this.C=SHA1_IV[2]|0,this.D=SHA1_IV[3]|0,this.E=SHA1_IV[4]|0}get(){const{A:t,B:r,C:n,D:o,E:s}=this;return[t,r,n,o,s]}set(t,r,n,o,s){this.A=t|0,this.B=r|0,this.C=n|0,this.D=o|0,this.E=s|0}process(t,r){for(let p=0;p<16;p++,r+=4)SHA1_W[p]=t.getUint32(r,!1);for(let p=16;p<80;p++)SHA1_W[p]=(0,utils_js_1.rotl)(SHA1_W[p-3]^SHA1_W[p-8]^SHA1_W[p-14]^SHA1_W[p-16],1);let{A:n,B:o,C:s,D:a,E:u}=this;for(let p=0;p<80;p++){let d,c;p<20?(d=(0,_md_js_1.Chi)(o,s,a),c=1518500249):p<40?(d=o^s^a,c=1859775393):p<60?(d=(0,_md_js_1.Maj)(o,s,a),c=2400959708):(d=o^s^a,c=3395469782);const m=(0,utils_js_1.rotl)(n,5)+d+u+c+SHA1_W[p]|0;u=a,a=s,s=(0,utils_js_1.rotl)(o,30),o=n,n=m}n=n+this.A|0,o=o+this.B|0,s=s+this.C|0,a=a+this.D|0,u=u+this.E|0,this.set(n,o,s,a,u)}roundClean(){SHA1_W.fill(0)}destroy(){this.set(0,0,0,0,0),this.buffer.fill(0)}}sha1.SHA1=SHA1;sha1.sha1=(0,utils_js_1.wrapConstructor)(()=>new SHA1);(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.taggedHash=e.TAGGED_HASH_PREFIXES=e.TAGS=e.hash256=e.hash160=e.sha256=e.sha1=e.ripemd160=void 0;const t=ripemd160,r=sha1,n=sha256$7;function o(c){return Buffer$e.from((0,t.ripemd160)(Uint8Array.from(c)))}e.ripemd160=o;function s(c){return Buffer$e.from((0,r.sha1)(Uint8Array.from(c)))}e.sha1=s;function a(c){return Buffer$e.from((0,n.sha256)(Uint8Array.from(c)))}e.sha256=a;function u(c){return Buffer$e.from((0,t.ripemd160)((0,n.sha256)(Uint8Array.from(c))))}e.hash160=u;function p(c){return Buffer$e.from((0,n.sha256)((0,n.sha256)(Uint8Array.from(c))))}e.hash256=p,e.TAGS=["BIP0340/challenge","BIP0340/aux","BIP0340/nonce","TapLeaf","TapBranch","TapSighash","TapTweak","KeyAgg list","KeyAgg coefficient"],e.TAGGED_HASH_PREFIXES={"BIP0340/challenge":Buffer$e.from([123,181,45,122,159,239,88,50,62,177,191,122,64,125,179,130,210,243,242,216,27,177,34,79,73,254,81,143,109,72,211,124,123,181,45,122,159,239,88,50,62,177,191,122,64,125,179,130,210,243,242,216,27,177,34,79,73,254,81,143,109,72,211,124]),"BIP0340/aux":Buffer$e.from([241,239,78,94,192,99,202,218,109,148,202,250,157,152,126,160,105,38,88,57,236,193,31,151,45,119,165,46,216,193,204,144,241,239,78,94,192,99,202,218,109,148,202,250,157,152,126,160,105,38,88,57,236,193,31,151,45,119,165,46,216,193,204,144]),"BIP0340/nonce":Buffer$e.from([7,73,119,52,167,155,203,53,91,155,140,125,3,79,18,28,244,52,215,62,247,45,218,25,135,0,97,251,82,191,235,47,7,73,119,52,167,155,203,53,91,155,140,125,3,79,18,28,244,52,215,62,247,45,218,25,135,0,97,251,82,191,235,47]),TapLeaf:Buffer$e.from([174,234,143,220,66,8,152,49,5,115,75,88,8,29,30,38,56,211,95,28,181,64,8,212,211,87,202,3,190,120,233,238,174,234,143,220,66,8,152,49,5,115,75,88,8,29,30,38,56,211,95,28,181,64,8,212,211,87,202,3,190,120,233,238]),TapBranch:Buffer$e.from([25,65,161,242,229,110,185,95,162,169,241,148,190,92,1,247,33,111,51,237,130,176,145,70,52,144,208,91,245,22,160,21,25,65,161,242,229,110,185,95,162,169,241,148,190,92,1,247,33,111,51,237,130,176,145,70,52,144,208,91,245,22,160,21]),TapSighash:Buffer$e.from([244,10,72,223,75,42,112,200,180,146,75,242,101,70,97,237,61,149,253,102,163,19,235,135,35,117,151,198,40,228,160,49,244,10,72,223,75,42,112,200,180,146,75,242,101,70,97,237,61,149,253,102,163,19,235,135,35,117,151,198,40,228,160,49]),TapTweak:Buffer$e.from([232,15,225,99,156,156,160,80,227,175,27,57,193,67,198,62,66,156,188,235,21,217,64,251,181,197,161,244,175,87,197,233,232,15,225,99,156,156,160,80,227,175,27,57,193,67,198,62,66,156,188,235,21,217,64,251,181,197,161,244,175,87,197,233]),"KeyAgg list":Buffer$e.from([72,28,151,28,60,11,70,215,240,178,117,174,89,141,78,44,126,215,49,156,89,74,92,110,199,158,160,212,153,2,148,240,72,28,151,28,60,11,70,215,240,178,117,174,89,141,78,44,126,215,49,156,89,74,92,110,199,158,160,212,153,2,148,240]),"KeyAgg coefficient":Buffer$e.from([191,201,4,3,77,28,136,232,200,14,34,229,61,36,86,109,100,130,78,214,66,114,129,192,145,0,249,77,205,82,201,129,191,201,4,3,77,28,136,232,200,14,34,229,61,36,86,109,100,130,78,214,66,114,129,192,145,0,249,77,205,82,201,129])};function d(c,m){return a(Buffer$e.concat([e.TAGGED_HASH_PREFIXES[c],m]))}e.taggedHash=d})(crypto$1);var bufferutils={},types$4={},types$3={Array:function(e){return e!=null&&e.constructor===Array},Boolean:function(e){return typeof e=="boolean"},Function:function(e){return typeof e=="function"},Nil:function(e){return e==null},Number:function(e){return typeof e=="number"},Object:function(e){return typeof e=="object"},String:function(e){return typeof e=="string"},"":function(){return!0}};types$3.Null=types$3.Nil;for(var typeName$1 in types$3)types$3[typeName$1].toJSON=(function(e){return e}).bind(null,typeName$1);var native$2=types$3,native$1=native$2;function getTypeName(e){return e.name||e.toString().match(/function (.*?)\s*\(/)[1]}function getValueTypeName$1(e){return native$1.Nil(e)?"":getTypeName(e.constructor)}function getValue(e){return native$1.Function(e)?"":native$1.String(e)?JSON.stringify(e):e&&native$1.Object(e)?"":e}function captureStackTrace(e,t){Error.captureStackTrace&&Error.captureStackTrace(e,t)}function tfJSON$1(e){return native$1.Function(e)?e.toJSON?e.toJSON():getTypeName(e):native$1.Array(e)?"Array":e&&native$1.Object(e)?"Object":e!==void 0?e:""}function tfErrorString(e,t,r){var n=getValue(t);return"Expected "+tfJSON$1(e)+", got"+(r!==""?" "+r:"")+(n!==""?" "+n:"")}function TfTypeError$1(e,t,r){r=r||getValueTypeName$1(t),this.message=tfErrorString(e,t,r),captureStackTrace(this,TfTypeError$1),this.__type=e,this.__value=t,this.__valueTypeName=r}TfTypeError$1.prototype=Object.create(Error.prototype);TfTypeError$1.prototype.constructor=TfTypeError$1;function tfPropertyErrorString(e,t,r,n,o){var s='" of type ';return t==="key"&&(s='" with key type '),tfErrorString('property "'+tfJSON$1(r)+s+tfJSON$1(e),n,o)}function TfPropertyTypeError$1(e,t,r,n,o){e?(o=o||getValueTypeName$1(n),this.message=tfPropertyErrorString(e,r,t,n,o)):this.message='Unexpected property "'+t+'"',captureStackTrace(this,TfTypeError$1),this.__label=r,this.__property=t,this.__type=e,this.__value=n,this.__valueTypeName=o}TfPropertyTypeError$1.prototype=Object.create(Error.prototype);TfPropertyTypeError$1.prototype.constructor=TfTypeError$1;function tfCustomError(e,t){return new TfTypeError$1(e,{},t)}function tfSubError$1(e,t,r){return e instanceof TfPropertyTypeError$1?(t=t+"."+e.__property,e=new TfPropertyTypeError$1(e.__type,t,e.__label,e.__value,e.__valueTypeName)):e instanceof TfTypeError$1&&(e=new TfPropertyTypeError$1(e.__type,t,r,e.__value,e.__valueTypeName)),captureStackTrace(e),e}var errors={TfTypeError:TfTypeError$1,TfPropertyTypeError:TfPropertyTypeError$1,tfCustomError,tfSubError:tfSubError$1,tfJSON:tfJSON$1,getValueTypeName:getValueTypeName$1},extra,hasRequiredExtra;function requireExtra(){if(hasRequiredExtra)return extra;hasRequiredExtra=1;var e=native$2,t=errors;function r(F){return Buffer$e.isBuffer(F)}function n(F){return typeof F=="string"&&/^([0-9a-f]{2})+$/i.test(F)}function o(F,y){var T=F.toJSON();function D(G){if(!F(G))return!1;if(G.length===y)return!0;throw t.tfCustomError(T+"(Length: "+y+")",T+"(Length: "+G.length+")")}return D.toJSON=function(){return T},D}var s=o.bind(null,e.Array),a=o.bind(null,r),u=o.bind(null,n),p=o.bind(null,e.String);function d(F,y,T){T=T||e.Number;function D(G,C){return T(G,C)&&G>F&&G<y}return D.toJSON=function(){return`${T.toJSON()} between [${F}, ${y}]`},D}var c=Math.pow(2,53)-1;function m(F){return typeof F=="number"&&isFinite(F)}function _(F){return F<<24>>24===F}function v(F){return F<<16>>16===F}function S(F){return(F|0)===F}function E(F){return typeof F=="number"&&F>=-c&&F<=c&&Math.floor(F)===F}function x(F){return(F&255)===F}function O(F){return(F&65535)===F}function q(F){return F>>>0===F}function U(F){return typeof F=="number"&&F>=0&&F<=c&&Math.floor(F)===F}var L={ArrayN:s,Buffer:r,BufferN:a,Finite:m,Hex:n,HexN:u,Int8:_,Int16:v,Int32:S,Int53:E,Range:d,StringN:p,UInt8:x,UInt16:O,UInt32:q,UInt53:U};for(var z in L)L[z].toJSON=(function(F){return F}).bind(null,z);return extra=L,extra}var ERRORS=errors,NATIVE=native$2,tfJSON=ERRORS.tfJSON,TfTypeError=ERRORS.TfTypeError,TfPropertyTypeError=ERRORS.TfPropertyTypeError,tfSubError=ERRORS.tfSubError,getValueTypeName=ERRORS.getValueTypeName,TYPES={arrayOf:function e(t,r){t=compile(t),r=r||{};function n(o,s){return!NATIVE.Array(o)||NATIVE.Nil(o)||r.minLength!==void 0&&o.length<r.minLength||r.maxLength!==void 0&&o.length>r.maxLength||r.length!==void 0&&o.length!==r.length?!1:o.every(function(a,u){try{return typeforce$3(t,a,s)}catch(p){throw tfSubError(p,u)}})}return n.toJSON=function(){var o="["+tfJSON(t)+"]";return r.length!==void 0?o+="{"+r.length+"}":(r.minLength!==void 0||r.maxLength!==void 0)&&(o+="{"+(r.minLength===void 0?0:r.minLength)+","+(r.maxLength===void 0?1/0:r.maxLength)+"}"),o},n},maybe:function e(t){t=compile(t);function r(n,o){return NATIVE.Nil(n)||t(n,o,e)}return r.toJSON=function(){return"?"+tfJSON(t)},r},map:function e(t,r){t=compile(t),r&&(r=compile(r));function n(o,s){if(!NATIVE.Object(o)||NATIVE.Nil(o))return!1;for(var a in o){try{r&&typeforce$3(r,a,s)}catch(p){throw tfSubError(p,a,"key")}try{var u=o[a];typeforce$3(t,u,s)}catch(p){throw tfSubError(p,a)}}return!0}return r?n.toJSON=function(){return"{"+tfJSON(r)+": "+tfJSON(t)+"}"}:n.toJSON=function(){return"{"+tfJSON(t)+"}"},n},object:function e(t){var r={};for(var n in t)r[n]=compile(t[n]);function o(s,a){if(!NATIVE.Object(s)||NATIVE.Nil(s))return!1;var u;try{for(u in r){var p=r[u],d=s[u];typeforce$3(p,d,a)}}catch(c){throw tfSubError(c,u)}if(a){for(u in s)if(!r[u])throw new TfPropertyTypeError(void 0,u)}return!0}return o.toJSON=function(){return tfJSON(r)},o},anyOf:function e(){var t=[].slice.call(arguments).map(compile);function r(n,o){return t.some(function(s){try{return typeforce$3(s,n,o)}catch{return!1}})}return r.toJSON=function(){return t.map(tfJSON).join("|")},r},allOf:function e(){var t=[].slice.call(arguments).map(compile);function r(n,o){return t.every(function(s){try{return typeforce$3(s,n,o)}catch{return!1}})}return r.toJSON=function(){return t.map(tfJSON).join(" & ")},r},quacksLike:function e(t){function r(n){return t===getValueTypeName(n)}return r.toJSON=function(){return t},r},tuple:function e(){var t=[].slice.call(arguments).map(compile);function r(n,o){return NATIVE.Nil(n)||NATIVE.Nil(n.length)||o&&n.length!==t.length?!1:t.every(function(s,a){try{return typeforce$3(s,n[a],o)}catch(u){throw tfSubError(u,a)}})}return r.toJSON=function(){return"("+t.map(tfJSON).join(", ")+")"},r},value:function e(t){function r(n){return n===t}return r.toJSON=function(){return t},r}};TYPES.oneOf=TYPES.anyOf;function compile(e){if(NATIVE.String(e))return e[0]==="?"?TYPES.maybe(e.slice(1)):NATIVE[e]||TYPES.quacksLike(e);if(e&&NATIVE.Object(e)){if(NATIVE.Array(e)){if(e.length!==1)throw new TypeError("Expected compile() parameter of type Array of length 1");return TYPES.arrayOf(e[0])}return TYPES.object(e)}else if(NATIVE.Function(e))return e;return TYPES.value(e)}function typeforce$3(e,t,r,n){if(NATIVE.Function(e)){if(e(t,r))return!0;throw new TfTypeError(n||e,t)}return typeforce$3(compile(e),t,r)}for(var typeName in NATIVE)typeforce$3[typeName]=NATIVE[typeName];for(typeName in TYPES)typeforce$3[typeName]=TYPES[typeName];var EXTRA=requireExtra();for(typeName in EXTRA)typeforce$3[typeName]=EXTRA[typeName];typeforce$3.compile=compile;typeforce$3.TfTypeError=TfTypeError;typeforce$3.TfPropertyTypeError=TfPropertyTypeError;var typeforce_1=typeforce$3;(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.oneOf=e.Null=e.BufferN=e.Function=e.UInt32=e.UInt8=e.tuple=e.maybe=e.Hex=e.Buffer=e.String=e.Boolean=e.Array=e.Number=e.Hash256bit=e.Hash160bit=e.Buffer256bit=e.isTaptree=e.isTapleaf=e.TAPLEAF_VERSION_MASK=e.Network=e.ECPoint=e.Satoshi=e.Signer=e.BIP32Path=e.UInt31=e.isPoint=e.typeforce=void 0;const t=require$$0$3;e.typeforce=typeforce_1;const r=t.Buffer.alloc(32,0),n=t.Buffer.from("fffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f","hex");function o(v){if(!t.Buffer.isBuffer(v)||v.length<33)return!1;const S=v[0],E=v.slice(1,33);if(E.compare(r)===0||E.compare(n)>=0)return!1;if((S===2||S===3)&&v.length===33)return!0;const x=v.slice(33);return x.compare(r)===0||x.compare(n)>=0?!1:S===4&&v.length===65}e.isPoint=o;const s=Math.pow(2,31)-1;function a(v){return e.typeforce.UInt32(v)&&v<=s}e.UInt31=a;function u(v){return e.typeforce.String(v)&&!!v.match(/^(m\/)?(\d+'?\/)*\d+'?$/)}e.BIP32Path=u,u.toJSON=()=>"BIP32 derivation path";function p(v){return(e.typeforce.Buffer(v.publicKey)||typeof v.getPublicKey=="function")&&typeof v.sign=="function"}e.Signer=p;const d=21*1e14;function c(v){return e.typeforce.UInt53(v)&&v<=d}e.Satoshi=c,e.ECPoint=e.typeforce.quacksLike("Point"),e.Network=e.typeforce.compile({messagePrefix:e.typeforce.oneOf(e.typeforce.Buffer,e.typeforce.String),bip32:{public:e.typeforce.UInt32,private:e.typeforce.UInt32},pubKeyHash:e.typeforce.UInt8,scriptHash:e.typeforce.UInt8,wif:e.typeforce.UInt8}),e.TAPLEAF_VERSION_MASK=254;function m(v){return!v||!("output"in v)||!t.Buffer.isBuffer(v.output)?!1:v.version!==void 0?(v.version&e.TAPLEAF_VERSION_MASK)===v.version:!0}e.isTapleaf=m;function _(v){return(0,e.Array)(v)?v.length!==2?!1:v.every(S=>_(S)):m(v)}e.isTaptree=_,e.Buffer256bit=e.typeforce.BufferN(32),e.Hash160bit=e.typeforce.BufferN(20),e.Hash256bit=e.typeforce.BufferN(32),e.Number=e.typeforce.Number,e.Array=e.typeforce.Array,e.Boolean=e.typeforce.Boolean,e.String=e.typeforce.String,e.Buffer=e.typeforce.Buffer,e.Hex=e.typeforce.Hex,e.maybe=e.typeforce.maybe,e.tuple=e.typeforce.tuple,e.UInt8=e.typeforce.UInt8,e.UInt32=e.typeforce.UInt32,e.Function=e.typeforce.Function,e.BufferN=e.typeforce.BufferN,e.Null=e.typeforce.Null,e.oneOf=e.typeforce.oneOf})(types$4);var Buffer=safeBufferExports.Buffer,MAX_SAFE_INTEGER$1=9007199254740991;function checkUInt53$1(e){if(e<0||e>MAX_SAFE_INTEGER$1||e%1!==0)throw new RangeError("value out of range")}function encode$5(e,t,r){if(checkUInt53$1(e),t||(t=Buffer.allocUnsafe(encodingLength$2(e))),!Buffer.isBuffer(t))throw new TypeError("buffer must be a Buffer instance");return r||(r=0),e<253?(t.writeUInt8(e,r),encode$5.bytes=1):e<=65535?(t.writeUInt8(253,r),t.writeUInt16LE(e,r+1),encode$5.bytes=3):e<=4294967295?(t.writeUInt8(254,r),t.writeUInt32LE(e,r+1),encode$5.bytes=5):(t.writeUInt8(255,r),t.writeUInt32LE(e>>>0,r+1),t.writeUInt32LE(e/4294967296|0,r+5),encode$5.bytes=9),t}function decode$5(e,t){if(!Buffer.isBuffer(e))throw new TypeError("buffer must be a Buffer instance");t||(t=0);var r=e.readUInt8(t);if(r<253)return decode$5.bytes=1,r;if(r===253)return decode$5.bytes=3,e.readUInt16LE(t+1);if(r===254)return decode$5.bytes=5,e.readUInt32LE(t+1);decode$5.bytes=9;var n=e.readUInt32LE(t+1),o=e.readUInt32LE(t+5),s=o*4294967296+n;return checkUInt53$1(s),s}function encodingLength$2(e){return checkUInt53$1(e),e<253?1:e<=65535?3:e<=4294967295?5:9}var varuintBitcoin={encode:encode$5,decode:decode$5,encodingLength:encodingLength$2};Object.defineProperty(bufferutils,"__esModule",{value:!0});bufferutils.BufferReader=bufferutils.BufferWriter=bufferutils.cloneBuffer=bufferutils.reverseBuffer=bufferutils.writeUInt64LE=bufferutils.readUInt64LE=bufferutils.varuint=void 0;const types$2=types$4,{typeforce:typeforce$2}=types$2,varuint$1=varuintBitcoin;bufferutils.varuint=varuint$1;function verifuint(e,t){if(typeof e!="number")throw new Error("cannot write a non-number as a number");if(e<0)throw new Error("specified a negative value for writing an unsigned value");if(e>t)throw new Error("RangeError: value out of range");if(Math.floor(e)!==e)throw new Error("value has a fractional component")}function readUInt64LE(e,t){const r=e.readUInt32LE(t);let n=e.readUInt32LE(t+4);return n*=4294967296,verifuint(n+r,9007199254740991),n+r}bufferutils.readUInt64LE=readUInt64LE;function writeUInt64LE(e,t,r){return verifuint(t,9007199254740991),e.writeInt32LE(t&-1,r),e.writeUInt32LE(Math.floor(t/4294967296),r+4),r+8}bufferutils.writeUInt64LE=writeUInt64LE;function reverseBuffer(e){if(e.length<1)return e;let t=e.length-1,r=0;for(let n=0;n<e.length/2;n++)r=e[n],e[n]=e[t],e[t]=r,t--;return e}bufferutils.reverseBuffer=reverseBuffer;function cloneBuffer(e){const t=Buffer$e.allocUnsafe(e.length);return e.copy(t),t}bufferutils.cloneBuffer=cloneBuffer;class BufferWriter{static withCapacity(t){return new BufferWriter(Buffer$e.alloc(t))}constructor(t,r=0){this.buffer=t,this.offset=r,typeforce$2(types$2.tuple(types$2.Buffer,types$2.UInt32),[t,r])}writeUInt8(t){this.offset=this.buffer.writeUInt8(t,this.offset)}writeInt32(t){this.offset=this.buffer.writeInt32LE(t,this.offset)}writeUInt32(t){this.offset=this.buffer.writeUInt32LE(t,this.offset)}writeUInt64(t){this.offset=writeUInt64LE(this.buffer,t,this.offset)}writeVarInt(t){varuint$1.encode(t,this.buffer,this.offset),this.offset+=varuint$1.encode.bytes}writeSlice(t){if(this.buffer.length<this.offset+t.length)throw new Error("Cannot write slice out of bounds");this.offset+=t.copy(this.buffer,this.offset)}writeVarSlice(t){this.writeVarInt(t.length),this.writeSlice(t)}writeVector(t){this.writeVarInt(t.length),t.forEach(r=>this.writeVarSlice(r))}end(){if(this.buffer.length===this.offset)return this.buffer;throw new Error(`buffer size ${this.buffer.length}, offset ${this.offset}`)}}bufferutils.BufferWriter=BufferWriter;class BufferReader{constructor(t,r=0){this.buffer=t,this.offset=r,typeforce$2(types$2.tuple(types$2.Buffer,types$2.UInt32),[t,r])}readUInt8(){const t=this.buffer.readUInt8(this.offset);return this.offset++,t}readInt32(){const t=this.buffer.readInt32LE(this.offset);return this.offset+=4,t}readUInt32(){const t=this.buffer.readUInt32LE(this.offset);return this.offset+=4,t}readUInt64(){const t=readUInt64LE(this.buffer,this.offset);return this.offset+=8,t}readVarInt(){const t=varuint$1.decode(this.buffer,this.offset);return this.offset+=varuint$1.decode.bytes,t}readSlice(t){if(this.buffer.length<this.offset+t)throw new Error("Cannot read slice out of bounds");const r=this.buffer.slice(this.offset,this.offset+t);return this.offset+=t,r}readVarSlice(){return this.readSlice(this.readVarInt())}readVector(){const t=this.readVarInt(),r=[];for(let n=0;n<t;n++)r.push(this.readVarSlice());return r}}bufferutils.BufferReader=BufferReader;(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.tweakKey=e.tapTweakHash=e.tapleafHash=e.findScriptPath=e.toHashTree=e.rootHashFromPath=e.MAX_TAPTREE_DEPTH=e.LEAF_VERSION_TAPSCRIPT=void 0;const t=require$$0$3,r=ecc_lib,n=crypto$1,o=bufferutils,s=types$4;e.LEAF_VERSION_TAPSCRIPT=192,e.MAX_TAPTREE_DEPTH=128;const a=E=>"left"in E&&"right"in E;function u(E,x){if(E.length<33)throw new TypeError(`The control-block length is too small. Got ${E.length}, expected min 33.`);const O=(E.length-33)/32;let q=x;for(let U=0;U<O;U++){const L=E.slice(33+32*U,65+32*U);q.compare(L)<0?q=v(q,L):q=v(L,q)}return q}e.rootHashFromPath=u;function p(E){if((0,s.isTapleaf)(E))return{hash:c(E)};const x=[p(E[0]),p(E[1])];x.sort((U,L)=>U.hash.compare(L.hash));const[O,q]=x;return{hash:v(O.hash,q.hash),left:O,right:q}}e.toHashTree=p;function d(E,x){if(a(E)){const O=d(E.left,x);if(O!==void 0)return[...O,E.right.hash];const q=d(E.right,x);if(q!==void 0)return[...q,E.left.hash]}else if(E.hash.equals(x))return[]}e.findScriptPath=d;function c(E){const x=E.version||e.LEAF_VERSION_TAPSCRIPT;return n.taggedHash("TapLeaf",t.Buffer.concat([t.Buffer.from([x]),S(E.output)]))}e.tapleafHash=c;function m(E,x){return n.taggedHash("TapTweak",t.Buffer.concat(x?[E,x]:[E]))}e.tapTweakHash=m;function _(E,x){if(!t.Buffer.isBuffer(E)||E.length!==32||x&&x.length!==32)return null;const O=m(E,x),q=(0,r.getEccLib)().xOnlyPointAddTweak(E,O);return!q||q.xOnlyPubkey===null?null:{parity:q.parity,x:t.Buffer.from(q.xOnlyPubkey)}}e.tweakKey=_;function v(E,x){return n.taggedHash("TapBranch",t.Buffer.concat([E,x]))}function S(E){const x=o.varuint.encodingLength(E.length),O=t.Buffer.allocUnsafe(x);return o.varuint.encode(E.length,O),t.Buffer.concat([O,E])}})(bip341);var bip371={},transaction={},script={},bip66$1={};Object.defineProperty(bip66$1,"__esModule",{value:!0});bip66$1.encode=bip66$1.decode=bip66$1.check=void 0;function check(e){if(e.length<8||e.length>72||e[0]!==48||e[1]!==e.length-2||e[2]!==2)return!1;const t=e[3];if(t===0||5+t>=e.length||e[4+t]!==2)return!1;const r=e[5+t];return!(r===0||6+t+r!==e.length||e[4]&128||t>1&&e[4]===0&&!(e[5]&128)||e[t+6]&128||r>1&&e[t+6]===0&&!(e[t+7]&128))}bip66$1.check=check;function decode$4(e){if(e.length<8)throw new Error("DER sequence length is too short");if(e.length>72)throw new Error("DER sequence length is too long");if(e[0]!==48)throw new Error("Expected DER sequence");if(e[1]!==e.length-2)throw new Error("DER sequence length is invalid");if(e[2]!==2)throw new Error("Expected DER integer");const t=e[3];if(t===0)throw new Error("R length is zero");if(5+t>=e.length)throw new Error("R length is too long");if(e[4+t]!==2)throw new Error("Expected DER integer (2)");const r=e[5+t];if(r===0)throw new Error("S length is zero");if(6+t+r!==e.length)throw new Error("S length is invalid");if(e[4]&128)throw new Error("R value is negative");if(t>1&&e[4]===0&&!(e[5]&128))throw new Error("R value excessively padded");if(e[t+6]&128)throw new Error("S value is negative");if(r>1&&e[t+6]===0&&!(e[t+7]&128))throw new Error("S value excessively padded");return{r:e.slice(4,4+t),s:e.slice(6+t)}}bip66$1.decode=decode$4;function encode$4(e,t){const r=e.length,n=t.length;if(r===0)throw new Error("R length is zero");if(n===0)throw new Error("S length is zero");if(r>33)throw new Error("R length is too long");if(n>33)throw new Error("S length is too long");if(e[0]&128)throw new Error("R value is negative");if(t[0]&128)throw new Error("S value is negative");if(r>1&&e[0]===0&&!(e[1]&128))throw new Error("R value excessively padded");if(n>1&&t[0]===0&&!(t[1]&128))throw new Error("S value excessively padded");const o=Buffer$e.allocUnsafe(6+r+n);return o[0]=48,o[1]=o.length-2,o[2]=2,o[3]=e.length,e.copy(o,4),o[4+r]=2,o[5+r]=t.length,t.copy(o,6+r),o}bip66$1.encode=encode$4;var ops={};Object.defineProperty(ops,"__esModule",{value:!0});ops.REVERSE_OPS=ops.OPS=void 0;const OPS$8={OP_FALSE:0,OP_0:0,OP_PUSHDATA1:76,OP_PUSHDATA2:77,OP_PUSHDATA4:78,OP_1NEGATE:79,OP_RESERVED:80,OP_TRUE:81,OP_1:81,OP_2:82,OP_3:83,OP_4:84,OP_5:85,OP_6:86,OP_7:87,OP_8:88,OP_9:89,OP_10:90,OP_11:91,OP_12:92,OP_13:93,OP_14:94,OP_15:95,OP_16:96,OP_NOP:97,OP_VER:98,OP_IF:99,OP_NOTIF:100,OP_VERIF:101,OP_VERNOTIF:102,OP_ELSE:103,OP_ENDIF:104,OP_VERIFY:105,OP_RETURN:106,OP_TOALTSTACK:107,OP_FROMALTSTACK:108,OP_2DROP:109,OP_2DUP:110,OP_3DUP:111,OP_2OVER:112,OP_2ROT:113,OP_2SWAP:114,OP_IFDUP:115,OP_DEPTH:116,OP_DROP:117,OP_DUP:118,OP_NIP:119,OP_OVER:120,OP_PICK:121,OP_ROLL:122,OP_ROT:123,OP_SWAP:124,OP_TUCK:125,OP_CAT:126,OP_SUBSTR:127,OP_LEFT:128,OP_RIGHT:129,OP_SIZE:130,OP_INVERT:131,OP_AND:132,OP_OR:133,OP_XOR:134,OP_EQUAL:135,OP_EQUALVERIFY:136,OP_RESERVED1:137,OP_RESERVED2:138,OP_1ADD:139,OP_1SUB:140,OP_2MUL:141,OP_2DIV:142,OP_NEGATE:143,OP_ABS:144,OP_NOT:145,OP_0NOTEQUAL:146,OP_ADD:147,OP_SUB:148,OP_MUL:149,OP_DIV:150,OP_MOD:151,OP_LSHIFT:152,OP_RSHIFT:153,OP_BOOLAND:154,OP_BOOLOR:155,OP_NUMEQUAL:156,OP_NUMEQUALVERIFY:157,OP_NUMNOTEQUAL:158,OP_LESSTHAN:159,OP_GREATERTHAN:160,OP_LESSTHANOREQUAL:161,OP_GREATERTHANOREQUAL:162,OP_MIN:163,OP_MAX:164,OP_WITHIN:165,OP_RIPEMD160:166,OP_SHA1:167,OP_SHA256:168,OP_HASH160:169,OP_HASH256:170,OP_CODESEPARATOR:171,OP_CHECKSIG:172,OP_CHECKSIGVERIFY:173,OP_CHECKMULTISIG:174,OP_CHECKMULTISIGVERIFY:175,OP_NOP1:176,OP_NOP2:177,OP_CHECKLOCKTIMEVERIFY:177,OP_NOP3:178,OP_CHECKSEQUENCEVERIFY:178,OP_NOP4:179,OP_NOP5:180,OP_NOP6:181,OP_NOP7:182,OP_NOP8:183,OP_NOP9:184,OP_NOP10:185,OP_CHECKSIGADD:186,OP_PUBKEYHASH:253,OP_PUBKEY:254,OP_INVALIDOPCODE:255};ops.OPS=OPS$8;const REVERSE_OPS={};ops.REVERSE_OPS=REVERSE_OPS;for(const e of Object.keys(OPS$8)){const t=OPS$8[e];REVERSE_OPS[t]=e}var push_data={};Object.defineProperty(push_data,"__esModule",{value:!0});push_data.decode=push_data.encode=push_data.encodingLength=void 0;const ops_1=ops;function encodingLength$1(e){return e<ops_1.OPS.OP_PUSHDATA1?1:e<=255?2:e<=65535?3:5}push_data.encodingLength=encodingLength$1;function encode$3(e,t,r){const n=encodingLength$1(t);return n===1?e.writeUInt8(t,r):n===2?(e.writeUInt8(ops_1.OPS.OP_PUSHDATA1,r),e.writeUInt8(t,r+1)):n===3?(e.writeUInt8(ops_1.OPS.OP_PUSHDATA2,r),e.writeUInt16LE(t,r+1)):(e.writeUInt8(ops_1.OPS.OP_PUSHDATA4,r),e.writeUInt32LE(t,r+1)),n}push_data.encode=encode$3;function decode$3(e,t){const r=e.readUInt8(t);let n,o;if(r<ops_1.OPS.OP_PUSHDATA1)n=r,o=1;else if(r===ops_1.OPS.OP_PUSHDATA1){if(t+2>e.length)return null;n=e.readUInt8(t+1),o=2}else if(r===ops_1.OPS.OP_PUSHDATA2){if(t+3>e.length)return null;n=e.readUInt16LE(t+1),o=3}else{if(t+5>e.length)return null;if(r!==ops_1.OPS.OP_PUSHDATA4)throw new Error("Unexpected opcode");n=e.readUInt32LE(t+1),o=5}return{opcode:r,number:n,size:o}}push_data.decode=decode$3;var script_number={};Object.defineProperty(script_number,"__esModule",{value:!0});script_number.encode=script_number.decode=void 0;function decode$2(e,t,r){t=t||4,r=r===void 0?!0:r;const n=e.length;if(n===0)return 0;if(n>t)throw new TypeError("Script number overflow");if(r&&!(e[n-1]&127)&&(n<=1||!(e[n-2]&128)))throw new Error("Non-minimally encoded script number");if(n===5){const s=e.readUInt32LE(0),a=e.readUInt8(4);return a&128?-((a&-129)*4294967296+s):a*4294967296+s}let o=0;for(let s=0;s<n;++s)o|=e[s]<<8*s;return e[n-1]&128?-(o&~(128<<8*(n-1))):o}script_number.decode=decode$2;function scriptNumSize(e){return e>2147483647?5:e>8388607?4:e>32767?3:e>127?2:e>0?1:0}function encode$2(e){let t=Math.abs(e);const r=scriptNumSize(t),n=Buffer$e.allocUnsafe(r),o=e<0;for(let s=0;s<r;++s)n.writeUInt8(t&255,s),t>>=8;return n[r-1]&128?n.writeUInt8(o?128:0,r-1):o&&(n[r-1]|=128),n}script_number.encode=encode$2;var script_signature={};Object.defineProperty(script_signature,"__esModule",{value:!0});script_signature.encode=script_signature.decode=void 0;const bip66=bip66$1,types$1=types$4,{typeforce:typeforce$1}=types$1,ZERO$1=Buffer$e.alloc(1,0);function toDER(e){let t=0;for(;e[t]===0;)++t;return t===e.length?ZERO$1:(e=e.slice(t),e[0]&128?Buffer$e.concat([ZERO$1,e],1+e.length):e)}function fromDER(e){e[0]===0&&(e=e.slice(1));const t=Buffer$e.alloc(32,0),r=Math.max(0,32-e.length);return e.copy(t,r),t}function decode$1(e){const t=e.readUInt8(e.length-1),r=t&-129;if(r<=0||r>=4)throw new Error("Invalid hashType "+t);const n=bip66.decode(e.slice(0,-1)),o=fromDER(n.r),s=fromDER(n.s);return{signature:Buffer$e.concat([o,s],64),hashType:t}}script_signature.decode=decode$1;function encode$1(e,t){typeforce$1({signature:types$1.BufferN(64),hashType:types$1.UInt8},{signature:e,hashType:t});const r=t&-129;if(r<=0||r>=4)throw new Error("Invalid hashType "+t);const n=Buffer$e.allocUnsafe(1);n.writeUInt8(t,0);const o=toDER(e.slice(0,32)),s=toDER(e.slice(32,64));return Buffer$e.concat([bip66.encode(o,s),n])}script_signature.encode=encode$1;(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.signature=e.number=e.isCanonicalScriptSignature=e.isDefinedHashType=e.isCanonicalPubKey=e.toStack=e.fromASM=e.toASM=e.decompile=e.compile=e.countNonPushOnlyOPs=e.isPushOnly=e.OPS=void 0;const t=bip66$1,r=ops;Object.defineProperty(e,"OPS",{enumerable:!0,get:function(){return r.OPS}});const n=push_data,o=script_number,s=script_signature,a=types$4,{typeforce:u}=a,p=r.OPS.OP_RESERVED;function d(D){return a.Number(D)&&(D===r.OPS.OP_0||D>=r.OPS.OP_1&&D<=r.OPS.OP_16||D===r.OPS.OP_1NEGATE)}function c(D){return a.Buffer(D)||d(D)}function m(D){return a.Array(D)&&D.every(c)}e.isPushOnly=m;function _(D){return D.length-D.filter(c).length}e.countNonPushOnlyOPs=_;function v(D){if(D.length===0)return r.OPS.OP_0;if(D.length===1){if(D[0]>=1&&D[0]<=16)return p+D[0];if(D[0]===129)return r.OPS.OP_1NEGATE}}function S(D){return Buffer$e.isBuffer(D)}function E(D){return a.Array(D)}function x(D){return Buffer$e.isBuffer(D)}function O(D){if(S(D))return D;u(a.Array,D);const G=D.reduce((A,w)=>x(w)?w.length===1&&v(w)!==void 0?A+1:A+n.encodingLength(w.length)+w.length:A+1,0),C=Buffer$e.allocUnsafe(G);let l=0;if(D.forEach(A=>{if(x(A)){const w=v(A);if(w!==void 0){C.writeUInt8(w,l),l+=1;return}l+=n.encode(C,A.length,l),A.copy(C,l),l+=A.length}else C.writeUInt8(A,l),l+=1}),l!==C.length)throw new Error("Could not decode chunks");return C}e.compile=O;function q(D){if(E(D))return D;u(a.Buffer,D);const G=[];let C=0;for(;C<D.length;){const l=D[C];if(l>r.OPS.OP_0&&l<=r.OPS.OP_PUSHDATA4){const A=n.decode(D,C);if(A===null||(C+=A.size,C+A.number>D.length))return null;const w=D.slice(C,C+A.number);C+=A.number;const B=v(w);B!==void 0?G.push(B):G.push(w)}else G.push(l),C+=1}return G}e.decompile=q;function U(D){return S(D)&&(D=q(D)),D.map(G=>{if(x(G)){const C=v(G);if(C===void 0)return G.toString("hex");G=C}return r.REVERSE_OPS[G]}).join(" ")}e.toASM=U;function L(D){return u(a.String,D),O(D.split(" ").map(G=>r.OPS[G]!==void 0?r.OPS[G]:(u(a.Hex,G),Buffer$e.from(G,"hex"))))}e.fromASM=L;function z(D){return D=q(D),u(m,D),D.map(G=>x(G)?G:G===r.OPS.OP_0?Buffer$e.allocUnsafe(0):o.encode(G-p))}e.toStack=z;function F(D){return a.isPoint(D)}e.isCanonicalPubKey=F;function y(D){const G=D&-129;return G>0&&G<4}e.isDefinedHashType=y;function T(D){return!Buffer$e.isBuffer(D)||!y(D[D.length-1])?!1:t.check(D.slice(0,-1))}e.isCanonicalScriptSignature=T,e.number=o,e.signature=s})(script);Object.defineProperty(transaction,"__esModule",{value:!0});transaction.Transaction=void 0;const bufferutils_1=bufferutils,bcrypto$4=crypto$1,bscript$9=script,script_1=script,types=types$4,{typeforce}=types;function varSliceSize(e){const t=e.length;return bufferutils_1.varuint.encodingLength(t)+t}function vectorSize(e){const t=e.length;return bufferutils_1.varuint.encodingLength(t)+e.reduce((r,n)=>r+varSliceSize(n),0)}const EMPTY_BUFFER$2=Buffer$e.allocUnsafe(0),EMPTY_WITNESS=[],ZERO=Buffer$e.from("0000000000000000000000000000000000000000000000000000000000000000","hex"),ONE=Buffer$e.from("0000000000000000000000000000000000000000000000000000000000000001","hex"),VALUE_UINT64_MAX=Buffer$e.from("ffffffffffffffff","hex"),BLANK_OUTPUT={script:EMPTY_BUFFER$2,valueBuffer:VALUE_UINT64_MAX};function isOutput(e){return e.value!==void 0}class Transaction{constructor(){this.version=1,this.locktime=0,this.ins=[],this.outs=[]}static fromBuffer(t,r){const n=new bufferutils_1.BufferReader(t),o=new Transaction;o.version=n.readInt32();const s=n.readUInt8(),a=n.readUInt8();let u=!1;s===Transaction.ADVANCED_TRANSACTION_MARKER&&a===Transaction.ADVANCED_TRANSACTION_FLAG?u=!0:n.offset-=2;const p=n.readVarInt();for(let c=0;c<p;++c)o.ins.push({hash:n.readSlice(32),index:n.readUInt32(),script:n.readVarSlice(),sequence:n.readUInt32(),witness:EMPTY_WITNESS});const d=n.readVarInt();for(let c=0;c<d;++c)o.outs.push({value:n.readUInt64(),script:n.readVarSlice()});if(u){for(let c=0;c<p;++c)o.ins[c].witness=n.readVector();if(!o.hasWitnesses())throw new Error("Transaction has superfluous witness data")}if(o.locktime=n.readUInt32(),r)return o;if(n.offset!==t.length)throw new Error("Transaction has unexpected data");return o}static fromHex(t){return Transaction.fromBuffer(Buffer$e.from(t,"hex"),!1)}static isCoinbaseHash(t){typeforce(types.Hash256bit,t);for(let r=0;r<32;++r)if(t[r]!==0)return!1;return!0}isCoinbase(){return this.ins.length===1&&Transaction.isCoinbaseHash(this.ins[0].hash)}addInput(t,r,n,o){return typeforce(types.tuple(types.Hash256bit,types.UInt32,types.maybe(types.UInt32),types.maybe(types.Buffer)),arguments),types.Null(n)&&(n=Transaction.DEFAULT_SEQUENCE),this.ins.push({hash:t,index:r,script:o||EMPTY_BUFFER$2,sequence:n,witness:EMPTY_WITNESS})-1}addOutput(t,r){return typeforce(types.tuple(types.Buffer,types.Satoshi),arguments),this.outs.push({script:t,value:r})-1}hasWitnesses(){return this.ins.some(t=>t.witness.length!==0)}weight(){const t=this.byteLength(!1),r=this.byteLength(!0);return t*3+r}virtualSize(){return Math.ceil(this.weight()/4)}byteLength(t=!0){const r=t&&this.hasWitnesses();return(r?10:8)+bufferutils_1.varuint.encodingLength(this.ins.length)+bufferutils_1.varuint.encodingLength(this.outs.length)+this.ins.reduce((n,o)=>n+40+varSliceSize(o.script),0)+this.outs.reduce((n,o)=>n+8+varSliceSize(o.script),0)+(r?this.ins.reduce((n,o)=>n+vectorSize(o.witness),0):0)}clone(){const t=new Transaction;return t.version=this.version,t.locktime=this.locktime,t.ins=this.ins.map(r=>({hash:r.hash,index:r.index,script:r.script,sequence:r.sequence,witness:r.witness})),t.outs=this.outs.map(r=>({script:r.script,value:r.value})),t}hashForSignature(t,r,n){if(typeforce(types.tuple(types.UInt32,types.Buffer,types.Number),arguments),t>=this.ins.length)return ONE;const o=bscript$9.compile(bscript$9.decompile(r).filter(u=>u!==script_1.OPS.OP_CODESEPARATOR)),s=this.clone();if((n&31)===Transaction.SIGHASH_NONE)s.outs=[],s.ins.forEach((u,p)=>{p!==t&&(u.sequence=0)});else if((n&31)===Transaction.SIGHASH_SINGLE){if(t>=this.outs.length)return ONE;s.outs.length=t+1;for(let u=0;u<t;u++)s.outs[u]=BLANK_OUTPUT;s.ins.forEach((u,p)=>{p!==t&&(u.sequence=0)})}n&Transaction.SIGHASH_ANYONECANPAY?(s.ins=[s.ins[t]],s.ins[0].script=o):(s.ins.forEach(u=>{u.script=EMPTY_BUFFER$2}),s.ins[t].script=o);const a=Buffer$e.allocUnsafe(s.byteLength(!1)+4);return a.writeInt32LE(n,a.length-4),s.__toBuffer(a,0,!1),bcrypto$4.hash256(a)}hashForWitnessV1(t,r,n,o,s,a){if(typeforce(types.tuple(types.UInt32,typeforce.arrayOf(types.Buffer),typeforce.arrayOf(types.Satoshi),types.UInt32),arguments),n.length!==this.ins.length||r.length!==this.ins.length)throw new Error("Must supply prevout script and value for all inputs");const u=o===Transaction.SIGHASH_DEFAULT?Transaction.SIGHASH_ALL:o&Transaction.SIGHASH_OUTPUT_MASK,d=(o&Transaction.SIGHASH_INPUT_MASK)===Transaction.SIGHASH_ANYONECANPAY,c=u===Transaction.SIGHASH_NONE,m=u===Transaction.SIGHASH_SINGLE;let _=EMPTY_BUFFER$2,v=EMPTY_BUFFER$2,S=EMPTY_BUFFER$2,E=EMPTY_BUFFER$2,x=EMPTY_BUFFER$2;if(!d){let L=bufferutils_1.BufferWriter.withCapacity(36*this.ins.length);this.ins.forEach(z=>{L.writeSlice(z.hash),L.writeUInt32(z.index)}),_=bcrypto$4.sha256(L.end()),L=bufferutils_1.BufferWriter.withCapacity(8*this.ins.length),n.forEach(z=>L.writeUInt64(z)),v=bcrypto$4.sha256(L.end()),L=bufferutils_1.BufferWriter.withCapacity(r.map(varSliceSize).reduce((z,F)=>z+F)),r.forEach(z=>L.writeVarSlice(z)),S=bcrypto$4.sha256(L.end()),L=bufferutils_1.BufferWriter.withCapacity(4*this.ins.length),this.ins.forEach(z=>L.writeUInt32(z.sequence)),E=bcrypto$4.sha256(L.end())}if(c||m){if(m&&t<this.outs.length){const L=this.outs[t],z=bufferutils_1.BufferWriter.withCapacity(8+varSliceSize(L.script));z.writeUInt64(L.value),z.writeVarSlice(L.script),x=bcrypto$4.sha256(z.end())}}else{const L=this.outs.map(F=>8+varSliceSize(F.script)).reduce((F,y)=>F+y),z=bufferutils_1.BufferWriter.withCapacity(L);this.outs.forEach(F=>{z.writeUInt64(F.value),z.writeVarSlice(F.script)}),x=bcrypto$4.sha256(z.end())}const O=(s?2:0)+(a?1:0),q=174-(d?49:0)-(c?32:0)+(a?32:0)+(s?37:0),U=bufferutils_1.BufferWriter.withCapacity(q);if(U.writeUInt8(o),U.writeInt32(this.version),U.writeUInt32(this.locktime),U.writeSlice(_),U.writeSlice(v),U.writeSlice(S),U.writeSlice(E),c||m||U.writeSlice(x),U.writeUInt8(O),d){const L=this.ins[t];U.writeSlice(L.hash),U.writeUInt32(L.index),U.writeUInt64(n[t]),U.writeVarSlice(r[t]),U.writeUInt32(L.sequence)}else U.writeUInt32(t);if(a){const L=bufferutils_1.BufferWriter.withCapacity(varSliceSize(a));L.writeVarSlice(a),U.writeSlice(bcrypto$4.sha256(L.end()))}return m&&U.writeSlice(x),s&&(U.writeSlice(s),U.writeUInt8(0),U.writeUInt32(4294967295)),bcrypto$4.taggedHash("TapSighash",Buffer$e.concat([Buffer$e.from([0]),U.end()]))}hashForWitnessV0(t,r,n,o){typeforce(types.tuple(types.UInt32,types.Buffer,types.Satoshi,types.UInt32),arguments);let s=Buffer$e.from([]),a,u=ZERO,p=ZERO,d=ZERO;if(o&Transaction.SIGHASH_ANYONECANPAY||(s=Buffer$e.allocUnsafe(36*this.ins.length),a=new bufferutils_1.BufferWriter(s,0),this.ins.forEach(m=>{a.writeSlice(m.hash),a.writeUInt32(m.index)}),p=bcrypto$4.hash256(s)),!(o&Transaction.SIGHASH_ANYONECANPAY)&&(o&31)!==Transaction.SIGHASH_SINGLE&&(o&31)!==Transaction.SIGHASH_NONE&&(s=Buffer$e.allocUnsafe(4*this.ins.length),a=new bufferutils_1.BufferWriter(s,0),this.ins.forEach(m=>{a.writeUInt32(m.sequence)}),d=bcrypto$4.hash256(s)),(o&31)!==Transaction.SIGHASH_SINGLE&&(o&31)!==Transaction.SIGHASH_NONE){const m=this.outs.reduce((_,v)=>_+8+varSliceSize(v.script),0);s=Buffer$e.allocUnsafe(m),a=new bufferutils_1.BufferWriter(s,0),this.outs.forEach(_=>{a.writeUInt64(_.value),a.writeVarSlice(_.script)}),u=bcrypto$4.hash256(s)}else if((o&31)===Transaction.SIGHASH_SINGLE&&t<this.outs.length){const m=this.outs[t];s=Buffer$e.allocUnsafe(8+varSliceSize(m.script)),a=new bufferutils_1.BufferWriter(s,0),a.writeUInt64(m.value),a.writeVarSlice(m.script),u=bcrypto$4.hash256(s)}s=Buffer$e.allocUnsafe(156+varSliceSize(r)),a=new bufferutils_1.BufferWriter(s,0);const c=this.ins[t];return a.writeInt32(this.version),a.writeSlice(p),a.writeSlice(d),a.writeSlice(c.hash),a.writeUInt32(c.index),a.writeVarSlice(r),a.writeUInt64(n),a.writeUInt32(c.sequence),a.writeSlice(u),a.writeUInt32(this.locktime),a.writeUInt32(o),bcrypto$4.hash256(s)}getHash(t){return t&&this.isCoinbase()?Buffer$e.alloc(32,0):bcrypto$4.hash256(this.__toBuffer(void 0,void 0,t))}getId(){return(0,bufferutils_1.reverseBuffer)(this.getHash(!1)).toString("hex")}toBuffer(t,r){return this.__toBuffer(t,r,!0)}toHex(){return this.toBuffer(void 0,void 0).toString("hex")}setInputScript(t,r){typeforce(types.tuple(types.Number,types.Buffer),arguments),this.ins[t].script=r}setWitness(t,r){typeforce(types.tuple(types.Number,[types.Buffer]),arguments),this.ins[t].witness=r}__toBuffer(t,r,n=!1){t||(t=Buffer$e.allocUnsafe(this.byteLength(n)));const o=new bufferutils_1.BufferWriter(t,r||0);o.writeInt32(this.version);const s=n&&this.hasWitnesses();return s&&(o.writeUInt8(Transaction.ADVANCED_TRANSACTION_MARKER),o.writeUInt8(Transaction.ADVANCED_TRANSACTION_FLAG)),o.writeVarInt(this.ins.length),this.ins.forEach(a=>{o.writeSlice(a.hash),o.writeUInt32(a.index),o.writeVarSlice(a.script),o.writeUInt32(a.sequence)}),o.writeVarInt(this.outs.length),this.outs.forEach(a=>{isOutput(a)?o.writeUInt64(a.value):o.writeSlice(a.valueBuffer),o.writeVarSlice(a.script)}),s&&this.ins.forEach(a=>{o.writeVector(a.witness)}),o.writeUInt32(this.locktime),r!==void 0?t.slice(r,o.offset):t}}transaction.Transaction=Transaction;Transaction.DEFAULT_SEQUENCE=4294967295;Transaction.SIGHASH_DEFAULT=0;Transaction.SIGHASH_ALL=1;Transaction.SIGHASH_NONE=2;Transaction.SIGHASH_SINGLE=3;Transaction.SIGHASH_ANYONECANPAY=128;Transaction.SIGHASH_OUTPUT_MASK=3;Transaction.SIGHASH_INPUT_MASK=128;Transaction.ADVANCED_TRANSACTION_MARKER=0;Transaction.ADVANCED_TRANSACTION_FLAG=1;var psbtutils={},varint={};Object.defineProperty(varint,"__esModule",{value:!0});const MAX_SAFE_INTEGER=9007199254740991;function checkUInt53(e){if(e<0||e>MAX_SAFE_INTEGER||e%1!==0)throw new RangeError("value out of range")}function encode(e,t,r){if(checkUInt53(e),t||(t=Buffer$e.allocUnsafe(encodingLength(e))),!Buffer$e.isBuffer(t))throw new TypeError("buffer must be a Buffer instance");return r||(r=0),e<253?(t.writeUInt8(e,r),Object.assign(encode,{bytes:1})):e<=65535?(t.writeUInt8(253,r),t.writeUInt16LE(e,r+1),Object.assign(encode,{bytes:3})):e<=4294967295?(t.writeUInt8(254,r),t.writeUInt32LE(e,r+1),Object.assign(encode,{bytes:5})):(t.writeUInt8(255,r),t.writeUInt32LE(e>>>0,r+1),t.writeUInt32LE(e/4294967296|0,r+5),Object.assign(encode,{bytes:9})),t}varint.encode=encode;function decode(e,t){if(!Buffer$e.isBuffer(e))throw new TypeError("buffer must be a Buffer instance");t||(t=0);const r=e.readUInt8(t);if(r<253)return Object.assign(decode,{bytes:1}),r;if(r===253)return Object.assign(decode,{bytes:3}),e.readUInt16LE(t+1);if(r===254)return Object.assign(decode,{bytes:5}),e.readUInt32LE(t+1);{Object.assign(decode,{bytes:9});const n=e.readUInt32LE(t+1),s=e.readUInt32LE(t+5)*4294967296+n;return checkUInt53(s),s}}varint.decode=decode;function encodingLength(e){return checkUInt53(e),e<253?1:e<=65535?3:e<=4294967295?5:9}varint.encodingLength=encodingLength;var payments$1={},embed={},networks={};Object.defineProperty(networks,"__esModule",{value:!0});networks.testnet=networks.regtest=networks.bitcoin=void 0;networks.bitcoin={messagePrefix:`Bitcoin Signed Message:
|
|
93
93
|
`,bech32:"bc",bip32:{public:76067358,private:76066276},pubKeyHash:0,scriptHash:5,wif:128};networks.regtest={messagePrefix:`Bitcoin Signed Message:
|
|
94
94
|
`,bech32:"bcrt",bip32:{public:70617039,private:70615956},pubKeyHash:111,scriptHash:196,wif:239};networks.testnet={messagePrefix:`Bitcoin Signed Message:
|
|
95
95
|
`,bech32:"tb",bip32:{public:70617039,private:70615956},pubKeyHash:111,scriptHash:196,wif:239};var lazy$8={};Object.defineProperty(lazy$8,"__esModule",{value:!0});lazy$8.value=lazy$8.prop=void 0;function prop(e,t,r){Object.defineProperty(e,t,{configurable:!0,enumerable:!0,get(){const n=r.call(this);return this[t]=n,n},set(n){Object.defineProperty(this,t,{configurable:!0,enumerable:!0,value:n,writable:!0})}})}lazy$8.prop=prop;function value(e){let t;return()=>(t!==void 0||(t=e()),t)}lazy$8.value=value;Object.defineProperty(embed,"__esModule",{value:!0});embed.p2data=void 0;const networks_1$7=networks,bscript$8=script,types_1$8=types$4,lazy$7=lazy$8,OPS$7=bscript$8.OPS;function stacksEqual$4(e,t){return e.length!==t.length?!1:e.every((r,n)=>r.equals(t[n]))}function p2data(e,t){if(!e.data&&!e.output)throw new TypeError("Not enough data");t=Object.assign({validate:!0},t||{}),(0,types_1$8.typeforce)({network:types_1$8.typeforce.maybe(types_1$8.typeforce.Object),output:types_1$8.typeforce.maybe(types_1$8.typeforce.Buffer),data:types_1$8.typeforce.maybe(types_1$8.typeforce.arrayOf(types_1$8.typeforce.Buffer))},e);const n={name:"embed",network:e.network||networks_1$7.bitcoin};if(lazy$7.prop(n,"output",()=>{if(e.data)return bscript$8.compile([OPS$7.OP_RETURN].concat(e.data))}),lazy$7.prop(n,"data",()=>{if(e.output)return bscript$8.decompile(e.output).slice(1)}),t.validate&&e.output){const o=bscript$8.decompile(e.output);if(o[0]!==OPS$7.OP_RETURN)throw new TypeError("Output is invalid");if(!o.slice(1).every(types_1$8.typeforce.Buffer))throw new TypeError("Output is invalid");if(e.data&&!stacksEqual$4(e.data,n.data))throw new TypeError("Data mismatch")}return Object.assign(n,e)}embed.p2data=p2data;var p2ms$1={};Object.defineProperty(p2ms$1,"__esModule",{value:!0});p2ms$1.p2ms=void 0;const networks_1$6=networks,bscript$7=script,types_1$7=types$4,lazy$6=lazy$8,OPS$6=bscript$7.OPS,OP_INT_BASE=OPS$6.OP_RESERVED;function stacksEqual$3(e,t){return e.length!==t.length?!1:e.every((r,n)=>r.equals(t[n]))}function p2ms(e,t){if(!e.input&&!e.output&&!(e.pubkeys&&e.m!==void 0)&&!e.signatures)throw new TypeError("Not enough data");t=Object.assign({validate:!0},t||{});function r(p){return bscript$7.isCanonicalScriptSignature(p)||(t.allowIncomplete&&p===OPS$6.OP_0)!==void 0}(0,types_1$7.typeforce)({network:types_1$7.typeforce.maybe(types_1$7.typeforce.Object),m:types_1$7.typeforce.maybe(types_1$7.typeforce.Number),n:types_1$7.typeforce.maybe(types_1$7.typeforce.Number),output:types_1$7.typeforce.maybe(types_1$7.typeforce.Buffer),pubkeys:types_1$7.typeforce.maybe(types_1$7.typeforce.arrayOf(types_1$7.isPoint)),signatures:types_1$7.typeforce.maybe(types_1$7.typeforce.arrayOf(r)),input:types_1$7.typeforce.maybe(types_1$7.typeforce.Buffer)},e);const o={network:e.network||networks_1$6.bitcoin};let s=[],a=!1;function u(p){a||(a=!0,s=bscript$7.decompile(p),o.m=s[0]-OP_INT_BASE,o.n=s[s.length-2]-OP_INT_BASE,o.pubkeys=s.slice(1,-2))}if(lazy$6.prop(o,"output",()=>{if(e.m&&o.n&&e.pubkeys)return bscript$7.compile([].concat(OP_INT_BASE+e.m,e.pubkeys,OP_INT_BASE+o.n,OPS$6.OP_CHECKMULTISIG))}),lazy$6.prop(o,"m",()=>{if(o.output)return u(o.output),o.m}),lazy$6.prop(o,"n",()=>{if(o.pubkeys)return o.pubkeys.length}),lazy$6.prop(o,"pubkeys",()=>{if(e.output)return u(e.output),o.pubkeys}),lazy$6.prop(o,"signatures",()=>{if(e.input)return bscript$7.decompile(e.input).slice(1)}),lazy$6.prop(o,"input",()=>{if(e.signatures)return bscript$7.compile([OPS$6.OP_0].concat(e.signatures))}),lazy$6.prop(o,"witness",()=>{if(o.input)return[]}),lazy$6.prop(o,"name",()=>{if(!(!o.m||!o.n))return`p2ms(${o.m} of ${o.n})`}),t.validate){if(e.output){if(u(e.output),!types_1$7.typeforce.Number(s[0]))throw new TypeError("Output is invalid");if(!types_1$7.typeforce.Number(s[s.length-2]))throw new TypeError("Output is invalid");if(s[s.length-1]!==OPS$6.OP_CHECKMULTISIG)throw new TypeError("Output is invalid");if(o.m<=0||o.n>16||o.m>o.n||o.n!==s.length-3)throw new TypeError("Output is invalid");if(!o.pubkeys.every(p=>(0,types_1$7.isPoint)(p)))throw new TypeError("Output is invalid");if(e.m!==void 0&&e.m!==o.m)throw new TypeError("m mismatch");if(e.n!==void 0&&e.n!==o.n)throw new TypeError("n mismatch");if(e.pubkeys&&!stacksEqual$3(e.pubkeys,o.pubkeys))throw new TypeError("Pubkeys mismatch")}if(e.pubkeys){if(e.n!==void 0&&e.n!==e.pubkeys.length)throw new TypeError("Pubkey count mismatch");if(o.n=e.pubkeys.length,o.n<o.m)throw new TypeError("Pubkey count cannot be less than m")}if(e.signatures){if(e.signatures.length<o.m)throw new TypeError("Not enough signatures provided");if(e.signatures.length>o.m)throw new TypeError("Too many signatures provided")}if(e.input){if(e.input[0]!==OPS$6.OP_0)throw new TypeError("Input is invalid");if(o.signatures.length===0||!o.signatures.every(r))throw new TypeError("Input has invalid signature(s)");if(e.signatures&&!stacksEqual$3(e.signatures,o.signatures))throw new TypeError("Signature mismatch");if(e.m!==void 0&&e.m!==e.signatures.length)throw new TypeError("Signature count mismatch")}}return Object.assign(o,e)}p2ms$1.p2ms=p2ms;var p2pk$1={};Object.defineProperty(p2pk$1,"__esModule",{value:!0});p2pk$1.p2pk=void 0;const networks_1$5=networks,bscript$6=script,types_1$6=types$4,lazy$5=lazy$8,OPS$5=bscript$6.OPS;function p2pk(e,t){if(!e.input&&!e.output&&!e.pubkey&&!e.input&&!e.signature)throw new TypeError("Not enough data");t=Object.assign({validate:!0},t||{}),(0,types_1$6.typeforce)({network:types_1$6.typeforce.maybe(types_1$6.typeforce.Object),output:types_1$6.typeforce.maybe(types_1$6.typeforce.Buffer),pubkey:types_1$6.typeforce.maybe(types_1$6.isPoint),signature:types_1$6.typeforce.maybe(bscript$6.isCanonicalScriptSignature),input:types_1$6.typeforce.maybe(types_1$6.typeforce.Buffer)},e);const r=lazy$5.value(()=>bscript$6.decompile(e.input)),o={name:"p2pk",network:e.network||networks_1$5.bitcoin};if(lazy$5.prop(o,"output",()=>{if(e.pubkey)return bscript$6.compile([e.pubkey,OPS$5.OP_CHECKSIG])}),lazy$5.prop(o,"pubkey",()=>{if(e.output)return e.output.slice(1,-1)}),lazy$5.prop(o,"signature",()=>{if(e.input)return r()[0]}),lazy$5.prop(o,"input",()=>{if(e.signature)return bscript$6.compile([e.signature])}),lazy$5.prop(o,"witness",()=>{if(o.input)return[]}),t.validate){if(e.output){if(e.output[e.output.length-1]!==OPS$5.OP_CHECKSIG)throw new TypeError("Output is invalid");if(!(0,types_1$6.isPoint)(o.pubkey))throw new TypeError("Output pubkey is invalid");if(e.pubkey&&!e.pubkey.equals(o.pubkey))throw new TypeError("Pubkey mismatch")}if(e.signature&&e.input&&!e.input.equals(o.input))throw new TypeError("Signature mismatch");if(e.input){if(r().length!==1)throw new TypeError("Input is invalid");if(!bscript$6.isCanonicalScriptSignature(o.signature))throw new TypeError("Input has invalid signature")}}return Object.assign(o,e)}p2pk$1.p2pk=p2pk;var p2pkh$1={};Object.defineProperty(p2pkh$1,"__esModule",{value:!0});p2pkh$1.p2pkh=void 0;const bcrypto$3=crypto$1,networks_1$4=networks,bscript$5=script,types_1$5=types$4,lazy$4=lazy$8,bs58check$1=bs58check$a,OPS$4=bscript$5.OPS;function p2pkh(e,t){if(!e.address&&!e.hash&&!e.output&&!e.pubkey&&!e.input)throw new TypeError("Not enough data");t=Object.assign({validate:!0},t||{}),(0,types_1$5.typeforce)({network:types_1$5.typeforce.maybe(types_1$5.typeforce.Object),address:types_1$5.typeforce.maybe(types_1$5.typeforce.String),hash:types_1$5.typeforce.maybe(types_1$5.typeforce.BufferN(20)),output:types_1$5.typeforce.maybe(types_1$5.typeforce.BufferN(25)),pubkey:types_1$5.typeforce.maybe(types_1$5.isPoint),signature:types_1$5.typeforce.maybe(bscript$5.isCanonicalScriptSignature),input:types_1$5.typeforce.maybe(types_1$5.typeforce.Buffer)},e);const r=lazy$4.value(()=>{const a=Buffer$e.from(bs58check$1.decode(e.address)),u=a.readUInt8(0),p=a.slice(1);return{version:u,hash:p}}),n=lazy$4.value(()=>bscript$5.decompile(e.input)),o=e.network||networks_1$4.bitcoin,s={name:"p2pkh",network:o};if(lazy$4.prop(s,"address",()=>{if(!s.hash)return;const a=Buffer$e.allocUnsafe(21);return a.writeUInt8(o.pubKeyHash,0),s.hash.copy(a,1),bs58check$1.encode(a)}),lazy$4.prop(s,"hash",()=>{if(e.output)return e.output.slice(3,23);if(e.address)return r().hash;if(e.pubkey||s.pubkey)return bcrypto$3.hash160(e.pubkey||s.pubkey)}),lazy$4.prop(s,"output",()=>{if(s.hash)return bscript$5.compile([OPS$4.OP_DUP,OPS$4.OP_HASH160,s.hash,OPS$4.OP_EQUALVERIFY,OPS$4.OP_CHECKSIG])}),lazy$4.prop(s,"pubkey",()=>{if(e.input)return n()[1]}),lazy$4.prop(s,"signature",()=>{if(e.input)return n()[0]}),lazy$4.prop(s,"input",()=>{if(e.pubkey&&e.signature)return bscript$5.compile([e.signature,e.pubkey])}),lazy$4.prop(s,"witness",()=>{if(s.input)return[]}),t.validate){let a=Buffer$e.from([]);if(e.address){if(r().version!==o.pubKeyHash)throw new TypeError("Invalid version or Network mismatch");if(r().hash.length!==20)throw new TypeError("Invalid address");a=r().hash}if(e.hash){if(a.length>0&&!a.equals(e.hash))throw new TypeError("Hash mismatch");a=e.hash}if(e.output){if(e.output.length!==25||e.output[0]!==OPS$4.OP_DUP||e.output[1]!==OPS$4.OP_HASH160||e.output[2]!==20||e.output[23]!==OPS$4.OP_EQUALVERIFY||e.output[24]!==OPS$4.OP_CHECKSIG)throw new TypeError("Output is invalid");const u=e.output.slice(3,23);if(a.length>0&&!a.equals(u))throw new TypeError("Hash mismatch");a=u}if(e.pubkey){const u=bcrypto$3.hash160(e.pubkey);if(a.length>0&&!a.equals(u))throw new TypeError("Hash mismatch");a=u}if(e.input){const u=n();if(u.length!==2)throw new TypeError("Input is invalid");if(!bscript$5.isCanonicalScriptSignature(u[0]))throw new TypeError("Input has invalid signature");if(!(0,types_1$5.isPoint)(u[1]))throw new TypeError("Input has invalid pubkey");if(e.signature&&!e.signature.equals(u[0]))throw new TypeError("Signature mismatch");if(e.pubkey&&!e.pubkey.equals(u[1]))throw new TypeError("Pubkey mismatch");const p=bcrypto$3.hash160(u[1]);if(a.length>0&&!a.equals(p))throw new TypeError("Hash mismatch")}}return Object.assign(s,e)}p2pkh$1.p2pkh=p2pkh;var p2sh$1={};Object.defineProperty(p2sh$1,"__esModule",{value:!0});p2sh$1.p2sh=void 0;const bcrypto$2=crypto$1,networks_1$3=networks,bscript$4=script,types_1$4=types$4,lazy$3=lazy$8,bs58check=bs58check$a,OPS$3=bscript$4.OPS;function stacksEqual$2(e,t){return e.length!==t.length?!1:e.every((r,n)=>r.equals(t[n]))}function p2sh(e,t){if(!e.address&&!e.hash&&!e.output&&!e.redeem&&!e.input)throw new TypeError("Not enough data");t=Object.assign({validate:!0},t||{}),(0,types_1$4.typeforce)({network:types_1$4.typeforce.maybe(types_1$4.typeforce.Object),address:types_1$4.typeforce.maybe(types_1$4.typeforce.String),hash:types_1$4.typeforce.maybe(types_1$4.typeforce.BufferN(20)),output:types_1$4.typeforce.maybe(types_1$4.typeforce.BufferN(23)),redeem:types_1$4.typeforce.maybe({network:types_1$4.typeforce.maybe(types_1$4.typeforce.Object),output:types_1$4.typeforce.maybe(types_1$4.typeforce.Buffer),input:types_1$4.typeforce.maybe(types_1$4.typeforce.Buffer),witness:types_1$4.typeforce.maybe(types_1$4.typeforce.arrayOf(types_1$4.typeforce.Buffer))}),input:types_1$4.typeforce.maybe(types_1$4.typeforce.Buffer),witness:types_1$4.typeforce.maybe(types_1$4.typeforce.arrayOf(types_1$4.typeforce.Buffer))},e);let r=e.network;r||(r=e.redeem&&e.redeem.network||networks_1$3.bitcoin);const n={network:r},o=lazy$3.value(()=>{const u=Buffer$e.from(bs58check.decode(e.address)),p=u.readUInt8(0),d=u.slice(1);return{version:p,hash:d}}),s=lazy$3.value(()=>bscript$4.decompile(e.input)),a=lazy$3.value(()=>{const u=s(),p=u[u.length-1];return{network:r,output:p===OPS$3.OP_FALSE?Buffer$e.from([]):p,input:bscript$4.compile(u.slice(0,-1)),witness:e.witness||[]}});if(lazy$3.prop(n,"address",()=>{if(!n.hash)return;const u=Buffer$e.allocUnsafe(21);return u.writeUInt8(n.network.scriptHash,0),n.hash.copy(u,1),bs58check.encode(u)}),lazy$3.prop(n,"hash",()=>{if(e.output)return e.output.slice(2,22);if(e.address)return o().hash;if(n.redeem&&n.redeem.output)return bcrypto$2.hash160(n.redeem.output)}),lazy$3.prop(n,"output",()=>{if(n.hash)return bscript$4.compile([OPS$3.OP_HASH160,n.hash,OPS$3.OP_EQUAL])}),lazy$3.prop(n,"redeem",()=>{if(e.input)return a()}),lazy$3.prop(n,"input",()=>{if(!(!e.redeem||!e.redeem.input||!e.redeem.output))return bscript$4.compile([].concat(bscript$4.decompile(e.redeem.input),e.redeem.output))}),lazy$3.prop(n,"witness",()=>{if(n.redeem&&n.redeem.witness)return n.redeem.witness;if(n.input)return[]}),lazy$3.prop(n,"name",()=>{const u=["p2sh"];return n.redeem!==void 0&&n.redeem.name!==void 0&&u.push(n.redeem.name),u.join("-")}),t.validate){let u=Buffer$e.from([]);if(e.address){if(o().version!==r.scriptHash)throw new TypeError("Invalid version or Network mismatch");if(o().hash.length!==20)throw new TypeError("Invalid address");u=o().hash}if(e.hash){if(u.length>0&&!u.equals(e.hash))throw new TypeError("Hash mismatch");u=e.hash}if(e.output){if(e.output.length!==23||e.output[0]!==OPS$3.OP_HASH160||e.output[1]!==20||e.output[22]!==OPS$3.OP_EQUAL)throw new TypeError("Output is invalid");const d=e.output.slice(2,22);if(u.length>0&&!u.equals(d))throw new TypeError("Hash mismatch");u=d}const p=d=>{if(d.output){const c=bscript$4.decompile(d.output);if(!c||c.length<1)throw new TypeError("Redeem.output too short");if(d.output.byteLength>520)throw new TypeError("Redeem.output unspendable if larger than 520 bytes");if(bscript$4.countNonPushOnlyOPs(c)>201)throw new TypeError("Redeem.output unspendable with more than 201 non-push ops");const m=bcrypto$2.hash160(d.output);if(u.length>0&&!u.equals(m))throw new TypeError("Hash mismatch");u=m}if(d.input){const c=d.input.length>0,m=d.witness&&d.witness.length>0;if(!c&&!m)throw new TypeError("Empty input");if(c&&m)throw new TypeError("Input and witness provided");if(c){const _=bscript$4.decompile(d.input);if(!bscript$4.isPushOnly(_))throw new TypeError("Non push-only scriptSig")}}};if(e.input){const d=s();if(!d||d.length<1)throw new TypeError("Input too short");if(!Buffer$e.isBuffer(a().output))throw new TypeError("Input is invalid");p(a())}if(e.redeem){if(e.redeem.network&&e.redeem.network!==r)throw new TypeError("Network mismatch");if(e.input){const d=a();if(e.redeem.output&&!e.redeem.output.equals(d.output))throw new TypeError("Redeem.output mismatch");if(e.redeem.input&&!e.redeem.input.equals(d.input))throw new TypeError("Redeem.input mismatch")}p(e.redeem)}if(e.witness&&e.redeem&&e.redeem.witness&&!stacksEqual$2(e.redeem.witness,e.witness))throw new TypeError("Witness and redeem.witness mismatch")}return Object.assign(n,e)}p2sh$1.p2sh=p2sh;var p2wpkh$1={},dist={};Object.defineProperty(dist,"__esModule",{value:!0});dist.bech32m=dist.bech32=void 0;const ALPHABET="qpzry9x8gf2tvdw0s3jn54khce6mua7l",ALPHABET_MAP={};for(let e=0;e<ALPHABET.length;e++){const t=ALPHABET.charAt(e);ALPHABET_MAP[t]=e}function polymodStep(e){const t=e>>25;return(e&33554431)<<5^-(t>>0&1)&996825010^-(t>>1&1)&642813549^-(t>>2&1)&513874426^-(t>>3&1)&1027748829^-(t>>4&1)&705979059}function prefixChk(e){let t=1;for(let r=0;r<e.length;++r){const n=e.charCodeAt(r);if(n<33||n>126)return"Invalid prefix ("+e+")";t=polymodStep(t)^n>>5}t=polymodStep(t);for(let r=0;r<e.length;++r){const n=e.charCodeAt(r);t=polymodStep(t)^n&31}return t}function convert(e,t,r,n){let o=0,s=0;const a=(1<<r)-1,u=[];for(let p=0;p<e.length;++p)for(o=o<<t|e[p],s+=t;s>=r;)s-=r,u.push(o>>s&a);if(n)s>0&&u.push(o<<r-s&a);else{if(s>=t)return"Excess padding";if(o<<r-s&a)return"Non-zero padding"}return u}function toWords(e){return convert(e,8,5,!0)}function fromWordsUnsafe(e){const t=convert(e,5,8,!1);if(Array.isArray(t))return t}function fromWords(e){const t=convert(e,5,8,!1);if(Array.isArray(t))return t;throw new Error(t)}function getLibraryFromEncoding(e){let t;e==="bech32"?t=1:t=734539939;function r(a,u,p){if(p=p||90,a.length+7+u.length>p)throw new TypeError("Exceeds length limit");a=a.toLowerCase();let d=prefixChk(a);if(typeof d=="string")throw new Error(d);let c=a+"1";for(let m=0;m<u.length;++m){const _=u[m];if(_>>5)throw new Error("Non 5-bit word");d=polymodStep(d)^_,c+=ALPHABET.charAt(_)}for(let m=0;m<6;++m)d=polymodStep(d);d^=t;for(let m=0;m<6;++m){const _=d>>(5-m)*5&31;c+=ALPHABET.charAt(_)}return c}function n(a,u){if(u=u||90,a.length<8)return a+" too short";if(a.length>u)return"Exceeds length limit";const p=a.toLowerCase(),d=a.toUpperCase();if(a!==p&&a!==d)return"Mixed-case string "+a;a=p;const c=a.lastIndexOf("1");if(c===-1)return"No separator character for "+a;if(c===0)return"Missing prefix for "+a;const m=a.slice(0,c),_=a.slice(c+1);if(_.length<6)return"Data too short";let v=prefixChk(m);if(typeof v=="string")return v;const S=[];for(let E=0;E<_.length;++E){const x=_.charAt(E),O=ALPHABET_MAP[x];if(O===void 0)return"Unknown character "+x;v=polymodStep(v)^O,!(E+6>=_.length)&&S.push(O)}return v!==t?"Invalid checksum for "+a:{prefix:m,words:S}}function o(a,u){const p=n(a,u);if(typeof p=="object")return p}function s(a,u){const p=n(a,u);if(typeof p=="object")return p;throw new Error(p)}return{decodeUnsafe:o,decode:s,encode:r,toWords,fromWordsUnsafe,fromWords}}dist.bech32=getLibraryFromEncoding("bech32");dist.bech32m=getLibraryFromEncoding("bech32m");Object.defineProperty(p2wpkh$1,"__esModule",{value:!0});p2wpkh$1.p2wpkh=void 0;const bcrypto$1=crypto$1,networks_1$2=networks,bscript$3=script,types_1$3=types$4,lazy$2=lazy$8,bech32_1$2=dist,OPS$2=bscript$3.OPS,EMPTY_BUFFER$1=Buffer$e.alloc(0);function p2wpkh(e,t){if(!e.address&&!e.hash&&!e.output&&!e.pubkey&&!e.witness)throw new TypeError("Not enough data");t=Object.assign({validate:!0},t||{}),(0,types_1$3.typeforce)({address:types_1$3.typeforce.maybe(types_1$3.typeforce.String),hash:types_1$3.typeforce.maybe(types_1$3.typeforce.BufferN(20)),input:types_1$3.typeforce.maybe(types_1$3.typeforce.BufferN(0)),network:types_1$3.typeforce.maybe(types_1$3.typeforce.Object),output:types_1$3.typeforce.maybe(types_1$3.typeforce.BufferN(22)),pubkey:types_1$3.typeforce.maybe(types_1$3.isPoint),signature:types_1$3.typeforce.maybe(bscript$3.isCanonicalScriptSignature),witness:types_1$3.typeforce.maybe(types_1$3.typeforce.arrayOf(types_1$3.typeforce.Buffer))},e);const r=lazy$2.value(()=>{const s=bech32_1$2.bech32.decode(e.address),a=s.words.shift(),u=bech32_1$2.bech32.fromWords(s.words);return{version:a,prefix:s.prefix,data:Buffer$e.from(u)}}),n=e.network||networks_1$2.bitcoin,o={name:"p2wpkh",network:n};if(lazy$2.prop(o,"address",()=>{if(!o.hash)return;const s=bech32_1$2.bech32.toWords(o.hash);return s.unshift(0),bech32_1$2.bech32.encode(n.bech32,s)}),lazy$2.prop(o,"hash",()=>{if(e.output)return e.output.slice(2,22);if(e.address)return r().data;if(e.pubkey||o.pubkey)return bcrypto$1.hash160(e.pubkey||o.pubkey)}),lazy$2.prop(o,"output",()=>{if(o.hash)return bscript$3.compile([OPS$2.OP_0,o.hash])}),lazy$2.prop(o,"pubkey",()=>{if(e.pubkey)return e.pubkey;if(e.witness)return e.witness[1]}),lazy$2.prop(o,"signature",()=>{if(e.witness)return e.witness[0]}),lazy$2.prop(o,"input",()=>{if(o.witness)return EMPTY_BUFFER$1}),lazy$2.prop(o,"witness",()=>{if(e.pubkey&&e.signature)return[e.signature,e.pubkey]}),t.validate){let s=Buffer$e.from([]);if(e.address){if(n&&n.bech32!==r().prefix)throw new TypeError("Invalid prefix or Network mismatch");if(r().version!==0)throw new TypeError("Invalid address version");if(r().data.length!==20)throw new TypeError("Invalid address data");s=r().data}if(e.hash){if(s.length>0&&!s.equals(e.hash))throw new TypeError("Hash mismatch");s=e.hash}if(e.output){if(e.output.length!==22||e.output[0]!==OPS$2.OP_0||e.output[1]!==20)throw new TypeError("Output is invalid");if(s.length>0&&!s.equals(e.output.slice(2)))throw new TypeError("Hash mismatch");s=e.output.slice(2)}if(e.pubkey){const a=bcrypto$1.hash160(e.pubkey);if(s.length>0&&!s.equals(a))throw new TypeError("Hash mismatch");if(s=a,!(0,types_1$3.isPoint)(e.pubkey)||e.pubkey.length!==33)throw new TypeError("Invalid pubkey for p2wpkh")}if(e.witness){if(e.witness.length!==2)throw new TypeError("Witness is invalid");if(!bscript$3.isCanonicalScriptSignature(e.witness[0]))throw new TypeError("Witness has invalid signature");if(!(0,types_1$3.isPoint)(e.witness[1])||e.witness[1].length!==33)throw new TypeError("Witness has invalid pubkey");if(e.signature&&!e.signature.equals(e.witness[0]))throw new TypeError("Signature mismatch");if(e.pubkey&&!e.pubkey.equals(e.witness[1]))throw new TypeError("Pubkey mismatch");const a=bcrypto$1.hash160(e.witness[1]);if(s.length>0&&!s.equals(a))throw new TypeError("Hash mismatch")}}return Object.assign(o,e)}p2wpkh$1.p2wpkh=p2wpkh;var p2wsh$1={};Object.defineProperty(p2wsh$1,"__esModule",{value:!0});p2wsh$1.p2wsh=void 0;const bcrypto=crypto$1,networks_1$1=networks,bscript$2=script,types_1$2=types$4,lazy$1=lazy$8,bech32_1$1=dist,OPS$1=bscript$2.OPS,EMPTY_BUFFER=Buffer$e.alloc(0);function stacksEqual$1(e,t){return e.length!==t.length?!1:e.every((r,n)=>r.equals(t[n]))}function chunkHasUncompressedPubkey(e){return!!(Buffer$e.isBuffer(e)&&e.length===65&&e[0]===4&&(0,types_1$2.isPoint)(e))}function p2wsh(e,t){if(!e.address&&!e.hash&&!e.output&&!e.redeem&&!e.witness)throw new TypeError("Not enough data");t=Object.assign({validate:!0},t||{}),(0,types_1$2.typeforce)({network:types_1$2.typeforce.maybe(types_1$2.typeforce.Object),address:types_1$2.typeforce.maybe(types_1$2.typeforce.String),hash:types_1$2.typeforce.maybe(types_1$2.typeforce.BufferN(32)),output:types_1$2.typeforce.maybe(types_1$2.typeforce.BufferN(34)),redeem:types_1$2.typeforce.maybe({input:types_1$2.typeforce.maybe(types_1$2.typeforce.Buffer),network:types_1$2.typeforce.maybe(types_1$2.typeforce.Object),output:types_1$2.typeforce.maybe(types_1$2.typeforce.Buffer),witness:types_1$2.typeforce.maybe(types_1$2.typeforce.arrayOf(types_1$2.typeforce.Buffer))}),input:types_1$2.typeforce.maybe(types_1$2.typeforce.BufferN(0)),witness:types_1$2.typeforce.maybe(types_1$2.typeforce.arrayOf(types_1$2.typeforce.Buffer))},e);const r=lazy$1.value(()=>{const a=bech32_1$1.bech32.decode(e.address),u=a.words.shift(),p=bech32_1$1.bech32.fromWords(a.words);return{version:u,prefix:a.prefix,data:Buffer$e.from(p)}}),n=lazy$1.value(()=>bscript$2.decompile(e.redeem.input));let o=e.network;o||(o=e.redeem&&e.redeem.network||networks_1$1.bitcoin);const s={network:o};if(lazy$1.prop(s,"address",()=>{if(!s.hash)return;const a=bech32_1$1.bech32.toWords(s.hash);return a.unshift(0),bech32_1$1.bech32.encode(o.bech32,a)}),lazy$1.prop(s,"hash",()=>{if(e.output)return e.output.slice(2);if(e.address)return r().data;if(s.redeem&&s.redeem.output)return bcrypto.sha256(s.redeem.output)}),lazy$1.prop(s,"output",()=>{if(s.hash)return bscript$2.compile([OPS$1.OP_0,s.hash])}),lazy$1.prop(s,"redeem",()=>{if(e.witness)return{output:e.witness[e.witness.length-1],input:EMPTY_BUFFER,witness:e.witness.slice(0,-1)}}),lazy$1.prop(s,"input",()=>{if(s.witness)return EMPTY_BUFFER}),lazy$1.prop(s,"witness",()=>{if(e.redeem&&e.redeem.input&&e.redeem.input.length>0&&e.redeem.output&&e.redeem.output.length>0){const a=bscript$2.toStack(n());return s.redeem=Object.assign({witness:a},e.redeem),s.redeem.input=EMPTY_BUFFER,[].concat(a,e.redeem.output)}if(e.redeem&&e.redeem.output&&e.redeem.witness)return[].concat(e.redeem.witness,e.redeem.output)}),lazy$1.prop(s,"name",()=>{const a=["p2wsh"];return s.redeem!==void 0&&s.redeem.name!==void 0&&a.push(s.redeem.name),a.join("-")}),t.validate){let a=Buffer$e.from([]);if(e.address){if(r().prefix!==o.bech32)throw new TypeError("Invalid prefix or Network mismatch");if(r().version!==0)throw new TypeError("Invalid address version");if(r().data.length!==32)throw new TypeError("Invalid address data");a=r().data}if(e.hash){if(a.length>0&&!a.equals(e.hash))throw new TypeError("Hash mismatch");a=e.hash}if(e.output){if(e.output.length!==34||e.output[0]!==OPS$1.OP_0||e.output[1]!==32)throw new TypeError("Output is invalid");const u=e.output.slice(2);if(a.length>0&&!a.equals(u))throw new TypeError("Hash mismatch");a=u}if(e.redeem){if(e.redeem.network&&e.redeem.network!==o)throw new TypeError("Network mismatch");if(e.redeem.input&&e.redeem.input.length>0&&e.redeem.witness&&e.redeem.witness.length>0)throw new TypeError("Ambiguous witness source");if(e.redeem.output){const u=bscript$2.decompile(e.redeem.output);if(!u||u.length<1)throw new TypeError("Redeem.output is invalid");if(e.redeem.output.byteLength>3600)throw new TypeError("Redeem.output unspendable if larger than 3600 bytes");if(bscript$2.countNonPushOnlyOPs(u)>201)throw new TypeError("Redeem.output unspendable with more than 201 non-push ops");const p=bcrypto.sha256(e.redeem.output);if(a.length>0&&!a.equals(p))throw new TypeError("Hash mismatch");a=p}if(e.redeem.input&&!bscript$2.isPushOnly(n()))throw new TypeError("Non push-only scriptSig");if(e.witness&&e.redeem.witness&&!stacksEqual$1(e.witness,e.redeem.witness))throw new TypeError("Witness and redeem.witness mismatch");if(e.redeem.input&&n().some(chunkHasUncompressedPubkey)||e.redeem.output&&(bscript$2.decompile(e.redeem.output)||[]).some(chunkHasUncompressedPubkey))throw new TypeError("redeem.input or redeem.output contains uncompressed pubkey")}if(e.witness&&e.witness.length>0){const u=e.witness[e.witness.length-1];if(e.redeem&&e.redeem.output&&!e.redeem.output.equals(u))throw new TypeError("Witness and redeem.output mismatch");if(e.witness.some(chunkHasUncompressedPubkey)||(bscript$2.decompile(u)||[]).some(chunkHasUncompressedPubkey))throw new TypeError("Witness contains uncompressed pubkey")}}return Object.assign(s,e)}p2wsh$1.p2wsh=p2wsh;var p2tr$1={};Object.defineProperty(p2tr$1,"__esModule",{value:!0});p2tr$1.p2tr=void 0;const buffer_1=require$$0$3,networks_1=networks,bscript$1=script,types_1$1=types$4,ecc_lib_1=ecc_lib,bip341_1$1=bip341,lazy=lazy$8,bech32_1=dist,OPS=bscript$1.OPS,TAPROOT_WITNESS_VERSION=1,ANNEX_PREFIX=80;function p2tr(e,t){if(!e.address&&!e.output&&!e.pubkey&&!e.internalPubkey&&!(e.witness&&e.witness.length>1))throw new TypeError("Not enough data");t=Object.assign({validate:!0},t||{}),(0,types_1$1.typeforce)({address:types_1$1.typeforce.maybe(types_1$1.typeforce.String),input:types_1$1.typeforce.maybe(types_1$1.typeforce.BufferN(0)),network:types_1$1.typeforce.maybe(types_1$1.typeforce.Object),output:types_1$1.typeforce.maybe(types_1$1.typeforce.BufferN(34)),internalPubkey:types_1$1.typeforce.maybe(types_1$1.typeforce.BufferN(32)),hash:types_1$1.typeforce.maybe(types_1$1.typeforce.BufferN(32)),pubkey:types_1$1.typeforce.maybe(types_1$1.typeforce.BufferN(32)),signature:types_1$1.typeforce.maybe(types_1$1.typeforce.anyOf(types_1$1.typeforce.BufferN(64),types_1$1.typeforce.BufferN(65))),witness:types_1$1.typeforce.maybe(types_1$1.typeforce.arrayOf(types_1$1.typeforce.Buffer)),scriptTree:types_1$1.typeforce.maybe(types_1$1.isTaptree),redeem:types_1$1.typeforce.maybe({output:types_1$1.typeforce.maybe(types_1$1.typeforce.Buffer),redeemVersion:types_1$1.typeforce.maybe(types_1$1.typeforce.Number),witness:types_1$1.typeforce.maybe(types_1$1.typeforce.arrayOf(types_1$1.typeforce.Buffer))}),redeemVersion:types_1$1.typeforce.maybe(types_1$1.typeforce.Number)},e);const r=lazy.value(()=>{const u=bech32_1.bech32m.decode(e.address),p=u.words.shift(),d=bech32_1.bech32m.fromWords(u.words);return{version:p,prefix:u.prefix,data:buffer_1.Buffer.from(d)}}),n=lazy.value(()=>{if(!(!e.witness||!e.witness.length))return e.witness.length>=2&&e.witness[e.witness.length-1][0]===ANNEX_PREFIX?e.witness.slice(0,-1):e.witness.slice()}),o=lazy.value(()=>{if(e.scriptTree)return(0,bip341_1$1.toHashTree)(e.scriptTree);if(e.hash)return{hash:e.hash}}),s=e.network||networks_1.bitcoin,a={name:"p2tr",network:s};if(lazy.prop(a,"address",()=>{if(!a.pubkey)return;const u=bech32_1.bech32m.toWords(a.pubkey);return u.unshift(TAPROOT_WITNESS_VERSION),bech32_1.bech32m.encode(s.bech32,u)}),lazy.prop(a,"hash",()=>{const u=o();if(u)return u.hash;const p=n();if(p&&p.length>1){const d=p[p.length-1],c=d[0]&types_1$1.TAPLEAF_VERSION_MASK,m=p[p.length-2],_=(0,bip341_1$1.tapleafHash)({output:m,version:c});return(0,bip341_1$1.rootHashFromPath)(d,_)}return null}),lazy.prop(a,"output",()=>{if(a.pubkey)return bscript$1.compile([OPS.OP_1,a.pubkey])}),lazy.prop(a,"redeemVersion",()=>e.redeemVersion?e.redeemVersion:e.redeem&&e.redeem.redeemVersion!==void 0&&e.redeem.redeemVersion!==null?e.redeem.redeemVersion:bip341_1$1.LEAF_VERSION_TAPSCRIPT),lazy.prop(a,"redeem",()=>{const u=n();if(!(!u||u.length<2))return{output:u[u.length-2],witness:u.slice(0,-2),redeemVersion:u[u.length-1][0]&types_1$1.TAPLEAF_VERSION_MASK}}),lazy.prop(a,"pubkey",()=>{if(e.pubkey)return e.pubkey;if(e.output)return e.output.slice(2);if(e.address)return r().data;if(a.internalPubkey){const u=(0,bip341_1$1.tweakKey)(a.internalPubkey,a.hash);if(u)return u.x}}),lazy.prop(a,"internalPubkey",()=>{if(e.internalPubkey)return e.internalPubkey;const u=n();if(u&&u.length>1)return u[u.length-1].slice(1,33)}),lazy.prop(a,"signature",()=>{if(e.signature)return e.signature;const u=n();if(!(!u||u.length!==1))return u[0]}),lazy.prop(a,"witness",()=>{if(e.witness)return e.witness;const u=o();if(u&&e.redeem&&e.redeem.output&&e.internalPubkey){const p=(0,bip341_1$1.tapleafHash)({output:e.redeem.output,version:a.redeemVersion}),d=(0,bip341_1$1.findScriptPath)(u,p);if(!d)return;const c=(0,bip341_1$1.tweakKey)(e.internalPubkey,u.hash);if(!c)return;const m=buffer_1.Buffer.concat([buffer_1.Buffer.from([a.redeemVersion|c.parity]),e.internalPubkey].concat(d));return[e.redeem.output,m]}if(e.signature)return[e.signature]}),t.validate){let u=buffer_1.Buffer.from([]);if(e.address){if(s&&s.bech32!==r().prefix)throw new TypeError("Invalid prefix or Network mismatch");if(r().version!==TAPROOT_WITNESS_VERSION)throw new TypeError("Invalid address version");if(r().data.length!==32)throw new TypeError("Invalid address data");u=r().data}if(e.pubkey){if(u.length>0&&!u.equals(e.pubkey))throw new TypeError("Pubkey mismatch");u=e.pubkey}if(e.output){if(e.output.length!==34||e.output[0]!==OPS.OP_1||e.output[1]!==32)throw new TypeError("Output is invalid");if(u.length>0&&!u.equals(e.output.slice(2)))throw new TypeError("Pubkey mismatch");u=e.output.slice(2)}if(e.internalPubkey){const c=(0,bip341_1$1.tweakKey)(e.internalPubkey,a.hash);if(u.length>0&&!u.equals(c.x))throw new TypeError("Pubkey mismatch");u=c.x}if(u&&u.length&&!(0,ecc_lib_1.getEccLib)().isXOnlyPoint(u))throw new TypeError("Invalid pubkey for p2tr");const p=o();if(e.hash&&p&&!e.hash.equals(p.hash))throw new TypeError("Hash mismatch");if(e.redeem&&e.redeem.output&&p){const c=(0,bip341_1$1.tapleafHash)({output:e.redeem.output,version:a.redeemVersion});if(!(0,bip341_1$1.findScriptPath)(p,c))throw new TypeError("Redeem script not in tree")}const d=n();if(e.redeem&&a.redeem){if(e.redeem.redeemVersion&&e.redeem.redeemVersion!==a.redeem.redeemVersion)throw new TypeError("Redeem.redeemVersion and witness mismatch");if(e.redeem.output){if(bscript$1.decompile(e.redeem.output).length===0)throw new TypeError("Redeem.output is invalid");if(a.redeem.output&&!e.redeem.output.equals(a.redeem.output))throw new TypeError("Redeem.output and witness mismatch")}if(e.redeem.witness&&a.redeem.witness&&!stacksEqual(e.redeem.witness,a.redeem.witness))throw new TypeError("Redeem.witness and witness mismatch")}if(d&&d.length)if(d.length===1){if(e.signature&&!e.signature.equals(d[0]))throw new TypeError("Signature mismatch")}else{const c=d[d.length-1];if(c.length<33)throw new TypeError(`The control-block length is too small. Got ${c.length}, expected min 33.`);if((c.length-33)%32!==0)throw new TypeError(`The control-block length of ${c.length} is incorrect!`);const m=(c.length-33)/32;if(m>128)throw new TypeError(`The script path is too long. Got ${m}, expected max 128.`);const _=c.slice(1,33);if(e.internalPubkey&&!e.internalPubkey.equals(_))throw new TypeError("Internal pubkey mismatch");if(!(0,ecc_lib_1.getEccLib)().isXOnlyPoint(_))throw new TypeError("Invalid internalPubkey for p2tr witness");const v=c[0]&types_1$1.TAPLEAF_VERSION_MASK,S=d[d.length-2],E=(0,bip341_1$1.tapleafHash)({output:S,version:v}),x=(0,bip341_1$1.rootHashFromPath)(c,E),O=(0,bip341_1$1.tweakKey)(_,x);if(!O)throw new TypeError("Invalid outputKey for p2tr witness");if(u.length&&!u.equals(O.x))throw new TypeError("Pubkey mismatch for p2tr witness");if(O.parity!==(c[0]&1))throw new Error("Incorrect parity")}}return Object.assign(a,e)}p2tr$1.p2tr=p2tr;function stacksEqual(e,t){return e.length!==t.length?!1:e.every((r,n)=>r.equals(t[n]))}(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.p2tr=e.p2wsh=e.p2wpkh=e.p2sh=e.p2pkh=e.p2pk=e.p2ms=e.embed=void 0;const t=embed;Object.defineProperty(e,"embed",{enumerable:!0,get:function(){return t.p2data}});const r=p2ms$1;Object.defineProperty(e,"p2ms",{enumerable:!0,get:function(){return r.p2ms}});const n=p2pk$1;Object.defineProperty(e,"p2pk",{enumerable:!0,get:function(){return n.p2pk}});const o=p2pkh$1;Object.defineProperty(e,"p2pkh",{enumerable:!0,get:function(){return o.p2pkh}});const s=p2sh$1;Object.defineProperty(e,"p2sh",{enumerable:!0,get:function(){return s.p2sh}});const a=p2wpkh$1;Object.defineProperty(e,"p2wpkh",{enumerable:!0,get:function(){return a.p2wpkh}});const u=p2wsh$1;Object.defineProperty(e,"p2wsh",{enumerable:!0,get:function(){return u.p2wsh}});const p=p2tr$1;Object.defineProperty(e,"p2tr",{enumerable:!0,get:function(){return p.p2tr}})})(payments$1);Object.defineProperty(psbtutils,"__esModule",{value:!0});psbtutils.signatureBlocksAction=psbtutils.checkInputForSig=pubkeyInScript_1=psbtutils.pubkeyInScript=psbtutils.pubkeyPositionInScript=psbtutils.witnessStackToScriptWitness=psbtutils.isP2TR=psbtutils.isP2SHScript=psbtutils.isP2WSHScript=psbtutils.isP2WPKH=psbtutils.isP2PKH=psbtutils.isP2PK=psbtutils.isP2MS=void 0;const varuint=varint,bscript=script,transaction_1$1=transaction,crypto_1=crypto$1,payments=payments$1;function isPaymentFactory(e){return t=>{try{return e({output:t}),!0}catch{return!1}}}psbtutils.isP2MS=isPaymentFactory(payments.p2ms);psbtutils.isP2PK=isPaymentFactory(payments.p2pk);psbtutils.isP2PKH=isPaymentFactory(payments.p2pkh);psbtutils.isP2WPKH=isPaymentFactory(payments.p2wpkh);psbtutils.isP2WSHScript=isPaymentFactory(payments.p2wsh);psbtutils.isP2SHScript=isPaymentFactory(payments.p2sh);psbtutils.isP2TR=isPaymentFactory(payments.p2tr);function witnessStackToScriptWitness(e){let t=Buffer$e.allocUnsafe(0);function r(a){t=Buffer$e.concat([t,Buffer$e.from(a)])}function n(a){const u=t.length,p=varuint.encodingLength(a);t=Buffer$e.concat([t,Buffer$e.allocUnsafe(p)]),varuint.encode(a,t,u)}function o(a){n(a.length),r(a)}function s(a){n(a.length),a.forEach(o)}return s(e),t}psbtutils.witnessStackToScriptWitness=witnessStackToScriptWitness;function pubkeyPositionInScript(e,t){const r=(0,crypto_1.hash160)(e),n=e.slice(1,33),o=bscript.decompile(t);if(o===null)throw new Error("Unknown script error");return o.findIndex(s=>typeof s=="number"?!1:s.equals(e)||s.equals(r)||s.equals(n))}psbtutils.pubkeyPositionInScript=pubkeyPositionInScript;function pubkeyInScript(e,t){return pubkeyPositionInScript(e,t)!==-1}var pubkeyInScript_1=psbtutils.pubkeyInScript=pubkeyInScript;function checkInputForSig(e,t){return extractPartialSigs(e).some(n=>signatureBlocksAction(n,bscript.signature.decode,t))}psbtutils.checkInputForSig=checkInputForSig;function signatureBlocksAction(e,t,r){const{hashType:n}=t(e),o=[];switch(n&transaction_1$1.Transaction.SIGHASH_ANYONECANPAY&&o.push("addInput"),n&31){case transaction_1$1.Transaction.SIGHASH_ALL:break;case transaction_1$1.Transaction.SIGHASH_SINGLE:case transaction_1$1.Transaction.SIGHASH_NONE:o.push("addOutput"),o.push("setInputSequence");break}return o.indexOf(r)===-1}psbtutils.signatureBlocksAction=signatureBlocksAction;function extractPartialSigs(e){let t=[];if((e.partialSig||[]).length===0){if(!e.finalScriptSig&&!e.finalScriptWitness)return[];t=getPsigsFromInputFinalScripts(e)}else t=e.partialSig;return t.map(r=>r.signature)}function getPsigsFromInputFinalScripts(e){const t=e.finalScriptSig?bscript.decompile(e.finalScriptSig)||[]:[],r=e.finalScriptWitness?bscript.decompile(e.finalScriptWitness)||[]:[];return t.concat(r).filter(n=>Buffer$e.isBuffer(n)&&bscript.isCanonicalScriptSignature(n)).map(n=>({signature:n}))}Object.defineProperty(bip371,"__esModule",{value:!0});bip371.checkTaprootInputForSigs=bip371.tapTreeFromList=bip371.tapTreeToList=bip371.tweakInternalPubKey=bip371.checkTaprootOutputFields=bip371.checkTaprootInputFields=bip371.isTaprootOutput=bip371.isTaprootInput=bip371.serializeTaprootSignature=bip371.tapScriptFinalizer=toXOnly_1=bip371.toXOnly=void 0;const types_1=types$4,transaction_1=transaction,psbtutils_1=psbtutils,bip341_1=bip341,payments_1=payments$1,psbtutils_2=psbtutils,toXOnly=e=>e.length===32?e:e.slice(1,33);var toXOnly_1=bip371.toXOnly=toXOnly;function tapScriptFinalizer(e,t,r){const n=findTapLeafToFinalize(t,e,r);try{const s=sortSignatures(t,n).concat(n.script).concat(n.controlBlock);return{finalScriptWitness:(0,psbtutils_1.witnessStackToScriptWitness)(s)}}catch(o){throw new Error(`Can not finalize taproot input #${e}: ${o}`)}}bip371.tapScriptFinalizer=tapScriptFinalizer;function serializeTaprootSignature(e,t){const r=t?Buffer$e.from([t]):Buffer$e.from([]);return Buffer$e.concat([e,r])}bip371.serializeTaprootSignature=serializeTaprootSignature;function isTaprootInput(e){return e&&!!(e.tapInternalKey||e.tapMerkleRoot||e.tapLeafScript&&e.tapLeafScript.length||e.tapBip32Derivation&&e.tapBip32Derivation.length||e.witnessUtxo&&(0,psbtutils_1.isP2TR)(e.witnessUtxo.script))}bip371.isTaprootInput=isTaprootInput;function isTaprootOutput(e,t){return e&&!!(e.tapInternalKey||e.tapTree||e.tapBip32Derivation&&e.tapBip32Derivation.length||t&&(0,psbtutils_1.isP2TR)(t))}bip371.isTaprootOutput=isTaprootOutput;function checkTaprootInputFields(e,t,r){checkMixedTaprootAndNonTaprootInputFields(e,t,r),checkIfTapLeafInTree(e,t,r)}bip371.checkTaprootInputFields=checkTaprootInputFields;function checkTaprootOutputFields(e,t,r){checkMixedTaprootAndNonTaprootOutputFields(e,t,r),checkTaprootScriptPubkey(e,t)}bip371.checkTaprootOutputFields=checkTaprootOutputFields;function checkTaprootScriptPubkey(e,t){if(!t.tapTree&&!t.tapInternalKey)return;const r=t.tapInternalKey||e.tapInternalKey,n=t.tapTree||e.tapTree;if(r){const{script:o}=e,s=getTaprootScripPubkey(r,n);if(o&&!o.equals(s))throw new Error("Error adding output. Script or address missmatch.")}}function getTaprootScripPubkey(e,t){const r=t&&tapTreeFromList(t.leaves),{output:n}=(0,payments_1.p2tr)({internalPubkey:e,scriptTree:r});return n}function tweakInternalPubKey(e,t){const r=t.tapInternalKey,n=r&&(0,bip341_1.tweakKey)(r,t.tapMerkleRoot);if(!n)throw new Error(`Cannot tweak tap internal key for input #${e}. Public key: ${r&&r.toString("hex")}`);return n.x}bip371.tweakInternalPubKey=tweakInternalPubKey;function tapTreeToList(e){if(!(0,types_1.isTaptree)(e))throw new Error("Cannot convert taptree to tapleaf list. Expecting a tapree structure.");return _tapTreeToList(e)}bip371.tapTreeToList=tapTreeToList;function tapTreeFromList(e=[]){return e.length===1&&e[0].depth===0?{output:e[0].script,version:e[0].leafVersion}:instertLeavesInTree(e)}bip371.tapTreeFromList=tapTreeFromList;function checkTaprootInputForSigs(e,t){return extractTaprootSigs(e).some(n=>(0,psbtutils_2.signatureBlocksAction)(n,decodeSchnorrSignature,t))}bip371.checkTaprootInputForSigs=checkTaprootInputForSigs;function decodeSchnorrSignature(e){return{signature:e.slice(0,64),hashType:e.slice(64)[0]||transaction_1.Transaction.SIGHASH_DEFAULT}}function extractTaprootSigs(e){const t=[];if(e.tapKeySig&&t.push(e.tapKeySig),e.tapScriptSig&&t.push(...e.tapScriptSig.map(r=>r.signature)),!t.length){const r=getTapKeySigFromWithness(e.finalScriptWitness);r&&t.push(r)}return t}function getTapKeySigFromWithness(e){if(!e)return;const t=e.slice(2);if(t.length===64||t.length===65)return t}function _tapTreeToList(e,t=[],r=0){if(r>bip341_1.MAX_TAPTREE_DEPTH)throw new Error("Max taptree depth exceeded.");return e?(0,types_1.isTapleaf)(e)?(t.push({depth:r,leafVersion:e.version||bip341_1.LEAF_VERSION_TAPSCRIPT,script:e.output}),t):(e[0]&&_tapTreeToList(e[0],t,r+1),e[1]&&_tapTreeToList(e[1],t,r+1),t):[]}function instertLeavesInTree(e){let t;for(const r of e)if(t=instertLeafInTree(r,t),!t)throw new Error("No room left to insert tapleaf in tree");return t}function instertLeafInTree(e,t,r=0){if(r>bip341_1.MAX_TAPTREE_DEPTH)throw new Error("Max taptree depth exceeded.");if(e.depth===r)return t?void 0:{output:e.script,version:e.leafVersion};if((0,types_1.isTapleaf)(t))return;const n=instertLeafInTree(e,t&&t[0],r+1);if(n)return[n,t&&t[1]];const o=instertLeafInTree(e,t&&t[1],r+1);if(o)return[t&&t[0],o]}function checkMixedTaprootAndNonTaprootInputFields(e,t,r){const n=isTaprootInput(e)&&hasNonTaprootFields(t),o=hasNonTaprootFields(e)&&isTaprootInput(t),s=e===t&&isTaprootInput(t)&&hasNonTaprootFields(t);if(n||o||s)throw new Error(`Invalid arguments for Psbt.${r}. Cannot use both taproot and non-taproot fields.`)}function checkMixedTaprootAndNonTaprootOutputFields(e,t,r){const n=isTaprootOutput(e)&&hasNonTaprootFields(t),o=hasNonTaprootFields(e)&&isTaprootOutput(t),s=e===t&&isTaprootOutput(t)&&hasNonTaprootFields(t);if(n||o||s)throw new Error(`Invalid arguments for Psbt.${r}. Cannot use both taproot and non-taproot fields.`)}function checkIfTapLeafInTree(e,t,r){if(t.tapMerkleRoot){const n=(t.tapLeafScript||[]).every(s=>isTapLeafInTree(s,t.tapMerkleRoot)),o=(e.tapLeafScript||[]).every(s=>isTapLeafInTree(s,t.tapMerkleRoot));if(!n||!o)throw new Error(`Invalid arguments for Psbt.${r}. Tapleaf not part of taptree.`)}else if(e.tapMerkleRoot&&!(t.tapLeafScript||[]).every(o=>isTapLeafInTree(o,e.tapMerkleRoot)))throw new Error(`Invalid arguments for Psbt.${r}. Tapleaf not part of taptree.`)}function isTapLeafInTree(e,t){if(!t)return!0;const r=(0,bip341_1.tapleafHash)({output:e.script,version:e.leafVersion});return(0,bip341_1.rootHashFromPath)(e.controlBlock,r).equals(t)}function sortSignatures(e,t){const r=(0,bip341_1.tapleafHash)({output:t.script,version:t.leafVersion});return(e.tapScriptSig||[]).filter(n=>n.leafHash.equals(r)).map(n=>addPubkeyPositionInScript(t.script,n)).sort((n,o)=>o.positionInScript-n.positionInScript).map(n=>n.signature)}function addPubkeyPositionInScript(e,t){return Object.assign({positionInScript:(0,psbtutils_1.pubkeyPositionInScript)(t.pubkey,e)},t)}function findTapLeafToFinalize(e,t,r){if(!e.tapScriptSig||!e.tapScriptSig.length)throw new Error(`Can not finalize taproot input #${t}. No tapleaf script signature provided.`);const n=(e.tapLeafScript||[]).sort((o,s)=>o.controlBlock.length-s.controlBlock.length).find(o=>canFinalizeLeaf(o,e.tapScriptSig,r));if(!n)throw new Error(`Can not finalize taproot input #${t}. Signature for tapleaf script not found.`);return n}function canFinalizeLeaf(e,t,r){const n=(0,bip341_1.tapleafHash)({output:e.script,version:e.leafVersion});return(!r||r.equals(n))&&t.find(s=>s.leafHash.equals(n))!==void 0}function hasNonTaprootFields(e){return e&&!!(e.redeemScript||e.witnessScript||e.bip32Derivation&&e.bip32Derivation.length)}const byteToHex=[];for(let e=0;e<256;++e)byteToHex.push((e+256).toString(16).slice(1));function unsafeStringify(e,t=0){return(byteToHex[e[t+0]]+byteToHex[e[t+1]]+byteToHex[e[t+2]]+byteToHex[e[t+3]]+"-"+byteToHex[e[t+4]]+byteToHex[e[t+5]]+"-"+byteToHex[e[t+6]]+byteToHex[e[t+7]]+"-"+byteToHex[e[t+8]]+byteToHex[e[t+9]]+"-"+byteToHex[e[t+10]]+byteToHex[e[t+11]]+byteToHex[e[t+12]]+byteToHex[e[t+13]]+byteToHex[e[t+14]]+byteToHex[e[t+15]]).toLowerCase()}let getRandomValues;const rnds8=new Uint8Array(16);function rng(){if(!getRandomValues){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");getRandomValues=crypto.getRandomValues.bind(crypto)}return getRandomValues(rnds8)}const randomUUID=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),native={randomUUID};function v4(e,t,r){var o;if(native.randomUUID&&!t&&!e)return native.randomUUID();e=e||{};const n=e.random??((o=e.rng)==null?void 0:o.call(e))??rng();if(n.length<16)throw new Error("Random bytes length must be >= 16");return n[6]=n[6]&15|64,n[8]=n[8]&63|128,unsafeStringify(n)}class BIP322{static hashMessage(t){const{sha256:r}=Lr__namespace.crypto,n=r(this.TAG);return r(Buffer$e.concat([n,n,Buffer$e.from(t)]))}static buildToSpendTx(t,r){const n=new Lr__namespace.Psbt;n.setVersion(0),n.setLocktime(0);const o=this.hashMessage(t),s=0,a=32,u=new Uint8Array([s,a]),p=new Uint8Array(u.length+o.length);return p.set(u),p.set(o,u.length),n.addInput({hash:"0".repeat(64),index:4294967295,sequence:0,finalScriptSig:Buffer$e.from(p),witnessScript:Buffer$e.from([])}),n.addOutput({value:0,script:r}),n.extractTransaction()}static buildToSignTx(t,r,n=!1,o){const s=new Lr__namespace.Psbt;return s.setVersion(0),s.setLocktime(0),s.addInput({hash:t,index:0,sequence:0,witnessUtxo:{script:r,value:0}}),n&&s.updateInput(0,{redeemScript:r}),o&&s.updateInput(0,{tapInternalKey:o}),s.addOutput({value:0,script:Buffer$e.from([106])}),s}static encodeWitness(t){const r=t.data.inputs[0].finalScriptWitness;if(!r)throw new Error("Cannot encode empty witness stack.");return r.toString("base64")}}Fu(BIP322,"TAG",Buffer$e.from("BIP0322-signed-message"));const COMPRESSED_PUBLIC_KEY_HEX_LENGTH=66,NETWORKS={[Network.MAINNET]:{name:"Mainnet",config:Lr.networks.bitcoin,addressPrefix:{common:"bc1",nativeSegWit:"bc1q",taproot:"bc1p"}},[Network.TESTNET]:{name:"Testnet",config:Lr.networks.testnet,addressPrefix:{common:"tb1",nativeSegWit:"tb1q",taproot:"tb1p"}},[Network.SIGNET]:{name:"Signet",config:Lr.networks.testnet,addressPrefix:{common:"tb1",nativeSegWit:"tb1q",taproot:"tb1p"}}},getTaprootAddress=(e,t)=>{e.length==COMPRESSED_PUBLIC_KEY_HEX_LENGTH&&(e=e.slice(2));const r=Buffer$e.from(e,"hex"),{address:n,output:o}=Lr.payments.p2tr({internalPubkey:toXOnly_1(r),network:NETWORKS[t].config});if(!n||!o)throw new Error("Failed to generate taproot address or script from public key");return n},getNativeSegwitAddress=(e,t)=>{if(e.length!==COMPRESSED_PUBLIC_KEY_HEX_LENGTH)throw new Error("Invalid public key length for generating native segwit address");const r=Buffer$e.from(e,"hex"),{address:n,output:o}=Lr.payments.p2wpkh({pubkey:r,network:NETWORKS[t].config});if(!n||!o)throw new Error("Failed to generate native segwit address or script from public key");return n};function validateAddressWithPK(e,t,r){return e.startsWith(NETWORKS[r].addressPrefix.taproot)?e===getTaprootAddress(t,r):e.startsWith(NETWORKS[r].addressPrefix.nativeSegWit)?e===getNativeSegwitAddress(t,r):!1}function validateAddress(e,t){const{addressPrefix:r,name:n}=NETWORKS[e];if(!(e in NETWORKS))throw new Error(`Unsupported network: ${e}. Please provide a valid network.`);if(!t.startsWith(r.common))throw new Error(`Incorrect address prefix for ${n}. Expected address to start with '${r.common}'.`)}const toNetwork=e=>NETWORKS[e].config,WALLET_PROVIDER_NAME$3="Keystone";class KeystoneProvider{constructor(t,r){Fu(this,"keystoneWaleltInfo");Fu(this,"viewSDK");Fu(this,"dataSdk");Fu(this,"config");Fu(this,"connectWallet",async()=>{const r=await(await this.viewSDK.getSdk()).read([Rr.SupportedResult.UR_CRYPTO_ACCOUNT],{title:"Sync Keystone with Babylon Staking App",description:"Please scan the QR code displayed on your Keystone, Currently only the first Taproot Address will be used",renderInitial:{walletMode:"btc",link:"",description:["1. Turn on your Keystone 3 with BTC only firmware.",'2. Click connect software wallet and use "Sparrow" for connection.','3. Press the "Sync Keystone" button and scan the QR Code displayed on your Keystone hardware wallet',"4. The first Taproot address will be used for staking."]},URTypeErrorMessage:"The scanned QR code is not the sync code from the Keystone hardware wallet. Please verify the code and try again."});if(r.status===Rr.ReadStatus.canceled)throw new Error("Connection to Keystone was canceled");if(r.status!==Rr.ReadStatus.success)throw new Error("Error reading QR code, Please try again.");const n=this.dataSdk.parseAccount(r.result),o=3,s=n.keys[o].extendedPublicKey;if(this.keystoneWaleltInfo={mfp:n.masterFingerprint,extendedPublicKey:s,path:n.keys[o].path,address:void 0,publicKeyHex:void 0,scriptPubKeyHex:void 0},!this.keystoneWaleltInfo.extendedPublicKey)throw new Error("Could not retrieve the extended public key");const{address:a,pubkeyHex:u,scriptPubKeyHex:p}=generateP2trAddressFromXpub(this.keystoneWaleltInfo.extendedPublicKey,"M/0/0",toNetwork(this.config.network));this.keystoneWaleltInfo.address=a,this.keystoneWaleltInfo.publicKeyHex=u,this.keystoneWaleltInfo.scriptPubKeyHex=p});Fu(this,"getAddress",async()=>{var t;if(!((t=this.keystoneWaleltInfo)!=null&&t.address))throw new Error("Could not retrieve the address");return this.keystoneWaleltInfo.address});Fu(this,"getPublicKeyHex",async()=>{var t;if(!((t=this.keystoneWaleltInfo)!=null&&t.publicKeyHex))throw new Error("Could not retrieve the BTC public key");return this.keystoneWaleltInfo.publicKeyHex});Fu(this,"signPsbt",async t=>{var s,a;if(!((s=this.keystoneWaleltInfo)!=null&&s.address)||!((a=this.keystoneWaleltInfo)!=null&&a.publicKeyHex))throw new Error("Keystone Wallet not connected");if(!t)throw new Error("psbt hex is required");let r=Lr.Psbt.fromHex(t);r=this.enhancePsbt(r);const n=r.toHex();return(await this.sign(n)).toHex()});Fu(this,"signPsbts",async t=>{var n,o;if(!((n=this.keystoneWaleltInfo)!=null&&n.address)||!((o=this.keystoneWaleltInfo)!=null&&o.publicKeyHex))throw new Error("Keystone Wallet not connected");if(!t&&!Array.isArray(t))throw new Error("psbts hexes are required");const r=[];for(const s of t){const a=await this.signPsbt(s);r.push(a)}return r});Fu(this,"getNetwork",async()=>this.config.network);Fu(this,"signMessage",async(t,r)=>r==="bip322-simple"?this.signMessageBIP322(t):this.signMessageECDSA(t));Fu(this,"signMessageBIP322",async t=>{var u,p;if(!((u=this.keystoneWaleltInfo)!=null&&u.scriptPubKeyHex)||!((p=this.keystoneWaleltInfo)!=null&&p.publicKeyHex))throw new Error("Keystone Wallet not connected");const r=Buffer$1$1.from(this.keystoneWaleltInfo.scriptPubKeyHex,"hex"),n=BIP322.buildToSpendTx(t,r),o=toXOnly_1(Buffer$1$1.from(this.keystoneWaleltInfo.publicKeyHex,"hex"));let s=BIP322.buildToSignTx(n.getId(),r,!1,o);s.updateInput(0,{sighashType:Lr.Transaction.SIGHASH_ALL}),s=this.enhancePsbt(s);const a=await this.sign(s.toHex());return BIP322.encodeWitness(a)});Fu(this,"signMessageECDSA",async t=>{var u,p;if(!((u=this.keystoneWaleltInfo)!=null&&u.address)||!((p=this.keystoneWaleltInfo)!=null&&p.publicKeyHex))throw new Error("Keystone Wallet not connected");const r=this.dataSdk.btc.generateSignRequest({requestId:v4(),signData:Buffer$1$1.from(t,"utf-8").toString("hex"),dataType:dist$v.KeystoneBitcoinSDK.DataType.message,accounts:[{path:`${this.keystoneWaleltInfo.path}/0/0`,xfp:`${this.keystoneWaleltInfo.mfp}`,address:this.keystoneWaleltInfo.address}],origin:"babylon staking app"}),n=composeQRProcess(Rr.SupportedResult.UR_BTC_SIGNATURE),o=await this.viewSDK.getSdk(),s=await n(o,r),a=this.dataSdk.btc.parseSignature(s);return Buffer$1$1.from(a.signature,"hex").toString("base64")});Fu(this,"getInscriptions",async()=>{throw new Error("Method not implemented.")});Fu(this,"on",()=>{});Fu(this,"off",()=>{});Fu(this,"getWalletProviderName",async()=>WALLET_PROVIDER_NAME$3);Fu(this,"getWalletProviderIcon",async()=>logo$3);Fu(this,"sign",async t=>{if(!t)throw new Error("psbt hex is required");const r=this.dataSdk.btc.generatePSBT(Buffer$1$1.from(t,"hex")),n=composeQRProcess(Rr.SupportedResult.UR_PSBT),o=await this.viewSDK.getSdk(),s=await n(o,r),a=this.dataSdk.btc.parsePSBT(s),u=Lr.Psbt.fromHex(a);return u.finalizeAllInputs(),u});Fu(this,"enhancePsbt",t=>{var n,o,s,a;if(!((n=this.keystoneWaleltInfo)!=null&&n.scriptPubKeyHex)||!((o=this.keystoneWaleltInfo)!=null&&o.publicKeyHex)||!((s=this.keystoneWaleltInfo)!=null&&s.mfp)||!((a=this.keystoneWaleltInfo)!=null&&a.path))throw new Error("Keystone Wallet not connected");const r={masterFingerprint:Buffer$1$1.from(this.keystoneWaleltInfo.mfp,"hex"),path:`${this.keystoneWaleltInfo.path}/0/0`,pubkey:Buffer$1$1.from(this.keystoneWaleltInfo.publicKeyHex,"hex")};return t.data.inputs.forEach(u=>{u.tapBip32Derivation=[{...r,pubkey:toXOnly_1(r.pubkey),leafHashes:caculateTapLeafHash(u,r.pubkey)}]}),t});this.config=r,Rr.viewSdk.bootstrap(),this.viewSDK=Rr.viewSdk,this.dataSdk=new dist$v.KeystoneSDK({origin:"babylon staking app"})}}const composeQRProcess=e=>async(t,r)=>{if(await t.play(r,{title:"Scan the QR Code",description:"Please scan the QR code with your Keystone device."})!==Rr.PlayStatus.success)throw new Error("Could not generate the QR code, please try again.");const o=await t.read([e],{title:"Get the Signature from Keystone",description:"Please scan the QR code displayed on your Keystone",URTypeErrorMessage:"The scanned QR code can't be read. please verify and try again."});if(o.status!==Rr.ReadStatus.success)throw new Error("Could not extract the signature, please try again.");return o.result},generateP2trAddressFromXpub=(e,t,r)=>{const o=HDKey.fromExtendedKey(e).derive(t),s=Buffer$1$1.from(o.publicKey),a=toXOnly_1(s);let u,p;try{const d=Lr.payments.p2tr({internalPubkey:a,network:r});u=d.address,p=d.output}catch(d){if(d instanceof Error&&d.message.includes("ECC")){btcStakingTs.initBTCCurve();const c=Lr.payments.p2tr({internalPubkey:a,network:r});u=c.address,p=c.output}else throw new Error(d)}return{address:u,pubkeyHex:s.toString("hex"),scriptPubKeyHex:p.toString("hex")}},caculateTapLeafHash=(e,t)=>e.tapInternalKey&&!e.tapLeafScript?[]:(e.tapLeafScript||[]).filter(n=>pubkeyInScript_1(t,n.script)).map(n=>{const o=bip341.tapleafHash({output:n.script,version:n.leafVersion});return Object.assign({hash:o},n)}).map(n=>n.hash),metadata$5={id:"keystone",name:WALLET_PROVIDER_NAME$3,icon:logo$3,docs:"https://www.keyst.one/btc-only",createProvider:(e,t)=>new KeystoneProvider(e,t),networks:[Network.MAINNET,Network.SIGNET],label:"Hardware wallet"},logo$2="data:image/svg+xml,%3c?xml%20version='1.0'%20encoding='UTF-8'?%3e%3csvg%20width='225px'%20height='224px'%20viewBox='0%200%20225%20224'%20version='1.1'%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%3e%3ctitle%3eokx%3c/title%3e%3cg%20id='Page-1'%20stroke='none'%20strokeWidth='1'%20fill='none'%20fill-rule='evenodd'%3e%3cg%20id='okx'%20transform='translate(0.401000,%200.006000)'%20fill='%23000000'%20fill-rule='nonzero'%3e%3cpath%20d='M144.382,74.667%20L79.673,74.667%20C76.924,74.667%2074.695,76.895%2074.695,79.644%20L74.695,144.354%20C74.695,147.103%2076.924,149.332%2079.673,149.332%20L144.382,149.332%20C147.131,149.332%20149.36,147.103%20149.36,144.354%20L149.36,79.644%20C149.36,76.895%20147.131,74.667%20144.382,74.667%20Z'%20id='Path'%3e%3c/path%3e%3cpath%20d='M69.687,0%20L4.978,0%20C2.229,0%200,2.228%200,4.978%20L0,69.687%20C0,72.436%202.229,74.665%204.978,74.665%20L69.687,74.665%20C72.437,74.665%2074.665,72.436%2074.665,69.687%20L74.665,4.978%20C74.665,2.228%2072.437,0%2069.687,0%20Z'%20id='Path'%3e%3c/path%3e%3cpath%20d='M219.017,0%20L154.307,0%20C151.558,0%20149.329,2.228%20149.329,4.978%20L149.329,69.687%20C149.329,72.436%20151.558,74.665%20154.307,74.665%20L219.017,74.665%20C221.766,74.665%20223.994,72.436%20223.994,69.687%20L223.994,4.978%20C223.994,2.228%20221.766,0%20219.017,0%20Z'%20id='Path'%3e%3c/path%3e%3cpath%20d='M69.687,149.328%20L4.978,149.328%20C2.229,149.328%200,151.556%200,154.305%20L0,219.015%20C0,221.764%202.229,223.993%204.978,223.993%20L69.687,223.993%20C72.437,223.993%2074.665,221.764%2074.665,219.015%20L74.665,154.305%20C74.665,151.556%2072.437,149.328%2069.687,149.328%20Z'%20id='Path'%3e%3c/path%3e%3cpath%20d='M219.017,149.328%20L154.307,149.328%20C151.558,149.328%20149.329,151.556%20149.329,154.305%20L149.329,219.015%20C149.329,221.764%20151.558,223.993%20154.307,223.993%20L219.017,223.993%20C221.766,223.993%20223.994,221.764%20223.994,219.015%20L223.994,154.305%20C223.994,151.556%20221.766,149.328%20219.017,149.328%20Z'%20id='Path'%3e%3c/path%3e%3c/g%3e%3c/g%3e%3c/svg%3e",PROVIDER_NAMES={[Network.MAINNET]:"bitcoin",[Network.TESTNET]:"bitcoinTestnet",[Network.SIGNET]:"bitcoinSignet"},WALLET_PROVIDER_NAME$2="OKX";class OKXProvider{constructor(t,r){Fu(this,"provider");Fu(this,"walletInfo");Fu(this,"config");Fu(this,"connectWallet",async()=>{var o;try{await this.wallet.enable()}catch(s){throw(o=s==null?void 0:s.message)!=null&&o.includes("rejected")?new Error("Connection to OKX Wallet was rejected"):new Error(s==null?void 0:s.message)}let t;try{t=await this.provider.connect()}catch{throw new Error(`BTC ${this.config.network} is not enabled in OKX Wallet`)}const{address:r,compressedPublicKey:n}=t;if(n&&r)this.walletInfo={publicKeyHex:n,address:r};else throw new Error("Could not connect to OKX Wallet")});Fu(this,"getAddress",async()=>{if(!this.walletInfo)throw new Error("OKX Wallet not connected");return this.walletInfo.address});Fu(this,"getPublicKeyHex",async()=>{if(!this.walletInfo)throw new Error("OKX Wallet not connected");return this.walletInfo.publicKeyHex});Fu(this,"signPsbt",async t=>{if(!this.walletInfo)throw new Error("OKX Wallet not connected");return await this.provider.signPsbt(t)});Fu(this,"signPsbts",async t=>{if(!this.walletInfo)throw new Error("OKX Wallet not connected");return await this.provider.signPsbts(t)});Fu(this,"getNetwork",async()=>{if(!this.config.network)throw new Error("Network not set");return this.config.network});Fu(this,"signMessage",async(t,r)=>{if(!this.walletInfo)throw new Error("OKX Wallet not connected");return await this.provider.signMessage(t,r)});Fu(this,"getInscriptions",async()=>{if(!this.walletInfo)throw new Error("OKX Wallet not connected");if(this.config.network!==Network.MAINNET)throw new Error("Inscriptions are only available on OKX Wallet BTC mainnet");const t=100,r=100,n=[];let o=0,s=0;try{for(;s<t;){const{list:a}=await this.provider.getInscriptions(o,r),u=a.map(p=>{const[d,c]=p.output.split(":");return{txid:d,vout:c}});if(n.push(...u),a.length<r)break;if(o+=r,s++,s>=t)throw new Error("Exceeded maximum iterations when fetching inscriptions")}}catch{throw new Error("Failed to get inscriptions from OKX Wallet")}return n});Fu(this,"on",(t,r)=>{if(!this.walletInfo)throw new Error("OKX Wallet not connected");if(t==="accountChanged")return this.provider.on(t,r)});Fu(this,"off",(t,r)=>{if(!this.walletInfo)throw new Error("OKX Wallet not connected");if(t==="accountChanged")return this.provider.off(t,r)});Fu(this,"getWalletProviderName",async()=>WALLET_PROVIDER_NAME$2);Fu(this,"getWalletProviderIcon",async()=>logo$2);if(this.wallet=t,this.config=r,!t)throw new Error("OKX Wallet extension not found");const n=PROVIDER_NAMES[r.network];if(!n)throw new Error("Unsupported network");this.provider=t[n]}}const metadata$4={id:"okx",name:WALLET_PROVIDER_NAME$2,icon:logo$2,docs:"https://www.okx.com/web3",wallet:"okxwallet",createProvider:(e,t)=>new OKXProvider(e,t),networks:[Network.MAINNET,Network.SIGNET]},logo$1="data:image/svg+xml,%3csvg%20width='288'%20height='288'%20viewBox='72%2072%20144%20144'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M144%20216C193.706%20216%20216%20193.706%20216%20144C216%2094.2944%20193.706%2072%20144%2072C94.2944%2072%2072%2094.2944%2072%20144C72%20193.706%2094.2944%20216%20144%20216ZM130.475%20102.531H150.505V135.538H138.086V113.156H126.961L130.475%20102.531ZM144%20185.469C156.616%20185.469%20166.844%20175.242%20166.844%20162.626C166.844%20150.01%20156.616%20139.783%20144%20139.783C131.384%20139.783%20121.157%20150.01%20121.157%20162.626C121.157%20175.242%20131.384%20185.469%20144%20185.469ZM144%20175.099C150.889%20175.099%20156.473%20169.515%20156.473%20162.626C156.473%20155.738%20150.889%20150.153%20144%20150.153C137.112%20150.153%20131.528%20155.738%20131.528%20162.626C131.528%20169.515%20137.112%20175.099%20144%20175.099Z'%20fill='black'%20style='fill:black;fill-opacity:1;'/%3e%3c/svg%3e",INTERNAL_NETWORK_NAMES={[Network.MAINNET]:"livenet",[Network.TESTNET]:"testnet",[Network.SIGNET]:"signet"},WALLET_PROVIDER_NAME$1="OneKey";class OneKeyProvider{constructor(t,r){Fu(this,"provider");Fu(this,"walletInfo");Fu(this,"config");Fu(this,"connectWallet",async()=>{var n;try{await this.provider.connectWallet()}catch(o){throw(n=o==null?void 0:o.message)!=null&&n.includes("rejected")?new Error("Connection to OneKey Wallet was rejected"):new Error(o==null?void 0:o.message)}const t=await this.provider.getAddress(),r=await this.provider.getPublicKeyHex();if(r&&t)this.walletInfo={publicKeyHex:r,address:t};else throw new Error("Could not connect to OneKey Wallet")});Fu(this,"getAddress",async()=>{if(!this.walletInfo)throw new Error("OneKey Wallet not connected");return this.walletInfo.address});Fu(this,"getPublicKeyHex",async()=>{if(!this.walletInfo)throw new Error("OneKey Wallet not connected");return this.walletInfo.publicKeyHex});Fu(this,"signPsbt",async t=>{if(!this.walletInfo)throw new Error("OneKey Wallet not connected");if(!t)throw new Error("psbt hex is required");return this.provider.signPsbt(t)});Fu(this,"signPsbts",async t=>{if(!this.walletInfo)throw new Error("OneKey Wallet not connected");if(!t&&!Array.isArray(t))throw new Error("psbts hexes are required");return this.provider.signPsbts(t)});Fu(this,"getNetwork",async()=>{const t=await this.provider.getNetwork();for(const[r,n]of Object.entries(INTERNAL_NETWORK_NAMES)){if(n==="testnet")return Network.SIGNET;if(n===t)return r}throw new Error("Unsupported network")});Fu(this,"signMessage",async(t,r)=>{if(!this.walletInfo)throw new Error("OneKey Wallet not connected");return await this.provider.signMessage(t,r)});Fu(this,"getInscriptions",async()=>{if(!this.walletInfo)throw new Error("OneKey Wallet not connected");if(this.config.network!==Network.MAINNET)throw new Error("Inscriptions are only available on OneKey Wallet BTC Mainnet");const t=100,r=100,n=[];let o=0,s=0;try{for(;s<t;){const{list:a}=await this.provider.getInscriptions(o,r),u=a.map(p=>{const[d,c]=p.output.split(":");return{txid:d,vout:c}});if(n.push(...u),a.length<r)break;if(o+=r,s++,s>=t)throw new Error("Exceeded maximum iterations when fetching inscriptions")}}catch{throw new Error("Failed to get inscriptions from OneKey Wallet")}return n});Fu(this,"on",(t,r)=>{if(!this.walletInfo)throw new Error("OneKey Wallet not connected");if(t==="accountChanged")return this.provider.on(t,r)});Fu(this,"off",(t,r)=>{if(!this.walletInfo)throw new Error("OneKey Wallet not connected");if(t==="accountChanged")return this.provider.off(t,r)});Fu(this,"getWalletProviderName",async()=>WALLET_PROVIDER_NAME$1);Fu(this,"getWalletProviderIcon",async()=>logo$1);if(this.config=r,!(t!=null&&t.btcwallet))throw new Error("OneKey Wallet extension not found");this.provider=t.btcwallet}}const metadata$3={id:"onekey",name:WALLET_PROVIDER_NAME$1,icon:logo$1,docs:"https://onekey.so/download",wallet:"$onekey",createProvider:(e,t)=>new OneKeyProvider(e,t),networks:[Network.MAINNET,Network.SIGNET]},logo="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='59'%20height='59'%3e%3cdefs%3e%3clinearGradient%20id='a'%20x1='91.9%25'%20x2='5.127%25'%20y1='28.561%25'%20y2='67.452%25'%3e%3cstop%20offset='0%25'%20stop-color='%23070100'/%3e%3cstop%20offset='36%25'%20stop-color='%2377390D'/%3e%3cstop%20offset='67%25'%20stop-color='%23EA8101'/%3e%3cstop%20offset='100%25'%20stop-color='%23F4B852'/%3e%3c/linearGradient%3e%3clinearGradient%20id='b'%20x1='10.514%25'%20x2='111.046%25'%20y1='63.228%25'%20y2='37.55%25'%3e%3cstop%20offset='0%25'%20stop-color='%23070100'/%3e%3cstop%20offset='37%25'%20stop-color='%2377390D'/%3e%3cstop%20offset='67%25'%20stop-color='%23EA8101'/%3e%3cstop%20offset='100%25'%20stop-color='%23F4FB52'/%3e%3c/linearGradient%3e%3cradialGradient%20id='c'%20cx='49.933%25'%20cy='50.067%25'%20r='50%25'%20fx='49.933%25'%20fy='50.067%25'%3e%3cstop%20offset='0%25'%20stop-color='%23F4B852'/%3e%3cstop%20offset='33%25'%20stop-color='%23EA8101'/%3e%3cstop%20offset='64%25'%20stop-color='%2377390D'/%3e%3cstop%20offset='100%25'%20stop-color='%23070100'/%3e%3c/radialGradient%3e%3c/defs%3e%3cg%20fill='none'%20fill-rule='nonzero'%20transform='translate(7%201)'%3e%3cpath%20fill='url(%23a)'%20d='m31.764%205.2%2011.761%2011.745c1%20.997%201.492%202.006%201.475%203.027-.018%201.014-.446%201.947-1.29%202.787-.879.88-1.827%201.33-2.845%201.347-1.017.018-2.023-.478-3.03-1.475L25.81%2010.617c-1.365-1.364-2.683-2.332-3.955-2.898-1.267-.566-2.602-.653-4.002-.268-1.399.385-2.902%201.382-4.51%202.991-2.22%202.217-3.278%204.298-3.168%206.246.11%201.948%201.208%203.96%203.301%206.054L25.6%2034.854c1.012%201.01%201.51%202.018%201.492%203.021-.017%201.003-.45%201.936-1.307%202.788-.855.851-1.792%201.3-2.821%201.335-1.024.035-2.041-.455-3.053-1.464L8.16%2028.79c-1.913-1.913-3.295-3.72-4.145-5.423-.85-1.703-1.168-3.633-.949-5.785.197-1.843.787-3.628%201.758-5.36.977-1.732%202.37-3.499%204.18-5.313%202.157-2.157%204.216-3.808%206.182-4.957C17.153.803%2019.049.161%2020.882.027c1.833-.134%203.643.233%205.435%201.102%201.787.869%203.603%202.222%205.453%204.07h-.006Z'/%3e%3cpath%20fill='url(%23b)'%20d='M13.234%2051.841%201.474%2040.188c-1-.99-1.49-1.99-1.474-3.003.018-1.012.446-1.932%201.29-2.766.878-.873%201.827-1.319%202.844-1.336%201.018-.017%202.024.469%203.03%201.464l12.025%2011.919c1.37%201.354%202.682%202.314%203.954%202.876%201.272.56%202.602.648%204%20.266%201.4-.382%202.903-1.372%204.51-2.968%202.22-2.2%203.278-4.265%203.169-6.197-.11-1.933-1.209-3.935-3.302-6.006l-6.457-6.347c-1.012-1.001-1.51-2.002-1.492-2.998.017-.995.451-1.92%201.307-2.765.855-.845%201.792-1.29%202.82-1.325%201.024-.035%202.042.451%203.053%201.452l6.088%205.983c1.914%201.898%203.296%203.691%204.145%205.38.85%201.69%201.168%203.605.949%205.74-.197%201.829-.787%203.6-1.758%205.318-.977%201.718-2.37%203.471-4.18%205.27-2.156%202.142-4.214%203.78-6.18%204.919-1.966%201.14-3.862%201.776-5.695%201.91-1.832.132-3.642-.232-5.434-1.094-1.787-.862-3.608-2.205-5.452-4.039Z'/%3e%3ccircle%20cx='20'%20cy='18'%20r='4'%20fill='url(%23c)'/%3e%3c/g%3e%3c/svg%3e",WALLET_PROVIDER_NAME="Unisat";class UnisatProvider{constructor(t,r){Fu(this,"provider");Fu(this,"walletInfo");Fu(this,"config");Fu(this,"connectWallet",async()=>{var o;let t;try{t=await this.provider.requestAccounts()}catch(s){throw(o=s==null?void 0:s.message)!=null&&o.includes("rejected")?new Error("Connection to Unisat Wallet was rejected"):new Error(s==null?void 0:s.message)}const r=t[0],n=await this.provider.getPublicKey();if(n&&r)this.walletInfo={publicKeyHex:n,address:r};else throw new Error("Could not connect to Unisat Wallet")});Fu(this,"getAddress",async()=>{if(!this.walletInfo)throw new Error("Unisat Wallet not connected");return this.walletInfo.address});Fu(this,"getPublicKeyHex",async()=>{if(!this.walletInfo)throw new Error("Unisat Wallet not connected");return this.walletInfo.publicKeyHex});Fu(this,"signPsbt",async t=>{if(!this.walletInfo)throw new Error("Unisat Wallet not connected");if(!t)throw new Error("psbt hex is required");const r=await this.getNetwork();try{return await this.provider.signPsbt(t,this.getSignPsbtDefaultOptions(t,r))}catch(n){throw new Error((n==null?void 0:n.message)||n)}});Fu(this,"signPsbts",async t=>{if(!this.walletInfo)throw new Error("Unisat Wallet not connected");if(!t&&!Array.isArray(t))throw new Error("psbts hexes are required");const r=await this.getNetwork();try{return await this.provider.signPsbts(t,t.map(n=>this.getSignPsbtDefaultOptions(n,r)))}catch(n){throw new Error((n==null?void 0:n.message)||n)}});Fu(this,"getNetwork",async()=>{switch((await this.provider.getChain()).enum){case"BITCOIN_MAINNET":return Network.MAINNET;case"BITCOIN_SIGNET":return Network.SIGNET;case"BITCOIN_TESTNET":return Network.SIGNET;default:throw new Error("Unsupported network")}});Fu(this,"signMessage",async(t,r)=>{if(!this.walletInfo)throw new Error("Unisat Wallet not connected");return await this.provider.signMessage(t,r)});Fu(this,"getInscriptions",async()=>{if(!this.walletInfo)throw new Error("Unisat Wallet not connected");if(this.config.network!==Network.MAINNET)throw new Error("Inscriptions are only available on Unisat Wallet BTC Mainnet");const t=100,r=100,n=[];let o=0,s=0;try{for(;s<t;){const{list:a}=await this.provider.getInscriptions(o,r),u=a.map(p=>{const[d,c]=p.output.split(":");return{txid:d,vout:c}});if(n.push(...u),a.length<r)break;if(o+=r,s++,s>=t)throw new Error("Exceeded maximum iterations when fetching inscriptions")}}catch{throw new Error("Failed to get inscriptions from Unisat Wallet")}return n});Fu(this,"on",(t,r)=>{if(!this.walletInfo)throw new Error("Unisat Wallet not connected");if(t==="accountChanged")return this.provider.on("accountsChanged",r)});Fu(this,"off",(t,r)=>{if(!this.walletInfo)throw new Error("Unisat Wallet not connected");if(t==="accountChanged")return this.provider.removeListener("accountsChanged",r)});Fu(this,"getWalletProviderName",async()=>WALLET_PROVIDER_NAME);Fu(this,"getWalletProviderIcon",async()=>logo);if(this.config=r,!t)throw new Error("Unisat Wallet extension not found");this.provider=t}getSignPsbtDefaultOptions(t,r){const n=[];return Lr.Psbt.fromHex(t).data.inputs.forEach((s,a)=>{var d,c;let u=!1;if(s.witnessUtxo&&s.witnessUtxo.script){let m=Lr.networks.bitcoin;(r===Network.TESTNET||r===Network.SIGNET)&&(m=Lr.networks.testnet);let _;try{_=Lr.address.fromOutputScript(s.witnessUtxo.script,m)}catch(E){if(E instanceof Error&&E.message.toLowerCase().includes("has no matching address"))btcStakingTs.initBTCCurve(),_=Lr.address.fromOutputScript(s.witnessUtxo.script,m);else throw new Error(E)}const v=_.indexOf("tb1p")===0||_.indexOf("bc1p")===0,S=_===((d=this.walletInfo)==null?void 0:d.address);v&&S&&(u=!0)}s.finalScriptSig||s.finalScriptWitness||n.push({index:a,publicKey:(c=this.walletInfo)==null?void 0:c.publicKeyHex,sighashTypes:void 0,useTweakedSigner:u})}),{autoFinalized:!0,toSignInputs:n}}}const metadata$2={id:"unisat",name:WALLET_PROVIDER_NAME,icon:logo,docs:"https://unisat.io/download",wallet:e=>e.unisat_wallet??e.unisat,createProvider:(e,t)=>new UnisatProvider(e,t),networks:[Network.MAINNET,Network.SIGNET]},metadata$1={chain:"BTC",name:"Bitcoin",icon,wallets:[metadata$4,metadata$6,metadata$3,metadata$2,metadata$5]},metadata={BTC:metadata$1,BBN:metadata$7};function usePersistState(e,t,r){function n(){const a=r;if(typeof t>"u")return a;const u=t.getItem(e);return(u?JSON.parse(u):null)??a}const[o,s]=R2.useState(n);return R2.useEffect(function(){t.setItem(e,JSON.stringify(o??""))},[e,t,o]),[o,s]}const Context$2=R2.createContext({lockInscriptions:!0,showAgain:!0});function InscriptionProvider({children:e,context:t}){const[r,n]=usePersistState("bwc-inscription-modal-show-again",t.localStorage,!0),[o,s]=usePersistState("bwc-inscription-modal-lock",t.localStorage,!0),a=R2.useMemo(()=>({showAgain:r,lockInscriptions:o,toggleLockInscriptions:s,toggleShowAgain:n}),[r,o,s,n]);return jsxRuntime.jsx(Context$2.Provider,{value:a,children:e})}const useInscriptionProvider=()=>R2.useContext(Context$2),defaultState$2={confirmed:!1,visible:!1,screen:{type:"TERMS_OF_SERVICE"},chains:{},selectedWallets:{}},StateContext=R2.createContext(defaultState$2);function StateProvider({children:e,chains:t}){const[r,n]=R2.useState(defaultState$2);R2.useEffect(()=>{n(a=>({...a,chains:t.reduce((u,p)=>({...u,[p.id]:p}),{})}))},[t]);const o=R2.useMemo(()=>({open:()=>{n(a=>({...a,visible:!0}))},close:()=>{n(a=>({...a,visible:!1}))},reset:()=>{n(({chains:a})=>({...defaultState$2,chains:a}))},displayLoader:(a="")=>{n(u=>({...u,screen:{type:"LOADER",params:{message:a}}}))},displayTermsOfService:()=>{n(a=>({...a,screen:{type:"TERMS_OF_SERVICE"}}))},displayChains:()=>{n(a=>({...a,screen:{type:"CHAINS"}}))},displayWallets:a=>{n(u=>({...u,screen:{type:"WALLETS",params:{chain:a}}}))},displayInscriptions:()=>{n(a=>({...a,screen:{type:"INSCRIPTIONS"}}))},displayError:a=>{n(u=>({...u,screen:{type:"ERROR",params:a}}))},selectWallet:(a,u)=>{n(p=>({...p,selectedWallets:{...p.selectedWallets,[a]:u}}))},removeWallet:a=>{n(u=>({...u,selectedWallets:{...u.selectedWallets,[a]:void 0}}))},confirm:()=>{n(a=>({...a,confirmed:!0}))}}),[]),s=R2.useMemo(()=>({...r,...o}),[r,o]);return jsxRuntime.jsx(StateContext.Provider,{value:s,children:e})}const defaultState$1={BTC:null,BBN:null},Context$1=R2.createContext(defaultState$1);function ChainProvider({persistent:e,storage:t,children:r,context:n,config:o,onError:s}){const[a,u]=R2.useState(defaultState$1),p=R2.useCallback(async()=>{const c=o.filter(_=>metadata[_.chain]).map(({chain:_,config:v})=>createWalletConnector({persistent:e,metadata:metadata[_],context:n,config:v,accountStorage:t}));return(await Promise.all(c)).reduce((_,v)=>({..._,[v.id]:v}),{})},[e]);R2.useEffect(()=>{p().then(c=>{u(c)}).catch(s)},[u,p,s]);const d=R2.useMemo(()=>Object.values(a).filter(Boolean),[a]);return jsxRuntime.jsx(InscriptionProvider,{context:n,children:jsxRuntime.jsx(StateProvider,{chains:d,children:jsxRuntime.jsx(Context$1.Provider,{value:a,children:r})})})}const useChainProviders=()=>R2.useContext(Context$1),Context=R2.createContext({});function LifeCycleHooksProvider({children:e,value:t}){const r=R2.useMemo(()=>t??{},[t]);return jsxRuntime.jsx(Context.Provider,{value:r,children:e})}const useLifeCycleHooks=()=>R2.useContext(Context),CONFIG_ADAPTERS={BTC:e=>({id:1,name:e.networkName,type:"bitcoin",network:e.network,backendUrls:{mempoolUrl:e.mempoolApiUrl+"/api/"}}),BBN:e=>({id:2,name:e.chainData.chainName,type:"cosmos",network:e.chainId,modularData:e.chainData,backendUrls:{rpcUrl:e.rpc},logo:e.chainData.chainSymbolImageUrl})},TomoConnectionProvider=({children:e,theme:t,config:r})=>{const n=R2.useMemo(()=>r.reduce((o,s)=>{var a;return{...o,[s.chain]:(a=CONFIG_ADAPTERS[s.chain])==null?void 0:a.call(CONFIG_ADAPTERS,s.config)}},{}),[r]);return jsxRuntime.jsx(hr,{autoReconnect:!1,bitcoinChains:[n.BTC],chainTypes:["bitcoin","cosmos"],cosmosChains:[n.BBN],style:{rounded:"medium",theme:t,primaryColor:"#FF7C2A"},children:e})},CONNECTED_ACCOUNTS_KEY="baby-connected-wallet-accounts",createAccountStorage=e=>({get:t=>{const r=localStorage.getItem(CONNECTED_ACCOUNTS_KEY)?JSON.parse(localStorage.getItem(CONNECTED_ACCOUNTS_KEY)||"{}"):{};if(!(r._timestamp&&Date.now()-r._timestamp>e))return r[t]},has:t=>{const r=localStorage.getItem(CONNECTED_ACCOUNTS_KEY)?JSON.parse(localStorage.getItem(CONNECTED_ACCOUNTS_KEY)||"{}"):{};return r._timestamp&&Date.now()-r._timestamp>e?!1:!!r[t]},set:(t,r)=>{const n=localStorage.getItem(CONNECTED_ACCOUNTS_KEY)?JSON.parse(localStorage.getItem(CONNECTED_ACCOUNTS_KEY)||"{}"):{};n[t]=r,n._timestamp=Date.now(),localStorage.setItem(CONNECTED_ACCOUNTS_KEY,JSON.stringify(n))},delete:t=>{const r=localStorage.getItem(CONNECTED_ACCOUNTS_KEY)?JSON.parse(localStorage.getItem(CONNECTED_ACCOUNTS_KEY)||"{}"):{},n=Reflect.deleteProperty(r,t);return localStorage.setItem(CONNECTED_ACCOUNTS_KEY,JSON.stringify(r)),n}});function useChainConnector(e){const t=useChainProviders();return(t==null?void 0:t[e])??null}const createProvider$1=e=>({connectWallet:async()=>void await e.connectWallet(),getAddress:()=>e.getAddress(),getPublicKeyHex:()=>e.getPublicKeyHex(),getWalletProviderName:()=>e.getWalletProviderName(),getWalletProviderIcon:()=>e.getWalletProviderIcon(),getOfflineSigner:()=>e.getOfflineSigner(),on:()=>{},off:()=>{}}),TomoBBNConnector=R2.memo(({persistent:e,storage:t})=>{const r=mr(),n=pr("cosmos"),{cosmosProvider:o}=Cr(),s=yr(),a=Jt(),u=useChainConnector("BBN"),p=R2.useMemo(()=>{const{connected:c,walletId:m}=r.cosmos??{};return c&&m?n.find(_=>_.id===m)??null:null},[r.cosmos,n]),d=R2.useCallback(async(c,m)=>{if(!u)return;const _=createExternalWallet({id:`tomo.${c.id}`,name:c.name,icon:c.img,provider:createProvider$1(m)});await u.connect(_)},[u]);return R2.useEffect(()=>{if(!e)return;const c=t.get("BBN");if(!c||!c.startsWith("tomo."))return;const m=c.replace("tomo.",""),_=n.find(v=>v.id===m);_&&a(_)},[n,e,t]),R2.useEffect(()=>{p&&o&&d(p,o)},[p,o,d]),R2.useEffect(()=>u?u.on("disconnect",m=>{m.id.startsWith("tomo.")&&s.disconnect()}):void 0,[u,s]),null});TomoBBNConnector.displayName="TomoBBNConnector";const createProvider=e=>({connectWallet:async()=>void await e.connectWallet(),getAddress:()=>e.getAddress(),getPublicKeyHex:()=>e.getPublicKeyHex(),signPsbt:t=>e.signPsbt(t),signPsbts:t=>e.signPsbts(t),getNetwork:()=>e.getNetwork(),signMessage:(t,r)=>e.signMessage(t,r),on:(t,r)=>e.on(t,r),off:(t,r)=>e.off(t,r),getWalletProviderName:()=>e.getWalletProviderName(),getWalletProviderIcon:()=>e.getWalletProviderIcon(),getInscriptions:()=>e.getInscriptions().then(t=>(t.list||[]).map(r=>({txid:r.inscriptionId,vout:r.outputValue})))}),TomoBTCConnector=R2.memo(({persistent:e,storage:t})=>{const r=mr(),n=pr("bitcoin"),{bitcoinProvider:o}=Cr(),s=yr(),a=Jt(),u=useChainConnector("BTC"),p=R2.useMemo(()=>{const{connected:c,walletId:m}=r.bitcoin??{};return c&&m?n.find(_=>_.id===m)??null:null},[r.bitcoin,n]),d=R2.useCallback(async(c,m)=>{if(!u)return;const _=createExternalWallet({id:`tomo.${c.id}`,name:c.name,icon:c.img,provider:createProvider(m)});await u.connect(_)},[u]);return R2.useEffect(()=>{if(!e)return;const c=t.get("BTC");if(!c||!c.startsWith("tomo."))return;const m=c.replace("tomo.",""),_=n.find(v=>v.id===m);_&&a(_)},[n,e,t]),R2.useEffect(()=>{p&&o&&d(p,o)},[p,o,d]),R2.useEffect(()=>u?u.on("disconnect",m=>{m.id.startsWith("tomo.")&&s.disconnect()}):void 0,[u,s]),null});TomoBTCConnector.displayName="TomoBTCConnector";var freeGlobal=typeof commonjsGlobal=="object"&&commonjsGlobal&&commonjsGlobal.Object===Object&&commonjsGlobal,freeSelf=typeof self=="object"&&self&&self.Object===Object&&self;freeGlobal||freeSelf||Function("return this")();var useIsomorphicLayoutEffect=typeof window<"u"?R2.useLayoutEffect:R2.useEffect,IS_SERVER2=typeof window>"u";function useMediaQuery(e,{defaultValue:t=!1,initializeWithValue:r=!0}={}){const n=u=>IS_SERVER2?t:window.matchMedia(u).matches,[o,s]=R2.useState(()=>r?n(e):t);function a(){s(n(e))}return useIsomorphicLayoutEffect(()=>{const u=window.matchMedia(e);return a(),u.addListener?u.addListener(a):u.addEventListener("change",a),()=>{u.removeListener?u.removeListener(a):u.removeEventListener("change",a)}},[e]),o}const useIsMobileView=()=>useMediaQuery("(max-width: 768px)");function ResponsiveDialog(e){const r=useIsMobileView()?coreUi.MobileDialog:coreUi.Dialog;return jsxRuntime.jsx(r,{...e})}const useWidgetState=()=>R2.useContext(StateContext);function useWalletConnect(){const{confirmed:e,chains:t,selectedWallets:r,open:n,reset:o}=useWidgetState(),s=useChainProviders(),a=R2.useCallback(()=>{o==null||o(),n==null||n()},[n,o]),u=R2.useCallback(async()=>{for(const d of Object.values(s))d&&await d.disconnect();o==null||o()},[s,o]),p=R2.useMemo(()=>Object.values(t).filter(Boolean).map(m=>r[m.id]).every(Boolean),[t,r]);return{selected:p,connected:p&&e,open:a,disconnect:u}}function useWalletConnectors({persistent:e,accountStorage:t,onError:r}){const n=useChainProviders(),{visible:o,selectWallet:s,removeWallet:a,displayLoader:u,displayChains:p,displayInscriptions:d,displayError:c,confirm:m,close:_,reset:v}=useWidgetState(),{showAgain:S}=useInscriptionProvider(),{verifyBTCAddress:E,acceptTermsOfService:x}=useLifeCycleHooks();R2.useEffect(()=>{if(!o)return;const L=Object.values(n).filter(Boolean).map(z=>z.on("connecting",F=>{u==null||u(F)}));return()=>L.forEach(z=>z())},[o,u,n]),R2.useEffect(()=>{const U=Object.values(n).filter(Boolean),L={BTC:F=>async y=>{var T,D,G;try{if(!y||!y.account||(s==null||s("BTC",y),e&&t.set(F.id,y.id),!o))return;validateAddress(F.config.network,y.account.address),await(x==null?void 0:x({address:y.account.address,public_key:y.account.publicKeyHex}));const C=()=>void(S?d==null?void 0:d():p==null?void 0:p());if(!validateAddressWithPK(((T=y.account)==null?void 0:T.address)??"",((D=y.account)==null?void 0:D.publicKeyHex)??"",F.config.network)){c==null||c({title:"Public Key Mismatch",description:"The Bitcoin address and Public Key for this wallet do not match. Please contact your wallet provider for support.",onSubmit:C,onCancel:()=>{F.disconnect(),a==null||a(F.id),p==null||p()}});return}if(E&&!await E(((G=y.account)==null?void 0:G.address)??"")){c==null||c({title:"Connection Failed",description:"The wallet cannot be connected.",submitButton:"",cancelButton:"Done",onCancel:async()=>{F.disconnect(),a==null||a(F.id),p==null||p()}});return}C()}catch(C){F.disconnect(),a==null||a(F.id),c==null||c({title:"Connection Failed",description:C.message,submitButton:"",cancelButton:"Done",onCancel:async()=>{p==null||p()}})}},BBN:F=>y=>{y&&(s==null||s(F.id,y),e&&t.set(F.id,y.id)),p==null||p()}},z=U.map(F=>{var y;return F.on("connect",(y=L[F.id])==null?void 0:y.call(L,F))});return U.forEach(F=>{s==null||s(F.id,F.connectedWallet)}),()=>z.forEach(F=>F())},[r,s,a,d,p,E,v,_,n,S,e,o]),R2.useEffect(()=>{const L=Object.values(n).filter(Boolean).map(z=>z.on("disconnect",F=>{F&&(a==null||a(z.id),p==null||p(),e&&t.delete(z.id))}));return()=>L.forEach(z=>z())},[a,p,n,e]),R2.useEffect(()=>{const L=Object.values(n).filter(Boolean).map(z=>z.on("error",F=>{r==null||r(F),p==null||p()}));return()=>L.forEach(z=>z())},[r,p,n]),R2.useEffect(()=>{const U=Object.values(n).filter(Boolean);e&&U.length&&U.every(L=>t.has(L.id))&&(m==null||m(),p==null||p())},[e,n,m,p]);const O=R2.useCallback(async(U,L)=>{const z=n[U.id];await(z==null?void 0:z.connect(L.id))},[n]),q=R2.useCallback(async U=>{const L=n[U];await(L==null?void 0:L.disconnect())},[n]);return{connect:O,disconnect:q}}function useWalletWidgets(e,t,r){const n=R2.useCallback((o,s)=>jsxRuntime.jsx(jsxRuntime.Fragment,{children:s.map(({id:a,widget:u})=>jsxRuntime.jsx(u,{id:a,connector:e[o],createWallet:createExternalWallet,onError:r},a))}),[e,r]);return R2.useMemo(()=>t.reduce((o,s)=>({...o,[s.chain]:n(s.chain,s.connectors??[])}),{}),[n,t])}function ChainButton({className:e,disabled:t,alt:r,logo:n,title:o,children:s,onClick:a}){const u=typeof n=="string"?jsxRuntime.jsx(coreUi.Avatar,{url:n,alt:r}):jsxRuntime.jsx(coreUi.Avatar,{children:n});return jsxRuntime.jsxs(coreUi.Text,{disabled:t,as:t?"div":"button",className:tailwindMerge.twMerge("flex w-full flex-col gap-2.5 rounded border border-secondary-strokeLight bg-surface p-4 text-accent-primary",t?"pointer-events-none":"pointer-events-auto",t?"cursor-default":"cursor-pointer",e),onClick:a,children:[jsxRuntime.jsxs("div",{className:"flex w-full items-center gap-2.5",children:[jsxRuntime.jsx("div",{className:"flex items-center",children:u}),o,!t&&jsxRuntime.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",className:"ml-auto block",children:jsxRuntime.jsx("path",{d:"M8.58984 16.59L13.1698 12L8.58984 7.41L9.99984 6L15.9998 12L9.99984 18L8.58984 16.59Z",fill:"currentColor"})})]}),s&&jsxRuntime.jsx("div",{className:"pointer-events-auto w-full",onClick:p=>p.stopPropagation(),children:s})]})}const formatAddress=(e,t=8)=>e.length<=t?e:t===0?"...":`${e.slice(0,t/2)}...${e.slice(-t/2)}`,ConnectedWallet=R2.memo(({className:e,chainId:t,logo:r,name:n,address:o,onDisconnect:s})=>jsxRuntime.jsxs("div",{className:tailwindMerge.twMerge("flex shrink-0 items-center gap-2.5 rounded border border-secondary-main/30 p-2",e),children:[jsxRuntime.jsx(coreUi.Avatar,{variant:"rounded",size:"medium",url:r}),jsxRuntime.jsxs("div",{className:"flex flex-1 flex-col items-start",children:[jsxRuntime.jsx(coreUi.Text,{as:"div",variant:"body2",className:"leading-4 text-accent-primary",children:n}),!!o&&jsxRuntime.jsx(coreUi.Text,{as:"div",variant:"caption",className:"leading-4 text-accent-secondary",children:formatAddress(o)})]}),jsxRuntime.jsx("button",{className:"shrink-0 cursor-pointer",onClick:()=>void(s==null?void 0:s(t)),children:jsxRuntime.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",className:"text-secondary-main",fill:"none",children:jsxRuntime.jsx("path",{d:"M19 6.41L17.59 5L12 10.59L6.41 5L5 6.41L10.59 12L5 17.59L6.41 19L12 13.41L17.59 19L19 17.59L13.41 12L19 6.41Z",fill:"currentColor"})})})]})),Chains=R2.memo(({disabled:e=!1,chains:t,selectedWallets:r={},className:n,onClose:o,onConfirm:s,onSelectChain:a,onDisconnectWallet:u})=>jsxRuntime.jsxs("div",{className:tailwindMerge.twMerge("flex flex-1 flex-col text-accent-primary",n),children:[jsxRuntime.jsx(coreUi.DialogHeader,{className:"mb-10",title:"Connect Wallets",onClose:o,children:jsxRuntime.jsx(coreUi.Text,{className:"text-accent-secondary",children:"Connect to both Bitcoin and Babylon Chain Wallets"})}),jsxRuntime.jsx(coreUi.DialogBody,{className:"flex flex-col gap-6",children:t.map(p=>{var c;const d=r[p.id];return jsxRuntime.jsx(ChainButton,{disabled:!!d,title:`Select ${p.name} Wallet`,logo:p.icon,alt:p.name,onClick:()=>void(a==null?void 0:a(p)),children:d&&jsxRuntime.jsx(ConnectedWallet,{chainId:p.id,logo:d.icon,name:d.name,address:((c=d.account)==null?void 0:c.address)??"",onDisconnect:u})},p.id)})}),jsxRuntime.jsxs(coreUi.DialogFooter,{className:"mt-auto flex gap-4 pt-10",children:[jsxRuntime.jsx(coreUi.Button,{variant:"outlined",fluid:!0,onClick:o,children:"Cancel"}),jsxRuntime.jsx(coreUi.Button,{disabled:e,fluid:!0,onClick:s,children:"Done"})]})]}));function ChainsContainer(e){const{chains:t,selectedWallets:r,displayWallets:n}=useWidgetState(),{selected:o}=useWalletConnect(),s=R2.useMemo(()=>Object.values(t),[t]),a=R2.useCallback(u=>{n==null||n(u.id)},[n]);return jsxRuntime.jsx(Chains,{disabled:!o,chains:s,selectedWallets:r,onSelectChain:a,...e})}const DEFAULT_ICON=jsxRuntime.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"52",height:"52",viewBox:"0 0 52 52",fill:"none",children:jsxRuntime.jsx("path",{d:"M2.16675 46.5837H49.8334L26.0001 5.41699L2.16675 46.5837ZM28.1667 40.0837H23.8334V35.7503H28.1667V40.0837ZM28.1667 31.417H23.8334V22.7503H28.1667V31.417Z",fill:"#387085"})});function Error$1({className:e,icon:t=DEFAULT_ICON,title:r,description:n,cancelButton:o="Cancel",submitButton:s=jsxRuntime.jsxs(jsxRuntime.Fragment,{children:["Continue ",jsxRuntime.jsx("span",{className:"hidden md:inline",children:"Anyway"})]}),onCancel:a,onSubmit:u}){return jsxRuntime.jsxs("div",{className:e,children:[jsxRuntime.jsxs(coreUi.DialogBody,{className:"py-16 text-center",children:[jsxRuntime.jsx("div",{className:"mb-6 inline-flex h-20 w-20 items-center justify-center bg-primary-contrast text-primary-light",children:t}),jsxRuntime.jsx(coreUi.Heading,{variant:"h4",className:"mb-4 text-accent-primary",children:r}),jsxRuntime.jsx(coreUi.Text,{as:"div",className:"text-accent-secondary",children:n})]}),jsxRuntime.jsxs(coreUi.DialogFooter,{className:"flex gap-4",children:[o&&jsxRuntime.jsx(coreUi.Button,{variant:"outlined",fluid:!0,onClick:a,children:o}),s&&jsxRuntime.jsx(coreUi.Button,{fluid:!0,onClick:u,children:s})]})]})}function ErrorContainer({className:e}){const{screen:t}=useWidgetState(),{icon:r,title:n,description:o,cancelButton:s,submitButton:a,onCancel:u,onSubmit:p}=t.params??{};return jsxRuntime.jsx(Error$1,{className:e,icon:r,title:n,description:o,cancelButton:s,submitButton:a,onCancel:u,onSubmit:p})}function FieldControl({label:e,className:t,children:r}){return jsxRuntime.jsxs("label",{className:tailwindMerge.twMerge("flex cursor-pointer gap-4 rounded border border-secondary-strokeLight text-accent-primary p-4",t),children:[r,e]})}function Inscriptions({className:e,config:t,onSubmit:r}){const[n=!0,o]=R2.useState(),[s=!0,a]=R2.useState();if(!t)return null;const{coinName:u}=t;return jsxRuntime.jsxs("div",{className:tailwindMerge.twMerge("flex flex-1 flex-col",e),children:[jsxRuntime.jsx(coreUi.DialogHeader,{title:`Manage ${u} Inscriptions`,className:"mb-4 text-accent-primary",onClose:()=>void(r==null?void 0:r(n,s))}),jsxRuntime.jsxs(coreUi.DialogBody,{children:[jsxRuntime.jsxs(coreUi.Text,{className:"mb-8 text-accent-secondary",children:["By default, we will not use ",u," that contains Inscriptions - such as Ordinals, NFTs, or Runes - in your stakeable balance. This helps prevent any accidental loss of your Inscriptions due to staking, unbonding, or withdrawal fees."]}),jsxRuntime.jsxs(coreUi.Text,{className:"mb-10 text-accent-secondary",children:["If you would like to include ",u," with Inscriptions in your stakeable balance, please select the option below."]}),jsxRuntime.jsxs("form",{action:"",children:[jsxRuntime.jsx(FieldControl,{label:jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("strong",{className:"mr-2",children:"Do not use"})," ",u," with Inscriptions for staking. (Recommended)"]}),className:"mb-8",children:jsxRuntime.jsx(coreUi.Radio,{name:"inscriptions",checked:n,onChange:()=>o(!0)})}),jsxRuntime.jsx(FieldControl,{label:jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("strong",{className:"mr-2",children:"Use"})," ",u," with Inscriptions in my stakable balance."]}),className:"mb-8",children:jsxRuntime.jsx(coreUi.Radio,{name:"inscriptions",checked:!n,onChange:()=>o(!1)})})]})]}),jsxRuntime.jsxs(coreUi.DialogFooter,{className:"mt-auto pt-10",children:[jsxRuntime.jsx(coreUi.Checkbox,{checked:!s,label:"Do not show again",labelClassName:"mb-6",onChange:p=>a(!p)}),jsxRuntime.jsx(coreUi.Button,{fluid:!0,onClick:()=>void(r==null?void 0:r(n,s)),children:"Save"})]})]})}function InscriptionsContainer({className:e,onSubmit:t}){var n;const{chains:r}=useWidgetState();return jsxRuntime.jsx(Inscriptions,{className:e,onSubmit:t,config:(n=r.BTC)==null?void 0:n.config})}function LoaderScreen({className:e,title:t}){return jsxRuntime.jsxs("div",{className:tailwindMerge.twMerge("flex flex-col items-center justify-center gap-6",e),children:[jsxRuntime.jsx("div",{className:"flex items-center justify-center bg-primary-contrast p-6",children:jsxRuntime.jsx(coreUi.Loader,{className:"text-primary-light"})}),t&&jsxRuntime.jsx(coreUi.Heading,{variant:"h4",className:"capitalize text-accent-primary",children:t})]})}const defaultState={termsOfUse:!1,inscriptions:!1,staking:!1};function TermsOfService({className:e,onClose:t,onSubmit:r}){const[n,o]=R2.useState(defaultState),s=R2.useMemo(()=>Object.values(n).every(u=>u),[n]),a=R2.useCallback(u=>(p=!1)=>{o(d=>({...d,[u]:p}))},[]);return jsxRuntime.jsxs("div",{className:tailwindMerge.twMerge("flex flex-1 flex-col",e),children:[jsxRuntime.jsx(coreUi.DialogHeader,{className:"mb-10 text-accent-primary",title:"Connect Wallets",onClose:t,children:jsxRuntime.jsx(coreUi.Text,{className:"text-accent-secondary",children:"Please read and accept the following terms"})}),jsxRuntime.jsxs(coreUi.DialogBody,{children:[jsxRuntime.jsx(FieldControl,{label:jsxRuntime.jsxs("div",{className:"block",children:["I certify that I have read and accept the updated"," ",jsxRuntime.jsx("a",{href:"https://babylonlabs.io/terms-of-use",target:"_blank",rel:"noopener noreferrer",className:"underline",children:"Terms of Use"})," ","and"," ",jsxRuntime.jsx("a",{href:"https://babylonlabs.io/privacy-policy",target:"_blank",rel:"noopener noreferrer",className:"underline",children:"Privacy Policy"}),"."]}),className:"mb-8",children:jsxRuntime.jsx(coreUi.Checkbox,{checked:n.termsOfUse,onChange:a("termsOfUse")})}),jsxRuntime.jsx(FieldControl,{label:"I certify that I wish to stake bitcoin and agree that doing so may cause some or all of the bitcoin ordinals, NFTs, Runes, and other inscriptions in the connected bitcoin wallet to be lost. I acknowledge that this interface will not detect all Inscriptions.",className:"mb-8",children:jsxRuntime.jsx(coreUi.Checkbox,{checked:n.inscriptions,onChange:a("inscriptions")})}),jsxRuntime.jsx(FieldControl,{label:"I acknowledge that the following are the only hardware wallets supporting Bitcoin Staking: (1) Keystone -- via QR code and (2) OneKey -- via the OneKey Chrome extension and the hardware devices (a) OneKey Pro and (b) OneKey Classic 1s (experimental, 3.10.1 firmware or higher) using Taproot only. Using any other hardware wallet through any means (such as connection to a software/extension/mobile wallet) can lead to permanent inability to withdraw the stake.",children:jsxRuntime.jsx(coreUi.Checkbox,{checked:n.staking,onChange:a("staking")})})]}),jsxRuntime.jsx(coreUi.DialogFooter,{className:"mt-auto pt-10",children:jsxRuntime.jsx(coreUi.Button,{disabled:!s,fluid:!0,onClick:r,children:"Next"})})]})}function TermsOfServiceContainer(e){var r;const{chains:t}=useWidgetState();return jsxRuntime.jsx(TermsOfService,{...e,config:(r=t.BTC)==null?void 0:r.config})}function WalletButton({className:e,disabled:t=!1,name:r,logo:n,label:o,fallbackLink:s,installed:a=!0,onClick:u}){const p=a?{as:"button",disabled:t,onClick:u}:{as:"a",href:s,target:"_blank"};return jsxRuntime.jsxs(coreUi.Text,{className:tailwindMerge.twMerge("flex h-14 w-full cursor-pointer items-center gap-2.5 rounded border border-secondary-strokeLight text-accent-primary px-2",t?"cursor-default":"cursor-pointer",e),...p,children:[jsxRuntime.jsx(coreUi.Avatar,{variant:"rounded",className:"shrink-0",alt:r,url:n}),r,o&&jsxRuntime.jsx(coreUi.Chip,{className:"ml-auto shrink-0",children:o})]})}const Wallets=R2.memo(({chain:e,className:t,append:r,onClose:n,onBack:o,onSelectWallet:s})=>{const a=R2.useMemo(()=>e.wallets.filter(u=>u.id==="injectable"?u.installed:!0),[e]);return jsxRuntime.jsxs("div",{className:tailwindMerge.twMerge("flex flex-1 flex-col",t),children:[jsxRuntime.jsx(coreUi.DialogHeader,{className:"text-accent-primary mb-10",title:"Select Wallet",onClose:n,children:jsxRuntime.jsxs(coreUi.Text,{className:"text-accent-secondary",children:["Connect a ",e.name," Wallet"]})}),jsxRuntime.jsxs(coreUi.DialogBody,{children:[jsxRuntime.jsx("div",{className:tailwindMerge.twMerge("grid gap-6",a.length>1?"grid-cols-1 md:grid-cols-2":"grid-cols-1"),children:a.map(u=>jsxRuntime.jsx(WalletButton,{installed:u.installed,name:u.name,logo:u.icon,label:u.label,fallbackLink:u.docs,onClick:()=>s==null?void 0:s(e,u)},u.id))}),r]}),jsxRuntime.jsx(coreUi.DialogFooter,{className:"mt-auto pt-10",children:jsxRuntime.jsx(coreUi.Button,{variant:"outlined",fluid:!0,onClick:o,children:"Back"})})]})});function WalletsContainer({widgets:e={},...t}){var p;const{chains:r,screen:n,displayChains:o}=useWidgetState(),s=((p=n.params)==null?void 0:p.chain)??"",a=r==null?void 0:r[s],u=e==null?void 0:e[s];return jsxRuntime.jsx(Wallets,{append:u,chain:a,onBack:o,...t})}const SCREENS={TERMS_OF_SERVICE:({className:e,onClose:t,onAccepTermsOfService:r})=>jsxRuntime.jsx(TermsOfServiceContainer,{className:e,onClose:t,onSubmit:r}),CHAINS:({className:e,onClose:t,onConfirm:r,onDisconnectWallet:n})=>jsxRuntime.jsx(ChainsContainer,{className:e,onClose:t,onConfirm:r,onDisconnectWallet:n}),WALLETS:({className:e,widgets:t,onClose:r,onSelectWallet:n})=>jsxRuntime.jsx(WalletsContainer,{widgets:t,className:e,onClose:r,onSelectWallet:n}),INSCRIPTIONS:({className:e,onToggleInscriptions:t})=>jsxRuntime.jsx(InscriptionsContainer,{className:e,onSubmit:t}),LOADER:({className:e,current:t})=>{var r;return jsxRuntime.jsx(LoaderScreen,{className:e,title:(r=t==null?void 0:t.params)==null?void 0:r.message})},ERROR:()=>jsxRuntime.jsx(ErrorContainer,{className:"min-h-0 md:w-[600px]"}),EMPTY:({className:e})=>jsxRuntime.jsx("div",{className:e})};function Screen(e){const t=SCREENS[e.current.type]??SCREENS.EMPTY;return jsxRuntime.jsx(t,{...e})}const ANIMATION_DELAY=1e3;function WalletDialog({persistent:e,storage:t,config:r,onError:n}){const{visible:o,screen:s,confirmed:a,close:u,confirm:p,displayChains:d}=useWidgetState(),{toggleShowAgain:c,toggleLockInscriptions:m}=useInscriptionProvider(),_=useChainProviders(),v=useWalletWidgets(_,r,n),{connect:S,disconnect:E}=useWalletConnectors({persistent:e,accountStorage:t,onError:n}),{disconnect:x}=useWalletConnect(),O=R2.useCallback(()=>{d==null||d()},[d]),q=R2.useCallback((z,F)=>{c==null||c(F),m==null||m(z),d==null||d()},[c,m,d]),U=R2.useCallback(()=>{u==null||u(),a||setTimeout(x,ANIMATION_DELAY)},[u,x,a]),L=R2.useCallback(()=>{p==null||p(),u==null||u()},[p]);return jsxRuntime.jsx(ResponsiveDialog,{className:"min-h-[80%]",open:o,onClose:U,children:jsxRuntime.jsx(Screen,{current:s,widgets:v,className:"min-h-0 md:size-[600px]",onClose:U,onConfirm:L,onSelectWallet:S,onAccepTermsOfService:O,onToggleInscriptions:q,onDisconnectWallet:E})})}const BBN_TESTNET_RPC_URL="https://rpc-dapp.testnet.babylonlabs.io/",BBN_TESTNET_LCD_URL="https://lcd-dapp.testnet.babylonlabs.io/",bbnTestnet={chainId:"bbn-test-5",chainName:"Babylon Testnet",chainSymbolImageUrl:"https://raw.githubusercontent.com/chainapsis/keplr-chain-registry/main/images/bbn-test/chain.png",rpc:BBN_TESTNET_RPC_URL,rest:BBN_TESTNET_LCD_URL,nodeProvider:{name:"Babylonlabs",email:"contact@babylonlabs.io",website:"https://babylonlabs.io/"},bip44:{coinType:118},bech32Config:{bech32PrefixAccAddr:"bbn",bech32PrefixAccPub:"bbnpub",bech32PrefixValAddr:"bbnvaloper",bech32PrefixValPub:"bbnvaloperpub",bech32PrefixConsAddr:"bbnvalcons",bech32PrefixConsPub:"bbnvalconspub"},currencies:[{coinDenom:"BABY",coinMinimalDenom:"ubbn",coinDecimals:6,coinImageUrl:"https://raw.githubusercontent.com/chainapsis/keplr-chain-registry/main/images/bbn-test/chain.png"}],feeCurrencies:[{coinDenom:"BABY",coinMinimalDenom:"ubbn",coinDecimals:6,coinImageUrl:"https://raw.githubusercontent.com/chainapsis/keplr-chain-registry/main/images/bbn-test/chain.png",gasPriceStep:{low:.007,average:.007,high:.01}}],stakeCurrency:{coinDenom:"BABY",coinMinimalDenom:"ubbn",coinDecimals:6,coinImageUrl:"https://raw.githubusercontent.com/chainapsis/keplr-chain-registry/main/images/bbn-test/chain.png"},features:["cosmwasm"]},ONE_HOUR=60*60*1e3;Network.SIGNET,bbnTestnet.currencies[0].coinDenom,bbnTestnet.chainName,bbnTestnet.currencies[0].coinDenom,bbnTestnet.chainId;function WalletProvider({ttl:e=ONE_HOUR,persistent:t=!1,theme:r,lifecycleHooks:n,children:o,config:s,context:a=window,onError:u}){const p=R2.useMemo(()=>createAccountStorage(e),[e]);return jsxRuntime.jsx(TomoConnectionProvider,{theme:r,config:s,children:jsxRuntime.jsx(LifeCycleHooksProvider,{value:n,children:jsxRuntime.jsxs(ChainProvider,{persistent:t,storage:p,context:a,config:s,onError:u,children:[o,jsxRuntime.jsx(TomoBTCConnector,{persistent:t,storage:p}),jsxRuntime.jsx(TomoBBNConnector,{persistent:t,storage:p}),jsxRuntime.jsx(WalletDialog,{persistent:t,storage:p,config:s,onError:u})]})})})}exports.ExternalWallets=ExternalWallets;exports.Network=Network;exports.StateContext=StateContext;exports.StateProvider=StateProvider;exports.WalletProvider=WalletProvider;exports.createExternalWallet=createExternalWallet;exports.useChainConnector=useChainConnector;exports.useInscriptionProvider=useInscriptionProvider;exports.useWalletConnect=useWalletConnect;exports.useWidgetState=useWidgetState;
|