diff --git a/assets/index-BkS8dmZm.js b/assets/index-BBHnRicu.js similarity index 99% rename from assets/index-BkS8dmZm.js rename to assets/index-BBHnRicu.js index 03a5a16..4421b8e 100644 --- a/assets/index-BkS8dmZm.js +++ b/assets/index-BBHnRicu.js @@ -1,4 +1,4 @@ -import{T as xt,M as re,R as N,E as k,C as x,a as X,b as Wo,O as Z,c as ht}from"./index-RiSkTB9V.js";import"./index-odG_wQ1_.js";/** +import{T as xt,M as re,R as N,E as k,C as x,a as X,b as Wo,O as Z,c as ht}from"./index-CPIN7QOU.js";import"./index-CsaIuMX9.js";/** * @license * Copyright 2019 Google LLC * SPDX-License-Identifier: BSD-3-Clause diff --git a/assets/index-RiSkTB9V.js b/assets/index-CPIN7QOU.js similarity index 98% rename from assets/index-RiSkTB9V.js rename to assets/index-CPIN7QOU.js index eedd58e..4157c26 100644 --- a/assets/index-RiSkTB9V.js +++ b/assets/index-CPIN7QOU.js @@ -1,2 +1,2 @@ -const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-BkS8dmZm.js","assets/index-odG_wQ1_.js","assets/index-AnxZPkAf.css"])))=>i.map(i=>d[i]); -import{_ as pe}from"./index-odG_wQ1_.js";const me=Symbol(),ee=Object.getPrototypeOf,Y=new WeakMap,he=e=>e&&(Y.has(e)?Y.get(e):ee(e)===Object.prototype||ee(e)===Array.prototype),ge=e=>he(e)&&e[me]||null,te=(e,t=!0)=>{Y.set(e,t)},z={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1},F=e=>typeof e=="object"&&e!==null,C=new WeakMap,x=new WeakSet,ye=(e=Object.is,t=(o,g)=>new Proxy(o,g),s=o=>F(o)&&!x.has(o)&&(Array.isArray(o)||!(Symbol.iterator in o))&&!(o instanceof WeakMap)&&!(o instanceof WeakSet)&&!(o instanceof Error)&&!(o instanceof Number)&&!(o instanceof Date)&&!(o instanceof String)&&!(o instanceof RegExp)&&!(o instanceof ArrayBuffer),n=o=>{switch(o.status){case"fulfilled":return o.value;case"rejected":throw o.reason;default:throw o}},l=new WeakMap,c=(o,g,I=n)=>{const v=l.get(o);if((v==null?void 0:v[0])===g)return v[1];const w=Array.isArray(o)?[]:Object.create(Object.getPrototypeOf(o));return te(w,!0),l.set(o,[g,w]),Reflect.ownKeys(o).forEach(j=>{if(Object.getOwnPropertyDescriptor(w,j))return;const O=Reflect.get(o,j),A={value:O,enumerable:!0,configurable:!0};if(x.has(O))te(O,!1);else if(O instanceof Promise)delete A.value,A.get=()=>I(O);else if(C.has(O)){const[y,H]=C.get(O);A.value=c(y,H(),I)}Object.defineProperty(w,j,A)}),Object.preventExtensions(w)},d=new WeakMap,f=[1,1],W=o=>{if(!F(o))throw new Error("object required");const g=d.get(o);if(g)return g;let I=f[0];const v=new Set,w=(i,a=++f[0])=>{I!==a&&(I=a,v.forEach(r=>r(i,a)))};let j=f[1];const O=(i=++f[1])=>(j!==i&&!v.size&&(j=i,y.forEach(([a])=>{const r=a[1](i);r>I&&(I=r)})),I),A=i=>(a,r)=>{const h=[...a];h[1]=[i,...h[1]],w(h,r)},y=new Map,H=(i,a)=>{if((z?"production":void 0)!=="production"&&y.has(i))throw new Error("prop listener already exists");if(v.size){const r=a[3](A(i));y.set(i,[a,r])}else y.set(i,[a])},Z=i=>{var a;const r=y.get(i);r&&(y.delete(i),(a=r[1])==null||a.call(r))},ue=i=>(v.add(i),v.size===1&&y.forEach(([r,h],U)=>{if((z?"production":void 0)!=="production"&&h)throw new Error("remove already exists");const k=r[3](A(U));y.set(U,[r,k])}),()=>{v.delete(i),v.size===0&&y.forEach(([r,h],U)=>{h&&(h(),y.set(U,[r]))})}),q=Array.isArray(o)?[]:Object.create(Object.getPrototypeOf(o)),R=t(q,{deleteProperty(i,a){const r=Reflect.get(i,a);Z(a);const h=Reflect.deleteProperty(i,a);return h&&w(["delete",[a],r]),h},set(i,a,r,h){const U=Reflect.has(i,a),k=Reflect.get(i,a,h);if(U&&(e(k,r)||d.has(r)&&e(k,d.get(r))))return!0;Z(a),F(r)&&(r=ge(r)||r);let V=r;if(r instanceof Promise)r.then(L=>{r.status="fulfilled",r.value=L,w(["resolve",[a],L])}).catch(L=>{r.status="rejected",r.reason=L,w(["reject",[a],L])});else{!C.has(r)&&s(r)&&(V=W(r));const L=!x.has(V)&&C.get(V);L&&H(a,L)}return Reflect.set(i,a,V,h),w(["set",[a],r,k]),!0}});d.set(o,R);const fe=[q,O,c,ue];return C.set(R,fe),Reflect.ownKeys(o).forEach(i=>{const a=Object.getOwnPropertyDescriptor(o,i);"value"in a&&(R[i]=o[i],delete a.value,delete a.writable),Object.defineProperty(q,i,a)}),R})=>[W,C,x,e,t,s,n,l,c,d,f],[ve]=ye();function P(e={}){return ve(e)}function D(e,t,s){const n=C.get(e);(z?"production":void 0)!=="production"&&!n&&console.warn("Please use proxy object");let l;const c=[],d=n[3];let f=!1;const o=d(g=>{c.push(g),l||(l=Promise.resolve().then(()=>{l=void 0,f&&t(c.splice(0))}))});return f=!0,()=>{f=!1,o()}}function we(e,t){const s=C.get(e);(z?"production":void 0)!=="production"&&!s&&console.warn("Please use proxy object");const[n,l,c]=s;return c(n,l(),t)}const u=P({history:["ConnectWallet"],view:"ConnectWallet",data:void 0}),de={state:u,subscribe(e){return D(u,()=>e(u))},push(e,t){e!==u.view&&(u.view=e,t&&(u.data=t),u.history.push(e))},reset(e){u.view=e,u.history=[e]},replace(e){u.history.length>1&&(u.history[u.history.length-1]=e,u.view=e)},goBack(){if(u.history.length>1){u.history.pop();const[e]=u.history.slice(-1);u.view=e}},setData(e){u.data=e}},m={WALLETCONNECT_DEEPLINK_CHOICE:"WALLETCONNECT_DEEPLINK_CHOICE",WCM_VERSION:"WCM_VERSION",RECOMMENDED_WALLET_AMOUNT:9,isMobile(){return typeof window<"u"?!!(window.matchMedia("(pointer:coarse)").matches||/Android|webOS|iPhone|iPad|iPod|BlackBerry|Opera Mini/u.test(navigator.userAgent)):!1},isAndroid(){return m.isMobile()&&navigator.userAgent.toLowerCase().includes("android")},isIos(){const e=navigator.userAgent.toLowerCase();return m.isMobile()&&(e.includes("iphone")||e.includes("ipad"))},isHttpUrl(e){return e.startsWith("http://")||e.startsWith("https://")},isArray(e){return Array.isArray(e)&&e.length>0},isTelegram(){return typeof window<"u"&&(!!window.TelegramWebviewProxy||!!window.Telegram||!!window.TelegramWebviewProxyProto)},formatNativeUrl(e,t,s){if(m.isHttpUrl(e))return this.formatUniversalUrl(e,t,s);let n=e;n.includes("://")||(n=e.replaceAll("/","").replaceAll(":",""),n=`${n}://`),n.endsWith("/")||(n=`${n}/`),this.setWalletConnectDeepLink(n,s);const l=encodeURIComponent(t);return`${n}wc?uri=${l}`},formatUniversalUrl(e,t,s){if(!m.isHttpUrl(e))return this.formatNativeUrl(e,t,s);let n=e;if(n.startsWith("https://t.me")){const c=Buffer.from(t).toString("base64").replace(/[=]/g,"");n.endsWith("/")&&(n=n.slice(0,-1)),this.setWalletConnectDeepLink(n,s);const d=new URL(n);return d.searchParams.set("startapp",c),d.toString()}n.endsWith("/")||(n=`${n}/`),this.setWalletConnectDeepLink(n,s);const l=encodeURIComponent(t);return`${n}wc?uri=${l}`},async wait(e){return new Promise(t=>{setTimeout(t,e)})},openHref(e,t){const s=this.isTelegram()?"_blank":t;window.open(e,s,"noreferrer noopener")},setWalletConnectDeepLink(e,t){try{localStorage.setItem(m.WALLETCONNECT_DEEPLINK_CHOICE,JSON.stringify({href:e,name:t}))}catch{console.info("Unable to set WalletConnect deep link")}},setWalletConnectAndroidDeepLink(e){try{const[t]=e.split("?");localStorage.setItem(m.WALLETCONNECT_DEEPLINK_CHOICE,JSON.stringify({href:t,name:"Android"}))}catch{console.info("Unable to set WalletConnect android deep link")}},removeWalletConnectDeepLink(){try{localStorage.removeItem(m.WALLETCONNECT_DEEPLINK_CHOICE)}catch{console.info("Unable to remove WalletConnect deep link")}},setModalVersionInStorage(){try{typeof localStorage<"u"&&localStorage.setItem(m.WCM_VERSION,"2.7.0")}catch{console.info("Unable to set Web3Modal version in storage")}},getWalletRouterData(){var e;const t=(e=de.state.data)==null?void 0:e.Wallet;if(!t)throw new Error('Missing "Wallet" view data');return t}},be=typeof location<"u"&&(location.hostname.includes("localhost")||location.protocol.includes("https")),p=P({enabled:be,userSessionId:"",events:[],connectedWalletId:void 0}),Ie={state:p,subscribe(e){return D(p.events,()=>e(we(p.events[p.events.length-1])))},initialize(){p.enabled&&typeof(crypto==null?void 0:crypto.randomUUID)<"u"&&(p.userSessionId=crypto.randomUUID())},setConnectedWalletId(e){p.connectedWalletId=e},click(e){if(p.enabled){const t={type:"CLICK",name:e.name,userSessionId:p.userSessionId,timestamp:Date.now(),data:e};p.events.push(t)}},track(e){if(p.enabled){const t={type:"TRACK",name:e.name,userSessionId:p.userSessionId,timestamp:Date.now(),data:e};p.events.push(t)}},view(e){if(p.enabled){const t={type:"VIEW",name:e.name,userSessionId:p.userSessionId,timestamp:Date.now(),data:e};p.events.push(t)}}},_=P({chains:void 0,walletConnectUri:void 0,isAuth:!1,isCustomDesktop:!1,isCustomMobile:!1,isDataLoaded:!1,isUiLoaded:!1}),b={state:_,subscribe(e){return D(_,()=>e(_))},setChains(e){_.chains=e},setWalletConnectUri(e){_.walletConnectUri=e},setIsCustomDesktop(e){_.isCustomDesktop=e},setIsCustomMobile(e){_.isCustomMobile=e},setIsDataLoaded(e){_.isDataLoaded=e},setIsUiLoaded(e){_.isUiLoaded=e},setIsAuth(e){_.isAuth=e}},B=P({projectId:"",mobileWallets:void 0,desktopWallets:void 0,walletImages:void 0,chains:void 0,enableAuthMode:!1,enableExplorer:!0,explorerExcludedWalletIds:void 0,explorerRecommendedWalletIds:void 0,termsOfServiceUrl:void 0,privacyPolicyUrl:void 0}),$={state:B,subscribe(e){return D(B,()=>e(B))},setConfig(e){var t,s;Ie.initialize(),b.setChains(e.chains),b.setIsAuth(!!e.enableAuthMode),b.setIsCustomMobile(!!((t=e.mobileWallets)!=null&&t.length)),b.setIsCustomDesktop(!!((s=e.desktopWallets)!=null&&s.length)),m.setModalVersionInStorage(),Object.assign(B,e)}};var _e=Object.defineProperty,se=Object.getOwnPropertySymbols,Ee=Object.prototype.hasOwnProperty,Oe=Object.prototype.propertyIsEnumerable,ne=(e,t,s)=>t in e?_e(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,We=(e,t)=>{for(var s in t||(t={}))Ee.call(t,s)&&ne(e,s,t[s]);if(se)for(var s of se(t))Oe.call(t,s)&&ne(e,s,t[s]);return e};const G="https://explorer-api.walletconnect.com",Q="wcm",X="js-2.7.0";async function K(e,t){const s=We({sdkType:Q,sdkVersion:X},t),n=new URL(e,G);return n.searchParams.append("projectId",$.state.projectId),Object.entries(s).forEach(([c,d])=>{d&&n.searchParams.append(c,String(d))}),(await fetch(n)).json()}const M={async getDesktopListings(e){return K("/w3m/v1/getDesktopListings",e)},async getMobileListings(e){return K("/w3m/v1/getMobileListings",e)},async getInjectedListings(e){return K("/w3m/v1/getInjectedListings",e)},async getAllListings(e){return K("/w3m/v1/getAllListings",e)},getWalletImageUrl(e){return`${G}/w3m/v1/getWalletImage/${e}?projectId=${$.state.projectId}&sdkType=${Q}&sdkVersion=${X}`},getAssetImageUrl(e){return`${G}/w3m/v1/getAssetImage/${e}?projectId=${$.state.projectId}&sdkType=${Q}&sdkVersion=${X}`}};var Le=Object.defineProperty,oe=Object.getOwnPropertySymbols,Ce=Object.prototype.hasOwnProperty,Pe=Object.prototype.propertyIsEnumerable,re=(e,t,s)=>t in e?Le(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,Ae=(e,t)=>{for(var s in t||(t={}))Ce.call(t,s)&&re(e,s,t[s]);if(oe)for(var s of oe(t))Pe.call(t,s)&&re(e,s,t[s]);return e};const ae=m.isMobile(),E=P({wallets:{listings:[],total:0,page:1},search:{listings:[],total:0,page:1},recomendedWallets:[]}),Ne={state:E,async getRecomendedWallets(){const{explorerRecommendedWalletIds:e,explorerExcludedWalletIds:t}=$.state;if(e==="NONE"||t==="ALL"&&!e)return E.recomendedWallets;if(m.isArray(e)){const n={recommendedIds:e.join(",")},{listings:l}=await M.getAllListings(n),c=Object.values(l);c.sort((d,f)=>{const W=e.indexOf(d.id),o=e.indexOf(f.id);return W-o}),E.recomendedWallets=c}else{const{chains:s,isAuth:n}=b.state,l=s==null?void 0:s.join(","),c=m.isArray(t),d={page:1,sdks:n?"auth_v1":void 0,entries:m.RECOMMENDED_WALLET_AMOUNT,chains:l,version:2,excludedIds:c?t.join(","):void 0},{listings:f}=ae?await M.getMobileListings(d):await M.getDesktopListings(d);E.recomendedWallets=Object.values(f)}return E.recomendedWallets},async getWallets(e){const t=Ae({},e),{explorerRecommendedWalletIds:s,explorerExcludedWalletIds:n}=$.state,{recomendedWallets:l}=E;if(n==="ALL")return E.wallets;l.length?t.excludedIds=l.map(I=>I.id).join(","):m.isArray(s)&&(t.excludedIds=s.join(",")),m.isArray(n)&&(t.excludedIds=[t.excludedIds,n].filter(Boolean).join(",")),b.state.isAuth&&(t.sdks="auth_v1");const{page:c,search:d}=e,{listings:f,total:W}=ae?await M.getMobileListings(t):await M.getDesktopListings(t),o=Object.values(f),g=d?"search":"wallets";return E[g]={listings:[...E[g].listings,...o],total:W,page:c??1},{listings:o,total:W}},getWalletImageUrl(e){return M.getWalletImageUrl(e)},getAssetImageUrl(e){return M.getAssetImageUrl(e)},resetSearch(){E.search={listings:[],total:0,page:1}}},T=P({open:!1}),J={state:T,subscribe(e){return D(T,()=>e(T))},async open(e){return new Promise(t=>{const{isUiLoaded:s,isDataLoaded:n}=b.state;if(m.removeWalletConnectDeepLink(),b.setWalletConnectUri(e==null?void 0:e.uri),b.setChains(e==null?void 0:e.chains),de.reset("ConnectWallet"),s&&n)T.open=!0,t();else{const l=setInterval(()=>{const c=b.state;c.isUiLoaded&&c.isDataLoaded&&(clearInterval(l),T.open=!0,t())},200)}})},close(){T.open=!1}};var Me=Object.defineProperty,ie=Object.getOwnPropertySymbols,Se=Object.prototype.hasOwnProperty,De=Object.prototype.propertyIsEnumerable,le=(e,t,s)=>t in e?Me(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,je=(e,t)=>{for(var s in t||(t={}))Se.call(t,s)&&le(e,s,t[s]);if(ie)for(var s of ie(t))De.call(t,s)&&le(e,s,t[s]);return e};function Ue(){return typeof matchMedia<"u"&&matchMedia("(prefers-color-scheme: dark)").matches}const N=P({themeMode:Ue()?"dark":"light"}),ce={state:N,subscribe(e){return D(N,()=>e(N))},setThemeConfig(e){const{themeMode:t,themeVariables:s}=e;t&&(N.themeMode=t),s&&(N.themeVariables=je({},s))}},S=P({open:!1,message:"",variant:"success"}),Re={state:S,subscribe(e){return D(S,()=>e(S))},openToast(e,t){S.open=!0,S.message=e,S.variant=t},closeToast(){S.open=!1}};class Te{constructor(t){this.openModal=J.open,this.closeModal=J.close,this.subscribeModal=J.subscribe,this.setTheme=ce.setThemeConfig,ce.setThemeConfig(t),$.setConfig(t),this.initUi()}async initUi(){if(typeof window<"u"){await pe(()=>import("./index-BkS8dmZm.js"),__vite__mapDeps([0,1,2]));const t=document.createElement("wcm-modal");document.body.insertAdjacentElement("beforeend",t),b.setIsUiLoaded(!0)}}}const Ve=Object.freeze(Object.defineProperty({__proto__:null,WalletConnectModal:Te},Symbol.toStringTag,{value:"Module"}));export{m as C,Ne as E,J as M,b as O,de as R,ce as T,Re as a,Ie as b,$ as c,Ve as i}; +const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-BBHnRicu.js","assets/index-CsaIuMX9.js","assets/index-AnxZPkAf.css"])))=>i.map(i=>d[i]); +import{_ as pe}from"./index-CsaIuMX9.js";const me=Symbol(),ee=Object.getPrototypeOf,Y=new WeakMap,he=e=>e&&(Y.has(e)?Y.get(e):ee(e)===Object.prototype||ee(e)===Array.prototype),ge=e=>he(e)&&e[me]||null,te=(e,t=!0)=>{Y.set(e,t)},z={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1},F=e=>typeof e=="object"&&e!==null,C=new WeakMap,x=new WeakSet,ye=(e=Object.is,t=(o,g)=>new Proxy(o,g),s=o=>F(o)&&!x.has(o)&&(Array.isArray(o)||!(Symbol.iterator in o))&&!(o instanceof WeakMap)&&!(o instanceof WeakSet)&&!(o instanceof Error)&&!(o instanceof Number)&&!(o instanceof Date)&&!(o instanceof String)&&!(o instanceof RegExp)&&!(o instanceof ArrayBuffer),n=o=>{switch(o.status){case"fulfilled":return o.value;case"rejected":throw o.reason;default:throw o}},l=new WeakMap,c=(o,g,I=n)=>{const v=l.get(o);if((v==null?void 0:v[0])===g)return v[1];const w=Array.isArray(o)?[]:Object.create(Object.getPrototypeOf(o));return te(w,!0),l.set(o,[g,w]),Reflect.ownKeys(o).forEach(j=>{if(Object.getOwnPropertyDescriptor(w,j))return;const O=Reflect.get(o,j),A={value:O,enumerable:!0,configurable:!0};if(x.has(O))te(O,!1);else if(O instanceof Promise)delete A.value,A.get=()=>I(O);else if(C.has(O)){const[y,H]=C.get(O);A.value=c(y,H(),I)}Object.defineProperty(w,j,A)}),Object.preventExtensions(w)},d=new WeakMap,f=[1,1],W=o=>{if(!F(o))throw new Error("object required");const g=d.get(o);if(g)return g;let I=f[0];const v=new Set,w=(i,a=++f[0])=>{I!==a&&(I=a,v.forEach(r=>r(i,a)))};let j=f[1];const O=(i=++f[1])=>(j!==i&&!v.size&&(j=i,y.forEach(([a])=>{const r=a[1](i);r>I&&(I=r)})),I),A=i=>(a,r)=>{const h=[...a];h[1]=[i,...h[1]],w(h,r)},y=new Map,H=(i,a)=>{if((z?"production":void 0)!=="production"&&y.has(i))throw new Error("prop listener already exists");if(v.size){const r=a[3](A(i));y.set(i,[a,r])}else y.set(i,[a])},Z=i=>{var a;const r=y.get(i);r&&(y.delete(i),(a=r[1])==null||a.call(r))},ue=i=>(v.add(i),v.size===1&&y.forEach(([r,h],U)=>{if((z?"production":void 0)!=="production"&&h)throw new Error("remove already exists");const k=r[3](A(U));y.set(U,[r,k])}),()=>{v.delete(i),v.size===0&&y.forEach(([r,h],U)=>{h&&(h(),y.set(U,[r]))})}),q=Array.isArray(o)?[]:Object.create(Object.getPrototypeOf(o)),R=t(q,{deleteProperty(i,a){const r=Reflect.get(i,a);Z(a);const h=Reflect.deleteProperty(i,a);return h&&w(["delete",[a],r]),h},set(i,a,r,h){const U=Reflect.has(i,a),k=Reflect.get(i,a,h);if(U&&(e(k,r)||d.has(r)&&e(k,d.get(r))))return!0;Z(a),F(r)&&(r=ge(r)||r);let V=r;if(r instanceof Promise)r.then(L=>{r.status="fulfilled",r.value=L,w(["resolve",[a],L])}).catch(L=>{r.status="rejected",r.reason=L,w(["reject",[a],L])});else{!C.has(r)&&s(r)&&(V=W(r));const L=!x.has(V)&&C.get(V);L&&H(a,L)}return Reflect.set(i,a,V,h),w(["set",[a],r,k]),!0}});d.set(o,R);const fe=[q,O,c,ue];return C.set(R,fe),Reflect.ownKeys(o).forEach(i=>{const a=Object.getOwnPropertyDescriptor(o,i);"value"in a&&(R[i]=o[i],delete a.value,delete a.writable),Object.defineProperty(q,i,a)}),R})=>[W,C,x,e,t,s,n,l,c,d,f],[ve]=ye();function P(e={}){return ve(e)}function D(e,t,s){const n=C.get(e);(z?"production":void 0)!=="production"&&!n&&console.warn("Please use proxy object");let l;const c=[],d=n[3];let f=!1;const o=d(g=>{c.push(g),l||(l=Promise.resolve().then(()=>{l=void 0,f&&t(c.splice(0))}))});return f=!0,()=>{f=!1,o()}}function we(e,t){const s=C.get(e);(z?"production":void 0)!=="production"&&!s&&console.warn("Please use proxy object");const[n,l,c]=s;return c(n,l(),t)}const u=P({history:["ConnectWallet"],view:"ConnectWallet",data:void 0}),de={state:u,subscribe(e){return D(u,()=>e(u))},push(e,t){e!==u.view&&(u.view=e,t&&(u.data=t),u.history.push(e))},reset(e){u.view=e,u.history=[e]},replace(e){u.history.length>1&&(u.history[u.history.length-1]=e,u.view=e)},goBack(){if(u.history.length>1){u.history.pop();const[e]=u.history.slice(-1);u.view=e}},setData(e){u.data=e}},m={WALLETCONNECT_DEEPLINK_CHOICE:"WALLETCONNECT_DEEPLINK_CHOICE",WCM_VERSION:"WCM_VERSION",RECOMMENDED_WALLET_AMOUNT:9,isMobile(){return typeof window<"u"?!!(window.matchMedia("(pointer:coarse)").matches||/Android|webOS|iPhone|iPad|iPod|BlackBerry|Opera Mini/u.test(navigator.userAgent)):!1},isAndroid(){return m.isMobile()&&navigator.userAgent.toLowerCase().includes("android")},isIos(){const e=navigator.userAgent.toLowerCase();return m.isMobile()&&(e.includes("iphone")||e.includes("ipad"))},isHttpUrl(e){return e.startsWith("http://")||e.startsWith("https://")},isArray(e){return Array.isArray(e)&&e.length>0},isTelegram(){return typeof window<"u"&&(!!window.TelegramWebviewProxy||!!window.Telegram||!!window.TelegramWebviewProxyProto)},formatNativeUrl(e,t,s){if(m.isHttpUrl(e))return this.formatUniversalUrl(e,t,s);let n=e;n.includes("://")||(n=e.replaceAll("/","").replaceAll(":",""),n=`${n}://`),n.endsWith("/")||(n=`${n}/`),this.setWalletConnectDeepLink(n,s);const l=encodeURIComponent(t);return`${n}wc?uri=${l}`},formatUniversalUrl(e,t,s){if(!m.isHttpUrl(e))return this.formatNativeUrl(e,t,s);let n=e;if(n.startsWith("https://t.me")){const c=Buffer.from(t).toString("base64").replace(/[=]/g,"");n.endsWith("/")&&(n=n.slice(0,-1)),this.setWalletConnectDeepLink(n,s);const d=new URL(n);return d.searchParams.set("startapp",c),d.toString()}n.endsWith("/")||(n=`${n}/`),this.setWalletConnectDeepLink(n,s);const l=encodeURIComponent(t);return`${n}wc?uri=${l}`},async wait(e){return new Promise(t=>{setTimeout(t,e)})},openHref(e,t){const s=this.isTelegram()?"_blank":t;window.open(e,s,"noreferrer noopener")},setWalletConnectDeepLink(e,t){try{localStorage.setItem(m.WALLETCONNECT_DEEPLINK_CHOICE,JSON.stringify({href:e,name:t}))}catch{console.info("Unable to set WalletConnect deep link")}},setWalletConnectAndroidDeepLink(e){try{const[t]=e.split("?");localStorage.setItem(m.WALLETCONNECT_DEEPLINK_CHOICE,JSON.stringify({href:t,name:"Android"}))}catch{console.info("Unable to set WalletConnect android deep link")}},removeWalletConnectDeepLink(){try{localStorage.removeItem(m.WALLETCONNECT_DEEPLINK_CHOICE)}catch{console.info("Unable to remove WalletConnect deep link")}},setModalVersionInStorage(){try{typeof localStorage<"u"&&localStorage.setItem(m.WCM_VERSION,"2.7.0")}catch{console.info("Unable to set Web3Modal version in storage")}},getWalletRouterData(){var e;const t=(e=de.state.data)==null?void 0:e.Wallet;if(!t)throw new Error('Missing "Wallet" view data');return t}},be=typeof location<"u"&&(location.hostname.includes("localhost")||location.protocol.includes("https")),p=P({enabled:be,userSessionId:"",events:[],connectedWalletId:void 0}),Ie={state:p,subscribe(e){return D(p.events,()=>e(we(p.events[p.events.length-1])))},initialize(){p.enabled&&typeof(crypto==null?void 0:crypto.randomUUID)<"u"&&(p.userSessionId=crypto.randomUUID())},setConnectedWalletId(e){p.connectedWalletId=e},click(e){if(p.enabled){const t={type:"CLICK",name:e.name,userSessionId:p.userSessionId,timestamp:Date.now(),data:e};p.events.push(t)}},track(e){if(p.enabled){const t={type:"TRACK",name:e.name,userSessionId:p.userSessionId,timestamp:Date.now(),data:e};p.events.push(t)}},view(e){if(p.enabled){const t={type:"VIEW",name:e.name,userSessionId:p.userSessionId,timestamp:Date.now(),data:e};p.events.push(t)}}},_=P({chains:void 0,walletConnectUri:void 0,isAuth:!1,isCustomDesktop:!1,isCustomMobile:!1,isDataLoaded:!1,isUiLoaded:!1}),b={state:_,subscribe(e){return D(_,()=>e(_))},setChains(e){_.chains=e},setWalletConnectUri(e){_.walletConnectUri=e},setIsCustomDesktop(e){_.isCustomDesktop=e},setIsCustomMobile(e){_.isCustomMobile=e},setIsDataLoaded(e){_.isDataLoaded=e},setIsUiLoaded(e){_.isUiLoaded=e},setIsAuth(e){_.isAuth=e}},B=P({projectId:"",mobileWallets:void 0,desktopWallets:void 0,walletImages:void 0,chains:void 0,enableAuthMode:!1,enableExplorer:!0,explorerExcludedWalletIds:void 0,explorerRecommendedWalletIds:void 0,termsOfServiceUrl:void 0,privacyPolicyUrl:void 0}),$={state:B,subscribe(e){return D(B,()=>e(B))},setConfig(e){var t,s;Ie.initialize(),b.setChains(e.chains),b.setIsAuth(!!e.enableAuthMode),b.setIsCustomMobile(!!((t=e.mobileWallets)!=null&&t.length)),b.setIsCustomDesktop(!!((s=e.desktopWallets)!=null&&s.length)),m.setModalVersionInStorage(),Object.assign(B,e)}};var _e=Object.defineProperty,se=Object.getOwnPropertySymbols,Ee=Object.prototype.hasOwnProperty,Oe=Object.prototype.propertyIsEnumerable,ne=(e,t,s)=>t in e?_e(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,We=(e,t)=>{for(var s in t||(t={}))Ee.call(t,s)&&ne(e,s,t[s]);if(se)for(var s of se(t))Oe.call(t,s)&&ne(e,s,t[s]);return e};const G="https://explorer-api.walletconnect.com",Q="wcm",X="js-2.7.0";async function K(e,t){const s=We({sdkType:Q,sdkVersion:X},t),n=new URL(e,G);return n.searchParams.append("projectId",$.state.projectId),Object.entries(s).forEach(([c,d])=>{d&&n.searchParams.append(c,String(d))}),(await fetch(n)).json()}const M={async getDesktopListings(e){return K("/w3m/v1/getDesktopListings",e)},async getMobileListings(e){return K("/w3m/v1/getMobileListings",e)},async getInjectedListings(e){return K("/w3m/v1/getInjectedListings",e)},async getAllListings(e){return K("/w3m/v1/getAllListings",e)},getWalletImageUrl(e){return`${G}/w3m/v1/getWalletImage/${e}?projectId=${$.state.projectId}&sdkType=${Q}&sdkVersion=${X}`},getAssetImageUrl(e){return`${G}/w3m/v1/getAssetImage/${e}?projectId=${$.state.projectId}&sdkType=${Q}&sdkVersion=${X}`}};var Le=Object.defineProperty,oe=Object.getOwnPropertySymbols,Ce=Object.prototype.hasOwnProperty,Pe=Object.prototype.propertyIsEnumerable,re=(e,t,s)=>t in e?Le(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,Ae=(e,t)=>{for(var s in t||(t={}))Ce.call(t,s)&&re(e,s,t[s]);if(oe)for(var s of oe(t))Pe.call(t,s)&&re(e,s,t[s]);return e};const ae=m.isMobile(),E=P({wallets:{listings:[],total:0,page:1},search:{listings:[],total:0,page:1},recomendedWallets:[]}),Ne={state:E,async getRecomendedWallets(){const{explorerRecommendedWalletIds:e,explorerExcludedWalletIds:t}=$.state;if(e==="NONE"||t==="ALL"&&!e)return E.recomendedWallets;if(m.isArray(e)){const n={recommendedIds:e.join(",")},{listings:l}=await M.getAllListings(n),c=Object.values(l);c.sort((d,f)=>{const W=e.indexOf(d.id),o=e.indexOf(f.id);return W-o}),E.recomendedWallets=c}else{const{chains:s,isAuth:n}=b.state,l=s==null?void 0:s.join(","),c=m.isArray(t),d={page:1,sdks:n?"auth_v1":void 0,entries:m.RECOMMENDED_WALLET_AMOUNT,chains:l,version:2,excludedIds:c?t.join(","):void 0},{listings:f}=ae?await M.getMobileListings(d):await M.getDesktopListings(d);E.recomendedWallets=Object.values(f)}return E.recomendedWallets},async getWallets(e){const t=Ae({},e),{explorerRecommendedWalletIds:s,explorerExcludedWalletIds:n}=$.state,{recomendedWallets:l}=E;if(n==="ALL")return E.wallets;l.length?t.excludedIds=l.map(I=>I.id).join(","):m.isArray(s)&&(t.excludedIds=s.join(",")),m.isArray(n)&&(t.excludedIds=[t.excludedIds,n].filter(Boolean).join(",")),b.state.isAuth&&(t.sdks="auth_v1");const{page:c,search:d}=e,{listings:f,total:W}=ae?await M.getMobileListings(t):await M.getDesktopListings(t),o=Object.values(f),g=d?"search":"wallets";return E[g]={listings:[...E[g].listings,...o],total:W,page:c??1},{listings:o,total:W}},getWalletImageUrl(e){return M.getWalletImageUrl(e)},getAssetImageUrl(e){return M.getAssetImageUrl(e)},resetSearch(){E.search={listings:[],total:0,page:1}}},T=P({open:!1}),J={state:T,subscribe(e){return D(T,()=>e(T))},async open(e){return new Promise(t=>{const{isUiLoaded:s,isDataLoaded:n}=b.state;if(m.removeWalletConnectDeepLink(),b.setWalletConnectUri(e==null?void 0:e.uri),b.setChains(e==null?void 0:e.chains),de.reset("ConnectWallet"),s&&n)T.open=!0,t();else{const l=setInterval(()=>{const c=b.state;c.isUiLoaded&&c.isDataLoaded&&(clearInterval(l),T.open=!0,t())},200)}})},close(){T.open=!1}};var Me=Object.defineProperty,ie=Object.getOwnPropertySymbols,Se=Object.prototype.hasOwnProperty,De=Object.prototype.propertyIsEnumerable,le=(e,t,s)=>t in e?Me(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,je=(e,t)=>{for(var s in t||(t={}))Se.call(t,s)&&le(e,s,t[s]);if(ie)for(var s of ie(t))De.call(t,s)&&le(e,s,t[s]);return e};function Ue(){return typeof matchMedia<"u"&&matchMedia("(prefers-color-scheme: dark)").matches}const N=P({themeMode:Ue()?"dark":"light"}),ce={state:N,subscribe(e){return D(N,()=>e(N))},setThemeConfig(e){const{themeMode:t,themeVariables:s}=e;t&&(N.themeMode=t),s&&(N.themeVariables=je({},s))}},S=P({open:!1,message:"",variant:"success"}),Re={state:S,subscribe(e){return D(S,()=>e(S))},openToast(e,t){S.open=!0,S.message=e,S.variant=t},closeToast(){S.open=!1}};class Te{constructor(t){this.openModal=J.open,this.closeModal=J.close,this.subscribeModal=J.subscribe,this.setTheme=ce.setThemeConfig,ce.setThemeConfig(t),$.setConfig(t),this.initUi()}async initUi(){if(typeof window<"u"){await pe(()=>import("./index-BBHnRicu.js"),__vite__mapDeps([0,1,2]));const t=document.createElement("wcm-modal");document.body.insertAdjacentElement("beforeend",t),b.setIsUiLoaded(!0)}}}const Ve=Object.freeze(Object.defineProperty({__proto__:null,WalletConnectModal:Te},Symbol.toStringTag,{value:"Module"}));export{m as C,Ne as E,J as M,b as O,de as R,ce as T,Re as a,Ie as b,$ as c,Ve as i}; diff --git a/assets/index-odG_wQ1_.js b/assets/index-CsaIuMX9.js similarity index 96% rename from assets/index-odG_wQ1_.js rename to assets/index-CsaIuMX9.js index df76c58..84b565a 100644 --- a/assets/index-odG_wQ1_.js +++ b/assets/index-CsaIuMX9.js @@ -890,7 +890,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho "stateMutability": "view", "type": "function" } -]`;class nE{constructor(e){ue(this,"isFetchingBalances",Or(!1));ue(this,"isFetchingTokenInfo",Or(!1));ue(this,"balances",Or([]));ue(this,"userAddedTokens",Or([]));ue(this,"local",{userAddedTokens:new eu(Ol.TOKENS_USER_ADDITIONS)});this.store=e}async loadBalances(e,r){const n=r.filter(o=>o.type===Bt.MAINNET),i=[];this.isFetchingBalances.set(!0),await Promise.allSettled(n.map(async o=>{if(!o.rpcUrl){console.warn(`No RPC URL found for network ${o.name}`);return}const a=new Py(o.rpcUrl);try{const c=await a.getBalance(e);i.push({contractType:hh.NATIVE,contractAddress:wu,tokenID:"",accountAddress:e,balance:c.toString(),chainId:o.chainId,blockHash:ty,blockNumber:0,contractInfo:d9e(ACe(o.chainId)),uniqueCollectibles:"0",isSummary:!0})}catch(c){console.error(c)}})),this.balances.set(i);const s=this.local.userAddedTokens.get()??[];this.userAddedTokens.set(s),s.length>0&&await Promise.allSettled(s.map(async o=>{await this.loadUserAddedTokenBalance(e,o)})),this.isFetchingBalances.set(!1)}async loadUserAddedTokenBalance(e,r){const n=this.store.get(Wn).providerForChainId(r.chainId);try{const s=await new Bn(r.address,qv,n).balanceOf(e),o=this.balances.get();if(!s){this.removeToken(r);return}o.push({contractType:r.contractType,contractAddress:r.address,tokenID:"",accountAddress:e,balance:s.toString(),chainId:r.chainId,blockHash:ty,blockNumber:0,contractInfo:{address:r.address,chainId:r.chainId,decimals:r.decimals,name:r.symbol,symbol:r.symbol,type:"ERC20",logoURI:"",deployed:!0,bytecodeHash:"",extensions:{link:"",description:"",ogImage:"",originAddress:"",originChainId:0,blacklist:!1,verified:!0,verifiedBy:"User",featured:!1},updatedAt:"0"},uniqueCollectibles:"0",isSummary:!0}),this.balances.set(o)}catch(i){console.error(i)}}async updateTokenBalance(e){const r=this.store.get(Wn).providerForChainId(e.chainId);this.isFetchingBalances.set(!0);const n=this.store.get(Mi).accountAddress.get();if(!n){console.warn("No account found");return}const i=this.balances.get();try{let s;e.contractType===hh.NATIVE?s=await r.getBalance(n):s=await new Bn(e.contractAddress,qv,r).balanceOf(n),i.map(o=>{o.contractAddress===e.contractAddress&&o.chainId===e.chainId&&(o.balance=s.toString())}),this.balances.set(i)}catch(s){console.error(s)}this.isFetchingBalances.set(!1)}async addToken(e){const r=this.local.userAddedTokens.get()??[];if(r.some(s=>s.chainId===e.chainId&&s.address===e.address))throw new Error(`Token with chainId ${e.chainId} and address ${e.address} already exists`);r.push(e),this.local.userAddedTokens.set(r),this.userAddedTokens.set(r);const i=this.store.get(Mi).accountAddress.get();i&&(this.isFetchingBalances.set(!0),await this.loadUserAddedTokenBalance(i,e),this.isFetchingBalances.set(!1))}async removeToken(e){const n=(this.local.userAddedTokens.get()??[]).filter(s=>!(s.chainId===e.chainId&&s.address===e.address));this.local.userAddedTokens.set(n),this.userAddedTokens.set(n);const i=this.balances.get().filter(s=>!(s.chainId===e.chainId&&s.contractAddress===e.address));this.balances.set(i)}async getTokenInfo(e,r){const n=this.store.get(Wn).providerForChainId(e);this.isFetchingTokenInfo.set(!0);try{const i=new Bn(r,qv,n),s=await i.decimals(),o=await i.symbol();if(this.isFetchingTokenInfo.set(!1),s&&o)return{decimals:Number(s),symbol:o};throw new Error(`Could not get decimals and symbol for token at ${r}`)}catch(i){throw console.error(i),new Error(`Error getting token info ${JSON.stringify(i)}`)}}clear(){this.local.userAddedTokens.set([]),this.isFetchingBalances.set(!1),this.isFetchingTokenInfo.set(!1),this.balances.set([])}}class Mi{constructor(e){ue(this,"isLoadingAccount",Or(!0));ue(this,"isPasswordSet",Or(!0));ue(this,"account");ue(this,"accountAddress",Or(void 0));ue(this,"isPromptingForPassword",Or(!1));this.store=e,this.loadAccount(),this.store.get(Wn).networks.subscribe(n=>{this.account&&this.loadAccount()}),this.accountAddress.subscribe(n=>{n&&this.store.get(Wn).accountLoaded.set(!0)}),ob(Da.SECURITY).then(async n=>{this.isPasswordSet.set(!n.get(Da.SECURITY,"key"))})}async signInWithRecoveryMnemonic(e,r,n){try{this.isLoadingAccount.set(!0);const i=j5.fromPhrase(r),s=new eE([i]),a=this.store.get(Wn).networks.get(),c=new Px({address:e,tracker:K_,contexts:nX,orchestrator:s,networks:a});n?await this.encryptRecoveryMnemonicWithPassword(r,c.address,n):await this.encryptRecoveryMnemonic(r,c.address),this.account=c,this.accountAddress.set(c.address)}catch(i){console.warn(i)}this.isLoadingAccount.set(!1)}async loadAccount(e){const r=await ob(Da.SECURITY),n=await r.get(Da.SECURITY,"mnemonic");var i=await r.get(Da.SECURITY,"key");let s;if(n&&!i&&!e){this.isPromptingForPassword.set(!0);return}n&&(i?s=await this.decryptRecoveryMnemonic(n,i):s=await this.decryptRecoveryMnemonicWithPassword(n,e)),s?e?this.signInWithRecoveryMnemonic(s.wallet,s.mnemonic,e):this.signInWithRecoveryMnemonic(s.wallet,s.mnemonic):setTimeout(()=>{this.isLoadingAccount.set(!1)},200)}async encryptRecoveryMnemonic(e,r){const n=await iAe(),i=JSON.stringify({wallet:r,mnemonic:e}),s=await HF(n,i);s.salt=zF(r);const o=await ob(Da.SECURITY);await o.put(Da.SECURITY,n,"key"),await o.put(Da.SECURITY,s,"mnemonic"),this.isPasswordSet.set(!1)}async encryptRecoveryMnemonicWithPassword(e,r,n){const i=zF(r),s=await VF(n,i),o=JSON.stringify({wallet:r,mnemonic:e}),a=await HF(s,o);a.salt=i,await(await ob(Da.SECURITY)).put(Da.SECURITY,a,"mnemonic"),this.isPasswordSet.set(!0)}async decryptRecoveryMnemonic(e,r){const n=await GF(r,e);return JSON.parse(n)}async decryptRecoveryMnemonicWithPassword(e,r){const n=e.salt,i=await VF(r,n),s=await GF(i,e);return JSON.parse(s)}logout(){this.account=void 0,this.accountAddress.set(void 0),bAe(Da.SECURITY);const e=this.store.get(Wn),r=this.store.get(nE);e.clear(),r.clear(),localStorage.clear()}}function p9e({onClose:t}){const e=Br(Wn),r=f8(),[n,i]=N.useState(),[s,o]=N.useState(),[a,c]=N.useState(),[l,f]=N.useState(),[u,p]=N.useState(),[g,y]=N.useState(),b=async()=>{if(n&&s&&a)await e.addNetwork({chainId:Number(n),name:s,title:s,type:Bt.MAINNET,rpcUrl:a,blockExplorer:l?{rootUrl:l}:void 0,nativeToken:{name:u||"Ether",symbol:g||"ETH",decimals:18}});else throw new Error("Please fill in all required fields, marked with *")},I=()=>{i(void 0),o(void 0),c(void 0),f(void 0),p(void 0),y(void 0)};return W.jsxs(we,{flexDirection:"column",width:"full",marginTop:"4",gap:"4",children:[W.jsx(Pn,{width:"full",label:"Chain ID*",labelLocation:"left",name:"chainId",value:n??"",onChange:C=>{i(C.target.value)}}),W.jsx(Pn,{width:"full",label:"Network Name*",labelLocation:"left",name:"networkName",value:s??"",onChange:C=>{o(C.target.value)}}),W.jsx(Pn,{width:"full",label:"RPC URL*",labelLocation:"left",name:"rpcUrl",value:a??"",onChange:C=>{c(C.target.value)}}),W.jsx(Pn,{width:"full",label:"Block explorer URL (optional)",labelLocation:"left",name:"rpcUrl",value:l??"",onChange:C=>{f(C.target.value)}}),W.jsx(Pn,{width:"full",label:"Native Token Name (default ETH)",labelLocation:"left",name:"tokenName",value:u??"",onChange:C=>{p(C.target.value)}}),W.jsx(Pn,{width:"full",label:"Native Token Symbol (default ETH)",labelLocation:"left",name:"tokenSymbol",value:g??"",onChange:C=>{y(C.target.value)}}),W.jsxs(we,{alignItems:"center",justifyContent:"flex-end",gap:"8",marginTop:"4",children:[W.jsx(Jt,{label:"Cancel",variant:"text",size:"md",shape:"square",onClick:()=>{I(),t()}}),W.jsx(Jt,{label:"Add",variant:"primary",size:"md",shape:"square",onClick:async()=>{try{await b(),r({variant:"success",title:"Network added",description:`You can now use ${s} network`}),I(),t()}catch(C){r({variant:"error",title:"Could not add network",description:C.message}),console.error(C)}}})]})]})}function nj({network:t}){var p,g;const e=Br(Wn),n=on(e.userAdditionNetworkChainIds).includes(t.chainId);N.useEffect(()=>{var y,b;(s!==t.rpcUrl||a!==((y=t.blockExplorer)==null?void 0:y.rootUrl)||l!==t.disabled)&&(o(t.rpcUrl),c(((b=t.blockExplorer)==null?void 0:b.rootUrl)??""),f(t.disabled))},[t]);const i=e.editedNetworkChainIds.get().includes(t.chainId),[s,o]=N.useState(t.rpcUrl),[a,c]=N.useState(((p=t.blockExplorer)==null?void 0:p.rootUrl)??""),[l,f]=N.useState(t.disabled),u=s!==t.rpcUrl||a!==((g=t.blockExplorer)==null?void 0:g.rootUrl)||l!==t.disabled;return W.jsxs(we,{flexDirection:"column",gap:"6",children:[W.jsx(we,{flexDirection:"row",gap:"3",children:W.jsx(K4,{label:W.jsx(Qe,{fontWeight:"bold",color:"text100",variant:"normal",children:t.title}),labelLocation:"right",color:"primary",checked:!l,onCheckedChange:y=>{f(!y)}})}),W.jsx(iP,{label:"Network Settings",children:W.jsxs(we,{flexDirection:"column",gap:"2",children:[W.jsx(Pn,{label:"RPC URL",labelLocation:"left",name:"rpcUrl",spellCheck:!1,disabled:n,value:s??"",onChange:y=>{o(y.target.value)}}),W.jsx(Pn,{label:"Block Explorer URL",labelLocation:"left",name:"blockExplorerUrl",spellCheck:!1,disabled:n,value:a??"",onChange:y=>{c(y.target.value)}})]})}),n&&W.jsxs(we,{marginTop:"4",alignItems:"center",justifyContent:"flex-end",gap:"5",children:[W.jsx(Qe,{variant:"small",color:"text50",children:"Added by you"}),W.jsx(Jt,{label:"Remove",variant:"danger",size:"md",shape:"square",onClick:()=>e.removeNetwork(t.chainId)})]}),(u||i)&&!n&&W.jsxs(we,{marginTop:"4",justifyContent:"flex-end",gap:"3",children:[W.jsx(W.Fragment,{children:i&&W.jsx(Jt,{label:"Reset to default",variant:"danger",size:"md",shape:"square",onClick:()=>e.resetNetworkEdit(t.chainId)})}),W.jsx(W.Fragment,{children:u&&W.jsx(Jt,{label:"Save",variant:"primary",size:"md",shape:"square",onClick:()=>{const y=t;y.rpcUrl=s,y.blockExplorer={rootUrl:a},y.relayer=E3(s),y.disabled=l,e.editNetwork(y)}})})]}),W.jsx(Pu,{})]})}function gM(){const t=Br(Wn),e=on(t.networks),r=e.filter(p=>p.type===Bt.MAINNET),n=on(t.userAdditionNetworkChainIds),i=r.sort((p,g)=>n.includes(p.chainId)?-1:1),s=e.filter(p=>p.type===Bt.TESTNET),o=on(t.arweaveGatewayUrl),a=on(t.arweaveGraphqlUrl),[c,l]=N.useState(Bt.MAINNET),[f,u]=N.useState(!1);return W.jsxs(we,{flexDirection:"column",paddingY:"4",paddingX:"8",background:"backgroundPrimary",width:"full",height:"full",alignItems:"center",children:[W.jsx(we,{children:W.jsx(Qe,{variant:"large",color:"text80",children:"Networks"})}),W.jsx(we,{width:"full",marginTop:"4",paddingBottom:"4",children:W.jsxs(swe,{value:c,onValueChange:p=>l(p),children:[W.jsx(we,{marginBottom:"10",children:W.jsx(iwe,{value:c,tabs:[{label:"Networks",value:Bt.MAINNET},{label:"Test Networks",value:Bt.TESTNET},{label:"Arweave",value:"arweave"}]})}),W.jsx(GA,{value:Bt.MAINNET,children:W.jsxs(we,{flexDirection:"column",gap:"2",children:[W.jsx(we,{width:"full",flexDirection:"column",alignItems:"flex-end",marginY:"4",children:f?W.jsx(p9e,{onClose:()=>u(!1)}):W.jsx(Jt,{label:"Add network",variant:"primary",size:"md",shape:"square",onClick:()=>{u(!0)}})}),W.jsx(W.Fragment,{children:i.map((p,g)=>W.jsx(nj,{network:p},g))})]})}),W.jsx(GA,{value:Bt.TESTNET,children:W.jsx(we,{flexDirection:"column",gap:"2",children:s.map((p,g)=>W.jsx(nj,{network:p},g))})}),W.jsx(GA,{value:"arweave",children:W.jsxs(we,{flexDirection:"column",gap:"2",children:[W.jsx(Qe,{fontWeight:"bold",color:"text100",children:"Arweave"}),W.jsx(Pn,{label:"Gateway URL",labelLocation:"left",name:"arweaveGatewayUrl",spellCheck:!1,value:o??"",onChange:p=>{t.arweaveGatewayUrl.set(p.target.value)}}),W.jsx(Pn,{label:"GraphQL URL",labelLocation:"left",name:"arweaveGraphqlUrl",spellCheck:!1,value:a??"",onChange:p=>{t.arweaveGraphqlUrl.set(p.target.value)}}),W.jsx(Pu,{})]})})]})})]})}const v9e="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20fill='none'%20viewBox='0%200%2024%2024'%20stroke-width='1.5'%20stroke='dimgray'%20class='size-6'%3e%3cpath%20stroke-linecap='round'%20stroke-linejoin='round'%20d='M3.98%208.223A10.477%2010.477%200%200%200%201.934%2012C3.226%2016.338%207.244%2019.5%2012%2019.5c.993%200%201.953-.138%202.863-.395M6.228%206.228A10.451%2010.451%200%200%201%2012%204.5c4.756%200%208.773%203.162%2010.065%207.498a10.522%2010.522%200%200%201-4.293%205.774M6.228%206.228%203%203m3.228%203.228%203.65%203.65m7.894%207.894L21%2021m-3.228-3.228-3.65-3.65m0%200a3%203%200%201%200-4.243-4.243m4.242%204.242L9.88%209.88'%20/%3e%3c/svg%3e",g9e="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20fill='none'%20viewBox='0%200%2024%2024'%20stroke-width='1.5'%20stroke='dimgray'%20class='size-6'%3e%3cpath%20stroke-linecap='round'%20stroke-linejoin='round'%20d='M2.036%2012.322a1.012%201.012%200%200%201%200-.639C3.423%207.51%207.36%204.5%2012%204.5c4.638%200%208.573%203.007%209.963%207.178.07.207.07.431%200%20.639C20.577%2016.49%2016.64%2019.5%2012%2019.5c-4.638%200-8.573-3.007-9.963-7.178Z'%20/%3e%3cpath%20stroke-linecap='round'%20stroke-linejoin='round'%20d='M15%2012a3%203%200%201%201-6%200%203%203%200%200%201%206%200Z'%20/%3e%3c/svg%3e",Y_=({label:t,labelLocation:e="top",value:r,onChange:n})=>{const[i,s]=N.useState(!1),o=()=>{s(!i)};return W.jsxs("div",{style:{position:"relative",width:"100%"},children:[W.jsx(Pn,{type:i?"text":"password",name:"password",label:t,labelLocation:e,value:r,onChange:n}),W.jsx("button",{type:"button",onClick:o,style:{position:"absolute",top:"50%",right:"12px",transform:"translateY(5%)",background:"none",border:"none",cursor:"pointer"},children:i?W.jsx("img",{src:v9e,style:{width:"25px",height:"25px"}}):W.jsx("img",{src:g9e,style:{width:"25px",height:"25px"}})})]})},yM="/assets/sequence-logo-B9LB7ao9.svg";function y9e(){const t=Br(Mi),e=on(t.isLoadingAccount),r=on(t.isPromptingForPassword),[n,i]=N.useState(""),[s,o]=N.useState(!1),[a,c]=N.useState(!1),[l,f]=N.useState(!1),u=async()=>{try{await t.loadAccount(n)}catch(y){console.warn(y),c(!0)}},p=()=>{o(!0)},g=()=>{t.logout(),o(!1),t.isLoadingAccount.set(!1)};return W.jsxs(W.Fragment,{children:[W.jsx(we,{flexDirection:"row",width:"full",background:"backgroundMuted",justifyContent:"flex-end",paddingX:"20",paddingY:"4",style:{height:"64.12px"},children:W.jsx(Jt,{label:"Networks",variant:"text",onClick:()=>f(!0)})}),W.jsxs(we,{background:"backgroundPrimary",width:"full",height:"full",paddingX:"8",alignItems:"center",justifyContent:"center",children:[W.jsxs(we,{width:"full",style:{maxWidth:"800px"},children:[W.jsx(we,{padding:"6",marginTop:"16",children:W.jsxs(we,{flexDirection:"column",alignItems:"center",justifyContent:"center",gap:"6",children:[W.jsx("img",{src:yM,alt:"Sequence Logo",style:{width:"100px",height:"100px"}}),W.jsxs(Qe,{variant:"large",color:"text100",textAlign:"center",children:["Sequence ",W.jsx("br",{})," Wallet Recovery"]})]})}),!e&&W.jsxs(W.Fragment,{children:[W.jsx(we,{marginTop:"8",children:W.jsxs(en,{flexDirection:"column",gap:"6",children:[W.jsx(Qe,{variant:"medium",color:"warning",textAlign:"center",children:"Warning section"}),W.jsx(Qe,{variant:"normal",color:"text100",marginBottom:"4",children:"At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga. At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga."})]})}),W.jsxs(we,{alignItems:"center",justifyContent:"center",flexDirection:"column",children:[W.jsx(we,{children:W.jsx(Jt,{as:QK,to:"/recovery",variant:"primary",size:"lg",shape:"square",label:"Start Recovery",width:"full",marginTop:"16"})}),W.jsx(we,{children:W.jsx(Jt,{variant:"text",size:"lg",shape:"square",label:"Learn more",width:"full",marginTop:"6"})})]})]}),e&&W.jsx(W.Fragment,{children:r?W.jsxs(we,{flexDirection:"column",marginTop:"8",justifyContent:"center",alignItems:"center",children:[W.jsx(Qe,{variant:"large",color:"text100",marginBottom:"8",children:"Welcome back!"}),W.jsx(Y_,{label:"Password",value:n,onChange:y=>{i(y.target.value),c(!1)}}),W.jsx(we,{alignSelf:"flex-start",height:"6",children:a&&W.jsx(Qe,{variant:"small",color:"negative",marginLeft:"2",marginTop:"1",children:"Incorrect password"})}),W.jsx(Jt,{marginBottom:"3",variant:"primary",size:"lg",shape:"square",label:"Unlock",onClick:()=>{u()}}),W.jsx(we,{children:W.jsx(Jt,{variant:"text",label:"Forgot your password?",onClick:()=>{p()}})})]}):W.jsx(we,{marginTop:"8",alignItems:"center",justifyContent:"center",children:W.jsx(en,{width:"16",alignItems:"center",justifyContent:"center",children:W.jsx(fh,{size:"lg"})})})})]}),s&&W.jsx(Ko,{size:"md",onClose:()=>o(!1),children:W.jsxs(we,{flexDirection:"column",alignItems:"center",padding:"16",children:[W.jsxs(Qe,{variant:"md",color:"text100",children:["Click ",W.jsx(Qe,{fontWeight:"bold",children:"Reset"})," to start over. This will require you to re-enter your mnemonic."]}),W.jsxs(we,{flexDirection:{sm:"column",md:"row"},gap:"2",width:"full",marginTop:"10",children:[W.jsx(Jt,{width:"full",label:"Cancel",onClick:()=>{o(!1)},"data-id":"signingCancel"}),W.jsx(Jt,{width:"full",variant:"primary",label:"Reset",onClick:()=>{g()},"data-id":"signingContinue"})]})]})}),l&&W.jsx(Ko,{onClose:()=>f(!1),children:W.jsx(gM,{})})]})]})}function m9e(t,e=6,r=4){if(t.length<=e+r+3)return t;const n=t.slice(0,e),i=t.slice(-r);return`${n}...${i}`}const b9e={"0x087Aa00C1f09464D1D6a9Ff0eE2377dBB7c7B324":[{wallet:"0xaf39AE56e001250FaCBd122b11A90d32A0aD6686",subdigest:"0x0f4490a7aa40f15929635252953ce594ba3342401c2c53eff56451dc147475da"}],"0x09A820a9109E5EC82DCfF24484b2047739a92Abc":[{wallet:"0xcF47342c7064AAA5BA0F4163bEA0c7545756b8BF",subdigest:"0xa598ddbe6372b985f60367a1a9c12cb99e20e38c782d9bc941ddaa9f4c9296e5"}],"0x0aBb5b9d20f06DAdF752CEeBe4df26E585A1d897":[{wallet:"0x3F00C5A7fEadD358429645b29b3d776C5f61892d",subdigest:"0x7c33d7864e6e6f92e39328b407fc8fa0206c6ebdb5a31d9056dcc96bba5eb108"}],"0x0f286489b5b85EAcC4E00e1902e138b5Aa662F1c":[{wallet:"0xD1Dda66401B40c7e9924200f5f9913C00c638f79",subdigest:"0x76009a037ebbb28a9f71f1e68c38291e3b2b1a4bf772a56a79e1a6336cbbc7ab"}],"0x1A535D13c62F240cC7985B05a0229182D546550e":[{wallet:"0x46Ba18e7eCB93362A1804cC47EaD90244945016D",subdigest:"0x0acff6ca38c72b9287ba8163569a452ce12c9ffd64c082feba8a5f7300546579"}],"0x1B9498d7177a09d98ABE532e472e1b9f32dAc9B8":[{wallet:"0x848045071DbdBa2F352dF2f0335e02ba61f205aC"}],"0x253ff3Dd87c440A9565814756f85219F487e2FFe":[{wallet:"0xd18a46E40b29FA6CFC0D9f5A930E72cD0EC1e4D2",subdigest:"0x12822b7fde91535103ee7757fe362bfdca0dc2e25211c6ca7c133c20a66d604f"}],"0x27D263a5707510378823fa496674EeC7656780B6":[{wallet:"0xBc4f7bB193ac09D7eC53eF0a499B073A296A94f0",subdigest:"0xbf3913760753e93aba2f40235dd03e693f85853d7c9f9c5f1f62ce7ee91c6313"}],"0x36fA6B68007575C100c1C2916942ee857dE0778E":[{wallet:"0x52CE3cab58639223cf870A73942175e6C7BA9A0C",subdigest:"0x455b01f5c47ece34a3f4dee5d9b3d3b590d524029f4e845b2d4eccb7e8d9472b"}],"0x3Ed9724712417687eb0eaBc2cA2e452E3d2DCdEc":[{wallet:"0x4955338954fFF19396Fe4bA17D93370cA8b77d2B",subdigest:"0x96c4ddf36a03af12b56cf6dc618ab83d814b86a01c69464f1b94bfca826e47fa"}],"0x3F0c7e32678Bc6dCf9dEfB6368EcaE7B88C69036":[{wallet:"0x592625C316A2F184F0C6a4b2952e9b40Ef111a26",subdigest:"0x5e9cf684e8dcf38d5b079a89ff4644de144c85ca16e3b618ab4ae490becff25f"},{wallet:"0xEBB418588FFc0785B6a2559a281A37c117679D6F",subdigest:"0x98be9228917ad8193e14102ed0a989689ec6af1f04bd731f3cca43c02c1abc07"}],"0x4577CAF3A5caBcaF2038863d361cb32f423d5d53":[{wallet:"0xF68f5A97abAAa940A9Ad3AeD723C2179F8551502",subdigest:"0x336448a71e4188cd95c39b278d6d26144d51dc5b3edfdd2af67c3b0425a2e2d3"}],"0x50d27302c45FE4FC8d7cc435920a22D477d3DEB2":[{wallet:"0x97692217ca8e06D7156ef7f4606faB4624bd10C0",subdigest:"0x898993e7c2394c1c9b63b2cfa637a8a2c7b04ce9387c9ecc9c56ef1f56ae58be"}],"0x57160B380fF4Edf3DA3b1c27e723dc2AB3f057Be":[{wallet:"0xD1Dda66401B40c7e9924200f5f9913C00c638f79",subdigest:"0x89f982d77ae08a8ea17d6755d297615f5756e5363db8a9b95758d5a981f8e4ae"}],"0x6647b94603e0D90265d8869a3656C1b0F9B6caC5":[{wallet:"0x6cDe6f20610FF172Cd838CDF69Aae3c27521CBa4",subdigest:"0xab2d0dbda84cffb9a3934412172236a9d98fd3d6b80d47b35956cc5f935c69de"}],"0x69DD1F76595E8a49252F16DDa69474c3a818E3c0":[{wallet:"0x756F9E22591e0aC2Aa0C365708aF0a516F269979",subdigest:"0x261126c464ac19bb769c407ec28fe026f297357938ba9024bd66bb5a48ca9349"}],"0x6Ae23160FBB280Ae4eE78C476ca9FDb51bBcC444":[{wallet:"0xDfA3338DD0147b5e7793cE040F92462177e00024",subdigest:"0xae67c59800e8dd98b955a5fb857c39971fe5fb29e3e5083246fd122b37c4ee88"}],"0x6B917b4459Db2C9cb774e0a9B0eee668273e191a":[{wallet:"0x676b5FaCD2380F51d4EB1A2492057A31FfB100c5",subdigest:"0x60a62db58b5be8277ff22e8104ead5c4d87d6d1173fd7b2b0174978e663974c7"}],"0x6b593de1F2c6cEf51693323edc4467c2A4D5B78B":[{wallet:"0xD9DF096A66A89e63eE977C5Fda59a65f872a6901",subdigest:"0x8ef909db0fd633cac1445a89dace09c5b2fa1bda2d85e5915f6afc2d547f6a87"}],"0x6c77214450C1060f2f6a093c8054278b77E8769b":[{wallet:"0x16b47E837ff421382D516cA5A79b76aFd8473675",subdigest:"0x67521db115964b2559b99d5854ab07bae09e6e6cb0c1cd3de3d1f553c31c515f"}],"0x70F2E179c95a6e3b9a2Fe742B88568a12FFF7f8B":[{wallet:"0x649ba7F76D856aB021C9EEB8bac3B46f3e72EfD0",subdigest:"0x178be5e2d834d0224794dfbe49cf9621127d3396b75246a32093a21e6db320eb"}],"0x77fCC4D33ae477f217a09Ec8dBEBC22E7e8F5e33":[{wallet:"0xD09C7A6Af7046F45343978A1620391D6237c3762",subdigest:"0xca780c4505a811222e215eceeb2b28f222c1a6b126e9ccc86560f5199c34d5da"}],"0x78C22edc81d7a7A1D690e6C91824Cf9Eff2760c8":[{wallet:"0xFbBFA86B877EAFa40699078E4eC1B544D2168dFC",subdigest:"0xd84553d4372b26e3eb96fa77bd157e4e1b593bff1c54c7e69ad8857673d2266e"}],"0x79621cB0c2c8FbB8Ca20E4177b7DF0Aa7a931e73":[{wallet:"0x3c7eCbe20caf91F377F021560a13D53ef3a1BA11",subdigest:"0xbd64f6f75e64b49c6a4f46b2715ca3bf11e21a7e07702b89ea1607e3884e9d40"}],"0x79A7DF6E89da1AEa293bFa11987d7CE828223a7A":[{wallet:"0x76799a33838A6E0d1160D26e8C47EA9f0e65AF1A",subdigest:"0x858235d87309c9e2d72dca9bfa41b61fbb635ac6d9e099b868ff8a8c99bf8c37"}],"0x7b1A301155c0Fad8e5b95055e2A100333D464eA3":[{wallet:"0x76799a33838A6E0d1160D26e8C47EA9f0e65AF1A",subdigest:"0x31001033b765a3cc9407304daeafeeda015d318e73be3de8832a9dc1377f9340"}],"0x85c5B1f9464723A2cC81F69A71a11dA528E0CBCe":[{wallet:"0xF178cE73DB2bA1C575D5c63ecA490b09ec31949b",subdigest:"0x65e9c76ef7e14697c6fd1822fbd39719b43091f13d2d051c911d1373175c2c42"}],"0x943237FFB0024Bf758A79db00e043789FD8299f0":[{wallet:"0x639b6017C4b8F8a5322205A68a1331A817Dd46e2",subdigest:"0xa3bc90cafcccb0fe0b8c0939fa908216ddc667d6b022fe54efca05ec815c163c"}],"0x9EeA332285d7B3755CB46f7D0D49CF0edcC112Ef":[{wallet:"0x04EfBe99e49001b78bB68c35B0354CD4a2Ac4Fd8",subdigest:"0xd3c43ef36d4347d1b5323fa188cf8482de05631a86bc05b12b8ce3b661f4d2f9"}],"0x9b704574e65F8b785FD125F5f3C4F7E34690Bd02":[{wallet:"0xBA9498300dFE650a2b59A42271ec771B6Ed6a091",subdigest:"0x9894f57b20f78245e02d424a21f0d361038905285f53c51c1949e27f39a9fbb8"}],"0xA923984d96b7327c60f246da366b2525B34C6984":[{wallet:"0x7ae10aA190513577D9Ac9ae146128d97df4F4fF0",subdigest:"0x3b849360d50831070d92bec368b63cf0725525cd7b60f406cee5357731b75457"}],"0xACFC6D1DB5875Cb72E1b6BaddaCe28F45044ee6a":[{wallet:"0xAdAf943368aB95208763ccAcCD5ecB9a7772de40",subdigest:"0xb0d0da150a42bca8103e1c40e5e99c7a190043b3121f52c6d41ae473597d0ebe"}],"0xB278dd7c9FC754dBc82Ac29C6f78B6301BE8E8C6":[{wallet:"0xeCc653CB03a9B6587Bcb58A8372535b6Ea5a17d6",subdigest:"0x6fd9bb4768107b4bd0f3c8e11b00027ee5e6417b1d4ab3d5e56c1724eeb2e3b2"}],"0xBaA9D704C8244071e6B9bF6BcbC2c2281dB75096":[{wallet:"0xb547CcA265A91f7a92d9a97804807962B2A4D7d8",subdigest:"0xfca7ea635bf9e89d7034ce6d9378ff6948eaa340ab2d428e5b157efc82b9f8d5"}],"0xC29fD04F9079c36dC15549e8AAF8F058214F0Dae":[{wallet:"0xB7005885711d54BD3594Be1955266d37470BD053",subdigest:"0xb0bc66ea204ea2cb93ca190189471392b59fb8608cb75a69a7b01b7096338428"}],"0xD2751030a5007895968414443efae561BdCB1Af2":[{wallet:"0x3c7eCbe20caf91F377F021560a13D53ef3a1BA11",subdigest:"0x2872f961dd02e7b3fabd4a7bed036259085de28fe2f1c0f49a5d1be6ae4c7b07"}],"0xD721d5849fDE7862E77D251B6fA711114f4579Ab":[{wallet:"0x77415fb6aFe8A13275b088f1e197Bd9EDa1AA95C",subdigest:"0xc775316600b59750707446a7915cf88cc6f1827ce931dd688bf5990a7b95ec29"}],"0xE1B6c2c194dF83A8E01F8C582ddA58840fE46318":[{wallet:"0xFbBFA86B877EAFa40699078E4eC1B544D2168dFC",subdigest:"0xde7ebed8b2c62552e8ff5a08d2e5b33d336d709e6cf2812b9874cd7b5fd5189e"}],"0xE5Ed2A916971Fa6fe07EbD4564DeAaF2c20A7684":[{wallet:"0xFDB7922bA08BAbad2e3e36b66e0521c7EEA0faEF"}],"0xF9ED1e54dc86Bf248FBe059D4aEfD8183F0A816F":[{wallet:"0xCdFdaDB6F2b2f3c7db93521AbD05a3C32aF6b226",subdigest:"0x0433c483ced183cee562b8061788fc93d0c9f666af896096a5e184076f787eac"}],"0xa3CF0b935AccFd8bbE569B984D9Bc7Ec775ce22d":[{wallet:"0x23C6B8E47fa9f40e73E6627598d13085130f3ed6",subdigest:"0x13e9cd21769bc2a4f779b0f73c1cc7ca6c96c6af3262721eec17ac72104fef32"}],"0xbe9f4fB13fbC98042a32dC8354A339258abf1456":[{wallet:"0x81fF1aD4232671403e0f3CC85D021144511E3B6e",subdigest:"0x130c5b993a04ab84b0b074ea69241d6f3c040eced24dbe7c2015263718526670"}],"0xd4b26195aD1487DE6a42Fd69bC81CEbc8b86f0b5":[{wallet:"0xF36A0bd53d85307b35f90756263984329FBfA176",subdigest:"0x13d918ac4e97df0477fcab1c210ef1f96a999abe64dd07e48017b96c4902f50b"}],"0xdaD0038b8BBf78Ac84a4566E75269339Daa0dEdC":[{wallet:"0x8Fd48EB1ecDc0652306de1A0A8BA5561Ba733351",subdigest:"0x3541d7b2f07d87fa8b30c9ef1594da2353d45c40830f0c8e01126e3c89b9b508"}],"0xe7d51Cd5097A287a3B63014dc453Cfb8D9A03152":[{wallet:"0x4E5B1F98F81372BD4B763Be9bF50Aa6C5B7b9913",subdigest:"0x818fbd74398f446b4d7fcb207bf6377393fa923732243995d8464844ec8d42ce"}],"0xed7F28464630398E06e0Fa0Fc04FEa2fe40427aB":[{wallet:"0x6D0f613C239ed1d409C4e41758ACd55E0b1Cb410",subdigest:"0xe6baef08a191785d5d3897cb3e96f3473585d2f034657a4134754c5206b87268"}],"0xf24d3aFE0768827EAe9f671F3C1c283BfFAF0C19":[{wallet:"0xf03Bf61943e00fa3557E496409e1E9c95a1c24E4",subdigest:"0x3d1192dcd531e9ec60795b4129b03eb54b9226bc2d08be3f2b2524ae80244afb"}],"0xf3bf75114bEf71abE4E87f8CA4dD82E372b948A9":[{wallet:"0x3e270820e36EC3C29903C2635B0f53f192Dc29ab",subdigest:"0x70f563cb3ba62214e88d61e55450a8f4245bc5666aa006c93802ad2e96d3ac05"}],"0xf95C86e3a52dEbf8b984983852CAc5d8652C8A9A":[{wallet:"0xb07d236F2B5d1f4AB12236e94ac8049dE40321F4",subdigest:"0x877c04b91ea48703e9cc936f4506d89943ed8b9ec32b15990eea41ce0c59dde7"}],"0xfed1D937a8708001A23AFD8AEd02f9E05de9f251":[{wallet:"0x6743b60A94898E228c5aa642A2e11cb595dCB1fB"}]};function w9e(){const t=Br(Mi),r=Br(Wn).networks.get(),[n,i]=N.useState(""),[s,o]=N.useState([]),[a,c]=N.useState(""),[l,f]=N.useState(""),[u,p]=N.useState(""),[g,y]=N.useState(!1),[b,I]=N.useState(!1),[C,S]=N.useState(!1),[R,L]=N.useState(""),[F,H]=N.useState(!1),[_,U]=N.useState(!1),[ie,ce]=N.useState(!1),K=on(t.isLoadingAccount);N.useEffect(()=>{if(L(""),!yw(n))return;U(!0);const x=Zt(n);B(x)},[n]);const k=()=>{const x=Zt(n);g?t.signInWithRecoveryMnemonic(x,a.trim(),l):t.signInWithRecoveryMnemonic(x,a.trim())},O=(x=a)=>x.replace(/\s+/g," ").trim().split(" ").length==12,v=()=>(l==null?void 0:l.length)>=8,m=async x=>{if(i(""),o([]),c(x),H(!1),!!O(x)){U(!0);try{const w=j5.fromPhrase(x),T=[...(await K_.walletsOfSigner({signer:w.address})).map(({wallet:P})=>P),...(b9e[w.address]??[]).map(({wallet:P})=>P)];S(!0),o(T),T.length===1&&i(T[0])}catch(w){console.error(w)}U(!1)}},M=async x=>{i(x),H(!1)},B=async x=>{try{const w=j5.fromPhrase(a),T=new eE([w]),oe=(await new Px({address:x,tracker:K_,contexts:nX,orchestrator:T,networks:r}).status(ge.MAINNET)).config,G=_s.genericCoderFor(oe.version).config.signersOf(oe).some(Z=>Z.address===w.address);H(G),G||L("Wallet does not match recovery phrase")}catch(w){L("Please ensure the RPC URL for Ethereum in Networks (top right) is correct"),console.error("failed to validate wallet address",w)}U(!1)},E=()=>{I(!b),i(s[0])};return W.jsxs(W.Fragment,{children:[W.jsx(we,{flexDirection:"row",width:"full",background:"backgroundMuted",justifyContent:"flex-end",paddingX:"20",paddingY:"4",style:{height:"64.12px"},children:W.jsx(Jt,{label:"Networks",variant:"text",onClick:()=>ce(!0)})}),W.jsxs(we,{background:"backgroundPrimary",width:"full",height:"full",paddingX:"8",alignItems:"center",justifyContent:"center",children:[W.jsxs(we,{width:"full",style:{maxWidth:"800px"},marginBottom:"16",children:[W.jsx(we,{padding:"6",marginTop:"16",children:W.jsxs(we,{flexDirection:"column",alignItems:"center",justifyContent:"center",gap:"6",children:[W.jsx("img",{src:yM,alt:"Sequence Logo",style:{width:"100px",height:"100px"}}),W.jsxs(Qe,{variant:"large",color:"text100",textAlign:"center",children:["Sequence ",W.jsx("br",{})," Wallet Recovery"]})]})}),W.jsxs(we,{marginTop:"12",children:[W.jsxs(we,{alignItems:"center",justifyContent:"center",flexDirection:"column",children:[W.jsx(Qe,{variant:"medium",color:"text100",textAlign:"center",children:"Enter your recovery phrase"}),W.jsxs(Qe,{variant:"normal",color:"text50",marginTop:"4",textAlign:"center",children:["This is the recovery phrase you create on"," ",W.jsx(Qe,{variant:"link",cursor:"pointer",color:"text80",onClick:()=>window.open("https://sequence.app/settings/recovery"),children:"sequence.app/settings/recovery"})]})]}),W.jsxs(we,{flexDirection:"column",marginTop:"12",children:[W.jsxs(we,{children:[W.jsx(Fwe,{name:"mnemonic",label:"Recovery Phrase",labelLocation:"top",value:a,onChange:x=>m(x.target.value)}),a&&!O()&&W.jsx(Qe,{variant:"small",color:"negative",marginLeft:"1",marginTop:"2",children:"Mnemonic must be 12 words"})]}),C&&O()&&W.jsxs(we,{flexDirection:"column",gap:"8",marginTop:"3",marginLeft:"1",children:[W.jsx(K4,{color:"primary",labelLocation:"right",label:W.jsx(Qe,{color:"text80",underline:"true",children:"Use Password to Encrypt Mnemonic (Recommended)"}),checked:g,onCheckedChange:x=>{y(x===!0)}}),g&&W.jsxs(we,{flexDirection:"column",gap:"3",children:[W.jsxs(we,{children:[W.jsx(Y_,{label:"Create Password (min 8 characters)",value:l,onChange:x=>f(x.target.value)}),l&&!v()&&W.jsx(Qe,{variant:"small",color:"negative",marginLeft:"1",marginTop:"2",children:"Password not long enough"})]}),W.jsxs(we,{children:[W.jsx(Y_,{label:"Confirm Password",value:u,onChange:x=>p(x.target.value)}),l&&u&&l!==u&&W.jsx(Qe,{variant:"small",color:"negative",marginLeft:"1",marginTop:"2",children:"Passwords must match"})]})]}),W.jsxs(we,{children:[W.jsx(Pu,{color:"white"}),W.jsx(we,{justifyContent:"flex-end",children:W.jsx(Qe,{marginRight:"1",variant:"small",color:"text80",cursor:"pointer",underline:"true",onClick:()=>{E()},children:b?"Go back to default wallet":"Enter another wallet"})})]}),(b||s.length>1)&&W.jsx(we,{flexDirection:"column",gap:"4",children:W.jsx(we,{display:"grid",gap:"4",style:{gridTemplateColumns:"1fr 1fr 1fr"},children:s.map(x=>W.jsx(Jt,{size:"lg",shape:"square",label:m9e(x,18,4),onClick:()=>{i(x)}},x))})}),W.jsxs(we,{children:[W.jsx(Pn,{name:"wallet",label:b?"Enter Address Manually":"Sequence Wallet Address",labelLocation:"left",disabled:!b,value:n,onChange:x=>M(x.target.value)}),R&&W.jsx(we,{justifyContent:"center",marginTop:"2",children:W.jsx(Qe,{variant:"small",color:"negative",children:R})})]})]}),_&&W.jsx(we,{alignItems:"center",justifyContent:"center",marginTop:"4",children:W.jsx(en,{width:"16",alignItems:"center",justifyContent:"center",children:W.jsx(fh,{size:"lg"})})})]})]}),W.jsxs(we,{alignItems:"center",justifyContent:"center",flexDirection:"column",children:[K&&W.jsx(we,{marginTop:"16",alignItems:"center",justifyContent:"center",children:W.jsx(en,{width:"16",alignItems:"center",justifyContent:"center",children:W.jsx(fh,{size:"lg"})})}),!K&&W.jsxs(W.Fragment,{children:[W.jsx(we,{children:W.jsx(Jt,{variant:"primary",size:"lg",shape:"square",label:"Continue",disabled:!a||!yw(n)||g&&(!l||l.length<8)||l!==u||F===!1,onClick:()=>{k()},width:"full",marginTop:"16"})}),W.jsx(we,{children:W.jsx(Jt,{as:QK,to:"/",variant:"text",size:"lg",shape:"square",label:"Go back to start",width:"full",marginTop:"6"})})]})]})]}),ie&&W.jsx(Ko,{onClose:()=>ce(!1),children:W.jsx(gM,{})})]})]})}const x9e="modulepreload",E9e=function(t){return"/"+t},ij={},C9e=function(e,r,n){let i=Promise.resolve();if(r&&r.length>0){document.getElementsByTagName("link");const o=document.querySelector("meta[property=csp-nonce]"),a=(o==null?void 0:o.nonce)||(o==null?void 0:o.getAttribute("nonce"));i=Promise.allSettled(r.map(c=>{if(c=E9e(c),c in ij)return;ij[c]=!0;const l=c.endsWith(".css"),f=l?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${c}"]${f}`))return;const u=document.createElement("link");if(u.rel=l?"stylesheet":x9e,l||(u.as="script"),u.crossOrigin="",u.href=c,a&&u.setAttribute("nonce",a),document.head.appendChild(u),l)return new Promise((p,g)=>{u.addEventListener("load",p),u.addEventListener("error",()=>g(new Error(`Unable to preload CSS for ${c}`)))})}))}function s(o){const a=new Event("vite:preloadError",{cancelable:!0});if(a.payload=o,window.dispatchEvent(a),!a.defaultPrevented)throw o}return i.then(o=>{for(const a of o||[])a.status==="rejected"&&s(a.reason);return e().catch(s)})};var mM={exports:{}},Vv=typeof Reflect=="object"?Reflect:null,sj=Vv&&typeof Vv.apply=="function"?Vv.apply:function(e,r,n){return Function.prototype.apply.call(e,r,n)},C3;Vv&&typeof Vv.ownKeys=="function"?C3=Vv.ownKeys:Object.getOwnPropertySymbols?C3=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:C3=function(e){return Object.getOwnPropertyNames(e)};function A9e(t){console&&console.warn&&console.warn(t)}var lX=Number.isNaN||function(e){return e!==e};function hn(){hn.init.call(this)}mM.exports=hn;mM.exports.once=T9e;hn.EventEmitter=hn;hn.prototype._events=void 0;hn.prototype._eventsCount=0;hn.prototype._maxListeners=void 0;var oj=10;function iE(t){if(typeof t!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}Object.defineProperty(hn,"defaultMaxListeners",{enumerable:!0,get:function(){return oj},set:function(t){if(typeof t!="number"||t<0||lX(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");oj=t}});hn.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0};hn.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||lX(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this};function fX(t){return t._maxListeners===void 0?hn.defaultMaxListeners:t._maxListeners}hn.prototype.getMaxListeners=function(){return fX(this)};hn.prototype.emit=function(e){for(var r=[],n=1;n0&&(o=r[0]),o instanceof Error)throw o;var a=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw a.context=o,a}var c=s[e];if(c===void 0)return!1;if(typeof c=="function")sj(c,this,r);else for(var l=c.length,f=vX(c,l),n=0;n0&&o.length>i&&!o.warned){o.warned=!0;var a=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");a.name="MaxListenersExceededWarning",a.emitter=t,a.type=e,a.count=o.length,A9e(a)}return t}hn.prototype.addListener=function(e,r){return uX(this,e,r,!1)};hn.prototype.on=hn.prototype.addListener;hn.prototype.prependListener=function(e,r){return uX(this,e,r,!0)};function S9e(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function dX(t,e,r){var n={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},i=S9e.bind(n);return i.listener=r,n.wrapFn=i,i}hn.prototype.once=function(e,r){return iE(r),this.on(e,dX(this,e,r)),this};hn.prototype.prependOnceListener=function(e,r){return iE(r),this.prependListener(e,dX(this,e,r)),this};hn.prototype.removeListener=function(e,r){var n,i,s,o,a;if(iE(r),i=this._events,i===void 0)return this;if(n=i[e],n===void 0)return this;if(n===r||n.listener===r)--this._eventsCount===0?this._events=Object.create(null):(delete i[e],i.removeListener&&this.emit("removeListener",e,n.listener||r));else if(typeof n!="function"){for(s=-1,o=n.length-1;o>=0;o--)if(n[o]===r||n[o].listener===r){a=n[o].listener,s=o;break}if(s<0)return this;s===0?n.shift():_9e(n,s),n.length===1&&(i[e]=n[0]),i.removeListener!==void 0&&this.emit("removeListener",e,a||r)}return this};hn.prototype.off=hn.prototype.removeListener;hn.prototype.removeAllListeners=function(e){var r,n,i;if(n=this._events,n===void 0)return this;if(n.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):n[e]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete n[e]),this;if(arguments.length===0){var s=Object.keys(n),o;for(i=0;i=0;i--)this.removeListener(e,r[i]);return this};function hX(t,e,r){var n=t._events;if(n===void 0)return[];var i=n[e];return i===void 0?[]:typeof i=="function"?r?[i.listener||i]:[i]:r?I9e(i):vX(i,i.length)}hn.prototype.listeners=function(e){return hX(this,e,!0)};hn.prototype.rawListeners=function(e){return hX(this,e,!1)};hn.listenerCount=function(t,e){return typeof t.listenerCount=="function"?t.listenerCount(e):pX.call(t,e)};hn.prototype.listenerCount=pX;function pX(t){var e=this._events;if(e!==void 0){var r=e[t];if(typeof r=="function")return 1;if(r!==void 0)return r.length}return 0}hn.prototype.eventNames=function(){return this._eventsCount>0?C3(this._events):[]};function vX(t,e){for(var r=new Array(e),n=0;n"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"?new N9e:typeof navigator<"u"?U9e(navigator.userAgent):q9e()}function j9e(t){return t!==""&&L9e.reduce(function(e,r){var n=r[0],i=r[1];if(e)return e;var s=i.exec(t);return!!s&&[n,s]},!1)}function U9e(t){var e=j9e(t);if(!e)return null;var r=e[0],n=e[1];if(r==="searchbot")return new O9e;var i=n[1]&&n[1].split(".").join("_").split("_").slice(0,3);i?i.lengtho.type===Bt.MAINNET),i=[];this.isFetchingBalances.set(!0),await Promise.allSettled(n.map(async o=>{if(!o.rpcUrl){console.warn(`No RPC URL found for network ${o.name}`);return}const a=new Py(o.rpcUrl);try{const c=await a.getBalance(e);i.push({contractType:hh.NATIVE,contractAddress:wu,tokenID:"",accountAddress:e,balance:c.toString(),chainId:o.chainId,blockHash:ty,blockNumber:0,contractInfo:d9e(ACe(o.chainId)),uniqueCollectibles:"0",isSummary:!0})}catch(c){console.error(c)}})),this.balances.set(i);const s=this.local.userAddedTokens.get()??[];this.userAddedTokens.set(s),s.length>0&&await Promise.allSettled(s.map(async o=>{await this.loadUserAddedTokenBalance(e,o)})),this.isFetchingBalances.set(!1)}async loadUserAddedTokenBalance(e,r){const n=this.store.get(Wn).providerForChainId(r.chainId);try{const s=await new Bn(r.address,qv,n).balanceOf(e),o=this.balances.get();if(!s){this.removeToken(r);return}o.push({contractType:r.contractType,contractAddress:r.address,tokenID:"",accountAddress:e,balance:s.toString(),chainId:r.chainId,blockHash:ty,blockNumber:0,contractInfo:{address:r.address,chainId:r.chainId,decimals:r.decimals,name:r.symbol,symbol:r.symbol,type:"ERC20",logoURI:"",deployed:!0,bytecodeHash:"",extensions:{link:"",description:"",ogImage:"",originAddress:"",originChainId:0,blacklist:!1,verified:!0,verifiedBy:"User",featured:!1},updatedAt:"0"},uniqueCollectibles:"0",isSummary:!0}),this.balances.set(o)}catch(i){console.error(i)}}async updateTokenBalance(e){const r=this.store.get(Wn).providerForChainId(e.chainId);this.isFetchingBalances.set(!0);const n=this.store.get(Mi).accountAddress.get();if(!n){console.warn("No account found");return}const i=this.balances.get();try{let s;e.contractType===hh.NATIVE?s=await r.getBalance(n):s=await new Bn(e.contractAddress,qv,r).balanceOf(n),i.map(o=>{o.contractAddress===e.contractAddress&&o.chainId===e.chainId&&(o.balance=s.toString())}),this.balances.set(i)}catch(s){console.error(s)}this.isFetchingBalances.set(!1)}async addToken(e){const r=this.local.userAddedTokens.get()??[];if(r.some(s=>s.chainId===e.chainId&&s.address===e.address))throw new Error(`Token with chainId ${e.chainId} and address ${e.address} already exists`);r.push(e),this.local.userAddedTokens.set(r),this.userAddedTokens.set(r);const i=this.store.get(Mi).accountAddress.get();i&&(this.isFetchingBalances.set(!0),await this.loadUserAddedTokenBalance(i,e),this.isFetchingBalances.set(!1))}async removeToken(e){const n=(this.local.userAddedTokens.get()??[]).filter(s=>!(s.chainId===e.chainId&&s.address===e.address));this.local.userAddedTokens.set(n),this.userAddedTokens.set(n);const i=this.balances.get().filter(s=>!(s.chainId===e.chainId&&s.contractAddress===e.address));this.balances.set(i)}async getTokenInfo(e,r){const n=this.store.get(Wn).providerForChainId(e);this.isFetchingTokenInfo.set(!0);try{const i=new Bn(r,qv,n),s=await i.decimals(),o=await i.symbol();if(this.isFetchingTokenInfo.set(!1),s&&o)return{decimals:Number(s),symbol:o};throw new Error(`Could not get decimals and symbol for token at ${r}`)}catch(i){throw console.error(i),new Error(`Error getting token info ${JSON.stringify(i)}`)}}clear(){this.local.userAddedTokens.set([]),this.isFetchingBalances.set(!1),this.isFetchingTokenInfo.set(!1),this.balances.set([])}}class Mi{constructor(e){ue(this,"isLoadingAccount",Or(!0));ue(this,"isPasswordSet",Or(!0));ue(this,"account");ue(this,"accountAddress",Or(void 0));ue(this,"isPromptingForPassword",Or(!1));this.store=e,this.loadAccount(),this.store.get(Wn).networks.subscribe(n=>{this.account&&this.loadAccount()}),this.accountAddress.subscribe(n=>{n&&this.store.get(Wn).accountLoaded.set(!0)}),ob(Da.SECURITY).then(async n=>{this.isPasswordSet.set(!n.get(Da.SECURITY,"key"))})}async signInWithRecoveryMnemonic(e,r,n){try{this.isLoadingAccount.set(!0);const i=j5.fromPhrase(r),s=new eE([i]),a=this.store.get(Wn).networks.get(),c=new Px({address:e,tracker:K_,contexts:nX,orchestrator:s,networks:a});n?await this.encryptRecoveryMnemonicWithPassword(r,c.address,n):await this.encryptRecoveryMnemonic(r,c.address),this.account=c,this.accountAddress.set(c.address)}catch(i){console.warn(i)}this.isLoadingAccount.set(!1)}async loadAccount(e){const r=await ob(Da.SECURITY),n=await r.get(Da.SECURITY,"mnemonic");var i=await r.get(Da.SECURITY,"key");let s;if(n&&!i&&!e){this.isPromptingForPassword.set(!0);return}n&&(i?s=await this.decryptRecoveryMnemonic(n,i):s=await this.decryptRecoveryMnemonicWithPassword(n,e)),s?e?this.signInWithRecoveryMnemonic(s.wallet,s.mnemonic,e):this.signInWithRecoveryMnemonic(s.wallet,s.mnemonic):setTimeout(()=>{this.isLoadingAccount.set(!1)},200)}async encryptRecoveryMnemonic(e,r){const n=await iAe(),i=JSON.stringify({wallet:r,mnemonic:e}),s=await HF(n,i);s.salt=zF(r);const o=await ob(Da.SECURITY);await o.put(Da.SECURITY,n,"key"),await o.put(Da.SECURITY,s,"mnemonic"),this.isPasswordSet.set(!1)}async encryptRecoveryMnemonicWithPassword(e,r,n){const i=zF(r),s=await VF(n,i),o=JSON.stringify({wallet:r,mnemonic:e}),a=await HF(s,o);a.salt=i,await(await ob(Da.SECURITY)).put(Da.SECURITY,a,"mnemonic"),this.isPasswordSet.set(!0)}async decryptRecoveryMnemonic(e,r){const n=await GF(r,e);return JSON.parse(n)}async decryptRecoveryMnemonicWithPassword(e,r){const n=e.salt,i=await VF(r,n),s=await GF(i,e);return JSON.parse(s)}logout(){this.account=void 0,this.accountAddress.set(void 0),bAe(Da.SECURITY);const e=this.store.get(Wn),r=this.store.get(nE);e.clear(),r.clear(),localStorage.clear()}}function p9e({onClose:t}){const e=Br(Wn),r=f8(),[n,i]=N.useState(),[s,o]=N.useState(),[a,c]=N.useState(),[l,f]=N.useState(),[u,p]=N.useState(),[g,y]=N.useState(),b=async()=>{if(n&&s&&a)await e.addNetwork({chainId:Number(n),name:s,title:s,type:Bt.MAINNET,rpcUrl:a,blockExplorer:l?{rootUrl:l}:void 0,nativeToken:{name:u||"Ether",symbol:g||"ETH",decimals:18}});else throw new Error("Please fill in all required fields, marked with *")},I=()=>{i(void 0),o(void 0),c(void 0),f(void 0),p(void 0),y(void 0)};return W.jsxs(we,{flexDirection:"column",width:"full",marginTop:"4",gap:"4",children:[W.jsx(Pn,{width:"full",label:"Chain ID*",labelLocation:"left",name:"chainId",value:n??"",onChange:C=>{i(C.target.value)}}),W.jsx(Pn,{width:"full",label:"Network Name*",labelLocation:"left",name:"networkName",value:s??"",onChange:C=>{o(C.target.value)}}),W.jsx(Pn,{width:"full",label:"RPC URL*",labelLocation:"left",name:"rpcUrl",value:a??"",onChange:C=>{c(C.target.value)}}),W.jsx(Pn,{width:"full",label:"Block explorer URL (optional)",labelLocation:"left",name:"rpcUrl",value:l??"",onChange:C=>{f(C.target.value)}}),W.jsx(Pn,{width:"full",label:"Native Token Name (default ETH)",labelLocation:"left",name:"tokenName",value:u??"",onChange:C=>{p(C.target.value)}}),W.jsx(Pn,{width:"full",label:"Native Token Symbol (default ETH)",labelLocation:"left",name:"tokenSymbol",value:g??"",onChange:C=>{y(C.target.value)}}),W.jsxs(we,{alignItems:"center",justifyContent:"flex-end",gap:"8",marginTop:"4",children:[W.jsx(Jt,{label:"Cancel",variant:"text",size:"md",shape:"square",onClick:()=>{I(),t()}}),W.jsx(Jt,{label:"Add",variant:"primary",size:"md",shape:"square",onClick:async()=>{try{await b(),r({variant:"success",title:"Network added",description:`You can now use ${s} network`}),I(),t()}catch(C){r({variant:"error",title:"Could not add network",description:C.message}),console.error(C)}}})]})]})}function nj({network:t}){var p,g;const e=Br(Wn),n=on(e.userAdditionNetworkChainIds).includes(t.chainId);N.useEffect(()=>{var y,b;(s!==t.rpcUrl||a!==((y=t.blockExplorer)==null?void 0:y.rootUrl)||l!==t.disabled)&&(o(t.rpcUrl),c(((b=t.blockExplorer)==null?void 0:b.rootUrl)??""),f(t.disabled))},[t]);const i=e.editedNetworkChainIds.get().includes(t.chainId),[s,o]=N.useState(t.rpcUrl),[a,c]=N.useState(((p=t.blockExplorer)==null?void 0:p.rootUrl)??""),[l,f]=N.useState(t.disabled),u=s!==t.rpcUrl||a!==((g=t.blockExplorer)==null?void 0:g.rootUrl)||l!==t.disabled;return W.jsxs(we,{flexDirection:"column",gap:"6",children:[W.jsx(we,{flexDirection:"row",gap:"3",children:W.jsx(K4,{label:W.jsx(Qe,{fontWeight:"bold",color:"text100",variant:"normal",children:t.title}),labelLocation:"right",color:"primary",checked:!l,onCheckedChange:y=>{f(!y)}})}),W.jsx(iP,{label:"Network Settings",children:W.jsxs(we,{flexDirection:"column",gap:"2",children:[W.jsx(Pn,{label:"RPC URL",labelLocation:"left",name:"rpcUrl",spellCheck:!1,disabled:n,value:s??"",onChange:y=>{o(y.target.value)}}),W.jsx(Pn,{label:"Block Explorer URL",labelLocation:"left",name:"blockExplorerUrl",spellCheck:!1,disabled:n,value:a??"",onChange:y=>{c(y.target.value)}})]})}),n&&W.jsxs(we,{marginTop:"4",alignItems:"center",justifyContent:"flex-end",gap:"5",children:[W.jsx(Qe,{variant:"small",color:"text50",children:"Added by you"}),W.jsx(Jt,{label:"Remove",variant:"danger",size:"md",shape:"square",onClick:()=>e.removeNetwork(t.chainId)})]}),(u||i)&&!n&&W.jsxs(we,{marginTop:"4",justifyContent:"flex-end",gap:"3",children:[W.jsx(W.Fragment,{children:i&&W.jsx(Jt,{label:"Reset to default",variant:"danger",size:"md",shape:"square",onClick:()=>e.resetNetworkEdit(t.chainId)})}),W.jsx(W.Fragment,{children:u&&W.jsx(Jt,{label:"Save",variant:"primary",size:"md",shape:"square",onClick:()=>{const y=t;y.rpcUrl=s,y.blockExplorer={rootUrl:a},y.relayer=E3(s),y.disabled=l,e.editNetwork(y)}})})]}),W.jsx(Pu,{})]})}function gM(){const t=Br(Wn),e=on(t.networks),r=e.filter(p=>p.type===Bt.MAINNET),n=on(t.userAdditionNetworkChainIds),i=r.sort((p,g)=>n.includes(p.chainId)?-1:1),s=e.filter(p=>p.type===Bt.TESTNET),o=on(t.arweaveGatewayUrl),a=on(t.arweaveGraphqlUrl),[c,l]=N.useState(Bt.MAINNET),[f,u]=N.useState(!1);return W.jsxs(we,{flexDirection:"column",paddingY:"4",paddingX:"8",background:"backgroundPrimary",width:"full",height:"full",alignItems:"center",children:[W.jsx(we,{children:W.jsx(Qe,{variant:"large",color:"text80",children:"Networks"})}),W.jsx(we,{width:"full",marginTop:"4",paddingBottom:"4",children:W.jsxs(swe,{value:c,onValueChange:p=>l(p),children:[W.jsx(we,{marginBottom:"10",children:W.jsx(iwe,{value:c,tabs:[{label:"Networks",value:Bt.MAINNET},{label:"Test Networks",value:Bt.TESTNET},{label:"Arweave",value:"arweave"}]})}),W.jsx(GA,{value:Bt.MAINNET,children:W.jsxs(we,{flexDirection:"column",gap:"2",children:[W.jsx(we,{width:"full",flexDirection:"column",alignItems:"flex-end",marginY:"4",children:f?W.jsx(p9e,{onClose:()=>u(!1)}):W.jsx(Jt,{label:"Add network",variant:"primary",size:"md",shape:"square",onClick:()=>{u(!0)}})}),W.jsx(W.Fragment,{children:i.map((p,g)=>W.jsx(nj,{network:p},g))})]})}),W.jsx(GA,{value:Bt.TESTNET,children:W.jsx(we,{flexDirection:"column",gap:"2",children:s.map((p,g)=>W.jsx(nj,{network:p},g))})}),W.jsx(GA,{value:"arweave",children:W.jsxs(we,{flexDirection:"column",gap:"2",children:[W.jsx(Qe,{fontWeight:"bold",color:"text100",children:"Arweave"}),W.jsx(Pn,{label:"Gateway URL",labelLocation:"left",name:"arweaveGatewayUrl",spellCheck:!1,value:o??"",onChange:p=>{t.arweaveGatewayUrl.set(p.target.value)}}),W.jsx(Pn,{label:"GraphQL URL",labelLocation:"left",name:"arweaveGraphqlUrl",spellCheck:!1,value:a??"",onChange:p=>{t.arweaveGraphqlUrl.set(p.target.value)}}),W.jsx(Pu,{})]})})]})})]})}const v9e="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20fill='none'%20viewBox='0%200%2024%2024'%20stroke-width='1.5'%20stroke='dimgray'%20class='size-6'%3e%3cpath%20stroke-linecap='round'%20stroke-linejoin='round'%20d='M3.98%208.223A10.477%2010.477%200%200%200%201.934%2012C3.226%2016.338%207.244%2019.5%2012%2019.5c.993%200%201.953-.138%202.863-.395M6.228%206.228A10.451%2010.451%200%200%201%2012%204.5c4.756%200%208.773%203.162%2010.065%207.498a10.522%2010.522%200%200%201-4.293%205.774M6.228%206.228%203%203m3.228%203.228%203.65%203.65m7.894%207.894L21%2021m-3.228-3.228-3.65-3.65m0%200a3%203%200%201%200-4.243-4.243m4.242%204.242L9.88%209.88'%20/%3e%3c/svg%3e",g9e="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20fill='none'%20viewBox='0%200%2024%2024'%20stroke-width='1.5'%20stroke='dimgray'%20class='size-6'%3e%3cpath%20stroke-linecap='round'%20stroke-linejoin='round'%20d='M2.036%2012.322a1.012%201.012%200%200%201%200-.639C3.423%207.51%207.36%204.5%2012%204.5c4.638%200%208.573%203.007%209.963%207.178.07.207.07.431%200%20.639C20.577%2016.49%2016.64%2019.5%2012%2019.5c-4.638%200-8.573-3.007-9.963-7.178Z'%20/%3e%3cpath%20stroke-linecap='round'%20stroke-linejoin='round'%20d='M15%2012a3%203%200%201%201-6%200%203%203%200%200%201%206%200Z'%20/%3e%3c/svg%3e",Y_=({label:t,labelLocation:e="top",value:r,onKeyPress:n,onChange:i,autoFocus:s=!1})=>{const[o,a]=N.useState(!1),c=()=>{a(!o)};return W.jsxs("div",{style:{position:"relative",width:"100%"},children:[W.jsx(Pn,{type:o?"text":"password",name:"password",label:t,labelLocation:e,value:r,onKeyPress:n,onChange:i,autoFocus:s}),W.jsx("button",{type:"button",onClick:c,style:{position:"absolute",top:"50%",right:"12px",transform:"translateY(5%)",background:"none",border:"none",cursor:"pointer"},children:o?W.jsx("img",{src:v9e,style:{width:"25px",height:"25px"}}):W.jsx("img",{src:g9e,style:{width:"25px",height:"25px"}})})]})},yM="/assets/sequence-logo-B9LB7ao9.svg";function y9e(){const t=Br(Mi),e=on(t.isLoadingAccount),r=on(t.isPromptingForPassword),[n,i]=N.useState(""),[s,o]=N.useState(!1),[a,c]=N.useState(!1),[l,f]=N.useState(!1),u=async()=>{try{await t.loadAccount(n)}catch(y){console.warn(y),c(!0)}},p=()=>{o(!0)},g=()=>{t.logout(),o(!1),t.isLoadingAccount.set(!1)};return W.jsxs(W.Fragment,{children:[W.jsx(we,{flexDirection:"row",width:"full",background:"backgroundMuted",justifyContent:"flex-end",paddingX:"20",paddingY:"4",style:{height:"64.12px"},children:W.jsx(Jt,{label:"Networks",variant:"text",onClick:()=>f(!0)})}),W.jsxs(we,{background:"backgroundPrimary",width:"full",height:"full",paddingX:"8",alignItems:"center",justifyContent:"center",children:[W.jsxs(we,{width:"full",style:{maxWidth:"800px"},children:[W.jsx(we,{padding:"6",marginTop:"16",children:W.jsxs(we,{flexDirection:"column",alignItems:"center",justifyContent:"center",gap:"6",children:[W.jsx("img",{src:yM,alt:"Sequence Logo",style:{width:"100px",height:"100px"}}),W.jsxs(Qe,{variant:"large",color:"text100",textAlign:"center",children:["Sequence ",W.jsx("br",{})," Wallet Recovery"]})]})}),!e&&W.jsxs(W.Fragment,{children:[W.jsx(we,{marginTop:"8",children:W.jsxs(en,{flexDirection:"column",gap:"6",children:[W.jsx(Qe,{variant:"medium",color:"warning",textAlign:"center",children:"Warning section"}),W.jsx(Qe,{variant:"normal",color:"text100",marginBottom:"4",children:"At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga. At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga."})]})}),W.jsxs(we,{alignItems:"center",justifyContent:"center",flexDirection:"column",children:[W.jsx(we,{children:W.jsx(Jt,{as:QK,to:"/recovery",variant:"primary",size:"lg",shape:"square",label:"Start Recovery",width:"full",marginTop:"16"})}),W.jsx(we,{children:W.jsx(Jt,{variant:"text",size:"lg",shape:"square",label:"Learn more",width:"full",marginTop:"6"})})]})]}),e&&W.jsx(W.Fragment,{children:r?W.jsxs(we,{flexDirection:"column",marginTop:"8",justifyContent:"center",alignItems:"center",children:[W.jsx(Qe,{variant:"large",color:"text100",marginBottom:"8",children:"Welcome back!"}),W.jsx(Y_,{label:"Password",value:n,onKeyPress:y=>{y.key==="Enter"&&u()},onChange:y=>{i(y.target.value),c(!1)},autoFocus:!0}),W.jsx(we,{alignSelf:"flex-start",height:"6",children:a&&W.jsx(Qe,{variant:"small",color:"negative",marginLeft:"2",marginTop:"1",children:"Incorrect password"})}),W.jsx(Jt,{marginBottom:"3",variant:"primary",size:"lg",shape:"square",label:"Unlock",onClick:()=>{u()}}),W.jsx(we,{children:W.jsx(Jt,{variant:"text",label:"Forgot your password?",onClick:()=>{p()}})})]}):W.jsx(we,{marginTop:"8",alignItems:"center",justifyContent:"center",children:W.jsx(en,{width:"16",alignItems:"center",justifyContent:"center",children:W.jsx(fh,{size:"lg"})})})})]}),s&&W.jsx(Ko,{size:"md",onClose:()=>o(!1),children:W.jsxs(we,{flexDirection:"column",alignItems:"center",padding:"16",children:[W.jsxs(Qe,{variant:"md",color:"text100",children:["Click ",W.jsx(Qe,{fontWeight:"bold",children:"Reset"})," to start over. This will require you to re-enter your mnemonic."]}),W.jsxs(we,{flexDirection:{sm:"column",md:"row"},gap:"2",width:"full",marginTop:"10",children:[W.jsx(Jt,{width:"full",label:"Cancel",onClick:()=>{o(!1)},"data-id":"signingCancel"}),W.jsx(Jt,{width:"full",variant:"primary",label:"Reset",onClick:()=>{g()},"data-id":"signingContinue"})]})]})}),l&&W.jsx(Ko,{onClose:()=>f(!1),children:W.jsx(gM,{})})]})]})}function m9e(t,e=6,r=4){if(t.length<=e+r+3)return t;const n=t.slice(0,e),i=t.slice(-r);return`${n}...${i}`}const b9e={"0x087Aa00C1f09464D1D6a9Ff0eE2377dBB7c7B324":[{wallet:"0xaf39AE56e001250FaCBd122b11A90d32A0aD6686",subdigest:"0x0f4490a7aa40f15929635252953ce594ba3342401c2c53eff56451dc147475da"}],"0x09A820a9109E5EC82DCfF24484b2047739a92Abc":[{wallet:"0xcF47342c7064AAA5BA0F4163bEA0c7545756b8BF",subdigest:"0xa598ddbe6372b985f60367a1a9c12cb99e20e38c782d9bc941ddaa9f4c9296e5"}],"0x0aBb5b9d20f06DAdF752CEeBe4df26E585A1d897":[{wallet:"0x3F00C5A7fEadD358429645b29b3d776C5f61892d",subdigest:"0x7c33d7864e6e6f92e39328b407fc8fa0206c6ebdb5a31d9056dcc96bba5eb108"}],"0x0f286489b5b85EAcC4E00e1902e138b5Aa662F1c":[{wallet:"0xD1Dda66401B40c7e9924200f5f9913C00c638f79",subdigest:"0x76009a037ebbb28a9f71f1e68c38291e3b2b1a4bf772a56a79e1a6336cbbc7ab"}],"0x1A535D13c62F240cC7985B05a0229182D546550e":[{wallet:"0x46Ba18e7eCB93362A1804cC47EaD90244945016D",subdigest:"0x0acff6ca38c72b9287ba8163569a452ce12c9ffd64c082feba8a5f7300546579"}],"0x1B9498d7177a09d98ABE532e472e1b9f32dAc9B8":[{wallet:"0x848045071DbdBa2F352dF2f0335e02ba61f205aC"}],"0x253ff3Dd87c440A9565814756f85219F487e2FFe":[{wallet:"0xd18a46E40b29FA6CFC0D9f5A930E72cD0EC1e4D2",subdigest:"0x12822b7fde91535103ee7757fe362bfdca0dc2e25211c6ca7c133c20a66d604f"}],"0x27D263a5707510378823fa496674EeC7656780B6":[{wallet:"0xBc4f7bB193ac09D7eC53eF0a499B073A296A94f0",subdigest:"0xbf3913760753e93aba2f40235dd03e693f85853d7c9f9c5f1f62ce7ee91c6313"}],"0x36fA6B68007575C100c1C2916942ee857dE0778E":[{wallet:"0x52CE3cab58639223cf870A73942175e6C7BA9A0C",subdigest:"0x455b01f5c47ece34a3f4dee5d9b3d3b590d524029f4e845b2d4eccb7e8d9472b"}],"0x3Ed9724712417687eb0eaBc2cA2e452E3d2DCdEc":[{wallet:"0x4955338954fFF19396Fe4bA17D93370cA8b77d2B",subdigest:"0x96c4ddf36a03af12b56cf6dc618ab83d814b86a01c69464f1b94bfca826e47fa"}],"0x3F0c7e32678Bc6dCf9dEfB6368EcaE7B88C69036":[{wallet:"0x592625C316A2F184F0C6a4b2952e9b40Ef111a26",subdigest:"0x5e9cf684e8dcf38d5b079a89ff4644de144c85ca16e3b618ab4ae490becff25f"},{wallet:"0xEBB418588FFc0785B6a2559a281A37c117679D6F",subdigest:"0x98be9228917ad8193e14102ed0a989689ec6af1f04bd731f3cca43c02c1abc07"}],"0x4577CAF3A5caBcaF2038863d361cb32f423d5d53":[{wallet:"0xF68f5A97abAAa940A9Ad3AeD723C2179F8551502",subdigest:"0x336448a71e4188cd95c39b278d6d26144d51dc5b3edfdd2af67c3b0425a2e2d3"}],"0x50d27302c45FE4FC8d7cc435920a22D477d3DEB2":[{wallet:"0x97692217ca8e06D7156ef7f4606faB4624bd10C0",subdigest:"0x898993e7c2394c1c9b63b2cfa637a8a2c7b04ce9387c9ecc9c56ef1f56ae58be"}],"0x57160B380fF4Edf3DA3b1c27e723dc2AB3f057Be":[{wallet:"0xD1Dda66401B40c7e9924200f5f9913C00c638f79",subdigest:"0x89f982d77ae08a8ea17d6755d297615f5756e5363db8a9b95758d5a981f8e4ae"}],"0x6647b94603e0D90265d8869a3656C1b0F9B6caC5":[{wallet:"0x6cDe6f20610FF172Cd838CDF69Aae3c27521CBa4",subdigest:"0xab2d0dbda84cffb9a3934412172236a9d98fd3d6b80d47b35956cc5f935c69de"}],"0x69DD1F76595E8a49252F16DDa69474c3a818E3c0":[{wallet:"0x756F9E22591e0aC2Aa0C365708aF0a516F269979",subdigest:"0x261126c464ac19bb769c407ec28fe026f297357938ba9024bd66bb5a48ca9349"}],"0x6Ae23160FBB280Ae4eE78C476ca9FDb51bBcC444":[{wallet:"0xDfA3338DD0147b5e7793cE040F92462177e00024",subdigest:"0xae67c59800e8dd98b955a5fb857c39971fe5fb29e3e5083246fd122b37c4ee88"}],"0x6B917b4459Db2C9cb774e0a9B0eee668273e191a":[{wallet:"0x676b5FaCD2380F51d4EB1A2492057A31FfB100c5",subdigest:"0x60a62db58b5be8277ff22e8104ead5c4d87d6d1173fd7b2b0174978e663974c7"}],"0x6b593de1F2c6cEf51693323edc4467c2A4D5B78B":[{wallet:"0xD9DF096A66A89e63eE977C5Fda59a65f872a6901",subdigest:"0x8ef909db0fd633cac1445a89dace09c5b2fa1bda2d85e5915f6afc2d547f6a87"}],"0x6c77214450C1060f2f6a093c8054278b77E8769b":[{wallet:"0x16b47E837ff421382D516cA5A79b76aFd8473675",subdigest:"0x67521db115964b2559b99d5854ab07bae09e6e6cb0c1cd3de3d1f553c31c515f"}],"0x70F2E179c95a6e3b9a2Fe742B88568a12FFF7f8B":[{wallet:"0x649ba7F76D856aB021C9EEB8bac3B46f3e72EfD0",subdigest:"0x178be5e2d834d0224794dfbe49cf9621127d3396b75246a32093a21e6db320eb"}],"0x77fCC4D33ae477f217a09Ec8dBEBC22E7e8F5e33":[{wallet:"0xD09C7A6Af7046F45343978A1620391D6237c3762",subdigest:"0xca780c4505a811222e215eceeb2b28f222c1a6b126e9ccc86560f5199c34d5da"}],"0x78C22edc81d7a7A1D690e6C91824Cf9Eff2760c8":[{wallet:"0xFbBFA86B877EAFa40699078E4eC1B544D2168dFC",subdigest:"0xd84553d4372b26e3eb96fa77bd157e4e1b593bff1c54c7e69ad8857673d2266e"}],"0x79621cB0c2c8FbB8Ca20E4177b7DF0Aa7a931e73":[{wallet:"0x3c7eCbe20caf91F377F021560a13D53ef3a1BA11",subdigest:"0xbd64f6f75e64b49c6a4f46b2715ca3bf11e21a7e07702b89ea1607e3884e9d40"}],"0x79A7DF6E89da1AEa293bFa11987d7CE828223a7A":[{wallet:"0x76799a33838A6E0d1160D26e8C47EA9f0e65AF1A",subdigest:"0x858235d87309c9e2d72dca9bfa41b61fbb635ac6d9e099b868ff8a8c99bf8c37"}],"0x7b1A301155c0Fad8e5b95055e2A100333D464eA3":[{wallet:"0x76799a33838A6E0d1160D26e8C47EA9f0e65AF1A",subdigest:"0x31001033b765a3cc9407304daeafeeda015d318e73be3de8832a9dc1377f9340"}],"0x85c5B1f9464723A2cC81F69A71a11dA528E0CBCe":[{wallet:"0xF178cE73DB2bA1C575D5c63ecA490b09ec31949b",subdigest:"0x65e9c76ef7e14697c6fd1822fbd39719b43091f13d2d051c911d1373175c2c42"}],"0x943237FFB0024Bf758A79db00e043789FD8299f0":[{wallet:"0x639b6017C4b8F8a5322205A68a1331A817Dd46e2",subdigest:"0xa3bc90cafcccb0fe0b8c0939fa908216ddc667d6b022fe54efca05ec815c163c"}],"0x9EeA332285d7B3755CB46f7D0D49CF0edcC112Ef":[{wallet:"0x04EfBe99e49001b78bB68c35B0354CD4a2Ac4Fd8",subdigest:"0xd3c43ef36d4347d1b5323fa188cf8482de05631a86bc05b12b8ce3b661f4d2f9"}],"0x9b704574e65F8b785FD125F5f3C4F7E34690Bd02":[{wallet:"0xBA9498300dFE650a2b59A42271ec771B6Ed6a091",subdigest:"0x9894f57b20f78245e02d424a21f0d361038905285f53c51c1949e27f39a9fbb8"}],"0xA923984d96b7327c60f246da366b2525B34C6984":[{wallet:"0x7ae10aA190513577D9Ac9ae146128d97df4F4fF0",subdigest:"0x3b849360d50831070d92bec368b63cf0725525cd7b60f406cee5357731b75457"}],"0xACFC6D1DB5875Cb72E1b6BaddaCe28F45044ee6a":[{wallet:"0xAdAf943368aB95208763ccAcCD5ecB9a7772de40",subdigest:"0xb0d0da150a42bca8103e1c40e5e99c7a190043b3121f52c6d41ae473597d0ebe"}],"0xB278dd7c9FC754dBc82Ac29C6f78B6301BE8E8C6":[{wallet:"0xeCc653CB03a9B6587Bcb58A8372535b6Ea5a17d6",subdigest:"0x6fd9bb4768107b4bd0f3c8e11b00027ee5e6417b1d4ab3d5e56c1724eeb2e3b2"}],"0xBaA9D704C8244071e6B9bF6BcbC2c2281dB75096":[{wallet:"0xb547CcA265A91f7a92d9a97804807962B2A4D7d8",subdigest:"0xfca7ea635bf9e89d7034ce6d9378ff6948eaa340ab2d428e5b157efc82b9f8d5"}],"0xC29fD04F9079c36dC15549e8AAF8F058214F0Dae":[{wallet:"0xB7005885711d54BD3594Be1955266d37470BD053",subdigest:"0xb0bc66ea204ea2cb93ca190189471392b59fb8608cb75a69a7b01b7096338428"}],"0xD2751030a5007895968414443efae561BdCB1Af2":[{wallet:"0x3c7eCbe20caf91F377F021560a13D53ef3a1BA11",subdigest:"0x2872f961dd02e7b3fabd4a7bed036259085de28fe2f1c0f49a5d1be6ae4c7b07"}],"0xD721d5849fDE7862E77D251B6fA711114f4579Ab":[{wallet:"0x77415fb6aFe8A13275b088f1e197Bd9EDa1AA95C",subdigest:"0xc775316600b59750707446a7915cf88cc6f1827ce931dd688bf5990a7b95ec29"}],"0xE1B6c2c194dF83A8E01F8C582ddA58840fE46318":[{wallet:"0xFbBFA86B877EAFa40699078E4eC1B544D2168dFC",subdigest:"0xde7ebed8b2c62552e8ff5a08d2e5b33d336d709e6cf2812b9874cd7b5fd5189e"}],"0xE5Ed2A916971Fa6fe07EbD4564DeAaF2c20A7684":[{wallet:"0xFDB7922bA08BAbad2e3e36b66e0521c7EEA0faEF"}],"0xF9ED1e54dc86Bf248FBe059D4aEfD8183F0A816F":[{wallet:"0xCdFdaDB6F2b2f3c7db93521AbD05a3C32aF6b226",subdigest:"0x0433c483ced183cee562b8061788fc93d0c9f666af896096a5e184076f787eac"}],"0xa3CF0b935AccFd8bbE569B984D9Bc7Ec775ce22d":[{wallet:"0x23C6B8E47fa9f40e73E6627598d13085130f3ed6",subdigest:"0x13e9cd21769bc2a4f779b0f73c1cc7ca6c96c6af3262721eec17ac72104fef32"}],"0xbe9f4fB13fbC98042a32dC8354A339258abf1456":[{wallet:"0x81fF1aD4232671403e0f3CC85D021144511E3B6e",subdigest:"0x130c5b993a04ab84b0b074ea69241d6f3c040eced24dbe7c2015263718526670"}],"0xd4b26195aD1487DE6a42Fd69bC81CEbc8b86f0b5":[{wallet:"0xF36A0bd53d85307b35f90756263984329FBfA176",subdigest:"0x13d918ac4e97df0477fcab1c210ef1f96a999abe64dd07e48017b96c4902f50b"}],"0xdaD0038b8BBf78Ac84a4566E75269339Daa0dEdC":[{wallet:"0x8Fd48EB1ecDc0652306de1A0A8BA5561Ba733351",subdigest:"0x3541d7b2f07d87fa8b30c9ef1594da2353d45c40830f0c8e01126e3c89b9b508"}],"0xe7d51Cd5097A287a3B63014dc453Cfb8D9A03152":[{wallet:"0x4E5B1F98F81372BD4B763Be9bF50Aa6C5B7b9913",subdigest:"0x818fbd74398f446b4d7fcb207bf6377393fa923732243995d8464844ec8d42ce"}],"0xed7F28464630398E06e0Fa0Fc04FEa2fe40427aB":[{wallet:"0x6D0f613C239ed1d409C4e41758ACd55E0b1Cb410",subdigest:"0xe6baef08a191785d5d3897cb3e96f3473585d2f034657a4134754c5206b87268"}],"0xf24d3aFE0768827EAe9f671F3C1c283BfFAF0C19":[{wallet:"0xf03Bf61943e00fa3557E496409e1E9c95a1c24E4",subdigest:"0x3d1192dcd531e9ec60795b4129b03eb54b9226bc2d08be3f2b2524ae80244afb"}],"0xf3bf75114bEf71abE4E87f8CA4dD82E372b948A9":[{wallet:"0x3e270820e36EC3C29903C2635B0f53f192Dc29ab",subdigest:"0x70f563cb3ba62214e88d61e55450a8f4245bc5666aa006c93802ad2e96d3ac05"}],"0xf95C86e3a52dEbf8b984983852CAc5d8652C8A9A":[{wallet:"0xb07d236F2B5d1f4AB12236e94ac8049dE40321F4",subdigest:"0x877c04b91ea48703e9cc936f4506d89943ed8b9ec32b15990eea41ce0c59dde7"}],"0xfed1D937a8708001A23AFD8AEd02f9E05de9f251":[{wallet:"0x6743b60A94898E228c5aa642A2e11cb595dCB1fB"}]};function w9e(){const t=Br(Mi),r=Br(Wn).networks.get(),[n,i]=N.useState(""),[s,o]=N.useState([]),[a,c]=N.useState(""),[l,f]=N.useState(""),[u,p]=N.useState(""),[g,y]=N.useState(!1),[b,I]=N.useState(!1),[C,S]=N.useState(!1),[R,L]=N.useState(""),[F,H]=N.useState(!1),[_,U]=N.useState(!1),[ie,ce]=N.useState(!1),K=on(t.isLoadingAccount);N.useEffect(()=>{if(L(""),!yw(n))return;U(!0);const x=Zt(n);B(x)},[n]);const k=()=>{const x=Zt(n);g?t.signInWithRecoveryMnemonic(x,a.trim(),l):t.signInWithRecoveryMnemonic(x,a.trim())},O=(x=a)=>x.replace(/\s+/g," ").trim().split(" ").length==12,v=()=>(l==null?void 0:l.length)>=8,m=async x=>{if(i(""),o([]),c(x),H(!1),!!O(x)){U(!0);try{const w=j5.fromPhrase(x),T=[...(await K_.walletsOfSigner({signer:w.address})).map(({wallet:P})=>P),...(b9e[w.address]??[]).map(({wallet:P})=>P)];S(!0),o(T),T.length===1&&i(T[0])}catch(w){console.error(w)}U(!1)}},M=async x=>{i(x),H(!1)},B=async x=>{try{const w=j5.fromPhrase(a),T=new eE([w]),oe=(await new Px({address:x,tracker:K_,contexts:nX,orchestrator:T,networks:r}).status(ge.MAINNET)).config,G=_s.genericCoderFor(oe.version).config.signersOf(oe).some(Z=>Z.address===w.address);H(G),G||L("Wallet does not match recovery phrase")}catch(w){L("Please ensure the RPC URL for Ethereum in Networks (top right) is correct"),console.error("failed to validate wallet address",w)}U(!1)},E=()=>{I(!b),i(s[0])};return W.jsxs(W.Fragment,{children:[W.jsx(we,{flexDirection:"row",width:"full",background:"backgroundMuted",justifyContent:"flex-end",paddingX:"20",paddingY:"4",style:{height:"64.12px"},children:W.jsx(Jt,{label:"Networks",variant:"text",onClick:()=>ce(!0)})}),W.jsxs(we,{background:"backgroundPrimary",width:"full",height:"full",paddingX:"8",alignItems:"center",justifyContent:"center",children:[W.jsxs(we,{width:"full",style:{maxWidth:"800px"},marginBottom:"16",children:[W.jsx(we,{padding:"6",marginTop:"16",children:W.jsxs(we,{flexDirection:"column",alignItems:"center",justifyContent:"center",gap:"6",children:[W.jsx("img",{src:yM,alt:"Sequence Logo",style:{width:"100px",height:"100px"}}),W.jsxs(Qe,{variant:"large",color:"text100",textAlign:"center",children:["Sequence ",W.jsx("br",{})," Wallet Recovery"]})]})}),W.jsxs(we,{marginTop:"12",children:[W.jsxs(we,{alignItems:"center",justifyContent:"center",flexDirection:"column",children:[W.jsx(Qe,{variant:"medium",color:"text100",textAlign:"center",children:"Enter your recovery phrase"}),W.jsxs(Qe,{variant:"normal",color:"text50",marginTop:"4",textAlign:"center",children:["This is the recovery phrase you create on"," ",W.jsx(Qe,{variant:"link",cursor:"pointer",color:"text80",onClick:()=>window.open("https://sequence.app/settings/recovery"),children:"sequence.app/settings/recovery"})]})]}),W.jsxs(we,{flexDirection:"column",marginTop:"12",children:[W.jsxs(we,{children:[W.jsx(Fwe,{name:"mnemonic",label:"Recovery Phrase",labelLocation:"top",value:a,onChange:x=>m(x.target.value)}),a&&!O()&&W.jsx(Qe,{variant:"small",color:"negative",marginLeft:"1",marginTop:"2",children:"Mnemonic must be 12 words"})]}),C&&O()&&W.jsxs(we,{flexDirection:"column",gap:"8",marginTop:"3",marginLeft:"1",children:[W.jsx(K4,{color:"primary",labelLocation:"right",label:W.jsx(Qe,{color:"text80",underline:"true",children:"Use Password to Encrypt Mnemonic (Recommended)"}),checked:g,onCheckedChange:x=>{y(x===!0)}}),g&&W.jsxs(we,{flexDirection:"column",gap:"3",children:[W.jsxs(we,{children:[W.jsx(Y_,{label:"Create Password (min 8 characters)",value:l,onChange:x=>f(x.target.value)}),l&&!v()&&W.jsx(Qe,{variant:"small",color:"negative",marginLeft:"1",marginTop:"2",children:"Password not long enough"})]}),W.jsxs(we,{children:[W.jsx(Y_,{label:"Confirm Password",value:u,onChange:x=>p(x.target.value)}),l&&u&&l!==u&&W.jsx(Qe,{variant:"small",color:"negative",marginLeft:"1",marginTop:"2",children:"Passwords must match"})]})]}),W.jsxs(we,{children:[W.jsx(Pu,{color:"white"}),W.jsx(we,{justifyContent:"flex-end",children:W.jsx(Qe,{marginRight:"1",variant:"small",color:"text80",cursor:"pointer",underline:"true",onClick:()=>{E()},children:b?"Go back to default wallet":"Enter another wallet"})})]}),(b||s.length>1)&&W.jsx(we,{flexDirection:"column",gap:"4",children:W.jsx(we,{display:"grid",gap:"4",style:{gridTemplateColumns:"1fr 1fr 1fr"},children:s.map(x=>W.jsx(Jt,{size:"lg",shape:"square",label:m9e(x,18,4),onClick:()=>{i(x)}},x))})}),W.jsxs(we,{children:[W.jsx(Pn,{name:"wallet",label:b?"Enter Address Manually":"Sequence Wallet Address",labelLocation:"left",disabled:!b,value:n,onChange:x=>M(x.target.value)}),R&&W.jsx(we,{justifyContent:"center",marginTop:"2",children:W.jsx(Qe,{variant:"small",color:"negative",children:R})})]})]}),_&&W.jsx(we,{alignItems:"center",justifyContent:"center",marginTop:"4",children:W.jsx(en,{width:"16",alignItems:"center",justifyContent:"center",children:W.jsx(fh,{size:"lg"})})})]})]}),W.jsxs(we,{alignItems:"center",justifyContent:"center",flexDirection:"column",children:[K&&W.jsx(we,{marginTop:"16",alignItems:"center",justifyContent:"center",children:W.jsx(en,{width:"16",alignItems:"center",justifyContent:"center",children:W.jsx(fh,{size:"lg"})})}),!K&&W.jsxs(W.Fragment,{children:[W.jsx(we,{children:W.jsx(Jt,{variant:"primary",size:"lg",shape:"square",label:"Continue",disabled:!a||!yw(n)||g&&(!l||l.length<8)||l!==u||F===!1,onClick:()=>{k()},width:"full",marginTop:"16"})}),W.jsx(we,{children:W.jsx(Jt,{as:QK,to:"/",variant:"text",size:"lg",shape:"square",label:"Go back to start",width:"full",marginTop:"6"})})]})]})]}),ie&&W.jsx(Ko,{onClose:()=>ce(!1),children:W.jsx(gM,{})})]})]})}const x9e="modulepreload",E9e=function(t){return"/"+t},ij={},C9e=function(e,r,n){let i=Promise.resolve();if(r&&r.length>0){document.getElementsByTagName("link");const o=document.querySelector("meta[property=csp-nonce]"),a=(o==null?void 0:o.nonce)||(o==null?void 0:o.getAttribute("nonce"));i=Promise.allSettled(r.map(c=>{if(c=E9e(c),c in ij)return;ij[c]=!0;const l=c.endsWith(".css"),f=l?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${c}"]${f}`))return;const u=document.createElement("link");if(u.rel=l?"stylesheet":x9e,l||(u.as="script"),u.crossOrigin="",u.href=c,a&&u.setAttribute("nonce",a),document.head.appendChild(u),l)return new Promise((p,g)=>{u.addEventListener("load",p),u.addEventListener("error",()=>g(new Error(`Unable to preload CSS for ${c}`)))})}))}function s(o){const a=new Event("vite:preloadError",{cancelable:!0});if(a.payload=o,window.dispatchEvent(a),!a.defaultPrevented)throw o}return i.then(o=>{for(const a of o||[])a.status==="rejected"&&s(a.reason);return e().catch(s)})};var mM={exports:{}},Vv=typeof Reflect=="object"?Reflect:null,sj=Vv&&typeof Vv.apply=="function"?Vv.apply:function(e,r,n){return Function.prototype.apply.call(e,r,n)},C3;Vv&&typeof Vv.ownKeys=="function"?C3=Vv.ownKeys:Object.getOwnPropertySymbols?C3=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:C3=function(e){return Object.getOwnPropertyNames(e)};function A9e(t){console&&console.warn&&console.warn(t)}var lX=Number.isNaN||function(e){return e!==e};function hn(){hn.init.call(this)}mM.exports=hn;mM.exports.once=T9e;hn.EventEmitter=hn;hn.prototype._events=void 0;hn.prototype._eventsCount=0;hn.prototype._maxListeners=void 0;var oj=10;function iE(t){if(typeof t!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}Object.defineProperty(hn,"defaultMaxListeners",{enumerable:!0,get:function(){return oj},set:function(t){if(typeof t!="number"||t<0||lX(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");oj=t}});hn.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0};hn.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||lX(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this};function fX(t){return t._maxListeners===void 0?hn.defaultMaxListeners:t._maxListeners}hn.prototype.getMaxListeners=function(){return fX(this)};hn.prototype.emit=function(e){for(var r=[],n=1;n0&&(o=r[0]),o instanceof Error)throw o;var a=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw a.context=o,a}var c=s[e];if(c===void 0)return!1;if(typeof c=="function")sj(c,this,r);else for(var l=c.length,f=vX(c,l),n=0;n0&&o.length>i&&!o.warned){o.warned=!0;var a=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");a.name="MaxListenersExceededWarning",a.emitter=t,a.type=e,a.count=o.length,A9e(a)}return t}hn.prototype.addListener=function(e,r){return uX(this,e,r,!1)};hn.prototype.on=hn.prototype.addListener;hn.prototype.prependListener=function(e,r){return uX(this,e,r,!0)};function S9e(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function dX(t,e,r){var n={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},i=S9e.bind(n);return i.listener=r,n.wrapFn=i,i}hn.prototype.once=function(e,r){return iE(r),this.on(e,dX(this,e,r)),this};hn.prototype.prependOnceListener=function(e,r){return iE(r),this.prependListener(e,dX(this,e,r)),this};hn.prototype.removeListener=function(e,r){var n,i,s,o,a;if(iE(r),i=this._events,i===void 0)return this;if(n=i[e],n===void 0)return this;if(n===r||n.listener===r)--this._eventsCount===0?this._events=Object.create(null):(delete i[e],i.removeListener&&this.emit("removeListener",e,n.listener||r));else if(typeof n!="function"){for(s=-1,o=n.length-1;o>=0;o--)if(n[o]===r||n[o].listener===r){a=n[o].listener,s=o;break}if(s<0)return this;s===0?n.shift():_9e(n,s),n.length===1&&(i[e]=n[0]),i.removeListener!==void 0&&this.emit("removeListener",e,a||r)}return this};hn.prototype.off=hn.prototype.removeListener;hn.prototype.removeAllListeners=function(e){var r,n,i;if(n=this._events,n===void 0)return this;if(n.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):n[e]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete n[e]),this;if(arguments.length===0){var s=Object.keys(n),o;for(i=0;i=0;i--)this.removeListener(e,r[i]);return this};function hX(t,e,r){var n=t._events;if(n===void 0)return[];var i=n[e];return i===void 0?[]:typeof i=="function"?r?[i.listener||i]:[i]:r?I9e(i):vX(i,i.length)}hn.prototype.listeners=function(e){return hX(this,e,!0)};hn.prototype.rawListeners=function(e){return hX(this,e,!1)};hn.listenerCount=function(t,e){return typeof t.listenerCount=="function"?t.listenerCount(e):pX.call(t,e)};hn.prototype.listenerCount=pX;function pX(t){var e=this._events;if(e!==void 0){var r=e[t];if(typeof r=="function")return 1;if(r!==void 0)return r.length}return 0}hn.prototype.eventNames=function(){return this._eventsCount>0?C3(this._events):[]};function vX(t,e){for(var r=new Array(e),n=0;n"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"?new N9e:typeof navigator<"u"?U9e(navigator.userAgent):q9e()}function j9e(t){return t!==""&&L9e.reduce(function(e,r){var n=r[0],i=r[1];if(e)return e;var s=i.exec(t);return!!s&&[n,s]},!1)}function U9e(t){var e=j9e(t);if(!e)return null;var r=e[0],n=e[1];if(r==="searchbot")return new O9e;var i=n[1]&&n[1].split(".").join("_").split("_").slice(0,3);i?i.length=se)return d;var ye=A-df($);if(ye<1)return $;var Ce=he?Ju(he,0,ye).join(""):d.slice(0,ye);if(J===r)return Ce+$;if(he&&(ye+=Ce.length-ye),FC(J)){if(d.slice(ye).search(J)){var Le,Fe=Ce;for(J.global||(J=em(J.source,Yr(tr.exec(J))+"g")),J.lastIndex=0;Le=J.exec(Fe);)var Ve=Le.index;Ce=Ce.slice(0,Ve===r?ye:Ve)}}else if(d.indexOf(Vo(J),ye)!=ye){var ft=Ce.lastIndexOf(J);ft>-1&&(Ce=Ce.slice(0,ft))}return Ce+$}function fae(d){return d=Yr(d),d&&Ot.test(d)?d.replace(ir,n2):d}var uae=I1(function(d,h,A){return d+(A?" ":"")+h.toUpperCase()}),$C=UR("toUpperCase");function FO(d,h,A){return d=Yr(d),h=A?r:h,h===r?Xx(d)?QE(d):jE(d):d.match(h)||[]}var jO=mr(function(d,h){try{return li(d,r,h)}catch(A){return LC(A)?A:new Xt(A)}}),dae=mf(function(d,h){return po(h,function(A){A=ol(A),gf(d,A,DC(d[A],d))}),d});function hae(d){var h=d==null?0:d.length,A=Wt();return d=h?un(d,function($){if(typeof $[1]!="function")throw new go(o);return[A($[0]),$[1]]}):[],mr(function($){for(var J=-1;++JE)return[];var A=T,$=dr(d,T);h=Wt(h),d-=T;for(var J=Vh($,h);++A0||h<0)?new Tr(A):(d<0?A=A.takeRight(-d):d&&(A=A.drop(d)),h!==r&&(h=hr(h),A=h<0?A.dropRight(-h):A.take(h-d)),A)},Tr.prototype.takeRightWhile=function(d){return this.reverse().takeWhile(d).reverse()},Tr.prototype.toArray=function(){return this.take(T)},il(Tr.prototype,function(d,h){var A=/^(?:filter|find|map|reject)|While$/.test(h),$=/^(?:head|last)$/.test(h),J=ne[$?"take"+(h=="last"?"Right":""):h],se=$||/^find/.test(h);J&&(ne.prototype[h]=function(){var he=this.__wrapped__,ye=$?[1]:arguments,Ce=he instanceof Tr,Le=ye[0],Fe=Ce||sr(he),Ve=function(Cr){var Rr=J.apply(ne,rl([Cr],ye));return $&&ft?Rr[0]:Rr};Fe&&A&&typeof Le=="function"&&Le.length!=1&&(Ce=Fe=!1);var ft=this.__chain__,Mt=!!this.__actions__.length,Kt=se&&!ft,vr=Ce&&!Mt;if(!se&&Fe){he=vr?he:new Tr(this);var Yt=d.apply(he,ye);return Yt.__actions__.push({func:A2,args:[Ve],thisArg:r}),new xa(Yt,ft)}return Kt&&vr?d.apply(this,ye):(Yt=this.thru(Ve),Kt?$?Yt.value()[0]:Yt.value():Yt)})}),po(["pop","push","shift","sort","splice","unshift"],function(d){var h=y1[d],A=/^(?:push|sort|unshift)$/.test(d)?"tap":"thru",$=/^(?:pop|shift)$/.test(d);ne.prototype[d]=function(){var J=arguments;if($&&!this.__chain__){var se=this.value();return h.apply(sr(se)?se:[],J)}return this[A](function(he){return h.apply(sr(he)?he:[],J)})}}),il(Tr.prototype,function(d,h){var A=ne[h];if(A){var $=A.name+"";Hr.call(vc,$)||(vc[$]=[]),vc[$].push({name:h,func:A})}}),vc[y2(r,C).name]=[{name:"wrapper",func:r}],Tr.prototype.clone=fre,Tr.prototype.reverse=ure,Tr.prototype.value=dre,ne.prototype.at=$ie,ne.prototype.chain=qie,ne.prototype.commit=Vie,ne.prototype.next=zie,ne.prototype.plant=Gie,ne.prototype.reverse=Wie,ne.prototype.toJSON=ne.prototype.valueOf=ne.prototype.value=Kie,ne.prototype.first=ne.prototype.head,q&&(ne.prototype[q]=Hie),ne},qu=JE();vn?((vn.exports=qu)._=qu,rn._=qu):Er._=qu}).call(wi)})(l4,l4.exports);var mBe=l4.exports,xI={exports:{}};(function(t,e){var r=typeof self<"u"?self:wi,n=function(){function s(){this.fetch=!1,this.DOMException=r.DOMException}return s.prototype=r,new s}();(function(s){(function(o){var a={searchParams:"URLSearchParams"in s,iterable:"Symbol"in s&&"iterator"in Symbol,blob:"FileReader"in s&&"Blob"in s&&function(){try{return new Blob,!0}catch{return!1}}(),formData:"FormData"in s,arrayBuffer:"ArrayBuffer"in s};function c(v){return v&&DataView.prototype.isPrototypeOf(v)}if(a.arrayBuffer)var l=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],f=ArrayBuffer.isView||function(v){return v&&l.indexOf(Object.prototype.toString.call(v))>-1};function u(v){if(typeof v!="string"&&(v=String(v)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(v))throw new TypeError("Invalid character in header field name");return v.toLowerCase()}function p(v){return typeof v!="string"&&(v=String(v)),v}function g(v){var m={next:function(){var M=v.shift();return{done:M===void 0,value:M}}};return a.iterable&&(m[Symbol.iterator]=function(){return m}),m}function y(v){this.map={},v instanceof y?v.forEach(function(m,M){this.append(M,m)},this):Array.isArray(v)?v.forEach(function(m){this.append(m[0],m[1])},this):v&&Object.getOwnPropertyNames(v).forEach(function(m){this.append(m,v[m])},this)}y.prototype.append=function(v,m){v=u(v),m=p(m);var M=this.map[v];this.map[v]=M?M+", "+m:m},y.prototype.delete=function(v){delete this.map[u(v)]},y.prototype.get=function(v){return v=u(v),this.has(v)?this.map[v]:null},y.prototype.has=function(v){return this.map.hasOwnProperty(u(v))},y.prototype.set=function(v,m){this.map[u(v)]=p(m)},y.prototype.forEach=function(v,m){for(var M in this.map)this.map.hasOwnProperty(M)&&v.call(m,this.map[M],M,this)},y.prototype.keys=function(){var v=[];return this.forEach(function(m,M){v.push(M)}),g(v)},y.prototype.values=function(){var v=[];return this.forEach(function(m){v.push(m)}),g(v)},y.prototype.entries=function(){var v=[];return this.forEach(function(m,M){v.push([M,m])}),g(v)},a.iterable&&(y.prototype[Symbol.iterator]=y.prototype.entries);function b(v){if(v.bodyUsed)return Promise.reject(new TypeError("Already read"));v.bodyUsed=!0}function I(v){return new Promise(function(m,M){v.onload=function(){m(v.result)},v.onerror=function(){M(v.error)}})}function C(v){var m=new FileReader,M=I(m);return m.readAsArrayBuffer(v),M}function S(v){var m=new FileReader,M=I(m);return m.readAsText(v),M}function R(v){for(var m=new Uint8Array(v),M=new Array(m.length),B=0;B-1?m:v}function U(v,m){m=m||{};var M=m.body;if(v instanceof U){if(v.bodyUsed)throw new TypeError("Already read");this.url=v.url,this.credentials=v.credentials,m.headers||(this.headers=new y(v.headers)),this.method=v.method,this.mode=v.mode,this.signal=v.signal,!M&&v._bodyInit!=null&&(M=v._bodyInit,v.bodyUsed=!0)}else this.url=String(v);if(this.credentials=m.credentials||this.credentials||"same-origin",(m.headers||!this.headers)&&(this.headers=new y(m.headers)),this.method=_(m.method||this.method||"GET"),this.mode=m.mode||this.mode||null,this.signal=m.signal||this.signal,this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&M)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(M)}U.prototype.clone=function(){return new U(this,{body:this._bodyInit})};function ie(v){var m=new FormData;return v.trim().split("&").forEach(function(M){if(M){var B=M.split("="),E=B.shift().replace(/\+/g," "),x=B.join("=").replace(/\+/g," ");m.append(decodeURIComponent(E),decodeURIComponent(x))}}),m}function ce(v){var m=new y,M=v.replace(/\r?\n[\t ]+/g," ");return M.split(/\r?\n/).forEach(function(B){var E=B.split(":"),x=E.shift().trim();if(x){var w=E.join(":").trim();m.append(x,w)}}),m}F.call(U.prototype);function K(v,m){m||(m={}),this.type="default",this.status=m.status===void 0?200:m.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in m?m.statusText:"OK",this.headers=new y(m.headers),this.url=m.url||"",this._initBody(v)}F.call(K.prototype),K.prototype.clone=function(){return new K(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new y(this.headers),url:this.url})},K.error=function(){var v=new K(null,{status:0,statusText:""});return v.type="error",v};var k=[301,302,303,307,308];K.redirect=function(v,m){if(k.indexOf(m)===-1)throw new RangeError("Invalid status code");return new K(null,{status:m,headers:{location:v}})},o.DOMException=s.DOMException;try{new o.DOMException}catch{o.DOMException=function(m,M){this.message=m,this.name=M;var B=Error(m);this.stack=B.stack},o.DOMException.prototype=Object.create(Error.prototype),o.DOMException.prototype.constructor=o.DOMException}function O(v,m){return new Promise(function(M,B){var E=new U(v,m);if(E.signal&&E.signal.aborted)return B(new o.DOMException("Aborted","AbortError"));var x=new XMLHttpRequest;function w(){x.abort()}x.onload=function(){var T={status:x.status,statusText:x.statusText,headers:ce(x.getAllResponseHeaders()||"")};T.url="responseURL"in x?x.responseURL:T.headers.get("X-Request-URL");var P="response"in x?x.response:x.responseText;M(new K(P,T))},x.onerror=function(){B(new TypeError("Network request failed"))},x.ontimeout=function(){B(new TypeError("Network request failed"))},x.onabort=function(){B(new o.DOMException("Aborted","AbortError"))},x.open(E.method,E.url,!0),E.credentials==="include"?x.withCredentials=!0:E.credentials==="omit"&&(x.withCredentials=!1),"responseType"in x&&a.blob&&(x.responseType="blob"),E.headers.forEach(function(T,P){x.setRequestHeader(P,T)}),E.signal&&(E.signal.addEventListener("abort",w),x.onreadystatechange=function(){x.readyState===4&&E.signal.removeEventListener("abort",w)}),x.send(typeof E._bodyInit>"u"?null:E._bodyInit)})}return O.polyfill=!0,s.fetch||(s.fetch=O,s.Headers=y,s.Request=U,s.Response=K),o.Headers=y,o.Request=U,o.Response=K,o.fetch=O,Object.defineProperty(o,"__esModule",{value:!0}),o})({})})(n),n.fetch.ponyfill=!0,delete n.fetch.polyfill;var i=n;e=i.fetch,e.default=i.fetch,e.fetch=i.fetch,e.Headers=i.Headers,e.Request=i.Request,e.Response=i.Response,t.exports=e})(xI,xI.exports);var bBe=xI.exports;const l$=Iu(bBe);var wBe=Object.defineProperty,xBe=Object.defineProperties,EBe=Object.getOwnPropertyDescriptors,f$=Object.getOwnPropertySymbols,CBe=Object.prototype.hasOwnProperty,ABe=Object.prototype.propertyIsEnumerable,u$=(t,e,r)=>e in t?wBe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,d$=(t,e)=>{for(var r in e||(e={}))CBe.call(e,r)&&u$(t,r,e[r]);if(f$)for(var r of f$(e))ABe.call(e,r)&&u$(t,r,e[r]);return t},h$=(t,e)=>xBe(t,EBe(e));const SBe={Accept:"application/json","Content-Type":"application/json"},_Be="POST",p$={headers:SBe,method:_Be},v$=10;let Jc=class{constructor(e,r=!1){if(this.url=e,this.disableProviderPing=r,this.events=new ga.EventEmitter,this.isAvailable=!1,this.registering=!1,!DU(e))throw new Error(`Provided URL is not compatible with HTTP connection: ${e}`);this.url=e,this.disableProviderPing=r}get connected(){return this.isAvailable}get connecting(){return this.registering}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async open(e=this.url){await this.register(e)}async close(){if(!this.isAvailable)throw new Error("Connection already closed");this.onClose()}async send(e){this.isAvailable||await this.register();try{const r=_u(e),n=await(await l$(this.url,h$(d$({},p$),{body:r}))).json();this.onPayload({data:n})}catch(r){this.onError(e.id,r)}}async register(e=this.url){if(!DU(e))throw new Error(`Provided URL is not compatible with HTTP connection: ${e}`);if(this.registering){const r=this.events.getMaxListeners();return(this.events.listenerCount("register_error")>=r||this.events.listenerCount("open")>=r)&&this.events.setMaxListeners(r+1),new Promise((n,i)=>{this.events.once("register_error",s=>{this.resetMaxListeners(),i(s)}),this.events.once("open",()=>{if(this.resetMaxListeners(),typeof this.isAvailable>"u")return i(new Error("HTTP connection is missing or invalid"));n()})})}this.url=e,this.registering=!0;try{if(!this.disableProviderPing){const r=_u({id:1,jsonrpc:"2.0",method:"test",params:[]});await l$(e,h$(d$({},p$),{body:r}))}this.onOpen()}catch(r){const n=this.parseError(r);throw this.events.emit("register_error",n),this.onClose(),n}}onOpen(){this.isAvailable=!0,this.registering=!1,this.events.emit("open")}onClose(){this.isAvailable=!1,this.registering=!1,this.events.emit("close")}onPayload(e){if(typeof e.data>"u")return;const r=typeof e.data=="string"?jp(e.data):e.data;this.events.emit("payload",r)}onError(e,r){const n=this.parseError(r),i=n.message||n.toString(),s=IE(e,i);this.events.emit("payload",s)}parseError(e,r=this.url){return Yee(e,r,"HTTP")}resetMaxListeners(){this.events.getMaxListeners()>v$&&this.events.setMaxListeners(v$)}};const g$="error",IBe="wss://relay.walletconnect.org",TBe="wc",PBe="universal_provider",y$=`${TBe}@2:${PBe}:`,bte="https://rpc.walletconnect.org/v1/",J1="generic",kBe=`${bte}bundler`,uc={DEFAULT_CHAIN_CHANGED:"default_chain_changed"};var MBe=Object.defineProperty,RBe=Object.defineProperties,OBe=Object.getOwnPropertyDescriptors,m$=Object.getOwnPropertySymbols,NBe=Object.prototype.hasOwnProperty,DBe=Object.prototype.propertyIsEnumerable,b$=(t,e,r)=>e in t?MBe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,M6=(t,e)=>{for(var r in e||(e={}))NBe.call(e,r)&&b$(t,r,e[r]);if(m$)for(var r of m$(e))DBe.call(e,r)&&b$(t,r,e[r]);return t},BBe=(t,e)=>RBe(t,OBe(e));function da(t,e,r){var n;const i=Gv(t);return((n=e.rpcMap)==null?void 0:n[i.reference])||`${bte}?chainId=${i.namespace}:${i.reference}&projectId=${r}`}function i1(t){return t.includes(":")?t.split(":")[1]:t}function wte(t){return t.map(e=>`${e.split(":")[0]}:${e.split(":")[1]}`)}function LBe(t,e){const r=Object.keys(e.namespaces).filter(i=>i.includes(t));if(!r.length)return[];const n=[];return r.forEach(i=>{const s=e.namespaces[i].accounts;n.push(...s)}),n}function rS(t={},e={}){const r=w$(t),n=w$(e);return mBe.merge(r,n)}function w$(t){var e,r,n,i;const s={};if(!Nw(t))return s;for(const[o,a]of Object.entries(t)){const c=VM(o)?[o]:a.chains,l=a.methods||[],f=a.events||[],u=a.rpcMap||{},p=ub(o);s[p]=BBe(M6(M6({},s[p]),a),{chains:T3(c,(e=s[p])==null?void 0:e.chains),methods:T3(l,(r=s[p])==null?void 0:r.methods),events:T3(f,(n=s[p])==null?void 0:n.events),rpcMap:M6(M6({},u),(i=s[p])==null?void 0:i.rpcMap)})}return s}function FBe(t){return t.includes(":")?t.split(":")[2]:t}function x$(t){const e={};for(const[r,n]of Object.entries(t)){const i=n.methods||[],s=n.events||[],o=n.accounts||[],a=VM(r)?[r]:n.chains?n.chains:wte(n.accounts);e[r]={chains:a,methods:i,events:s,accounts:o}}return e}function nS(t){return typeof t=="number"?t:t.includes("0x")?parseInt(t,16):(t=t.includes(":")?t.split(":")[1]:t,isNaN(Number(t))?t:Number(t))}const xte={},Vr=t=>xte[t],iS=(t,e)=>{xte[t]=e};class jBe{constructor(e){this.name="polkadot",this.namespace=e.namespace,this.events=Vr("events"),this.client=Vr("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(uc.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getAccounts(){const e=this.namespace.accounts;return e?e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2])||[]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;const i=i1(r);e[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||da(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new fc(new Jc(n,Vr("disableProviderPing")))}}var UBe=Object.defineProperty,$Be=Object.defineProperties,qBe=Object.getOwnPropertyDescriptors,E$=Object.getOwnPropertySymbols,VBe=Object.prototype.hasOwnProperty,zBe=Object.prototype.propertyIsEnumerable,C$=(t,e,r)=>e in t?UBe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,A$=(t,e)=>{for(var r in e||(e={}))VBe.call(e,r)&&C$(t,r,e[r]);if(E$)for(var r of E$(e))zBe.call(e,r)&&C$(t,r,e[r]);return t},S$=(t,e)=>$Be(t,qBe(e));class HBe{constructor(e){this.name="eip155",this.namespace=e.namespace,this.events=Vr("events"),this.client=Vr("client"),this.httpProviders=this.createHttpProviders(),this.chainId=parseInt(this.getDefaultChain())}async request(e){switch(e.request.method){case"eth_requestAccounts":return this.getAccounts();case"eth_accounts":return this.getAccounts();case"wallet_switchEthereumChain":return await this.handleSwitchChain(e);case"eth_chainId":return parseInt(this.getDefaultChain());case"wallet_getCapabilities":return await this.getCapabilities(e);case"wallet_getCallsStatus":return await this.getCallStatus(e)}return this.namespace.methods.includes(e.request.method)?await this.client.request(e):this.getHttpProvider().request(e.request)}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(parseInt(e),r),this.chainId=parseInt(e),this.events.emit(uc.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId.toString();if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}createHttpProvider(e,r){const n=r||da(`${this.name}:${e}`,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new fc(new Jc(n,Vr("disableProviderPing")))}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;const i=parseInt(i1(r));e[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}getHttpProvider(){const e=this.chainId,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}async handleSwitchChain(e){var r,n;let i=e.request.params?(r=e.request.params[0])==null?void 0:r.chainId:"0x0";i=i.startsWith("0x")?i:`0x${i}`;const s=parseInt(i,16);if(this.isChainApproved(s))this.setDefaultChain(`${s}`);else if(this.namespace.methods.includes("wallet_switchEthereumChain"))await this.client.request({topic:e.topic,request:{method:e.request.method,params:[{chainId:i}]},chainId:(n=this.namespace.chains)==null?void 0:n[0]}),this.setDefaultChain(`${s}`);else throw new Error(`Failed to switch to chain 'eip155:${s}'. The chain is not approved or the wallet does not support 'wallet_switchEthereumChain' method.`);return null}isChainApproved(e){return this.namespace.chains.includes(`${this.name}:${e}`)}async getCapabilities(e){var r,n,i;const s=(n=(r=e.request)==null?void 0:r.params)==null?void 0:n[0];if(!s)throw new Error("Missing address parameter in `wallet_getCapabilities` request");const o=this.client.session.get(e.topic),a=((i=o==null?void 0:o.sessionProperties)==null?void 0:i.capabilities)||{};if(a!=null&&a[s])return a==null?void 0:a[s];const c=await this.client.request(e);try{await this.client.session.update(e.topic,{sessionProperties:S$(A$({},o.sessionProperties||{}),{capabilities:S$(A$({},a||{}),{[s]:c})})})}catch(l){console.warn("Failed to update session with capabilities",l)}return c}async getCallStatus(e){var r,n;const i=this.client.session.get(e.topic),s=(r=i.sessionProperties)==null?void 0:r.bundler_name;if(s){const a=this.getBundlerUrl(e.chainId,s);try{return await this.getUserOperationReceipt(a,e)}catch(c){console.warn("Failed to fetch call status from bundler",c,a)}}const o=(n=i.sessionProperties)==null?void 0:n.bundler_url;if(o)try{return await this.getUserOperationReceipt(o,e)}catch(a){console.warn("Failed to fetch call status from custom bundler",a,o)}if(this.namespace.methods.includes(e.request.method))return await this.client.request(e);throw new Error("Fetching call status not approved by the wallet.")}async getUserOperationReceipt(e,r){var n;const i=new URL(e),s=await fetch(i,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify($d("eth_getUserOperationReceipt",[(n=r.request.params)==null?void 0:n[0]]))});if(!s.ok)throw new Error(`Failed to fetch user operation receipt - ${s.status}`);return await s.json()}getBundlerUrl(e,r){return`${kBe}?projectId=${this.client.core.projectId}&chainId=${e}&bundler=${r}`}}class GBe{constructor(e){this.name="solana",this.namespace=e.namespace,this.events=Vr("events"),this.client=Vr("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(uc.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;const i=i1(r);e[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||da(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new fc(new Jc(n,Vr("disableProviderPing")))}}class WBe{constructor(e){this.name="cosmos",this.namespace=e.namespace,this.events=Vr("events"),this.client=Vr("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(uc.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;const i=i1(r);e[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||da(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new fc(new Jc(n,Vr("disableProviderPing")))}}class KBe{constructor(e){this.name="algorand",this.namespace=e.namespace,this.events=Vr("events"),this.client=Vr("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){if(!this.httpProviders[e]){const n=r||da(`${this.name}:${e}`,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);this.setHttpProvider(e,n)}this.chainId=e,this.events.emit(uc.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;e[r]=this.createHttpProvider(r,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||da(e,this.namespace,this.client.core.projectId);return typeof n>"u"?void 0:new fc(new Jc(n,Vr("disableProviderPing")))}}class YBe{constructor(e){this.name="cip34",this.namespace=e.namespace,this.events=Vr("events"),this.client=Vr("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(uc.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{const n=this.getCardanoRPCUrl(r),i=i1(r);e[i]=this.createHttpProvider(i,n)}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}getCardanoRPCUrl(e){const r=this.namespace.rpcMap;if(r)return r[e]}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||this.getCardanoRPCUrl(e);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new fc(new Jc(n,Vr("disableProviderPing")))}}class QBe{constructor(e){this.name="elrond",this.namespace=e.namespace,this.events=Vr("events"),this.client=Vr("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(uc.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;const i=i1(r);e[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||da(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new fc(new Jc(n,Vr("disableProviderPing")))}}class JBe{constructor(e){this.name="multiversx",this.namespace=e.namespace,this.events=Vr("events"),this.client=Vr("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(uc.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;const i=i1(r);e[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||da(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new fc(new Jc(n,Vr("disableProviderPing")))}}class ZBe{constructor(e){this.name="near",this.namespace=e.namespace,this.events=Vr("events"),this.client=Vr("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){if(this.chainId=e,!this.httpProviders[e]){const n=r||da(`${this.name}:${e}`,this.namespace);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);this.setHttpProvider(e,n)}this.events.emit(uc.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e?e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2])||[]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;e[r]=this.createHttpProvider(r,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||da(e,this.namespace);return typeof n>"u"?void 0:new fc(new Jc(n,Vr("disableProviderPing")))}}class XBe{constructor(e){this.name="tezos",this.namespace=e.namespace,this.events=Vr("events"),this.client=Vr("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){if(this.chainId=e,!this.httpProviders[e]){const n=r||da(`${this.name}:${e}`,this.namespace);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);this.setHttpProvider(e,n)}this.events.emit(uc.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e?e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2])||[]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{e[r]=this.createHttpProvider(r)}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||da(e,this.namespace);return typeof n>"u"?void 0:new fc(new Jc(n))}}class eLe{constructor(e){this.name=J1,this.namespace=e.namespace,this.events=Vr("events"),this.client=Vr("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace.chains=[...new Set((this.namespace.chains||[]).concat(e.chains||[]))],this.namespace.accounts=[...new Set((this.namespace.accounts||[]).concat(e.accounts||[]))],this.namespace.methods=[...new Set((this.namespace.methods||[]).concat(e.methods||[]))],this.namespace.events=[...new Set((this.namespace.events||[]).concat(e.events||[]))],this.httpProviders=this.createHttpProviders()}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider(e.chainId).request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(uc.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){var e,r;const n={};return(r=(e=this.namespace)==null?void 0:e.accounts)==null||r.forEach(i=>{const s=Gv(i);n[`${s.namespace}:${s.reference}`]=this.createHttpProvider(i)}),n}getHttpProvider(e){const r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||da(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new fc(new Jc(n,Vr("disableProviderPing")))}}var tLe=Object.defineProperty,rLe=Object.defineProperties,nLe=Object.getOwnPropertyDescriptors,_$=Object.getOwnPropertySymbols,iLe=Object.prototype.hasOwnProperty,sLe=Object.prototype.propertyIsEnumerable,I$=(t,e,r)=>e in t?tLe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,R6=(t,e)=>{for(var r in e||(e={}))iLe.call(e,r)&&I$(t,r,e[r]);if(_$)for(var r of _$(e))sLe.call(e,r)&&I$(t,r,e[r]);return t},sS=(t,e)=>rLe(t,nLe(e));let oLe=class Ete{constructor(e){this.events=new bM,this.rpcProviders={},this.shouldAbortPairingAttempt=!1,this.maxPairingAttempts=10,this.disableProviderPing=!1,this.providerOpts=e,this.logger=typeof(e==null?void 0:e.logger)<"u"&&typeof(e==null?void 0:e.logger)!="string"?e.logger:Vx(SE({level:(e==null?void 0:e.logger)||g$})),this.disableProviderPing=(e==null?void 0:e.disableProviderPing)||!1}static async init(e){const r=new Ete(e);return await r.initialize(),r}async request(e,r,n){const[i,s]=this.validateChain(r);if(!this.session)throw new Error("Please call connect() before request()");return await this.getProvider(i).request({request:R6({},e),chainId:`${i}:${s}`,topic:this.session.topic,expiry:n})}sendAsync(e,r,n,i){const s=new Date().getTime();this.request(e,n,i).then(o=>r(null,_E(s,o))).catch(o=>r(o,void 0))}async enable(){if(!this.client)throw new Error("Sign Client not initialized");return this.session||await this.connect({namespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties}),await this.requestAccounts()}async disconnect(){var e;if(!this.session)throw new Error("Please call connect() before enable()");await this.client.disconnect({topic:(e=this.session)==null?void 0:e.topic,reason:sn("USER_DISCONNECTED")}),await this.cleanup()}async connect(e){if(!this.client)throw new Error("Sign Client not initialized");if(this.setNamespaces(e),await this.cleanupPendingPairings(),!e.skipPairing)return await this.pair(e.pairingTopic)}async authenticate(e,r){if(!this.client)throw new Error("Sign Client not initialized");this.setNamespaces(e),await this.cleanupPendingPairings();const{uri:n,response:i}=await this.client.authenticate(e,r);n&&(this.uri=n,this.events.emit("display_uri",n));const s=await i();if(this.session=s.session,this.session){const o=x$(this.session.namespaces);this.namespaces=rS(this.namespaces,o),this.persist("namespaces",this.namespaces),this.onConnect()}return s}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}removeListener(e,r){this.events.removeListener(e,r)}off(e,r){this.events.off(e,r)}get isWalletConnect(){return!0}async pair(e){this.shouldAbortPairingAttempt=!1;let r=0;do{if(this.shouldAbortPairingAttempt)throw new Error("Pairing aborted");if(r>=this.maxPairingAttempts)throw new Error("Max auto pairing attempts reached");const{uri:n,approval:i}=await this.client.connect({pairingTopic:e,requiredNamespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties});n&&(this.uri=n,this.events.emit("display_uri",n)),await i().then(s=>{this.session=s;const o=x$(s.namespaces);this.namespaces=rS(this.namespaces,o),this.persist("namespaces",this.namespaces)}).catch(s=>{if(s.message!==mte)throw s;r++})}while(!this.session);return this.onConnect(),this.session}setDefaultChain(e,r){try{if(!this.session)return;const[n,i]=this.validateChain(e),s=this.getProvider(n);s.name===J1?s.setDefaultChain(`${n}:${i}`,r):s.setDefaultChain(i,r)}catch(n){if(!/Please call connect/.test(n.message))throw n}}async cleanupPendingPairings(e={}){this.logger.info("Cleaning up inactive pairings...");const r=this.client.pairing.getAll();if(Jl(r)){for(const n of r)e.deletePairings?this.client.core.expirer.set(n.topic,0):await this.client.core.relayer.subscriber.unsubscribe(n.topic);this.logger.info(`Inactive pairings cleared: ${r.length}`)}}abortPairingAttempt(){this.shouldAbortPairingAttempt=!0}async checkStorage(){if(this.namespaces=await this.getFromStore("namespaces"),this.optionalNamespaces=await this.getFromStore("optionalNamespaces")||{},this.client.session.length){const e=this.client.session.keys.length-1;this.session=this.client.session.get(this.client.session.keys[e]),this.createProviders()}}async initialize(){this.logger.trace("Initialized"),await this.createClient(),await this.checkStorage(),this.registerEventListeners()}async createClient(){this.client=this.providerOpts.client||await ME.init({core:this.providerOpts.core,logger:this.providerOpts.logger||g$,relayUrl:this.providerOpts.relayUrl||IBe,projectId:this.providerOpts.projectId,metadata:this.providerOpts.metadata,storageOptions:this.providerOpts.storageOptions,storage:this.providerOpts.storage,name:this.providerOpts.name,customStoragePrefix:this.providerOpts.customStoragePrefix,telemetryEnabled:this.providerOpts.telemetryEnabled}),this.logger.trace("SignClient Initialized")}createProviders(){if(!this.client)throw new Error("Sign Client not initialized");if(!this.session)throw new Error("Session not initialized. Please call connect() before enable()");const e=[...new Set(Object.keys(this.session.namespaces).map(r=>ub(r)))];iS("client",this.client),iS("events",this.events),iS("disableProviderPing",this.disableProviderPing),e.forEach(r=>{if(!this.session)return;const n=LBe(r,this.session),i=wte(n),s=rS(this.namespaces,this.optionalNamespaces),o=sS(R6({},s[r]),{accounts:n,chains:i});switch(r){case"eip155":this.rpcProviders[r]=new HBe({namespace:o});break;case"algorand":this.rpcProviders[r]=new KBe({namespace:o});break;case"solana":this.rpcProviders[r]=new GBe({namespace:o});break;case"cosmos":this.rpcProviders[r]=new WBe({namespace:o});break;case"polkadot":this.rpcProviders[r]=new jBe({namespace:o});break;case"cip34":this.rpcProviders[r]=new YBe({namespace:o});break;case"elrond":this.rpcProviders[r]=new QBe({namespace:o});break;case"multiversx":this.rpcProviders[r]=new JBe({namespace:o});break;case"near":this.rpcProviders[r]=new ZBe({namespace:o});break;case"tezos":this.rpcProviders[r]=new XBe({namespace:o});break;default:this.rpcProviders[J1]?this.rpcProviders[J1].updateNamespace(o):this.rpcProviders[J1]=new eLe({namespace:o})}})}registerEventListeners(){if(typeof this.client>"u")throw new Error("Sign Client is not initialized");this.client.on("session_ping",e=>{this.events.emit("session_ping",e)}),this.client.on("session_event",e=>{const{params:r}=e,{event:n}=r;if(n.name==="accountsChanged"){const i=n.data;i&&Jl(i)&&this.events.emit("accountsChanged",i.map(FBe))}else if(n.name==="chainChanged"){const i=r.chainId,s=r.event.data,o=ub(i),a=nS(i)!==nS(s)?`${o}:${nS(s)}`:i;this.onChainChanged(a)}else this.events.emit(n.name,n.data);this.events.emit("session_event",e)}),this.client.on("session_update",({topic:e,params:r})=>{var n;const{namespaces:i}=r,s=(n=this.client)==null?void 0:n.session.get(e);this.session=sS(R6({},s),{namespaces:i}),this.onSessionUpdate(),this.events.emit("session_update",{topic:e,params:r})}),this.client.on("session_delete",async e=>{await this.cleanup(),this.events.emit("session_delete",e),this.events.emit("disconnect",sS(R6({},sn("USER_DISCONNECTED")),{data:e.topic}))}),this.on(uc.DEFAULT_CHAIN_CHANGED,e=>{this.onChainChanged(e,!0)})}getProvider(e){return this.rpcProviders[e]||this.rpcProviders[J1]}onSessionUpdate(){Object.keys(this.rpcProviders).forEach(e=>{var r;this.getProvider(e).updateNamespace((r=this.session)==null?void 0:r.namespaces[e])})}setNamespaces(e){const{namespaces:r,optionalNamespaces:n,sessionProperties:i}=e;r&&Object.keys(r).length&&(this.namespaces=r),n&&Object.keys(n).length&&(this.optionalNamespaces=n),this.sessionProperties=i,this.persist("namespaces",r),this.persist("optionalNamespaces",n)}validateChain(e){const[r,n]=(e==null?void 0:e.split(":"))||["",""];if(!this.namespaces||!Object.keys(this.namespaces).length)return[r,n];if(r&&!Object.keys(this.namespaces||{}).map(o=>ub(o)).includes(r))throw new Error(`Namespace '${r}' is not configured. Please call connect() first with namespace config.`);if(r&&n)return[r,n];const i=ub(Object.keys(this.namespaces)[0]),s=this.rpcProviders[i].getDefaultChain();return[i,s]}async requestAccounts(){const[e]=this.validateChain();return await this.getProvider(e).requestAccounts()}onChainChanged(e,r=!1){if(!this.namespaces)return;const[n,i]=this.validateChain(e);i&&(r||this.getProvider(n).setDefaultChain(i),this.namespaces[n]?this.namespaces[n].defaultChain=i:this.namespaces[`${n}:${i}`]?this.namespaces[`${n}:${i}`].defaultChain=i:this.namespaces[`${n}:${i}`]={defaultChain:i},this.persist("namespaces",this.namespaces),this.events.emit("chainChanged",i))}onConnect(){this.createProviders(),this.events.emit("connect",{session:this.session})}async cleanup(){this.session=void 0,this.namespaces=void 0,this.optionalNamespaces=void 0,this.sessionProperties=void 0,this.persist("namespaces",void 0),this.persist("optionalNamespaces",void 0),this.persist("sessionProperties",void 0),await this.cleanupPendingPairings({deletePairings:!0})}persist(e,r){this.client.core.storage.setItem(`${y$}/${e}`,r)}async getFromStore(e){return await this.client.core.storage.getItem(`${y$}/${e}`)}};const aLe=oLe,cLe="wc",lLe="ethereum_provider",fLe=`${cLe}@2:${lLe}:`,uLe="https://rpc.walletconnect.org/v1/",EI=["eth_sendTransaction","personal_sign"],dLe=["eth_accounts","eth_requestAccounts","eth_sendRawTransaction","eth_sign","eth_signTransaction","eth_signTypedData","eth_signTypedData_v3","eth_signTypedData_v4","eth_sendTransaction","personal_sign","wallet_switchEthereumChain","wallet_addEthereumChain","wallet_getPermissions","wallet_requestPermissions","wallet_registerOnboarding","wallet_watchAsset","wallet_scanQRCode","wallet_sendCalls","wallet_getCapabilities","wallet_getCallsStatus","wallet_showCallsStatus"],CI=["chainChanged","accountsChanged"],hLe=["chainChanged","accountsChanged","message","disconnect","connect"];var pLe=Object.defineProperty,vLe=Object.defineProperties,gLe=Object.getOwnPropertyDescriptors,T$=Object.getOwnPropertySymbols,yLe=Object.prototype.hasOwnProperty,mLe=Object.prototype.propertyIsEnumerable,P$=(t,e,r)=>e in t?pLe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Z1=(t,e)=>{for(var r in e||(e={}))yLe.call(e,r)&&P$(t,r,e[r]);if(T$)for(var r of T$(e))mLe.call(e,r)&&P$(t,r,e[r]);return t},oS=(t,e)=>vLe(t,gLe(e));function f4(t){return Number(t[0].split(":")[1])}function O6(t){return`0x${t.toString(16)}`}function bLe(t){const{chains:e,optionalChains:r,methods:n,optionalMethods:i,events:s,optionalEvents:o,rpcMap:a}=t;if(!Jl(e))throw new Error("Invalid chains");const c={chains:e,methods:n||EI,events:s||CI,rpcMap:Z1({},e.length?{[f4(e)]:a[f4(e)]}:{})},l=s==null?void 0:s.filter(g=>!CI.includes(g)),f=n==null?void 0:n.filter(g=>!EI.includes(g));if(!r&&!o&&!i&&!(l!=null&&l.length)&&!(f!=null&&f.length))return{required:e.length?c:void 0};const u=(l==null?void 0:l.length)&&(f==null?void 0:f.length)||!r,p={chains:[...new Set(u?c.chains.concat(r||[]):r)],methods:[...new Set(c.methods.concat(i!=null&&i.length?i:dLe))],events:[...new Set(c.events.concat(o!=null&&o.length?o:hLe))],rpcMap:a};return{required:e.length?c:void 0,optional:r.length?p:void 0}}let wLe=class Cte{constructor(){this.events=new ga.EventEmitter,this.namespace="eip155",this.accounts=[],this.chainId=1,this.STORAGE_KEY=fLe,this.on=(e,r)=>(this.events.on(e,r),this),this.once=(e,r)=>(this.events.once(e,r),this),this.removeListener=(e,r)=>(this.events.removeListener(e,r),this),this.off=(e,r)=>(this.events.off(e,r),this),this.parseAccount=e=>this.isCompatibleChainId(e)?this.parseAccountId(e).address:e,this.signer={},this.rpc={}}static async init(e){const r=new Cte;return await r.initialize(e),r}async request(e,r){return await this.signer.request(e,this.formatChainId(this.chainId),r)}sendAsync(e,r,n){this.signer.sendAsync(e,r,this.formatChainId(this.chainId),n)}get connected(){return this.signer.client?this.signer.client.core.relayer.connected:!1}get connecting(){return this.signer.client?this.signer.client.core.relayer.connecting:!1}async enable(){return this.session||await this.connect(),await this.request({method:"eth_requestAccounts"})}async connect(e){if(!this.signer.client)throw new Error("Provider not initialized. Call init() first");this.loadConnectOpts(e);const{required:r,optional:n}=bLe(this.rpc);try{const i=await new Promise(async(o,a)=>{var c;this.rpc.showQrModal&&((c=this.modal)==null||c.subscribeModal(l=>{!l.open&&!this.signer.session&&(this.signer.abortPairingAttempt(),a(new Error("Connection request reset. Please try again.")))})),await this.signer.connect(oS(Z1({namespaces:Z1({},r&&{[this.namespace]:r})},n&&{optionalNamespaces:{[this.namespace]:n}}),{pairingTopic:e==null?void 0:e.pairingTopic})).then(l=>{o(l)}).catch(l=>{a(new Error(l.message))})});if(!i)return;const s=Zj(i.namespaces,[this.namespace]);this.setChainIds(this.rpc.chains.length?this.rpc.chains:s),this.setAccounts(s),this.events.emit("connect",{chainId:O6(this.chainId)})}catch(i){throw this.signer.logger.error(i),i}finally{this.modal&&this.modal.closeModal()}}async authenticate(e,r){if(!this.signer.client)throw new Error("Provider not initialized. Call init() first");this.loadConnectOpts({chains:e==null?void 0:e.chains});try{const n=await new Promise(async(s,o)=>{var a;this.rpc.showQrModal&&((a=this.modal)==null||a.subscribeModal(c=>{!c.open&&!this.signer.session&&(this.signer.abortPairingAttempt(),o(new Error("Connection request reset. Please try again.")))})),await this.signer.authenticate(oS(Z1({},e),{chains:this.rpc.chains}),r).then(c=>{s(c)}).catch(c=>{o(new Error(c.message))})}),i=n.session;if(i){const s=Zj(i.namespaces,[this.namespace]);this.setChainIds(this.rpc.chains.length?this.rpc.chains:s),this.setAccounts(s),this.events.emit("connect",{chainId:O6(this.chainId)})}return n}catch(n){throw this.signer.logger.error(n),n}finally{this.modal&&this.modal.closeModal()}}async disconnect(){this.session&&await this.signer.disconnect(),this.reset()}get isWalletConnect(){return!0}get session(){return this.signer.session}registerEventListeners(){this.signer.on("session_event",e=>{const{params:r}=e,{event:n}=r;n.name==="accountsChanged"?(this.accounts=this.parseAccounts(n.data),this.events.emit("accountsChanged",this.accounts)):n.name==="chainChanged"?this.setChainId(this.formatChainId(n.data)):this.events.emit(n.name,n.data),this.events.emit("session_event",e)}),this.signer.on("chainChanged",e=>{const r=parseInt(e);this.chainId=r,this.events.emit("chainChanged",O6(this.chainId)),this.persist()}),this.signer.on("session_update",e=>{this.events.emit("session_update",e)}),this.signer.on("session_delete",e=>{this.reset(),this.events.emit("session_delete",e),this.events.emit("disconnect",oS(Z1({},sn("USER_DISCONNECTED")),{data:e.topic,name:"USER_DISCONNECTED"}))}),this.signer.on("display_uri",e=>{var r,n;this.rpc.showQrModal&&((r=this.modal)==null||r.closeModal(),(n=this.modal)==null||n.openModal({uri:e})),this.events.emit("display_uri",e)})}switchEthereumChain(e){this.request({method:"wallet_switchEthereumChain",params:[{chainId:e.toString(16)}]})}isCompatibleChainId(e){return typeof e=="string"?e.startsWith(`${this.namespace}:`):!1}formatChainId(e){return`${this.namespace}:${e}`}parseChainId(e){return Number(e.split(":")[1])}setChainIds(e){const r=e.filter(n=>this.isCompatibleChainId(n)).map(n=>this.parseChainId(n));r.length&&(this.chainId=r[0],this.events.emit("chainChanged",O6(this.chainId)),this.persist())}setChainId(e){if(this.isCompatibleChainId(e)){const r=this.parseChainId(e);this.chainId=r,this.switchEthereumChain(r)}}parseAccountId(e){const[r,n,i]=e.split(":");return{chainId:`${r}:${n}`,address:i}}setAccounts(e){this.accounts=e.filter(r=>this.parseChainId(this.parseAccountId(r).chainId)===this.chainId).map(r=>this.parseAccountId(r).address),this.events.emit("accountsChanged",this.accounts)}getRpcConfig(e){var r,n;const i=(r=e==null?void 0:e.chains)!=null?r:[],s=(n=e==null?void 0:e.optionalChains)!=null?n:[],o=i.concat(s);if(!o.length)throw new Error("No chains specified in either `chains` or `optionalChains`");const a=i.length?(e==null?void 0:e.methods)||EI:[],c=i.length?(e==null?void 0:e.events)||CI:[],l=(e==null?void 0:e.optionalMethods)||[],f=(e==null?void 0:e.optionalEvents)||[],u=(e==null?void 0:e.rpcMap)||this.buildRpcMap(o,e.projectId),p=(e==null?void 0:e.qrModalOptions)||void 0;return{chains:i==null?void 0:i.map(g=>this.formatChainId(g)),optionalChains:s.map(g=>this.formatChainId(g)),methods:a,events:c,optionalMethods:l,optionalEvents:f,rpcMap:u,showQrModal:!!(e!=null&&e.showQrModal),qrModalOptions:p,projectId:e.projectId,metadata:e.metadata}}buildRpcMap(e,r){const n={};return e.forEach(i=>{n[i]=this.getRpcUrl(i,r)}),n}async initialize(e){if(this.rpc=this.getRpcConfig(e),this.chainId=this.rpc.chains.length?f4(this.rpc.chains):f4(this.rpc.optionalChains),this.signer=await aLe.init({projectId:this.rpc.projectId,metadata:this.rpc.metadata,disableProviderPing:e.disableProviderPing,relayUrl:e.relayUrl,storageOptions:e.storageOptions,customStoragePrefix:e.customStoragePrefix,telemetryEnabled:e.telemetryEnabled}),this.registerEventListeners(),await this.loadPersistedSession(),this.rpc.showQrModal){let r;try{const{WalletConnectModal:n}=await C9e(()=>import("./index-RiSkTB9V.js").then(i=>i.i),[]);r=n}catch{throw new Error("To use QR modal, please install @walletconnect/modal package")}if(r)try{this.modal=new r(Z1({projectId:this.rpc.projectId},this.rpc.qrModalOptions))}catch(n){throw this.signer.logger.error(n),new Error("Could not generate WalletConnectModal Instance")}}}loadConnectOpts(e){if(!e)return;const{chains:r,optionalChains:n,rpcMap:i}=e;r&&Jl(r)&&(this.rpc.chains=r.map(s=>this.formatChainId(s)),r.forEach(s=>{this.rpc.rpcMap[s]=(i==null?void 0:i[s])||this.getRpcUrl(s)})),n&&Jl(n)&&(this.rpc.optionalChains=[],this.rpc.optionalChains=n==null?void 0:n.map(s=>this.formatChainId(s)),n.forEach(s=>{this.rpc.rpcMap[s]=(i==null?void 0:i[s])||this.getRpcUrl(s)}))}getRpcUrl(e,r){var n;return((n=this.rpc.rpcMap)==null?void 0:n[e])||`${uLe}?chainId=eip155:${e}&projectId=${r||this.rpc.projectId}`}async loadPersistedSession(){if(this.session)try{const e=await this.signer.client.core.storage.getItem(`${this.STORAGE_KEY}/chainId`),r=this.session.namespaces[`${this.namespace}:${e}`]?this.session.namespaces[`${this.namespace}:${e}`]:this.session.namespaces[this.namespace];this.setChainIds(e?[this.formatChainId(e)]:r==null?void 0:r.accounts),this.setAccounts(r==null?void 0:r.accounts)}catch(e){this.signer.logger.error("Failed to load persisted session, clearing state..."),this.signer.logger.error(e),await this.disconnect().catch(r=>this.signer.logger.warn(r))}}reset(){this.chainId=1,this.accounts=[]}persist(){this.session&&this.signer.client.core.storage.setItem(`${this.STORAGE_KEY}/chainId`,this.chainId)}parseAccounts(e){return typeof e=="string"||e instanceof String?[this.parseAccount(e)]:e.map(r=>this.parseAccount(r))}};var Ate={exports:{}};/*! +}`;var vr=jO(function(){return Lr(se,Mt+"return "+Ve).apply(r,he)});if(vr.source=Ve,LC(vr))throw vr;return vr}function iae(d){return Yr(d).toLowerCase()}function sae(d){return Yr(d).toUpperCase()}function oae(d,h,A){if(d=Yr(d),d&&(A||h===r))return $u(d);if(!d||!(h=Vo(h)))return d;var $=vo(d),J=vo(h),se=Jx($,J),he=Zx($,J)+1;return Ju($,se,he).join("")}function aae(d,h,A){if(d=Yr(d),d&&(A||h===r))return d.slice(0,Xy(d)+1);if(!d||!(h=Vo(h)))return d;var $=vo(d),J=Zx($,vo(h))+1;return Ju($,0,J).join("")}function cae(d,h,A){if(d=Yr(d),d&&(A||h===r))return d.replace(Dt,"");if(!d||!(h=Vo(h)))return d;var $=vo(d),J=Jx($,vo(h));return Ju($,J).join("")}function lae(d,h){var A=ce,$=K;if(Rn(h)){var J="separator"in h?h.separator:J;A="length"in h?hr(h.length):A,$="omission"in h?Vo(h.omission):$}d=Yr(d);var se=d.length;if(Kr(d)){var he=vo(d);se=he.length}if(A>=se)return d;var ye=A-df($);if(ye<1)return $;var Ce=he?Ju(he,0,ye).join(""):d.slice(0,ye);if(J===r)return Ce+$;if(he&&(ye+=Ce.length-ye),FC(J)){if(d.slice(ye).search(J)){var Le,Fe=Ce;for(J.global||(J=em(J.source,Yr(tr.exec(J))+"g")),J.lastIndex=0;Le=J.exec(Fe);)var Ve=Le.index;Ce=Ce.slice(0,Ve===r?ye:Ve)}}else if(d.indexOf(Vo(J),ye)!=ye){var ft=Ce.lastIndexOf(J);ft>-1&&(Ce=Ce.slice(0,ft))}return Ce+$}function fae(d){return d=Yr(d),d&&Ot.test(d)?d.replace(ir,n2):d}var uae=I1(function(d,h,A){return d+(A?" ":"")+h.toUpperCase()}),$C=UR("toUpperCase");function FO(d,h,A){return d=Yr(d),h=A?r:h,h===r?Xx(d)?QE(d):jE(d):d.match(h)||[]}var jO=mr(function(d,h){try{return li(d,r,h)}catch(A){return LC(A)?A:new Xt(A)}}),dae=mf(function(d,h){return po(h,function(A){A=ol(A),gf(d,A,DC(d[A],d))}),d});function hae(d){var h=d==null?0:d.length,A=Wt();return d=h?un(d,function($){if(typeof $[1]!="function")throw new go(o);return[A($[0]),$[1]]}):[],mr(function($){for(var J=-1;++JE)return[];var A=T,$=dr(d,T);h=Wt(h),d-=T;for(var J=Vh($,h);++A0||h<0)?new Tr(A):(d<0?A=A.takeRight(-d):d&&(A=A.drop(d)),h!==r&&(h=hr(h),A=h<0?A.dropRight(-h):A.take(h-d)),A)},Tr.prototype.takeRightWhile=function(d){return this.reverse().takeWhile(d).reverse()},Tr.prototype.toArray=function(){return this.take(T)},il(Tr.prototype,function(d,h){var A=/^(?:filter|find|map|reject)|While$/.test(h),$=/^(?:head|last)$/.test(h),J=ne[$?"take"+(h=="last"?"Right":""):h],se=$||/^find/.test(h);J&&(ne.prototype[h]=function(){var he=this.__wrapped__,ye=$?[1]:arguments,Ce=he instanceof Tr,Le=ye[0],Fe=Ce||sr(he),Ve=function(Cr){var Rr=J.apply(ne,rl([Cr],ye));return $&&ft?Rr[0]:Rr};Fe&&A&&typeof Le=="function"&&Le.length!=1&&(Ce=Fe=!1);var ft=this.__chain__,Mt=!!this.__actions__.length,Kt=se&&!ft,vr=Ce&&!Mt;if(!se&&Fe){he=vr?he:new Tr(this);var Yt=d.apply(he,ye);return Yt.__actions__.push({func:A2,args:[Ve],thisArg:r}),new xa(Yt,ft)}return Kt&&vr?d.apply(this,ye):(Yt=this.thru(Ve),Kt?$?Yt.value()[0]:Yt.value():Yt)})}),po(["pop","push","shift","sort","splice","unshift"],function(d){var h=y1[d],A=/^(?:push|sort|unshift)$/.test(d)?"tap":"thru",$=/^(?:pop|shift)$/.test(d);ne.prototype[d]=function(){var J=arguments;if($&&!this.__chain__){var se=this.value();return h.apply(sr(se)?se:[],J)}return this[A](function(he){return h.apply(sr(he)?he:[],J)})}}),il(Tr.prototype,function(d,h){var A=ne[h];if(A){var $=A.name+"";Hr.call(vc,$)||(vc[$]=[]),vc[$].push({name:h,func:A})}}),vc[y2(r,C).name]=[{name:"wrapper",func:r}],Tr.prototype.clone=fre,Tr.prototype.reverse=ure,Tr.prototype.value=dre,ne.prototype.at=$ie,ne.prototype.chain=qie,ne.prototype.commit=Vie,ne.prototype.next=zie,ne.prototype.plant=Gie,ne.prototype.reverse=Wie,ne.prototype.toJSON=ne.prototype.valueOf=ne.prototype.value=Kie,ne.prototype.first=ne.prototype.head,q&&(ne.prototype[q]=Hie),ne},qu=JE();vn?((vn.exports=qu)._=qu,rn._=qu):Er._=qu}).call(wi)})(l4,l4.exports);var mBe=l4.exports,xI={exports:{}};(function(t,e){var r=typeof self<"u"?self:wi,n=function(){function s(){this.fetch=!1,this.DOMException=r.DOMException}return s.prototype=r,new s}();(function(s){(function(o){var a={searchParams:"URLSearchParams"in s,iterable:"Symbol"in s&&"iterator"in Symbol,blob:"FileReader"in s&&"Blob"in s&&function(){try{return new Blob,!0}catch{return!1}}(),formData:"FormData"in s,arrayBuffer:"ArrayBuffer"in s};function c(v){return v&&DataView.prototype.isPrototypeOf(v)}if(a.arrayBuffer)var l=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],f=ArrayBuffer.isView||function(v){return v&&l.indexOf(Object.prototype.toString.call(v))>-1};function u(v){if(typeof v!="string"&&(v=String(v)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(v))throw new TypeError("Invalid character in header field name");return v.toLowerCase()}function p(v){return typeof v!="string"&&(v=String(v)),v}function g(v){var m={next:function(){var M=v.shift();return{done:M===void 0,value:M}}};return a.iterable&&(m[Symbol.iterator]=function(){return m}),m}function y(v){this.map={},v instanceof y?v.forEach(function(m,M){this.append(M,m)},this):Array.isArray(v)?v.forEach(function(m){this.append(m[0],m[1])},this):v&&Object.getOwnPropertyNames(v).forEach(function(m){this.append(m,v[m])},this)}y.prototype.append=function(v,m){v=u(v),m=p(m);var M=this.map[v];this.map[v]=M?M+", "+m:m},y.prototype.delete=function(v){delete this.map[u(v)]},y.prototype.get=function(v){return v=u(v),this.has(v)?this.map[v]:null},y.prototype.has=function(v){return this.map.hasOwnProperty(u(v))},y.prototype.set=function(v,m){this.map[u(v)]=p(m)},y.prototype.forEach=function(v,m){for(var M in this.map)this.map.hasOwnProperty(M)&&v.call(m,this.map[M],M,this)},y.prototype.keys=function(){var v=[];return this.forEach(function(m,M){v.push(M)}),g(v)},y.prototype.values=function(){var v=[];return this.forEach(function(m){v.push(m)}),g(v)},y.prototype.entries=function(){var v=[];return this.forEach(function(m,M){v.push([M,m])}),g(v)},a.iterable&&(y.prototype[Symbol.iterator]=y.prototype.entries);function b(v){if(v.bodyUsed)return Promise.reject(new TypeError("Already read"));v.bodyUsed=!0}function I(v){return new Promise(function(m,M){v.onload=function(){m(v.result)},v.onerror=function(){M(v.error)}})}function C(v){var m=new FileReader,M=I(m);return m.readAsArrayBuffer(v),M}function S(v){var m=new FileReader,M=I(m);return m.readAsText(v),M}function R(v){for(var m=new Uint8Array(v),M=new Array(m.length),B=0;B-1?m:v}function U(v,m){m=m||{};var M=m.body;if(v instanceof U){if(v.bodyUsed)throw new TypeError("Already read");this.url=v.url,this.credentials=v.credentials,m.headers||(this.headers=new y(v.headers)),this.method=v.method,this.mode=v.mode,this.signal=v.signal,!M&&v._bodyInit!=null&&(M=v._bodyInit,v.bodyUsed=!0)}else this.url=String(v);if(this.credentials=m.credentials||this.credentials||"same-origin",(m.headers||!this.headers)&&(this.headers=new y(m.headers)),this.method=_(m.method||this.method||"GET"),this.mode=m.mode||this.mode||null,this.signal=m.signal||this.signal,this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&M)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(M)}U.prototype.clone=function(){return new U(this,{body:this._bodyInit})};function ie(v){var m=new FormData;return v.trim().split("&").forEach(function(M){if(M){var B=M.split("="),E=B.shift().replace(/\+/g," "),x=B.join("=").replace(/\+/g," ");m.append(decodeURIComponent(E),decodeURIComponent(x))}}),m}function ce(v){var m=new y,M=v.replace(/\r?\n[\t ]+/g," ");return M.split(/\r?\n/).forEach(function(B){var E=B.split(":"),x=E.shift().trim();if(x){var w=E.join(":").trim();m.append(x,w)}}),m}F.call(U.prototype);function K(v,m){m||(m={}),this.type="default",this.status=m.status===void 0?200:m.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in m?m.statusText:"OK",this.headers=new y(m.headers),this.url=m.url||"",this._initBody(v)}F.call(K.prototype),K.prototype.clone=function(){return new K(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new y(this.headers),url:this.url})},K.error=function(){var v=new K(null,{status:0,statusText:""});return v.type="error",v};var k=[301,302,303,307,308];K.redirect=function(v,m){if(k.indexOf(m)===-1)throw new RangeError("Invalid status code");return new K(null,{status:m,headers:{location:v}})},o.DOMException=s.DOMException;try{new o.DOMException}catch{o.DOMException=function(m,M){this.message=m,this.name=M;var B=Error(m);this.stack=B.stack},o.DOMException.prototype=Object.create(Error.prototype),o.DOMException.prototype.constructor=o.DOMException}function O(v,m){return new Promise(function(M,B){var E=new U(v,m);if(E.signal&&E.signal.aborted)return B(new o.DOMException("Aborted","AbortError"));var x=new XMLHttpRequest;function w(){x.abort()}x.onload=function(){var T={status:x.status,statusText:x.statusText,headers:ce(x.getAllResponseHeaders()||"")};T.url="responseURL"in x?x.responseURL:T.headers.get("X-Request-URL");var P="response"in x?x.response:x.responseText;M(new K(P,T))},x.onerror=function(){B(new TypeError("Network request failed"))},x.ontimeout=function(){B(new TypeError("Network request failed"))},x.onabort=function(){B(new o.DOMException("Aborted","AbortError"))},x.open(E.method,E.url,!0),E.credentials==="include"?x.withCredentials=!0:E.credentials==="omit"&&(x.withCredentials=!1),"responseType"in x&&a.blob&&(x.responseType="blob"),E.headers.forEach(function(T,P){x.setRequestHeader(P,T)}),E.signal&&(E.signal.addEventListener("abort",w),x.onreadystatechange=function(){x.readyState===4&&E.signal.removeEventListener("abort",w)}),x.send(typeof E._bodyInit>"u"?null:E._bodyInit)})}return O.polyfill=!0,s.fetch||(s.fetch=O,s.Headers=y,s.Request=U,s.Response=K),o.Headers=y,o.Request=U,o.Response=K,o.fetch=O,Object.defineProperty(o,"__esModule",{value:!0}),o})({})})(n),n.fetch.ponyfill=!0,delete n.fetch.polyfill;var i=n;e=i.fetch,e.default=i.fetch,e.fetch=i.fetch,e.Headers=i.Headers,e.Request=i.Request,e.Response=i.Response,t.exports=e})(xI,xI.exports);var bBe=xI.exports;const l$=Iu(bBe);var wBe=Object.defineProperty,xBe=Object.defineProperties,EBe=Object.getOwnPropertyDescriptors,f$=Object.getOwnPropertySymbols,CBe=Object.prototype.hasOwnProperty,ABe=Object.prototype.propertyIsEnumerable,u$=(t,e,r)=>e in t?wBe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,d$=(t,e)=>{for(var r in e||(e={}))CBe.call(e,r)&&u$(t,r,e[r]);if(f$)for(var r of f$(e))ABe.call(e,r)&&u$(t,r,e[r]);return t},h$=(t,e)=>xBe(t,EBe(e));const SBe={Accept:"application/json","Content-Type":"application/json"},_Be="POST",p$={headers:SBe,method:_Be},v$=10;let Jc=class{constructor(e,r=!1){if(this.url=e,this.disableProviderPing=r,this.events=new ga.EventEmitter,this.isAvailable=!1,this.registering=!1,!DU(e))throw new Error(`Provided URL is not compatible with HTTP connection: ${e}`);this.url=e,this.disableProviderPing=r}get connected(){return this.isAvailable}get connecting(){return this.registering}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async open(e=this.url){await this.register(e)}async close(){if(!this.isAvailable)throw new Error("Connection already closed");this.onClose()}async send(e){this.isAvailable||await this.register();try{const r=_u(e),n=await(await l$(this.url,h$(d$({},p$),{body:r}))).json();this.onPayload({data:n})}catch(r){this.onError(e.id,r)}}async register(e=this.url){if(!DU(e))throw new Error(`Provided URL is not compatible with HTTP connection: ${e}`);if(this.registering){const r=this.events.getMaxListeners();return(this.events.listenerCount("register_error")>=r||this.events.listenerCount("open")>=r)&&this.events.setMaxListeners(r+1),new Promise((n,i)=>{this.events.once("register_error",s=>{this.resetMaxListeners(),i(s)}),this.events.once("open",()=>{if(this.resetMaxListeners(),typeof this.isAvailable>"u")return i(new Error("HTTP connection is missing or invalid"));n()})})}this.url=e,this.registering=!0;try{if(!this.disableProviderPing){const r=_u({id:1,jsonrpc:"2.0",method:"test",params:[]});await l$(e,h$(d$({},p$),{body:r}))}this.onOpen()}catch(r){const n=this.parseError(r);throw this.events.emit("register_error",n),this.onClose(),n}}onOpen(){this.isAvailable=!0,this.registering=!1,this.events.emit("open")}onClose(){this.isAvailable=!1,this.registering=!1,this.events.emit("close")}onPayload(e){if(typeof e.data>"u")return;const r=typeof e.data=="string"?jp(e.data):e.data;this.events.emit("payload",r)}onError(e,r){const n=this.parseError(r),i=n.message||n.toString(),s=IE(e,i);this.events.emit("payload",s)}parseError(e,r=this.url){return Yee(e,r,"HTTP")}resetMaxListeners(){this.events.getMaxListeners()>v$&&this.events.setMaxListeners(v$)}};const g$="error",IBe="wss://relay.walletconnect.org",TBe="wc",PBe="universal_provider",y$=`${TBe}@2:${PBe}:`,bte="https://rpc.walletconnect.org/v1/",J1="generic",kBe=`${bte}bundler`,uc={DEFAULT_CHAIN_CHANGED:"default_chain_changed"};var MBe=Object.defineProperty,RBe=Object.defineProperties,OBe=Object.getOwnPropertyDescriptors,m$=Object.getOwnPropertySymbols,NBe=Object.prototype.hasOwnProperty,DBe=Object.prototype.propertyIsEnumerable,b$=(t,e,r)=>e in t?MBe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,M6=(t,e)=>{for(var r in e||(e={}))NBe.call(e,r)&&b$(t,r,e[r]);if(m$)for(var r of m$(e))DBe.call(e,r)&&b$(t,r,e[r]);return t},BBe=(t,e)=>RBe(t,OBe(e));function da(t,e,r){var n;const i=Gv(t);return((n=e.rpcMap)==null?void 0:n[i.reference])||`${bte}?chainId=${i.namespace}:${i.reference}&projectId=${r}`}function i1(t){return t.includes(":")?t.split(":")[1]:t}function wte(t){return t.map(e=>`${e.split(":")[0]}:${e.split(":")[1]}`)}function LBe(t,e){const r=Object.keys(e.namespaces).filter(i=>i.includes(t));if(!r.length)return[];const n=[];return r.forEach(i=>{const s=e.namespaces[i].accounts;n.push(...s)}),n}function rS(t={},e={}){const r=w$(t),n=w$(e);return mBe.merge(r,n)}function w$(t){var e,r,n,i;const s={};if(!Nw(t))return s;for(const[o,a]of Object.entries(t)){const c=VM(o)?[o]:a.chains,l=a.methods||[],f=a.events||[],u=a.rpcMap||{},p=ub(o);s[p]=BBe(M6(M6({},s[p]),a),{chains:T3(c,(e=s[p])==null?void 0:e.chains),methods:T3(l,(r=s[p])==null?void 0:r.methods),events:T3(f,(n=s[p])==null?void 0:n.events),rpcMap:M6(M6({},u),(i=s[p])==null?void 0:i.rpcMap)})}return s}function FBe(t){return t.includes(":")?t.split(":")[2]:t}function x$(t){const e={};for(const[r,n]of Object.entries(t)){const i=n.methods||[],s=n.events||[],o=n.accounts||[],a=VM(r)?[r]:n.chains?n.chains:wte(n.accounts);e[r]={chains:a,methods:i,events:s,accounts:o}}return e}function nS(t){return typeof t=="number"?t:t.includes("0x")?parseInt(t,16):(t=t.includes(":")?t.split(":")[1]:t,isNaN(Number(t))?t:Number(t))}const xte={},Vr=t=>xte[t],iS=(t,e)=>{xte[t]=e};class jBe{constructor(e){this.name="polkadot",this.namespace=e.namespace,this.events=Vr("events"),this.client=Vr("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(uc.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getAccounts(){const e=this.namespace.accounts;return e?e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2])||[]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;const i=i1(r);e[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||da(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new fc(new Jc(n,Vr("disableProviderPing")))}}var UBe=Object.defineProperty,$Be=Object.defineProperties,qBe=Object.getOwnPropertyDescriptors,E$=Object.getOwnPropertySymbols,VBe=Object.prototype.hasOwnProperty,zBe=Object.prototype.propertyIsEnumerable,C$=(t,e,r)=>e in t?UBe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,A$=(t,e)=>{for(var r in e||(e={}))VBe.call(e,r)&&C$(t,r,e[r]);if(E$)for(var r of E$(e))zBe.call(e,r)&&C$(t,r,e[r]);return t},S$=(t,e)=>$Be(t,qBe(e));class HBe{constructor(e){this.name="eip155",this.namespace=e.namespace,this.events=Vr("events"),this.client=Vr("client"),this.httpProviders=this.createHttpProviders(),this.chainId=parseInt(this.getDefaultChain())}async request(e){switch(e.request.method){case"eth_requestAccounts":return this.getAccounts();case"eth_accounts":return this.getAccounts();case"wallet_switchEthereumChain":return await this.handleSwitchChain(e);case"eth_chainId":return parseInt(this.getDefaultChain());case"wallet_getCapabilities":return await this.getCapabilities(e);case"wallet_getCallsStatus":return await this.getCallStatus(e)}return this.namespace.methods.includes(e.request.method)?await this.client.request(e):this.getHttpProvider().request(e.request)}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(parseInt(e),r),this.chainId=parseInt(e),this.events.emit(uc.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId.toString();if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}createHttpProvider(e,r){const n=r||da(`${this.name}:${e}`,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new fc(new Jc(n,Vr("disableProviderPing")))}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;const i=parseInt(i1(r));e[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}getHttpProvider(){const e=this.chainId,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}async handleSwitchChain(e){var r,n;let i=e.request.params?(r=e.request.params[0])==null?void 0:r.chainId:"0x0";i=i.startsWith("0x")?i:`0x${i}`;const s=parseInt(i,16);if(this.isChainApproved(s))this.setDefaultChain(`${s}`);else if(this.namespace.methods.includes("wallet_switchEthereumChain"))await this.client.request({topic:e.topic,request:{method:e.request.method,params:[{chainId:i}]},chainId:(n=this.namespace.chains)==null?void 0:n[0]}),this.setDefaultChain(`${s}`);else throw new Error(`Failed to switch to chain 'eip155:${s}'. The chain is not approved or the wallet does not support 'wallet_switchEthereumChain' method.`);return null}isChainApproved(e){return this.namespace.chains.includes(`${this.name}:${e}`)}async getCapabilities(e){var r,n,i;const s=(n=(r=e.request)==null?void 0:r.params)==null?void 0:n[0];if(!s)throw new Error("Missing address parameter in `wallet_getCapabilities` request");const o=this.client.session.get(e.topic),a=((i=o==null?void 0:o.sessionProperties)==null?void 0:i.capabilities)||{};if(a!=null&&a[s])return a==null?void 0:a[s];const c=await this.client.request(e);try{await this.client.session.update(e.topic,{sessionProperties:S$(A$({},o.sessionProperties||{}),{capabilities:S$(A$({},a||{}),{[s]:c})})})}catch(l){console.warn("Failed to update session with capabilities",l)}return c}async getCallStatus(e){var r,n;const i=this.client.session.get(e.topic),s=(r=i.sessionProperties)==null?void 0:r.bundler_name;if(s){const a=this.getBundlerUrl(e.chainId,s);try{return await this.getUserOperationReceipt(a,e)}catch(c){console.warn("Failed to fetch call status from bundler",c,a)}}const o=(n=i.sessionProperties)==null?void 0:n.bundler_url;if(o)try{return await this.getUserOperationReceipt(o,e)}catch(a){console.warn("Failed to fetch call status from custom bundler",a,o)}if(this.namespace.methods.includes(e.request.method))return await this.client.request(e);throw new Error("Fetching call status not approved by the wallet.")}async getUserOperationReceipt(e,r){var n;const i=new URL(e),s=await fetch(i,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify($d("eth_getUserOperationReceipt",[(n=r.request.params)==null?void 0:n[0]]))});if(!s.ok)throw new Error(`Failed to fetch user operation receipt - ${s.status}`);return await s.json()}getBundlerUrl(e,r){return`${kBe}?projectId=${this.client.core.projectId}&chainId=${e}&bundler=${r}`}}class GBe{constructor(e){this.name="solana",this.namespace=e.namespace,this.events=Vr("events"),this.client=Vr("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(uc.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;const i=i1(r);e[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||da(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new fc(new Jc(n,Vr("disableProviderPing")))}}class WBe{constructor(e){this.name="cosmos",this.namespace=e.namespace,this.events=Vr("events"),this.client=Vr("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(uc.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;const i=i1(r);e[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||da(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new fc(new Jc(n,Vr("disableProviderPing")))}}class KBe{constructor(e){this.name="algorand",this.namespace=e.namespace,this.events=Vr("events"),this.client=Vr("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){if(!this.httpProviders[e]){const n=r||da(`${this.name}:${e}`,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);this.setHttpProvider(e,n)}this.chainId=e,this.events.emit(uc.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;e[r]=this.createHttpProvider(r,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||da(e,this.namespace,this.client.core.projectId);return typeof n>"u"?void 0:new fc(new Jc(n,Vr("disableProviderPing")))}}class YBe{constructor(e){this.name="cip34",this.namespace=e.namespace,this.events=Vr("events"),this.client=Vr("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(uc.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{const n=this.getCardanoRPCUrl(r),i=i1(r);e[i]=this.createHttpProvider(i,n)}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}getCardanoRPCUrl(e){const r=this.namespace.rpcMap;if(r)return r[e]}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||this.getCardanoRPCUrl(e);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new fc(new Jc(n,Vr("disableProviderPing")))}}class QBe{constructor(e){this.name="elrond",this.namespace=e.namespace,this.events=Vr("events"),this.client=Vr("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(uc.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;const i=i1(r);e[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||da(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new fc(new Jc(n,Vr("disableProviderPing")))}}class JBe{constructor(e){this.name="multiversx",this.namespace=e.namespace,this.events=Vr("events"),this.client=Vr("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(uc.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;const i=i1(r);e[i]=this.createHttpProvider(i,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||da(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new fc(new Jc(n,Vr("disableProviderPing")))}}class ZBe{constructor(e){this.name="near",this.namespace=e.namespace,this.events=Vr("events"),this.client=Vr("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){if(this.chainId=e,!this.httpProviders[e]){const n=r||da(`${this.name}:${e}`,this.namespace);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);this.setHttpProvider(e,n)}this.events.emit(uc.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e?e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2])||[]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{var n;e[r]=this.createHttpProvider(r,(n=this.namespace.rpcMap)==null?void 0:n[r])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||da(e,this.namespace);return typeof n>"u"?void 0:new fc(new Jc(n,Vr("disableProviderPing")))}}class XBe{constructor(e){this.name="tezos",this.namespace=e.namespace,this.events=Vr("events"),this.client=Vr("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,r){if(this.chainId=e,!this.httpProviders[e]){const n=r||da(`${this.name}:${e}`,this.namespace);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);this.setHttpProvider(e,n)}this.events.emit(uc.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e?e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2])||[]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(r=>{e[r]=this.createHttpProvider(r)}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||da(e,this.namespace);return typeof n>"u"?void 0:new fc(new Jc(n))}}class eLe{constructor(e){this.name=J1,this.namespace=e.namespace,this.events=Vr("events"),this.client=Vr("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace.chains=[...new Set((this.namespace.chains||[]).concat(e.chains||[]))],this.namespace.accounts=[...new Set((this.namespace.accounts||[]).concat(e.accounts||[]))],this.namespace.methods=[...new Set((this.namespace.methods||[]).concat(e.methods||[]))],this.namespace.events=[...new Set((this.namespace.events||[]).concat(e.events||[]))],this.httpProviders=this.createHttpProviders()}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider(e.chainId).request(e.request)}setDefaultChain(e,r){this.httpProviders[e]||this.setHttpProvider(e,r),this.chainId=e,this.events.emit(uc.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(r=>r.split(":")[1]===this.chainId.toString()).map(r=>r.split(":")[2]))]:[]}createHttpProviders(){var e,r;const n={};return(r=(e=this.namespace)==null?void 0:e.accounts)==null||r.forEach(i=>{const s=Gv(i);n[`${s.namespace}:${s.reference}`]=this.createHttpProvider(i)}),n}getHttpProvider(e){const r=this.httpProviders[e];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,r){const n=this.createHttpProvider(e,r);n&&(this.httpProviders[e]=n)}createHttpProvider(e,r){const n=r||da(e,this.namespace,this.client.core.projectId);if(!n)throw new Error(`No RPC url provided for chainId: ${e}`);return new fc(new Jc(n,Vr("disableProviderPing")))}}var tLe=Object.defineProperty,rLe=Object.defineProperties,nLe=Object.getOwnPropertyDescriptors,_$=Object.getOwnPropertySymbols,iLe=Object.prototype.hasOwnProperty,sLe=Object.prototype.propertyIsEnumerable,I$=(t,e,r)=>e in t?tLe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,R6=(t,e)=>{for(var r in e||(e={}))iLe.call(e,r)&&I$(t,r,e[r]);if(_$)for(var r of _$(e))sLe.call(e,r)&&I$(t,r,e[r]);return t},sS=(t,e)=>rLe(t,nLe(e));let oLe=class Ete{constructor(e){this.events=new bM,this.rpcProviders={},this.shouldAbortPairingAttempt=!1,this.maxPairingAttempts=10,this.disableProviderPing=!1,this.providerOpts=e,this.logger=typeof(e==null?void 0:e.logger)<"u"&&typeof(e==null?void 0:e.logger)!="string"?e.logger:Vx(SE({level:(e==null?void 0:e.logger)||g$})),this.disableProviderPing=(e==null?void 0:e.disableProviderPing)||!1}static async init(e){const r=new Ete(e);return await r.initialize(),r}async request(e,r,n){const[i,s]=this.validateChain(r);if(!this.session)throw new Error("Please call connect() before request()");return await this.getProvider(i).request({request:R6({},e),chainId:`${i}:${s}`,topic:this.session.topic,expiry:n})}sendAsync(e,r,n,i){const s=new Date().getTime();this.request(e,n,i).then(o=>r(null,_E(s,o))).catch(o=>r(o,void 0))}async enable(){if(!this.client)throw new Error("Sign Client not initialized");return this.session||await this.connect({namespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties}),await this.requestAccounts()}async disconnect(){var e;if(!this.session)throw new Error("Please call connect() before enable()");await this.client.disconnect({topic:(e=this.session)==null?void 0:e.topic,reason:sn("USER_DISCONNECTED")}),await this.cleanup()}async connect(e){if(!this.client)throw new Error("Sign Client not initialized");if(this.setNamespaces(e),await this.cleanupPendingPairings(),!e.skipPairing)return await this.pair(e.pairingTopic)}async authenticate(e,r){if(!this.client)throw new Error("Sign Client not initialized");this.setNamespaces(e),await this.cleanupPendingPairings();const{uri:n,response:i}=await this.client.authenticate(e,r);n&&(this.uri=n,this.events.emit("display_uri",n));const s=await i();if(this.session=s.session,this.session){const o=x$(this.session.namespaces);this.namespaces=rS(this.namespaces,o),this.persist("namespaces",this.namespaces),this.onConnect()}return s}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}removeListener(e,r){this.events.removeListener(e,r)}off(e,r){this.events.off(e,r)}get isWalletConnect(){return!0}async pair(e){this.shouldAbortPairingAttempt=!1;let r=0;do{if(this.shouldAbortPairingAttempt)throw new Error("Pairing aborted");if(r>=this.maxPairingAttempts)throw new Error("Max auto pairing attempts reached");const{uri:n,approval:i}=await this.client.connect({pairingTopic:e,requiredNamespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties});n&&(this.uri=n,this.events.emit("display_uri",n)),await i().then(s=>{this.session=s;const o=x$(s.namespaces);this.namespaces=rS(this.namespaces,o),this.persist("namespaces",this.namespaces)}).catch(s=>{if(s.message!==mte)throw s;r++})}while(!this.session);return this.onConnect(),this.session}setDefaultChain(e,r){try{if(!this.session)return;const[n,i]=this.validateChain(e),s=this.getProvider(n);s.name===J1?s.setDefaultChain(`${n}:${i}`,r):s.setDefaultChain(i,r)}catch(n){if(!/Please call connect/.test(n.message))throw n}}async cleanupPendingPairings(e={}){this.logger.info("Cleaning up inactive pairings...");const r=this.client.pairing.getAll();if(Jl(r)){for(const n of r)e.deletePairings?this.client.core.expirer.set(n.topic,0):await this.client.core.relayer.subscriber.unsubscribe(n.topic);this.logger.info(`Inactive pairings cleared: ${r.length}`)}}abortPairingAttempt(){this.shouldAbortPairingAttempt=!0}async checkStorage(){if(this.namespaces=await this.getFromStore("namespaces"),this.optionalNamespaces=await this.getFromStore("optionalNamespaces")||{},this.client.session.length){const e=this.client.session.keys.length-1;this.session=this.client.session.get(this.client.session.keys[e]),this.createProviders()}}async initialize(){this.logger.trace("Initialized"),await this.createClient(),await this.checkStorage(),this.registerEventListeners()}async createClient(){this.client=this.providerOpts.client||await ME.init({core:this.providerOpts.core,logger:this.providerOpts.logger||g$,relayUrl:this.providerOpts.relayUrl||IBe,projectId:this.providerOpts.projectId,metadata:this.providerOpts.metadata,storageOptions:this.providerOpts.storageOptions,storage:this.providerOpts.storage,name:this.providerOpts.name,customStoragePrefix:this.providerOpts.customStoragePrefix,telemetryEnabled:this.providerOpts.telemetryEnabled}),this.logger.trace("SignClient Initialized")}createProviders(){if(!this.client)throw new Error("Sign Client not initialized");if(!this.session)throw new Error("Session not initialized. Please call connect() before enable()");const e=[...new Set(Object.keys(this.session.namespaces).map(r=>ub(r)))];iS("client",this.client),iS("events",this.events),iS("disableProviderPing",this.disableProviderPing),e.forEach(r=>{if(!this.session)return;const n=LBe(r,this.session),i=wte(n),s=rS(this.namespaces,this.optionalNamespaces),o=sS(R6({},s[r]),{accounts:n,chains:i});switch(r){case"eip155":this.rpcProviders[r]=new HBe({namespace:o});break;case"algorand":this.rpcProviders[r]=new KBe({namespace:o});break;case"solana":this.rpcProviders[r]=new GBe({namespace:o});break;case"cosmos":this.rpcProviders[r]=new WBe({namespace:o});break;case"polkadot":this.rpcProviders[r]=new jBe({namespace:o});break;case"cip34":this.rpcProviders[r]=new YBe({namespace:o});break;case"elrond":this.rpcProviders[r]=new QBe({namespace:o});break;case"multiversx":this.rpcProviders[r]=new JBe({namespace:o});break;case"near":this.rpcProviders[r]=new ZBe({namespace:o});break;case"tezos":this.rpcProviders[r]=new XBe({namespace:o});break;default:this.rpcProviders[J1]?this.rpcProviders[J1].updateNamespace(o):this.rpcProviders[J1]=new eLe({namespace:o})}})}registerEventListeners(){if(typeof this.client>"u")throw new Error("Sign Client is not initialized");this.client.on("session_ping",e=>{this.events.emit("session_ping",e)}),this.client.on("session_event",e=>{const{params:r}=e,{event:n}=r;if(n.name==="accountsChanged"){const i=n.data;i&&Jl(i)&&this.events.emit("accountsChanged",i.map(FBe))}else if(n.name==="chainChanged"){const i=r.chainId,s=r.event.data,o=ub(i),a=nS(i)!==nS(s)?`${o}:${nS(s)}`:i;this.onChainChanged(a)}else this.events.emit(n.name,n.data);this.events.emit("session_event",e)}),this.client.on("session_update",({topic:e,params:r})=>{var n;const{namespaces:i}=r,s=(n=this.client)==null?void 0:n.session.get(e);this.session=sS(R6({},s),{namespaces:i}),this.onSessionUpdate(),this.events.emit("session_update",{topic:e,params:r})}),this.client.on("session_delete",async e=>{await this.cleanup(),this.events.emit("session_delete",e),this.events.emit("disconnect",sS(R6({},sn("USER_DISCONNECTED")),{data:e.topic}))}),this.on(uc.DEFAULT_CHAIN_CHANGED,e=>{this.onChainChanged(e,!0)})}getProvider(e){return this.rpcProviders[e]||this.rpcProviders[J1]}onSessionUpdate(){Object.keys(this.rpcProviders).forEach(e=>{var r;this.getProvider(e).updateNamespace((r=this.session)==null?void 0:r.namespaces[e])})}setNamespaces(e){const{namespaces:r,optionalNamespaces:n,sessionProperties:i}=e;r&&Object.keys(r).length&&(this.namespaces=r),n&&Object.keys(n).length&&(this.optionalNamespaces=n),this.sessionProperties=i,this.persist("namespaces",r),this.persist("optionalNamespaces",n)}validateChain(e){const[r,n]=(e==null?void 0:e.split(":"))||["",""];if(!this.namespaces||!Object.keys(this.namespaces).length)return[r,n];if(r&&!Object.keys(this.namespaces||{}).map(o=>ub(o)).includes(r))throw new Error(`Namespace '${r}' is not configured. Please call connect() first with namespace config.`);if(r&&n)return[r,n];const i=ub(Object.keys(this.namespaces)[0]),s=this.rpcProviders[i].getDefaultChain();return[i,s]}async requestAccounts(){const[e]=this.validateChain();return await this.getProvider(e).requestAccounts()}onChainChanged(e,r=!1){if(!this.namespaces)return;const[n,i]=this.validateChain(e);i&&(r||this.getProvider(n).setDefaultChain(i),this.namespaces[n]?this.namespaces[n].defaultChain=i:this.namespaces[`${n}:${i}`]?this.namespaces[`${n}:${i}`].defaultChain=i:this.namespaces[`${n}:${i}`]={defaultChain:i},this.persist("namespaces",this.namespaces),this.events.emit("chainChanged",i))}onConnect(){this.createProviders(),this.events.emit("connect",{session:this.session})}async cleanup(){this.session=void 0,this.namespaces=void 0,this.optionalNamespaces=void 0,this.sessionProperties=void 0,this.persist("namespaces",void 0),this.persist("optionalNamespaces",void 0),this.persist("sessionProperties",void 0),await this.cleanupPendingPairings({deletePairings:!0})}persist(e,r){this.client.core.storage.setItem(`${y$}/${e}`,r)}async getFromStore(e){return await this.client.core.storage.getItem(`${y$}/${e}`)}};const aLe=oLe,cLe="wc",lLe="ethereum_provider",fLe=`${cLe}@2:${lLe}:`,uLe="https://rpc.walletconnect.org/v1/",EI=["eth_sendTransaction","personal_sign"],dLe=["eth_accounts","eth_requestAccounts","eth_sendRawTransaction","eth_sign","eth_signTransaction","eth_signTypedData","eth_signTypedData_v3","eth_signTypedData_v4","eth_sendTransaction","personal_sign","wallet_switchEthereumChain","wallet_addEthereumChain","wallet_getPermissions","wallet_requestPermissions","wallet_registerOnboarding","wallet_watchAsset","wallet_scanQRCode","wallet_sendCalls","wallet_getCapabilities","wallet_getCallsStatus","wallet_showCallsStatus"],CI=["chainChanged","accountsChanged"],hLe=["chainChanged","accountsChanged","message","disconnect","connect"];var pLe=Object.defineProperty,vLe=Object.defineProperties,gLe=Object.getOwnPropertyDescriptors,T$=Object.getOwnPropertySymbols,yLe=Object.prototype.hasOwnProperty,mLe=Object.prototype.propertyIsEnumerable,P$=(t,e,r)=>e in t?pLe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Z1=(t,e)=>{for(var r in e||(e={}))yLe.call(e,r)&&P$(t,r,e[r]);if(T$)for(var r of T$(e))mLe.call(e,r)&&P$(t,r,e[r]);return t},oS=(t,e)=>vLe(t,gLe(e));function f4(t){return Number(t[0].split(":")[1])}function O6(t){return`0x${t.toString(16)}`}function bLe(t){const{chains:e,optionalChains:r,methods:n,optionalMethods:i,events:s,optionalEvents:o,rpcMap:a}=t;if(!Jl(e))throw new Error("Invalid chains");const c={chains:e,methods:n||EI,events:s||CI,rpcMap:Z1({},e.length?{[f4(e)]:a[f4(e)]}:{})},l=s==null?void 0:s.filter(g=>!CI.includes(g)),f=n==null?void 0:n.filter(g=>!EI.includes(g));if(!r&&!o&&!i&&!(l!=null&&l.length)&&!(f!=null&&f.length))return{required:e.length?c:void 0};const u=(l==null?void 0:l.length)&&(f==null?void 0:f.length)||!r,p={chains:[...new Set(u?c.chains.concat(r||[]):r)],methods:[...new Set(c.methods.concat(i!=null&&i.length?i:dLe))],events:[...new Set(c.events.concat(o!=null&&o.length?o:hLe))],rpcMap:a};return{required:e.length?c:void 0,optional:r.length?p:void 0}}let wLe=class Cte{constructor(){this.events=new ga.EventEmitter,this.namespace="eip155",this.accounts=[],this.chainId=1,this.STORAGE_KEY=fLe,this.on=(e,r)=>(this.events.on(e,r),this),this.once=(e,r)=>(this.events.once(e,r),this),this.removeListener=(e,r)=>(this.events.removeListener(e,r),this),this.off=(e,r)=>(this.events.off(e,r),this),this.parseAccount=e=>this.isCompatibleChainId(e)?this.parseAccountId(e).address:e,this.signer={},this.rpc={}}static async init(e){const r=new Cte;return await r.initialize(e),r}async request(e,r){return await this.signer.request(e,this.formatChainId(this.chainId),r)}sendAsync(e,r,n){this.signer.sendAsync(e,r,this.formatChainId(this.chainId),n)}get connected(){return this.signer.client?this.signer.client.core.relayer.connected:!1}get connecting(){return this.signer.client?this.signer.client.core.relayer.connecting:!1}async enable(){return this.session||await this.connect(),await this.request({method:"eth_requestAccounts"})}async connect(e){if(!this.signer.client)throw new Error("Provider not initialized. Call init() first");this.loadConnectOpts(e);const{required:r,optional:n}=bLe(this.rpc);try{const i=await new Promise(async(o,a)=>{var c;this.rpc.showQrModal&&((c=this.modal)==null||c.subscribeModal(l=>{!l.open&&!this.signer.session&&(this.signer.abortPairingAttempt(),a(new Error("Connection request reset. Please try again.")))})),await this.signer.connect(oS(Z1({namespaces:Z1({},r&&{[this.namespace]:r})},n&&{optionalNamespaces:{[this.namespace]:n}}),{pairingTopic:e==null?void 0:e.pairingTopic})).then(l=>{o(l)}).catch(l=>{a(new Error(l.message))})});if(!i)return;const s=Zj(i.namespaces,[this.namespace]);this.setChainIds(this.rpc.chains.length?this.rpc.chains:s),this.setAccounts(s),this.events.emit("connect",{chainId:O6(this.chainId)})}catch(i){throw this.signer.logger.error(i),i}finally{this.modal&&this.modal.closeModal()}}async authenticate(e,r){if(!this.signer.client)throw new Error("Provider not initialized. Call init() first");this.loadConnectOpts({chains:e==null?void 0:e.chains});try{const n=await new Promise(async(s,o)=>{var a;this.rpc.showQrModal&&((a=this.modal)==null||a.subscribeModal(c=>{!c.open&&!this.signer.session&&(this.signer.abortPairingAttempt(),o(new Error("Connection request reset. Please try again.")))})),await this.signer.authenticate(oS(Z1({},e),{chains:this.rpc.chains}),r).then(c=>{s(c)}).catch(c=>{o(new Error(c.message))})}),i=n.session;if(i){const s=Zj(i.namespaces,[this.namespace]);this.setChainIds(this.rpc.chains.length?this.rpc.chains:s),this.setAccounts(s),this.events.emit("connect",{chainId:O6(this.chainId)})}return n}catch(n){throw this.signer.logger.error(n),n}finally{this.modal&&this.modal.closeModal()}}async disconnect(){this.session&&await this.signer.disconnect(),this.reset()}get isWalletConnect(){return!0}get session(){return this.signer.session}registerEventListeners(){this.signer.on("session_event",e=>{const{params:r}=e,{event:n}=r;n.name==="accountsChanged"?(this.accounts=this.parseAccounts(n.data),this.events.emit("accountsChanged",this.accounts)):n.name==="chainChanged"?this.setChainId(this.formatChainId(n.data)):this.events.emit(n.name,n.data),this.events.emit("session_event",e)}),this.signer.on("chainChanged",e=>{const r=parseInt(e);this.chainId=r,this.events.emit("chainChanged",O6(this.chainId)),this.persist()}),this.signer.on("session_update",e=>{this.events.emit("session_update",e)}),this.signer.on("session_delete",e=>{this.reset(),this.events.emit("session_delete",e),this.events.emit("disconnect",oS(Z1({},sn("USER_DISCONNECTED")),{data:e.topic,name:"USER_DISCONNECTED"}))}),this.signer.on("display_uri",e=>{var r,n;this.rpc.showQrModal&&((r=this.modal)==null||r.closeModal(),(n=this.modal)==null||n.openModal({uri:e})),this.events.emit("display_uri",e)})}switchEthereumChain(e){this.request({method:"wallet_switchEthereumChain",params:[{chainId:e.toString(16)}]})}isCompatibleChainId(e){return typeof e=="string"?e.startsWith(`${this.namespace}:`):!1}formatChainId(e){return`${this.namespace}:${e}`}parseChainId(e){return Number(e.split(":")[1])}setChainIds(e){const r=e.filter(n=>this.isCompatibleChainId(n)).map(n=>this.parseChainId(n));r.length&&(this.chainId=r[0],this.events.emit("chainChanged",O6(this.chainId)),this.persist())}setChainId(e){if(this.isCompatibleChainId(e)){const r=this.parseChainId(e);this.chainId=r,this.switchEthereumChain(r)}}parseAccountId(e){const[r,n,i]=e.split(":");return{chainId:`${r}:${n}`,address:i}}setAccounts(e){this.accounts=e.filter(r=>this.parseChainId(this.parseAccountId(r).chainId)===this.chainId).map(r=>this.parseAccountId(r).address),this.events.emit("accountsChanged",this.accounts)}getRpcConfig(e){var r,n;const i=(r=e==null?void 0:e.chains)!=null?r:[],s=(n=e==null?void 0:e.optionalChains)!=null?n:[],o=i.concat(s);if(!o.length)throw new Error("No chains specified in either `chains` or `optionalChains`");const a=i.length?(e==null?void 0:e.methods)||EI:[],c=i.length?(e==null?void 0:e.events)||CI:[],l=(e==null?void 0:e.optionalMethods)||[],f=(e==null?void 0:e.optionalEvents)||[],u=(e==null?void 0:e.rpcMap)||this.buildRpcMap(o,e.projectId),p=(e==null?void 0:e.qrModalOptions)||void 0;return{chains:i==null?void 0:i.map(g=>this.formatChainId(g)),optionalChains:s.map(g=>this.formatChainId(g)),methods:a,events:c,optionalMethods:l,optionalEvents:f,rpcMap:u,showQrModal:!!(e!=null&&e.showQrModal),qrModalOptions:p,projectId:e.projectId,metadata:e.metadata}}buildRpcMap(e,r){const n={};return e.forEach(i=>{n[i]=this.getRpcUrl(i,r)}),n}async initialize(e){if(this.rpc=this.getRpcConfig(e),this.chainId=this.rpc.chains.length?f4(this.rpc.chains):f4(this.rpc.optionalChains),this.signer=await aLe.init({projectId:this.rpc.projectId,metadata:this.rpc.metadata,disableProviderPing:e.disableProviderPing,relayUrl:e.relayUrl,storageOptions:e.storageOptions,customStoragePrefix:e.customStoragePrefix,telemetryEnabled:e.telemetryEnabled}),this.registerEventListeners(),await this.loadPersistedSession(),this.rpc.showQrModal){let r;try{const{WalletConnectModal:n}=await C9e(()=>import("./index-CPIN7QOU.js").then(i=>i.i),[]);r=n}catch{throw new Error("To use QR modal, please install @walletconnect/modal package")}if(r)try{this.modal=new r(Z1({projectId:this.rpc.projectId},this.rpc.qrModalOptions))}catch(n){throw this.signer.logger.error(n),new Error("Could not generate WalletConnectModal Instance")}}}loadConnectOpts(e){if(!e)return;const{chains:r,optionalChains:n,rpcMap:i}=e;r&&Jl(r)&&(this.rpc.chains=r.map(s=>this.formatChainId(s)),r.forEach(s=>{this.rpc.rpcMap[s]=(i==null?void 0:i[s])||this.getRpcUrl(s)})),n&&Jl(n)&&(this.rpc.optionalChains=[],this.rpc.optionalChains=n==null?void 0:n.map(s=>this.formatChainId(s)),n.forEach(s=>{this.rpc.rpcMap[s]=(i==null?void 0:i[s])||this.getRpcUrl(s)}))}getRpcUrl(e,r){var n;return((n=this.rpc.rpcMap)==null?void 0:n[e])||`${uLe}?chainId=eip155:${e}&projectId=${r||this.rpc.projectId}`}async loadPersistedSession(){if(this.session)try{const e=await this.signer.client.core.storage.getItem(`${this.STORAGE_KEY}/chainId`),r=this.session.namespaces[`${this.namespace}:${e}`]?this.session.namespaces[`${this.namespace}:${e}`]:this.session.namespaces[this.namespace];this.setChainIds(e?[this.formatChainId(e)]:r==null?void 0:r.accounts),this.setAccounts(r==null?void 0:r.accounts)}catch(e){this.signer.logger.error("Failed to load persisted session, clearing state..."),this.signer.logger.error(e),await this.disconnect().catch(r=>this.signer.logger.warn(r))}}reset(){this.chainId=1,this.accounts=[]}persist(){this.session&&this.signer.client.core.storage.setItem(`${this.STORAGE_KEY}/chainId`,this.chainId)}parseAccounts(e){return typeof e=="string"||e instanceof String?[this.parseAccount(e)]:e.map(r=>this.parseAccount(r))}};var Ate={exports:{}};/*! * EventEmitter2 * https://github.com/hij1nx/EventEmitter2 * * Copyright (c) 2013 hij1nx * Licensed under the MIT license. */(function(t,e){(function(r){var n=Object.hasOwnProperty,i=Array.isArray?Array.isArray:function(x){return Object.prototype.toString.call(x)==="[object Array]"},s=10,o=typeof process=="object"&&typeof process.nextTick=="function",a=typeof Symbol=="function",c=typeof Reflect=="object",l=typeof setImmediate=="function",f=l?setImmediate:setTimeout,u=a?c&&typeof Reflect.ownKeys=="function"?Reflect.ownKeys:function(E){var x=Object.getOwnPropertyNames(E);return x.push.apply(x,Object.getOwnPropertySymbols(E)),x}:Object.keys;function p(){this._events={},this._conf&&g.call(this,this._conf)}function g(E){E&&(this._conf=E,E.delimiter&&(this.delimiter=E.delimiter),E.maxListeners!==r&&(this._maxListeners=E.maxListeners),E.wildcard&&(this.wildcard=E.wildcard),E.newListener&&(this._newListener=E.newListener),E.removeListener&&(this._removeListener=E.removeListener),E.verboseMemoryLeak&&(this.verboseMemoryLeak=E.verboseMemoryLeak),E.ignoreErrors&&(this.ignoreErrors=E.ignoreErrors),this.wildcard&&(this.listenerTree={}))}function y(E,x){var w="(node) warning: possible EventEmitter memory leak detected. "+E+" listeners added. Use emitter.setMaxListeners() to increase limit.";if(this.verboseMemoryLeak&&(w+=" Event name: "+x+"."),typeof process<"u"&&process.emitWarning){var T=new Error(w);T.name="MaxListenersExceededWarning",T.emitter=this,T.count=E,process.emitWarning(T)}else console.error(w),console.trace&&console.trace()}var b=function(E,x,w){var T=arguments.length;switch(T){case 0:return[];case 1:return[E];case 2:return[E,x];case 3:return[E,x,w];default:for(var P=new Array(T);T--;)P[T]=arguments[T];return P}};function I(E,x){for(var w={},T,P=E.length,z=0,oe=0;oe0;)E=z[X],oe.call(j,E,w[E]);this._listeners={},this._listenersCount=0,G()}}});function S(E,x,w,T){var P=Object.assign({},x);if(!E)return P;if(typeof E!="object")throw TypeError("options must be an object");var z=Object.keys(E),oe=z.length,j,X,G;function Z(D){throw Error('Invalid "'+j+'" option value'+(D?". Reason: "+D:""))}for(var re=0;re0;)if(j===E[X])return z;oe(x)}}var F=L(["function"]),H=L(["object","function"]);function _(E,x,w){var T,P,z=0,oe,j=new E(function(X,G,Z){w=S(w,{timeout:0,overload:!1},{timeout:function(fe,Ee){return fe*=1,(typeof fe!="number"||fe<0||!Number.isFinite(fe))&&Ee("timeout must be a positive number"),fe}}),T=!w.overload&&typeof E.prototype.cancel=="function"&&typeof Z=="function";function re(){P&&(P=null),z&&(clearTimeout(z),z=0)}var D=function(fe){re(),X(fe)},ee=function(fe){re(),G(fe)};T?x(D,ee,Z):(P=[function(fe){ee(fe||Error("canceled"))}],x(D,ee,function(fe){if(oe)throw Error("Unable to subscribe on cancel event asynchronously");if(typeof fe!="function")throw TypeError("onCancel callback must be a function");P.push(fe)}),oe=!0),w.timeout>0&&(z=setTimeout(function(){var fe=Error("timeout");fe.code="ETIMEDOUT",z=0,j.cancel(fe),G(fe)},w.timeout))});return T||(j.cancel=function(X){if(P){for(var G=P.length,Z=1;Z0;)ee=et[j],ee!=="_listeners"&&(Re=ie(E,x,w[ee],T+1,P),Re&&(D?D.push.apply(D,Re):D=Re));return D}else if(Ze==="**"){for(Me=T+1===P||T+2===P&&ze==="*",Me&&w._listeners&&(D=ie(E,x,w,P,P)),et=u(w),j=et.length;j-- >0;)ee=et[j],ee!=="_listeners"&&(ee==="*"||ee==="**"?(w[ee]._listeners&&!Me&&(Re=ie(E,x,w[ee],P,P),Re&&(D?D.push.apply(D,Re):D=Re)),Re=ie(E,x,w[ee],T,P)):ee===ze?Re=ie(E,x,w[ee],T+2,P):Re=ie(E,x,w[ee],T,P),Re&&(D?D.push.apply(D,Re):D=Re));return D}else w[Ze]&&(D=ie(E,x,w[Ze],T+1,P));if(fe=w["*"],fe&&ie(E,x,fe,T+1,P),Ee=w["**"],Ee)if(T0;)ee=et[j],ee!=="_listeners"&&(ee===ze?ie(E,x,Ee[ee],T+2,P):ee===Ze?ie(E,x,Ee[ee],T+1,P):(_e={},_e[ee]=Ee[ee],ie(E,x,{"**":_e},T+1,P)));else Ee._listeners?ie(E,x,Ee,P,P):Ee["*"]&&Ee["*"]._listeners&&ie(E,x,Ee["*"],P,P);return D}function ce(E,x,w){var T=0,P=0,z,oe=this.delimiter,j=oe.length,X;if(typeof E=="string")if((z=E.indexOf(oe))!==-1){X=new Array(5);do X[T++]=E.slice(P,z),P=z+j;while((z=E.indexOf(oe,P))!==-1);X[T++]=E.slice(P)}else X=[E],T=1;else X=E,T=E.length;if(T>1){for(z=0;z+10&&G._listeners.length>this._maxListeners&&(G._listeners.warned=!0,y.call(this,G._listeners.length,Z))):G._listeners=x,!0;return!0}function K(E,x,w,T){for(var P=u(E),z=P.length,oe,j,X,G=E._listeners,Z;z-- >0;)j=P[z],oe=E[j],j==="_listeners"?X=w:X=w?w.concat(j):[j],Z=T||typeof j=="symbol",G&&x.push(Z?X:X.join(this.delimiter)),typeof oe=="object"&&K.call(this,oe,x,X,Z);return x}function k(E){for(var x=u(E),w=x.length,T,P,z;w-- >0;)P=x[w],T=E[P],T&&(z=!0,P!=="_listeners"&&!k(T)&&delete E[P]);return z}function O(E,x,w){this.emitter=E,this.event=x,this.listener=w}O.prototype.off=function(){return this.emitter.off(this.event,this.listener),this};function v(E,x,w){if(w===!0)P=!0;else if(w===!1)T=!0;else{if(!w||typeof w!="object")throw TypeError("options should be an object or true");var T=w.async,P=w.promisify,z=w.nextTick,oe=w.objectify}if(T||z||P){var j=x,X=x._origin||x;if(z&&!o)throw Error("process.nextTick is not supported");P===r&&(P=x.constructor.name==="AsyncFunction"),x=function(){var G=arguments,Z=this,re=this.event;return P?z?Promise.resolve():new Promise(function(D){f(D)}).then(function(){return Z.event=re,j.apply(Z,G)}):(z?process.nextTick:f)(function(){Z.event=re,j.apply(Z,G)})},x._async=!0,x._origin=X}return[x,oe?new O(this,E,x):this]}function m(E){this._events={},this._newListener=!1,this._removeListener=!1,this.verboseMemoryLeak=!1,g.call(this,E)}m.EventEmitter2=m,m.prototype.listenTo=function(E,x,w){if(typeof E!="object")throw TypeError("target musts be an object");var T=this;w=S(w,{on:r,off:r,reducers:r},{on:F,off:F,reducers:H});function P(z){if(typeof z!="object")throw TypeError("events must be an object");var oe=w.reducers,j=U.call(T,E),X;j===-1?X=new C(T,E,w):X=T._observers[j];for(var G=u(z),Z=G.length,re,D=typeof oe=="function",ee=0;ee0;)P=w[T],(!E||P._target===E)&&(P.unsubscribe(x),z=!0);return z},m.prototype.delimiter=".",m.prototype.setMaxListeners=function(E){E!==r&&(this._maxListeners=E,this._conf||(this._conf={}),this._conf.maxListeners=E)},m.prototype.getMaxListeners=function(){return this._maxListeners},m.prototype.event="",m.prototype.once=function(E,x,w){return this._once(E,x,!1,w)},m.prototype.prependOnceListener=function(E,x,w){return this._once(E,x,!0,w)},m.prototype._once=function(E,x,w,T){return this._many(E,1,x,w,T)},m.prototype.many=function(E,x,w,T){return this._many(E,x,w,!1,T)},m.prototype.prependMany=function(E,x,w,T){return this._many(E,x,w,!0,T)},m.prototype._many=function(E,x,w,T,P){var z=this;if(typeof w!="function")throw new Error("many only accepts instances of Function");function oe(){return--x===0&&z.off(E,oe),w.apply(this,arguments)}return oe._origin=w,this._on(E,oe,T,P)},m.prototype.emit=function(){if(!this._events&&!this._all)return!1;this._events||p.call(this);var E=arguments[0],x,w=this.wildcard,T,P,z,oe,j;if(E==="newListener"&&!this._newListener&&!this._events.newListener)return!1;if(w&&(x=E,E!=="newListener"&&E!=="removeListener"&&typeof E=="object")){if(P=E.length,a){for(z=0;z3)for(T=new Array(X-1),oe=1;oe3)for(P=new Array(G-1),j=1;j0&&this._events[E].length>this._maxListeners&&(this._events[E].warned=!0,y.call(this,this._events[E].length,E))):this._events[E]=x,P)},m.prototype.off=function(E,x){if(typeof x!="function")throw new Error("removeListener only takes instances of Function");var w,T=[];if(this.wildcard){var P=typeof E=="string"?E.split(this.delimiter):E.slice();if(T=ie.call(this,null,P,this.listenerTree,0),!T)return this}else{if(!this._events[E])return this;w=this._events[E],T.push({_listeners:w})}for(var z=0;z0){for(T=this._all,x=0,w=T.length;x0;)T=x[w[z]],typeof T=="function"?P.push(T):P.push.apply(P,T);return P}else{if(this.wildcard){if(oe=this.listenerTree,!oe)return[];var j=[],X=typeof E=="string"?E.split(this.delimiter):E.slice();return ie.call(this,j,X,oe,0),j}return x?(T=x[E],T?typeof T=="function"?[T]:T:[]):[]}},m.prototype.eventNames=function(E){var x=this._events;return this.wildcard?K.call(this,this.listenerTree,[],null,E):x?u(x):[]},m.prototype.listenerCount=function(E){return this.listeners(E).length},m.prototype.hasListeners=function(E){if(this.wildcard){var x=[],w=typeof E=="string"?E.split(this.delimiter):E.slice();return ie.call(this,x,w,this.listenerTree,0),x.length>0}var T=this._events,P=this._all;return!!(P&&P.length||T&&(E===r?u(T).length:T[E]))},m.prototype.listenersAny=function(){return this._all?this._all:[]},m.prototype.waitFor=function(E,x){var w=this,T=typeof x;return T==="number"?x={timeout:x}:T==="function"&&(x={filter:x}),x=S(x,{timeout:0,filter:r,handleError:!1,Promise,overload:!1},{filter:F,Promise:R}),_(x.Promise,function(P,z,oe){function j(){var X=x.filter;if(!(X&&!X.apply(w,arguments)))if(w.off(E,j),x.handleError){var G=arguments[0];G?z(G):P(b.apply(null,arguments).slice(1))}else P(b.apply(null,arguments))}oe(function(){w.off(E,j)}),w._on(E,j,!1)},{timeout:x.timeout,overload:x.overload})};function M(E,x,w){w=S(w,{Promise,timeout:0,overload:!1},{Promise:R});var T=w.Promise;return _(T,function(P,z,oe){var j;if(typeof E.addEventListener=="function"){j=function(){P(b.apply(null,arguments))},oe(function(){E.removeEventListener(x,j)}),E.addEventListener(x,j,{once:!0});return}var X=function(){G&&E.removeListener("error",G),P(b.apply(null,arguments))},G;x!=="error"&&(G=function(Z){E.removeListener(x,X),z(Z)},E.once("error",G)),oe(function(){G&&E.removeListener("error",G),E.removeListener(x,X)}),E.once(x,X)},{timeout:w.timeout,overload:w.overload})}var B=m.prototype;Object.defineProperties(m,{defaultMaxListeners:{get:function(){return B._maxListeners},set:function(E){if(typeof E!="number"||E<0||Number.isNaN(E))throw TypeError("n must be a non-negative number");B._maxListeners=E},enumerable:!0},once:{value:M,writable:!0,configurable:!0}}),Object.defineProperties(B,{_maxListeners:{value:s,writable:!0,configurable:!0},_observers:{value:null,writable:!0,configurable:!0}}),t.exports=m})()})(Ate);var xLe=Ate.exports,AI=function(){return AI=Object.assign||function(e){for(var r,n=1,i=arguments.length;n0&&s[s.length-1])&&(l[0]===6||l[0]===2)){r=0;continue}if(l[0]===3&&(!s||l[1]>s[0]&&l[1]0&&(i.types.Claims.push({name:"app",type:"string"}),i.message.app=this.claims.app),this.claims.iat&&this.claims.iat>0&&(i.types.Claims.push({name:"iat",type:"int64"}),i.message.iat=this.claims.iat),this.claims.exp&&this.claims.exp>0&&(i.types.Claims.push({name:"exp",type:"int64"}),i.message.exp=this.claims.exp),this.claims.n&&this.claims.n>0&&(i.types.Claims.push({name:"n",type:"uint64"}),i.message.n=this.claims.n),this.claims.typ&&this.claims.typ.length>0&&(i.types.Claims.push({name:"typ",type:"string"}),i.message.typ=this.claims.typ),this.claims.ogn&&this.claims.ogn.length>0&&(i.types.Claims.push({name:"ogn",type:"string"}),i.message.ogn=this.claims.ogn),this.claims.v&&this.claims.v.length>0&&(i.types.Claims.push({name:"v",type:"string"}),i.message.v=this.claims.v),i},t}(),ALe=function(t){if(t.app==="")return{ok:!1,err:new Error("claims: app is empty")};var e=Math.round(new Date().getTime()/1e3),r=5*60,n=60*60*24*365+r;return t.v===""?{ok:!1,err:new Error("claims: ethauth version is empty")}:t.iat&&t.iat!==0&&(t.iat>e+r||t.iate+n?{ok:!1,err:new Error("claims: token has expired")}:{ok:!0}},SLe=function(t,e,r){return A0(void 0,void 0,void 0,function(){var n,i;return S0(this,function(s){return n=r.messageDigest(),i=p4e(n,r.signature),i.slice(0,2)==="0x"&&i.length===42&&i.toLowerCase()===r.address.toLowerCase()?[2,{isValid:!0,address:r.address}]:[2,{isValid:!1}]})})},_Le=function(t,e,r){return A0(void 0,void 0,void 0,function(){var n,i,s,o,a;return S0(this,function(c){switch(c.label){case 0:return!t||t===void 0?[2,{isValid:!1}]:(n=r.messageDigest(),[4,t.getCode(r.address)]);case 1:if(i=c.sent(),i==="0x"||i.length<=2)throw new Error("ValidateContractAccountProof failed. unable to fetch wallet contract code");return s=["function isValidSignature(bytes32, bytes) public view returns (bytes4)"],o=new Bn(r.address,s,t),[4,o.isValidSignature(n,je(r.signature))];case 2:return a=c.sent(),a===ILe?[2,{isValid:!0,address:r.address}]:[2,{isValid:!1}]}})})},ILe="0x1626ba7e",TLe=function(){function t(){for(var e=[],r=0;r0&&(c+="."+i.extra),[2,c]}})})},this.decodeProof=function(i,s){return s===void 0&&(s=!1),A0(n,void 0,void 0,function(){var o,a,c,l,f,u,p,g,y,b;return S0(this,function(I){switch(I.label){case 0:if(o=i.split("."),o.length<4||o.length>5)throw new Error("ethauth: invalid proof string");if(a=o[0],c=o[1],l=o[2],f=o[3],u=o[4],a!==SI)throw new Error("ethauth: not an ethauth proof");return p=OF.decode(l),g=JSON.parse(p),y=new _te({address:c,claims:g,signature:f,extra:u}),[4,this.validateProof(y,s)];case 1:if(b=I.sent(),!b)throw new Error("ethauth: proof is invalid");return[2,y]}})})},this.validateProof=function(i,s){return s===void 0&&(s=!1),A0(n,void 0,void 0,function(){var o,a;return S0(this,function(c){switch(c.label){case 0:if(o=this.validateProofClaims(i),o.err)throw new Error("ethauth: proof claims are invalid ".concat(o.err));return s===!0?[3,2]:[4,this.validateProofSignature(i)];case 1:if(a=c.sent(),a!==!0)throw new Error("ethauth: proof signature is invalid");c.label=2;case 2:return[2,!0]}})})},this.validateProofSignature=function(i){return A0(n,void 0,void 0,function(){var s,c,o,a,c;return S0(this,function(l){switch(l.label){case 0:s=[],c=0,l.label=1;case 1:if(!(c{const n=Zt(await t.getAddress());if(!n||n===""||n==="0x")throw MLe;const i=new _te;if(i.address=n,!r||!r.app||r.app==="")throw new Ite("authorization options requires app to be set");i.claims.app=r.app,i.claims.ogn=r.origin,i.claims.n=r.nonce,i.setExpiryIn(r.expiry?Math.max(r.expiry,200):PLe);const s=i.messageTypedData(),o=OCe(e);i.signature=await(t instanceof Px?t.signTypedData(s.domain,s.types,s.message,o,"eip6492"):t.signTypedData(s.domain,s.types,s.message,o));const c=await new TLe().encodeProof(i,!0);return{typedData:s,proofString:c}};class Ite extends Error{constructor(e){super(e),this.name="AuthError"}}const MLe=new Ite("auth error: account address is empty");yt.context.defaultContexts,new hM.remote.RemoteConfigTracker("https://sessions.sequence.app");const RLe=new Map(["addHook(bytes4,address)","clearExtraImageHashes(bytes32[])","removeHook(bytes4)","setExtraImageHash(bytes32,uint256)","updateIPFSRoot(bytes32)","updateImageHash(bytes32)","updateImageHashAndIPFS(bytes32,bytes32)","updateImplementation(address)"].map(t=>[No(t).slice(0,10),t]));function _I(t,e){const r=yt.transaction.fromTransactionish(t,e);yt.transaction.unwind(t,r).forEach(i=>OLe(t,i))}function OLe(t,e){if(e.to.toLowerCase()===t.toLowerCase()&&e.data){const r=je(e.data);if(r.length>=4&&!NLe(r))throw new Error("self calls are forbidden")}if(e.delegateCall)throw new Error("delegate calls are forbidden");if(e.data){const n=ke(e.data).slice(0,10),i=RLe.get(n);if(i){const s=i.slice(0,i.indexOf("("));throw new Error(`${s} calls are forbidden`)}}}function NLe(t){const e=new Fi(Ms.mainModule.abi);try{return e.decodeFunctionData("createContract",t),!0}catch{return!1}}function Bc(){return Bc=Object.assign?Object.assign.bind():function(t){for(var e=1;ee.predicate(t))}const FLe=[{name:"Decentraland Exception",predicate:ULe},{name:"0x v3 Exception",predicate:$Le}],jLe=/^Decentraland Login\nEphemeral address: 0x[a-fA-F0-9]{40}\nExpiration: (\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2}(?:\.\d*)?)((-(\d{2}):(\d{2})|Z)?)$/;function ULe(t){try{const e=kp(t);return jLe.test(e)}catch{return!1}}function $Le(t){const e=new Fi(qLe);try{return e.decodeFunctionData("OrderWithHash",t),!0}catch{return!1}}const qLe=[{inputs:[{components:[{internalType:"address",name:"makerAddress",type:"address"},{internalType:"address",name:"takerAddress",type:"address"},{internalType:"address",name:"feeRecipientAddress",type:"address"},{internalType:"address",name:"senderAddress",type:"address"},{internalType:"uint256",name:"makerAssetAmount",type:"uint256"},{internalType:"uint256",name:"takerAssetAmount",type:"uint256"},{internalType:"uint256",name:"makerFee",type:"uint256"},{internalType:"uint256",name:"takerFee",type:"uint256"},{internalType:"uint256",name:"expirationTimeSeconds",type:"uint256"},{internalType:"uint256",name:"salt",type:"uint256"},{internalType:"bytes",name:"makerAssetData",type:"bytes"},{internalType:"bytes",name:"takerAssetData",type:"bytes"},{internalType:"bytes",name:"makerFeeAssetData",type:"bytes"},{internalType:"bytes",name:"takerFeeAssetData",type:"bytes"}],internalType:"struct IEIP1271Data.Order",name:"order",type:"tuple"},{internalType:"bytes32",name:"orderHash",type:"bytes32"}],name:"OrderWithHash",outputs:[],stateMutability:"pure",type:"function"}],N3=Ei(`Ethereum Signed Message: -`),VLe=t=>bu(t)?je(t):Ei(t),Tte=t=>{const e=VLe(t);return LLe(e)?e:je(qr([N3,Ei(String(e.length)),e]))},zLe=t=>{if(JSON.stringify(t.slice(0,N3.length))!==JSON.stringify(N3))return t;const e=t.slice(N3.length),r=String(e.length).length;let n,i;try{i=Number(kp(e.slice(0,r)))}catch{i=Number(ke(e.slice(0,r)))}return i>e.length||!Number.isInteger(i)?n=r-1:n=r,e.slice(n)},k$=async(t,e,r,n)=>new yt.reader.OnChainReader(n).isValidSignature(t,e,r);async function HLe(t){return Array.isArray(t)?Promise.all(t.map(e=>fi(e))):fi(t)}function GLe(t){return[t,...t.auxiliary||[]]}const WLe=1e4;class KLe{constructor(e,r,n){var i=this;this.account=void 0,this.signerReadyCallbacks=[],this.prompter=void 0,this.networks=void 0,this._openIntent=void 0,this._connectOptions=void 0,this.events=new xLe.EventEmitter2,this.onConnectOptionsChange=void 0,this.promptConnect=async function(s){if(!s&&!i._connectOptions)throw new Error("prompter connect options are empty");if(!i.prompter)return i.connect(s);const o=await i.prompter.promptConnect(s||i._connectOptions).catch(c=>({connected:!1})),a=o;return a.connected&&!a.session&&(a.session=await i.walletSession(s==null?void 0:s.networkId)),o},this.isSignedIn=async function(){return await i.signerReady(),!!i.account},this.getAccount=async function(){if(await i.signerReady(),i.account===void 0)throw new Error("signerReady failed resolve");return i.account},this.account=e,this.prompter=r,this.networks=n}defaultChainId(){var e,r;return(e=(r=this.prompter)==null?void 0:r.getDefaultChainId())!=null?e:this.networks[0].chainId}async signIn(e,r={}){this.setAccount(e);const{connect:n,defaultNetworkId:i}=r;if(n){const a=this._connectOptions;let c;if(this.prompter!==null){var s;c=await((s=this.prompter)==null?void 0:s.promptSignInConnect(a))}else c=await this.connect(a);this.notifyConnect(c),(!a||a.keepWalletOpened!==!0)&&this.notifyClose()}if(i&&this.defaultChainId()!==i){var o;await((o=this.prompter)==null?void 0:o.promptChangeNetwork(i))}}signOut(){this.account&&this.notifyDisconnect(),this.setAccount(null)}signerReset(){this.account=void 0}signerReady(e=WLe){return new Promise((r,n)=>{this.account!==void 0?r():(setTimeout(()=>{this.account===void 0&&(this.signerReadyCallbacks=[],n("signerReady timed out"))},e),this.signerReadyCallbacks.push(r))})}async connect(e){var r,n;if(!this.account)return{connected:!1,chainId:"0x0",error:"unable to connect without signed in account"};const i=(r=(n=e==null?void 0:e.networkId)!=null?n:this.defaultChainId())!=null?r:ge.MAINNET,s=RCe(i).chainId,o={connected:!0,chainId:jc(s)};if(e&&e.authorize){const a={app:e.app,origin:e.origin,expiry:e.expiry,nonce:e.authorizeNonce};try{o.proof=await kLe(this.account,s,a)}catch(c){return mi.warn(`connect, signAuthorization failed for options: ${JSON.stringify(e)}, due to: ${c.message}`),{connected:!1,chainId:"0x0",error:`signAuthorization failed: ${c.message}`}}}return o.session=this.walletSession(s),o}async sendMessageRequest(e){var r;const i=Number(((r=e.clientVersion)==null?void 0:r.split(".")[0])||"0")<2,s={id:e.data.id,jsonrpc:"2.0",result:null,error:void 0};try{const o=await this.request({method:e.data.method,params:e.data.params,chainId:e.chainId});return Bc({},e,{data:i?Bc({},s,{result:o}):o})}catch(o){return Bc({},e,{data:i?Bc({},s,{error:o}):{error:o}})}}async request(e){await this.getAccount();try{var r,n;if((!this.account||this.account===null)&&!YLe.includes(e.method))throw BLe;const l=this.account;if(!l)throw new Error("WalletRequestHandler: wallet account is not configured");const f=(r=this.account)==null?void 0:r.providerFor((n=e.chainId)!=null?n:this.defaultChainId());if(!f)throw new Error(`WalletRequestHandler: wallet provider is not configured for chainId ${e.chainId}`);const u=QLe(f)?f:void 0;switch(e.method){case"net_version":{if(!u)throw new Error("Account provider doesn't support send method");return await u.send("net_version",[])}case"eth_chainId":{if(!u)throw new Error("Account provider doesn't support send method");return await u.send("eth_chainId",[])}case"eth_accounts":return[l.address];case"eth_getBalance":{const[p,g]=e.params,y=await f.getBalance(p,g);return jv(y)}case"sequence_sign":case"personal_sign":case"eth_sign":{let p;switch(e.method){case"sequence_sign":case"personal_sign":{const[I,C]=e.params;p=I;break}case"eth_sign":{const[I,C]=e.params;p=C;break}}let g="";const y=Tte(p),b=e.method==="sequence_sign";if(this.prompter===null){var i;g=await l.signMessage(y,(i=e.chainId)!=null?i:this.defaultChainId(),b?"eip6492":"ignore")}else g=await this.prompter.promptSignMessage({chainId:e.chainId,message:je(y),eip6492:b},this.connectOptions);if(g&&g.length>0)return g;throw new Error("declined by user")}case"sequence_signTypedData_v4":case"eth_signTypedData":case"eth_signTypedData_v4":{const[p,g]=e.params;let y;if(typeof g=="string")try{y=JSON.parse(g)}catch(C){console.warn("walletRequestHandler: error parsing typedData",C)}else y=g;if(!y||!y.domain||!y.types||!y.message)throw new Error("invalid typedData object");let b="";const I=e.method==="sequence_signTypedData_v4";if(this.prompter===null){var s;b=await l.signTypedData(y.domain,y.types,y.message,(s=e.chainId)!=null?s:this.defaultChainId(),I?"eip6492":"ignore")}else b=await this.prompter.promptSignMessage({chainId:e.chainId,typedData:y,eip6492:I},this.connectOptions);if(b&&b.length>0)return b;throw new Error("declined by user")}case"eth_sendTransaction":{const p=GLe(e.params[0]).map(y=>("gas"in y&&y.gasLimit===void 0&&(y.gasLimit=y.gas,delete y.gas),y));_I(l.address,p);let g="";if(this.prompter===null){var o,a;const y=await l.sendTransaction(p,(o=e.chainId)!=null?o:this.defaultChainId());g=(a=y==null?void 0:y.hash)!=null?a:""}else g=await this.prompter.promptSendTransaction(p,e.chainId,this.connectOptions);if(g)return g;throw new Error("declined by user")}case"eth_signTransaction":{const[p]=e.params;if(Zt(p.from)!==l.address)throw new Error("sender address does not match wallet");if(_I(l.address,p),this.prompter===null){var c;return await l.signTransactions(p,(c=e.chainId)!=null?c:this.defaultChainId())}else return await this.prompter.promptSignTransaction(p,e.chainId,this.connectOptions)}case"eth_sendRawTransaction":if(yt.transaction.isSignedTransactionBundle(e.params[0])){const p=Number(e.params[0].chainId);return(await l.relayer(p).relay(e.params[0])).hash}else return(await f.broadcastTransaction(e.params[0])).hash;case"eth_getTransactionCount":{const p=Zt(e.params[0]),g=e.params[1],y=await f.getTransactionCount(p,g);return jv(BigInt(y))}case"eth_blockNumber":return await f.getBlockNumber();case"eth_getBlockByNumber":return await f.getBlock(e.params[0]);case"eth_getBlockByHash":return await f.getBlock(e.params[0]);case"eth_getTransactionByHash":return await f.getTransaction(e.params[0]);case"eth_call":{const[p,g]=e.params;return await f.call(Bc({},p,{blockTag:g}))}case"eth_getCode":{const[p,g]=e.params;return await f.getCode(p,g)}case"eth_estimateGas":{const[p]=e.params;return await f.estimateGas(p)}case"eth_gasPrice":{const p=await f.getFeeData();return p.gasPrice===null?null:jv(p.gasPrice)}case"wallet_switchEthereumChain":{const[p]=e.params;if(!p.chainId||p.chainId.length===0)throw new Error("invalid chainId");const g=BigInt(p.chainId);return this.setDefaultChainId(Number(g)),null}case"sequence_getWalletContext":return l.contexts;case"sequence_getWalletConfig":{const[p]=e.params;return p?[(await l.status(p)).onChain.config]:await Promise.all(l.networks.map(async function(g){return(await l.status(g.chainId)).onChain.config}))}case"sequence_getWalletState":{const[p]=e.params;return p?[M$(p,await l.status(p))]:await Promise.all(l.networks.map(async function(g){const y=await l.status(g.chainId);return M$(g.chainId,y)}))}case"sequence_getNetworks":return await this.getNetworks(!0);case"sequence_isSequence":return!0;case"sequence_updateConfig":throw new Error("sequence_updateConfig method is not allowed from a dapp");case"sequence_publishConfig":throw new Error("sequence_publishConfig method is not allowed from a dapp");case"sequence_gasRefundOptions":break;case"sequence_getNonce":break;case"sequence_relay":break;case"sequence_setDefaultNetwork":{const[p]=e.params;if(!p)throw new Error("invalid request, method argument defaultChainId cannot be empty");return this.setDefaultChainId(p),await this.getNetworks(!0)}default:{if(!u)throw new Error("Account provider doesn't support send method");return await u.send(e.method,e.params)}}}catch(l){throw mi.error(l),{message:typeof l=="string"?l:(l==null?void 0:l.message)||"unkown error",code:4001}}}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}async getAddress(){var e,r;return(e=(r=this.account)==null?void 0:r.address)!=null?e:""}get openIntent(){return this._openIntent}setOpenIntent(e){this._openIntent=e}get connectOptions(){return this._connectOptions}setConnectOptions(e){var r;this._connectOptions=e,(r=this.onConnectOptionsChange)==null||r.call(this,e)}async setDefaultChainId(e){var r;return await((r=this.prompter)==null?void 0:r.promptChangeNetwork(e)),this.defaultChainId()}async getNetworks(e){return this.account?e?this.account.networks.map(r=>{const n=Bc({},r);return n.provider=void 0,n.relayer=void 0,n}):this.account.networks:(mi.warn("signer not set: getNetworks is returning an empty list"),[])}walletSession(e){if(!this.account)return;const r={walletContext:this.account.contexts,accountAddress:this.account.address,networks:this.account.networks.map(i=>Bc({},i,{provider:void 0,relayer:void 0}))};if(e){const i=Pw(r.networks,e);if(i){var n;(n=r.networks)==null||n.forEach(s=>delete s.isDefaultChain),i.isDefaultChain=!0}}return r}notifyConnect(e,r){var n;if(console.log("emit connect",e),this.events.emit("connect",e),(n=e.session)!=null&&n.accountAddress){var i;this.events.emit("accountsChanged",[(i=e.session)==null?void 0:i.accountAddress],r)}}notifyDisconnect(e){this.events.emit("accountsChanged",[],e),this.events.emit("disconnect",void 0,e)}notifyChainChanged(e,r){this.events.emit("chainChanged",jc(e),r)}async notifyNetworks(e){const r=e||await this.getNetworks(!0);if(this.events.emit("networks",r),r.length>0){const n=r.find(i=>i.chainId===this.defaultChainId());n&&this.events.emit("chainChanged",jc(n.chainId))}else this.events.emit("chainChanged","0x0")}async notifyWalletContext(){if(!this.account){mi.warn("signer not set: skipping to notify wallet context");return}const e=this.account.contexts;this.events.emit("walletContext",e)}notifyClose(e){this.events.emit("close",e)}setAccount(e){if(this.account=e,e!==void 0){for(let r=0;rc.canOnchainValidate||c.original.version===2&&n,o=await r.status(i);if(s(o))return!0;if(await e.promptConfirmWalletDeploy(i,this.connectOptions)){const c=await r.status(i);return s(c)?!0:(mi.error("WalletRequestHandler: result for promptConfirmWalletDeploy is not correct"),!1)}return!1}}function M$(t,e){return{context:e.original.context,config:e.onChain.config,address:yt.context.addressOf(e.original.context,e.original.imageHash),chainId:t,deployed:e.onChain.deployed,imageHash:e.imageHash,lastImageHash:e.onChain.imageHash,published:!0,status:e}}const YLe=["net_version","eth_chainId","eth_getBalance","eth_getTransactionCount","eth_blockNumber","eth_getBlockByNumber","eth_getBlockByHash","eth_getTransactionByHash","eth_getCode","eth_estimateGas","eth_gasPrice","sequence_getWalletContext","sequence_getNetworks","sequence_setDefaultNetwork"];function QLe(t){return t&&typeof t=="object"&&typeof t.send=="function"&&typeof t.getNetwork=="function"}function JLe(t,e){if(t==null)return{};var r={};for(var n in t)if({}.hasOwnProperty.call(t,n)){if(e.includes(n))continue;r[n]=t[n]}return r}class RE{get utils(){return this.provider.utils}constructor(e,r){this.client=e,this.provider=r,this.singleNetworkSigners={},this._isSequenceSigner=!0}async getAddress(){return this.client.getAddress()}connect(e){if(!QM.is(e))throw new Error("SequenceSigner can only be connected to a SequenceProvider");return new RE(this.client,e)}getSigner(e){if(!e)return this;const r=this.provider.toChainId(e);return this.singleNetworkSigners[r]||(this.singleNetworkSigners[r]=new Pte(this.client,this.provider,r)),this.singleNetworkSigners[r]}useChainId(e){return this.provider.toChainId(e)||this.client.getChainId()}async signMessage(e,r){const{eip6492:n=!0}=r||{},i=this.useChainId(r==null?void 0:r.chainId);return this.client.signMessage(e,{eip6492:n,chainId:i})}async signTypedData(e,r,n,i){const{eip6492:s=!0}=i||{},o=this.useChainId(i==null?void 0:i.chainId);return this.client.signTypedData({domain:e,types:r,message:n},{eip6492:s,chainId:o})}getProvider(e){return this.provider.getProvider(e)}async sendTransaction(e,r){const n=this.useChainId(r==null?void 0:r.chainId),i=await HLe(e),s=await this.client.sendTransaction(i,{chainId:n}),o=this.getProvider(n);try{return await new Promise(c=>{(async function f(){const u=await o.getTransaction(s);if(u!==null)return c(u);await o.once("block",f)})()})}catch(a){throw a.transactionHash=s,a}}async getWalletConfig(e){const r=this.useChainId(e);return this.client.getOnchainWalletConfig({chainId:r})}getNetworks(){return this.client.getNetworks()}async getBalance(e,r){return this.getProvider(r==null?void 0:r.chainId).getBalance(this.getAddress(),e)}async estimateGas(e,r){return this.getProvider(r==null?void 0:r.chainId).estimateGas(e)}async call(e,r){return this.getProvider(r==null?void 0:r.chainId).call(e)}getChainId(){return Promise.resolve(this.client.getChainId())}async getFeeData(e){return this.getProvider(e==null?void 0:e.chainId).getFeeData()}async resolveName(e){const r=await this.provider.resolveName(e);if(r===null)throw new Error(`ENS name not found: ${e}`);return r}_checkProvider(e){}getNonce(e){throw new Error("SequenceSigner does not support getNonce")}populateCall(e){throw new Error("SequenceSigner does not support populateCall")}populateTransaction(e){throw new Error("SequenceSigner does not support populateTransaction")}checkTransaction(e){throw new Error("SequenceSigner does not support checkTransaction")}getTransactionCount(e){throw new Error("SequenceSigner does not support getTransactionCount")}signTransaction(e){throw new Error("SequenceWallet does not support signTransaction, use sendTransaction instead.")}static is(e){return e&&typeof e=="object"&&e._isSequenceSigner===!0}}class Pte extends RE{constructor(e,r,n){super(e,r.getProvider(n)),this.chainId=n,this._isSingleNetworkSequenceSigner=!0}_useChainId(e){const r=this.provider.toChainId(e);if(r&&r!==this.chainId)throw new Error(`This signer only supports the network ${this.chainId}, but ${r} was requested.`);return r||this.provider.toChainId(this.chainId)}useChainId(e){return this._useChainId(e)}getChainId(){return Promise.resolve(this.provider.toChainId(this.chainId))}getProvider(e){return super.getProvider(this._useChainId(e))}getSigner(e){if(this._useChainId(e)!==this.chainId)throw new Error("Unreachable code");return this}static is(e){return e&&typeof e=="object"&&e._isSingleNetworkSequenceSigner===!0}}class ZLe{constructor(e){if(this.signer=e,Pte.is(e))throw new Error("WalletUtils does not support SingleNetworkSequenceSigner")}signMessage(e,r,n){return this.signer.signMessage(e,{chainId:r,eip6492:n})}signTypedData(e,r,n,i,s){return this.signer.signTypedData(e,r,n,{chainId:i,eip6492:s})}async isValidSignature(e,r,n,i){return k$(e,r,n,this.signer.getProvider(i))}async isValidMessageSignature(e,r,n,i){const s=this.signer.getProvider(i),o=Tte(r),a=CEe(o);return k$(e,a,n,s)}isValidTypedDataSignature(e,r,n,i){return this.isValidSignature(e,Nk(r),n,i)}}const XLe=["method"],R$=["connect","disconnect","chainChanged","accountsChanged"];class QM extends dJ{constructor(e,r,n=Zk,i){super(e.getChainId(),i),this.client=e,this.providerFor=r,this.networks=n,this.options=i,this.singleNetworkProviders={},this._isSequenceProvider=!0,this.utils=void 0,this.signer=void 0,this.eip1193EventListeners=new Map,e.onConnect(s=>{var o;(o=this.eip1193EventListeners.get("connect"))==null||o.forEach(a=>a(s))}),e.onDisconnect(s=>{var o;(o=this.eip1193EventListeners.get("disconnect"))==null||o.forEach(a=>a(s))}),e.onDefaultChainIdChanged(s=>{var o;(o=this.eip1193EventListeners.get("chainChanged"))==null||o.forEach(a=>a(s))}),e.onAccountsChanged(s=>{var o;(o=this.eip1193EventListeners.get("accountsChanged"))==null||o.forEach(a=>a(s))}),this.signer=new RE(this.client,this),this.utils=new ZLe(this.signer)}async on(e,r){if(R$.includes(e)){const n=this.eip1193EventListeners.get(e)||new Set;return n.add(r),this.eip1193EventListeners.set(e,n),this}return super.on(e,r)}async off(e,r){if(R$.includes(e)){const n=this.eip1193EventListeners.get(e);return n&&(r?n.delete(r):n.clear()),this}return super.off(e,r)}getSigner(e){return this.signer.getSigner(e)}connect(e){return this.client.connect(e)}disconnect(){return this.client.disconnect()}isConnected(){return this.client.isConnected()}getSession(){return this.client.getSession()}listAccounts(){return[this.client.getAddress()]}getAddress(){return this.client.getAddress()}getNetworks(){return this.client.getNetworks()}getChainId(){return this.client.getChainId()}setDefaultChainId(e){return this.client.setDefaultChainId(this.toChainId(e))}isOpened(){return this.client.isOpened()}closeWallet(){return this.client.closeWallet()}getWalletContext(){return this.client.getWalletContext()}async getWalletConfig(e){const r=await this.useChainId(e);return this.client.getOnchainWalletConfig({chainId:r})}authorize(e){return this.client.connect(Bc({},e,{authorize:!0}))}async openWallet(e,r){return await this.client.openWallet(e,r),!0}toChainId(e){if(e===void 0)return;const r=Pw(this.networks,e);if(!r)throw new Error(`Unsupported network ${e}`);return r.chainId}async useChainId(e){return this.toChainId(e)||this.client.getChainId()}getProvider(e){if(!e)return this;const r=this.toChainId(e);return this.singleNetworkProviders[r]||(this.singleNetworkProviders[r]=new eFe(this.client,this.providerFor,r,this.options)),this.singleNetworkProviders[r]}async _getSubprovider(e){const r=await this.useChainId(e),n=this.providerFor(r);if(!n)throw new Error(`Unsupported network ${r}`);return n}async _perform(e){var r;const{method:n}=e,i=JLe(e,XLe),s=await this._getSubprovider(),o=(r=s.getRpcRequest(e))!=null?r:{method:n,args:Object.values(i)};if(!o)throw new Error(`Unsupported method ${e.method}`);return s.send(o.method,o.args)}async perform(e,r){if(e==="eth_chainId")return jc(await this.useChainId());if(e==="eth_accounts")return[this.client.getAddress()];if(e==="wallet_switchEthereumChain"){const n=r[0],i=kte(n);return this.setDefaultChainId(i)}return e==="eth_sendTransaction"||e==="eth_sign"||e==="eth_signTypedData"||e==="eth_signTypedData_v4"||e==="personal_sign"||e==="sequence_sign"||e==="sequence_signTypedData_v4"?this.client.request({method:e,params:r,chainId:this.getChainId()}):this._perform(Bc({method:e},r))}send(e,r){return this.perform(e,r)}request(e){return this.perform(e.method,e.params)}async _detectNetwork(){const e=this.client.getChainId(),r=Pw(this.networks,e);if(!r)throw new Error(`Unknown network ${e}`);return new sa(r.name,r.chainId)}async detectNetwork(){return this._detectNetwork()}async waitForTransaction(e,r,n,i){return(await this._getSubprovider(i==null?void 0:i.chainId)).waitForTransaction(e,r,n)}async getBlockNumber(e){return(await this._getSubprovider(e==null?void 0:e.chainId)).getBlockNumber()}async getFeeData(e){return(await this._getSubprovider(e==null?void 0:e.chainId)).getFeeData()}async getBalance(e,r,n){return(await this._getSubprovider(n==null?void 0:n.chainId)).getBalance(e,r)}async getTransactionCount(e,r,n){return(await this._getSubprovider(n==null?void 0:n.chainId)).getTransactionCount(e,r)}async getCode(e,r,n){return(await this._getSubprovider(n==null?void 0:n.chainId)).getCode(e,r)}async getStorage(e,r,n,i){return(await this._getSubprovider(i==null?void 0:i.chainId)).getStorage(e,r,n)}async call(e,r){return(await this._getSubprovider(r==null?void 0:r.chainId)).call(e)}async estimateGas(e,r){return(await this._getSubprovider(r==null?void 0:r.chainId)).estimateGas(e)}async getBlock(e,r,n){return(await this._getSubprovider(n==null?void 0:n.chainId)).getBlock(e,r)}async getTransaction(e,r){return(await this._getSubprovider(r==null?void 0:r.chainId)).getTransaction(e)}async getLogs(e,r){return(await this._getSubprovider(r==null?void 0:r.chainId)).getLogs(e)}async supportsENS(){return(await this.getNetworks()).some(r=>r.chainId===1)}async getResolver(e){return await this.supportsENS()?(await this._getSubprovider(1)).getResolver(e):null}async resolveName(e){return yw(e)?e:await this.supportsENS()?(await this._getSubprovider(1)).resolveName(e):null}async lookupAddress(e){return await this.supportsENS()?(await this._getSubprovider(1)).lookupAddress(e):null}async getAvatar(e){return await this.supportsENS()?(await this._getSubprovider(1)).getAvatar(e):null}}QM.is=t=>t&&typeof t=="object"&&t._isSequenceProvider===!0;function kte(t){return typeof t=="object"?kte(t.chainId):Number(t)}class eFe extends QM{constructor(e,r,n,i){super(e,r,void 0,i),this.chainId=n,this._isSingleNetworkSequenceProvider=!0}_useChainId(e){const r=this.toChainId(e);if(r&&r!==this.chainId)throw new Error(`This provider only supports the network ${this.chainId}, but ${r} was requested.`);return r||super.toChainId(this.chainId)}useChainId(e){return Promise.resolve(this._useChainId(e))}getChainId(){return super.toChainId(this.chainId)}async getNetwork(){const e=await this.client.getNetworks(),r=Pw(e,this.chainId);if(!r)throw new Error(`Unsupported network ${this.chainId}`);return new sa(r.name,r.chainId)}getProvider(e){if(this._useChainId(e)!==this.chainId)throw new Error("Unreachable code");return this}getSigner(e){return super.getSigner(this._useChainId(e))}setDefaultChainId(e){throw new Error(`This provider only supports the network ${this.chainId}; use the parent provider to switch networks.`)}static is(e){return e&&typeof e=="object"&&e._isSingleNetworkSequenceProvider===!0}}class Zr{constructor(e){ue(this,"networkStore",Br(Wn));ue(this,"authStore",Br(Mi));ue(this,"accountAddress",this.authStore.accountAddress.get());ue(this,"availableExternalProviders",Or([]));ue(this,"selectedExternalProvider",Or(void 0));ue(this,"selectedExternalWalletAddress",Or(void 0));ue(this,"isSendingTokenTransaction",Or(void 0));ue(this,"isSendingCollectibleTransaction",Or(void 0));ue(this,"isSendingSignedTokenTransaction",Or(void 0));ue(this,"connectDetails",Or(void 0));ue(this,"connectOptions",Or(void 0));ue(this,"isSigningTxn",Or(!1));ue(this,"isSigningMsg",Or(!1));ue(this,"toSignPermission",Or(void 0));ue(this,"toSignResult",Or(void 0));ue(this,"toSignTxnDetails",Or(void 0));ue(this,"toSignMsgDetails",Or(void 0));ue(this,"isCheckingWalletDeployment",Or(!1));ue(this,"signClientWarningType",Or(!1));ue(this,"walletRequestHandler");ue(this,"local",{lastConnectedExternalProviderInfo:new eu(Ol.LAST_CONNECTED_EXTERNAL_PROVIDER_INFO)});ue(this,"defaultNetwork",new eu(Ol.DEFAULT_NETWORK));ue(this,"getLastConnectedExternalProviderInfo",()=>this.local.lastConnectedExternalProviderInfo.get());ue(this,"sendToken",async(e,r,n)=>{var i,s;try{const o=this.store.get(Mi).account,a=e.chainId;if(!o)throw new Error("No account found");const c=this.store.get(Wn).providerForChainId(a);this.isSendingTokenTransaction.set({tokenBalance:e,to:r,amount:n});const l=(i=this.selectedExternalProvider.get())==null?void 0:i.provider;if(!l)throw new Error("No external provider selected");const u=(await this.getExternalProviderAccounts(l))[0];await this.switchToChain(l,a);let p;if(!n)return{hash:""};if(e.contractType===hh.NATIVE?(console.info("Sending native token with address, on chainId: ",e.contractAddress,a),p={to:r,value:d6e(n)}):e.contractType===hh.ERC20&&(console.info("Sending ERC20 token with address, on chainId: ",e.contractAddress,a),p=await new Bn(e.contractAddress,qv,c).transfer.populateTransaction(r,G7(n,((s=e.contractInfo)==null?void 0:s.decimals)??18))),!p)throw this.isSendingTokenTransaction.set(void 0),new Error("Could not create transaction");let g;try{g=(await this.sendTransaction(o,l,u,p,a)).hash}catch(y){throw this.isSendingTokenTransaction.set(void 0),y}return{hash:g}}catch{throw this.isSendingTokenTransaction.set(void 0),new Error("Could not create transaction")}});ue(this,"sendCollectible",async(e,r,n)=>{var i,s;try{const o=this.store.get(Mi).account,a=e.collectibleInfoParams.chainId;if(!o)throw new Error("No account found");const c=this.store.get(Wn).providerForChainId(a);this.isSendingCollectibleTransaction.set({collectibleInfo:e,to:r,amount:n});const l=(i=this.selectedExternalProvider.get())==null?void 0:i.provider;if(!l)throw new Error("No external provider selected");const u=(await this.getExternalProviderAccounts(l))[0];await this.switchToChain(l,a);let p;if(e.collectibleInfoParams.contractType==="ERC721")console.info("Sending ERC721 non-fungible token with address, on chainId: ",e.collectibleInfoParams.address,a),p=await new Bn(e.collectibleInfoParams.address,pM,c).safeTransferFrom.populateTransaction(o,r,e.collectibleInfoParams.tokenId);else if(e.collectibleInfoParams.contractType==="ERC1155"){console.info("Sending ERC1155 token with address, on chainId: ",e.collectibleInfoParams.address,a);const y=new Bn(e.collectibleInfoParams.address,vM,c);if(!n)return{hash:""};p=await y.safeTransferFrom.populateTransaction(o,r,e.collectibleInfoParams.tokenId,G7(n,((s=e==null?void 0:e.collectibleInfoResponse)==null?void 0:s.decimals)??18),"0x")}if(!p)throw this.isSendingCollectibleTransaction.set(void 0),new Error("Could not create transaction");let g;try{g=(await this.sendTransaction(o,l,u,p,a)).hash}catch(y){throw this.isSendingCollectibleTransaction.set(void 0),y}return{hash:g}}catch{throw this.isSendingCollectibleTransaction.set(void 0),new Error("Could not create transaction")}});ue(this,"setExternalProvider",async e=>{if(!e){this.selectedExternalProvider.set(void 0),this.selectedExternalWalletAddress.set(void 0),this.local.lastConnectedExternalProviderInfo.set(void 0);return}const n=(await this.getExternalProviderAccounts(e.provider))[0];this.local.lastConnectedExternalProviderInfo.set(e.info),this.selectedExternalProvider.set(e),this.selectedExternalWalletAddress.set(n),e.provider.on("accountsChanged",async i=>{if(i.length===0){this.selectedExternalProvider.set(void 0),this.selectedExternalWalletAddress.set(void 0);return}if(i[0]!==n){const o=(await this.getExternalProviderAccounts(e.provider))[0];this.selectedExternalWalletAddress.set(o)}})});ue(this,"resetSignObservables",()=>{this.isSigningTxn.set(!1),this.toSignTxnDetails.set(void 0),this.toSignMsgDetails.set(void 0),this.toSignPermission.set(void 0),this.toSignResult.set(void 0)});ue(this,"checkWalletDeployment",async e=>{const r=this.store.get(Mi).account;if(!r)throw new Error("No account found");return(await r.status(e)).onChain.deployed});this.store=e,this.walletRequestHandler=new KLe(void 0,new tFe(e),this.networkStore.networks.get()),this.walletRequestHandler.onConnectOptionsChange=n=>{this.connectOptions.set(n)},this.availableExternalProviders.subscribe(n=>{const i=this.local.lastConnectedExternalProviderInfo.get(),s=n.find(o=>(i==null?void 0:i.name)===o.info.name);s&&this.setExternalProvider(s)});const r=this.store.get(Mi).account;this.walletRequestHandler.signIn(r??null)}async sendTransaction(e,r,n,i,s){const o=await e.status(s),a=await e.predecorateTransactions(i,o,s),c=await e.signTransactions(a,s,void 0,{serial:!0}),l=await e.decorateTransactions(c,o);await this.switchToChain(r,s);const f=await r.request({method:"eth_estimateGas",params:[{from:n,to:l.entrypoint,data:yt.transaction.encodeBundleExecData(l)}]});return{hash:await r.request({method:"eth_sendTransaction",params:[{from:n,to:l.entrypoint,data:yt.transaction.encodeBundleExecData(l),gas:f}]})}}async getExternalProviderAccounts(e){return new Promise((r,n)=>{var i;(i=e.sendAsync)==null||i.call(e,{method:"eth_requestAccounts",params:[]},(s,o)=>{s&&n(s),o.result.length===0&&n(new Error("No accounts found")),r(o.result)})})}async getExternalProviderAddress(e){return(await this.getExternalProviderAccounts(e))[0]}async switchToChain(e,r){return new Promise((n,i)=>{var s;(s=e.sendAsync)==null||s.call(e,{method:"wallet_switchEthereumChain",params:[{chainId:jc(r)}]},(o,a)=>{o&&i(o),n(a)})})}}class tFe{constructor(e){this.store=e}getDefaultChainId(){return this.store.get(Zr).defaultNetwork.get()??1}async promptChangeNetwork(e){return this.store.get(Wn).networks.get().some(n=>n.chainId===e)?(this.store.get(Zr).defaultNetwork.set(e),!0):!1}async promptConfirmWalletDeploy(e,r){if(console.log("prompt confirm wallet deploy:",e,r),!e)return Promise.resolve(!1);const n=await this.store.get(Zr).checkWalletDeployment(e);return new Promise((i,s)=>{i(!!n)})}async promptConnect(e){console.log("promptconnect",e);const r=this.store.get(Mi).account;return await this.store.get(Zr).walletRequestHandler.signIn(r??null),e&&this.store.get(Zr).walletRequestHandler.setConnectOptions(e),new Promise((n,i)=>{const s=this.store.get(Zr).connectDetails.subscribe(o=>{s(),!o||!o.connected?i("connect cancelled by user"):n(o)})})}async promptSignInConnect(e){return console.log("prompt sign in connect:",e),{connected:!1}}async promptSignMessage(e,r){return console.log("prompt sign message:",e,r),e.chainId?e.eip6492!==!0&&!(await this.store.get(Mi).account.status(e.chainId)).canOnchainValidate&&!await this.promptConfirmWalletDeploy(e.chainId,r)?(this.store.get(Zr).signClientWarningType.set("notDeployed"),Promise.reject("User rejected wallet deploy request")):(this.store.get(Zr).isSigningMsg.set(!0),this.store.get(Zr).toSignMsgDetails.set({message:e,chainId:e.chainId,options:r}),new Promise((n,i)=>{const s=this.store.get(Zr).toSignPermission.subscribe(()=>{s();const o=this.store.get(Zr).toSignPermission.get();if(this.store.get(Zr).toSignPermission.set(void 0),!o||o==="cancelled")i("request failed");else{const a=this.store.get(Zr).toSignResult.get();a&&n(a.hash)}})})):Promise.reject("No chainId found in message")}promptSignTransaction(e,r,n){console.log("prompt sign transaction:",e,r,n);let i;Array.isArray(e)?i=e:i=[e];const s=this.store.get(Mi).accountAddress.get();if(!s)throw new Error("Unknown account address");const o=yt.transaction.fromTransactionish(s,i);return console.log("prompt sign txn:",o,r,n),_I(s,i),new Promise((a,c)=>{this.store.get(Zr).toSignTxnDetails.set({txn:i,chainId:r,options:n}),this.store.get(Zr).isSigningTxn.set(!0);const l=this.store.get(Zr).toSignPermission.subscribe(()=>{l();const f=this.store.get(Zr).toSignPermission.get();if(this.store.get(Zr).toSignPermission.set(void 0),!f||f==="cancelled")c("request failed");else{const u=this.store.get(Zr).toSignResult.get();u&&a(u.hash)}})})}promptSendTransaction(e,r,n){return this.promptSignTransaction(e,r,n)}}async function Mte(t){return await wLe.init({projectId:iX,showQrModal:t,optionalChains:[1],metadata:{name:"Sequence Recovery Wallet External Wallet",description:"",url:"TODO_CHANGE_LATER",icons:[]}})}function rFe(){const[t,e]=N.useState(null),n=Br(Zr).getLastConnectedExternalProviderInfo();return N.useEffect(()=>{async function i(){const s=await Mte(!1);await s.enable(),e(s)}return(n==null?void 0:n.name)==="WalletConnect"&&i(),()=>{t&&t.disconnect()}},[]),t}const O$=async(t,e,r=15)=>{let n,i=0;do{if(i>5&&await new Promise(s=>setTimeout(s,100*i)),n=await t.getTransactionReceipt(e),i===r){console.warn(`Could not get receipt for transaction ${e} after ${i} tries`);return}if(n)return n;i++}while(!n&&i<=r)};let N6=[];const aS={value:()=>N6,subscribe:t=>{function e(r){N6.some(n=>n.info.uuid===r.detail.info.uuid)||(N6=[...N6,r.detail],t())}return window.addEventListener("eip6963:announceProvider",e),window.dispatchEvent(new Event("eip6963:requestProvider")),()=>window.removeEventListener("eip6963:announceProvider",e)}},Rte=()=>N.useSyncExternalStore(aS.subscribe,aS.value,aS.value);class OE{constructor(e){ue(this,"authStore",Br(Mi));ue(this,"accountAddress",this.authStore.accountAddress.get());ue(this,"isReady",Or(!1));ue(this,"signClient");ue(this,"currentRequestInfo");ue(this,"allSessions",Or([]));ue(this,"sessions",this.allSessions.readOnly());ue(this,"createSignClient",async()=>{this.signClient=await ME.init({projectId:iX,metadata:{name:"Sequence Recovery Wallet",description:"Sequence Recovery Wallet - Recover Your Wallet",url:"http://localhost:5173",icons:["https://sequence.app/apple-touch-icon.png"]}}),this.signClient.on("session_proposal",this.onSessionProposal),this.signClient.on("session_request",this.onSessionRequest),this.signClient.on("session_ping",this.onSessionPing),this.signClient.on("session_event",this.onSessionEvent),this.signClient.on("session_update",this.onSessionUpdate),this.signClient.on("session_delete",this.onSessionDelete);const e=this.getSignClientSessions();e?this.allSessions.set(e):this.allSessions.set([]),this.isReady.set(!0)});ue(this,"getSignClientSessions",()=>this.signClient.session.getAll().filter(r=>r.self.metadata.name!=="Sequence Recovery Wallet External Wallet"));ue(this,"pair",async e=>{if(!this.signClient)throw new Error("WalletConnect signClient not initialized.");await this.signClient.core.pairing.pair({uri:e}),this.allSessions.set(this.getSignClientSessions())});ue(this,"rejectRequest",()=>{var e;this.currentRequestInfo&&((e=this.signClient)==null||e.respond({topic:this.currentRequestInfo.topic,response:{id:this.currentRequestInfo.id,jsonrpc:"2.0",error:{message:"User rejected.",code:4001}}}))});ue(this,"disconnectSession",async e=>{var n,i;const r=(n=this.signClient)==null?void 0:n.session.get(e);r&&(await((i=this.signClient)==null?void 0:i.engine.client.disconnect({topic:r.topic,reason:{message:"User disconnected.",code:6e3}})),this.allSessions.set(this.getSignClientSessions()??[]))});ue(this,"disconnectAllSessions",async()=>{var r;(((r=this.signClient)==null?void 0:r.session.getAll())??[]).forEach(async n=>{var i;await((i=this.signClient)==null?void 0:i.engine.client.disconnect({topic:n.topic,reason:{message:"User disconnected.",code:6e3}}))}),this.allSessions.set([])});ue(this,"onSessionProposal",async e=>{var l,f,u,p,g;console.log("onSessionProposal",e);const r=e.params.requiredNamespaces,n=e.params.optionalNamespaces,i=Object.keys(r).length===0?[]:r.eip155.chains??[],s=Object.keys(n).length===0?[]:n.eip155.chains??[],o=((l=i[0])==null?void 0:l.split(":").pop())??((f=s[0])==null?void 0:f.split(":").pop());if(!o)throw new Error("No chainId found in WalletConnect session proposal namespaces.");const a={app:e.params.proposer.metadata.name,origin:e.params.proposer.metadata.url,networkId:o,keepWalletOpened:!0},c=await this.store.get(Zr).walletRequestHandler.promptConnect(a);if(c&&c.connected){const b=this.store.get(Wn).networks.get(),I=i.map(_=>Number(_.split(":").pop())),C=s.map(_=>Number(_.split(":").pop())),L={eip155:{accounts:b.map(_=>_.chainId).filter(_=>[...I,...C].includes(_)).map(_=>"eip155:"+_+":"+this.accountAddress),methods:["eth_sendTransaction","eth_sign","personal_sign","eth_signTypedData","eth_signTypedData_v4","wallet_switchEthereumChain"],events:["chainChanged","accountsChanged","connect","disconnect"]}},F=await((u=this.signClient)==null?void 0:u.approve({id:e.id,namespaces:L})),H=await(F==null?void 0:F.acknowledged());console.log("session",H),this.allSessions.set(this.getSignClientSessions()??[]),(p=this.signClient)==null||p.core.pairing.getPairings().filter(_=>e.params.pairingTopic!==_.topic).forEach(async _=>{var U,ie;e.params.proposer.metadata.url===((U=_.peerMetadata)==null?void 0:U.url)&&await((ie=this.signClient)==null?void 0:ie.core.pairing.disconnect({topic:_.topic}))})}else(g=this.signClient)==null||g.reject({id:e.id,reason:{message:"User rejected.",code:5e3}})});ue(this,"onSessionRequest",async e=>{var o,a,c;console.log("onSessionRequest",e);const r=e.params.chainId.split(":").pop(),n={jsonrpc:"2.0",id:e.id,method:e.params.request.method,params:e.params.request.params,chainId:Number(r)};n.method==="eth_sendTransaction"&&Array.isArray(n.params)&&n.params.forEach(l=>{delete l.nonce});const i=(o=this.signClient)==null?void 0:o.session.get(e.topic),s={app:(i==null?void 0:i.peer.metadata.name)??"",origin:i==null?void 0:i.peer.metadata.url,networkId:r};this.store.get(Zr).walletRequestHandler.setConnectOptions(s),this.currentRequestInfo={topic:e.topic,id:e.id};try{const l=await this.store.get(Zr).walletRequestHandler.request(n);(a=this.signClient)==null||a.respond({topic:e.topic,response:{id:e.id,jsonrpc:"2.0",result:l}})}catch(l){(c=this.signClient)==null||c.respond({topic:e.topic,response:{id:e.id,jsonrpc:"2.0",error:{message:l.message,code:l.code??4001}}})}this.currentRequestInfo=void 0});ue(this,"onSessionPing",async e=>{console.log("onSessionPing",e)});ue(this,"onSessionEvent",async e=>{console.log("onSessionEvent",e)});ue(this,"onSessionUpdate",async e=>{console.log("onSessionUpdate",e)});ue(this,"onSessionDelete",async e=>{console.log("onSessionDelete",e),this.allSessions.set(this.getSignClientSessions()??[])});this.store=e,this.createSignClient()}}const N$=["https://dweb.link/ipfs/","https://gateway.pinata.cloud/ipfs/","https://nftstorage.link/ipfs/","https://flk-ipfs.io/ipfs/","https://storry.tv/ipfs/","https://ipfs.io/ipfs/","https://hardbin.com/ipfs/","https://ipfs.runfission.com/ipfs/","https://ipfs.eth.aragon.network/ipfs/","https://4everland.io/ipfs/","https://w3s.link/ipfs/","https://trustless-gateway.link/ipfs/"],nFe="QmeSjSinHpPnmXmspMjwiXyN6zS4E9zccariGR3jxcaWtq/1";class iFe{constructor(){ue(this,"gatewayURL");ue(this,"localStore");this.localStore=new eu(Ol.GATEWAY_ADDRESS),this.gatewayURL=this.localStore.get(),this.findAccessibleGateway()}async findAccessibleGateway(){const e=this.localStore.get();if(e&&await this.isGatewayAccessible(e)){this.gatewayURL=e;return}for(const r of N$)if(await this.isGatewayAccessible(r)){this.gatewayURL=r,this.localStore.set(r);return}this.gatewayURL=N$[0],console.warn("No accessible IPFS gateways found, falling back to default")}async isGatewayAccessible(e){try{return await fetch(`${e}${nFe}`,{signal:AbortSignal.timeout(3e3)}),!0}catch{return!1}}async fetch(e){this.gatewayURL||await this.findAccessibleGateway();const r=await this.getGatewayURL(e);return fetch(r,{signal:AbortSignal.timeout(3e3)})}async getGatewayURL(e){if(this.gatewayURL||await this.findAccessibleGateway(),!e.startsWith("ipfs://"))throw new Error("Invalid IPFS URI");return e.replace("ipfs://",this.gatewayURL)}}function sFe(t,e){e(t.get()),t.subscribe(e)}class JM{constructor(e){ue(this,"isFetchingBalances",Or(!1));ue(this,"isFetchingCollectibleInfo",Or(!1));ue(this,"ipfsGatewayHelper",new iFe);ue(this,"userCollectibles",Or([]));ue(this,"local",{userCollectibles:new eu(Ol.COLLECTIBLES)});this.store=e;const r=this.store.get(Wn);sFe(r.networks,n=>{const i=this.store.get(Mi).accountAddress.get();i&&n.length>0&&this.loadBalances(i)})}async loadBalances(e){const r=this.local.userCollectibles.get()??[];if(r.length===0)return;this.isFetchingBalances.set(!0);const n=[],i=r.map(async s=>{const o=await this.getCollectibleInfo(s);if(!o.isOwner){this.removeCollectible({collectibleInfoParams:s,collectibleInfoResponse:o});return}n.push({collectibleInfoParams:s,collectibleInfoResponse:o})});await Promise.allSettled(i),this.userCollectibles.set(n),this.isFetchingBalances.set(!1)}async getCollectibleInfo(e){const r=this.store.get(Mi).accountAddress.get();if(!r)throw new Error("No account found");const n=this.store.get(Wn).providerForChainId(e.chainId);this.isFetchingCollectibleInfo.set(!0);let i,s,o,a,c;if(e.contractType===hh.ERC721){const f=new Bn(e.address,pM,n),p=(await f.ownerOf(e.tokenId)).toLowerCase()===r.toLowerCase();if(!p)return this.isFetchingCollectibleInfo.set(!1),{isOwner:p,uri:""};i=await f.tokenURI(e.tokenId)}else if(e.contractType===hh.ERC1155){const f=new Bn(e.address,vM,n);if(a=await f.balanceOf(r,e.tokenId),!a)return this.isFetchingCollectibleInfo.set(!1),{isOwner:!1,uri:""};a=a??BigInt(1),i=await f.uri(e.tokenId)}if(!i)throw new Error("Could not get collectible URI");i.includes("{id}")&&(i=i.replace("{id}",e.tokenId.toString()));let l;try{i.startsWith("ipfs://")?l=await this.ipfsGatewayHelper.fetch(i).then(f=>f.json()):l=await fetch(i).then(f=>f.json()),l&&(c=l.decimals,s=l.image,o=l.name),s!=null&&s.startsWith("ipfs://")&&(s=await this.ipfsGatewayHelper.getGatewayURL(s))}catch{o||(o=`No Metadata Found Address: ${e.address} TokenId: ${e.tokenId}`)}return c=c??0,this.isFetchingCollectibleInfo.set(!1),{isOwner:!0,uri:i,image:s,name:o,balance:a,decimals:c}}async addCollectible(e){if(e.collectibleInfoResponse.isOwner){const r=this.local.userCollectibles.get()??[];if(r.some(n=>n.address===e.collectibleInfoParams.address&&n.tokenId===e.collectibleInfoParams.tokenId))throw new Error("Collectible already added");this.local.userCollectibles.set([...r,e.collectibleInfoParams]),this.isFetchingCollectibleInfo.set(!0),this.loadBalances(),this.isFetchingCollectibleInfo.set(!1)}}async removeCollectible(e){const n=(this.local.userCollectibles.get()??[]).filter(o=>o.address!==e.collectibleInfoParams.address||o.tokenId!==e.collectibleInfoParams.tokenId);this.local.userCollectibles.set(n);const s=this.userCollectibles.get().filter(o=>o.collectibleInfoParams.address!==e.collectibleInfoParams.address||o.collectibleInfoParams.tokenId!==e.collectibleInfoParams.tokenId);this.userCollectibles.set(s)}}function ZM({chainId:t,paddingTop:e="1",paddingBottom:r="2"}){return W.jsx(we,{background:"backgroundMuted",width:"fit",height:"fit",borderRadius:"sm",paddingTop:e,paddingBottom:r,paddingX:"2",children:W.jsx(Qe,{variant:"xsmall",color:"text100",children:Ry(t)})})}function oFe({collectibleInfo:t,onSendClick:e,onRemoveClick:r}){return W.jsxs(en,{width:"full",flexDirection:"column",gap:"2",padding:"4",children:[W.jsx(we,{flexDirection:"row",alignItems:"center",gap:"2",children:W.jsx(Qe,{variant:"medium",color:"text80",wordBreak:"break-word",children:t.collectibleInfoResponse.name??"Collectible"})}),t.collectibleInfoResponse.image&&W.jsx(we,{style:{height:"200px"},children:W.jsx(i8,{style:{maxWidth:"100%",maxHeight:"100%",objectFit:"contain"},src:t.collectibleInfoResponse.image,width:"full"})}),W.jsx(we,{justifyContent:"flex-end",children:W.jsx(Qe,{variant:"medium",color:"text100",children:t.collectibleInfoParams.contractType==="ERC1155"?Number(uh(t.collectibleInfoResponse.balance,t.collectibleInfoResponse.decimals??0)):1})}),W.jsxs(we,{flexDirection:"row",justifyContent:"space-between",children:[W.jsx(ZM,{chainId:t.collectibleInfoParams.chainId}),W.jsxs(we,{children:[W.jsx(Jt,{size:"xs",label:"Send",variant:"primary",shape:"square",onClick:e}),r&&W.jsx(Jt,{marginLeft:"2",size:"xs",label:"Remove",shape:"square",onClick:r})]})]})]})}function aFe({onClose:t}){const r=Br(Wn).networks.get(),n=r.filter(H=>H.type===Bt.MAINNET),i=Br(JM),s=on(i.isFetchingCollectibleInfo),o=f8(),[a,c]=N.useState(),[l,f]=N.useState(),[u,p]=N.useState(),[g,y]=N.useState(),[b,I]=N.useState(),[C,S]=N.useState(!1);N.useEffect(()=>{a&&l&&u&&g?i.getCollectibleInfo({chainId:a.chainId,address:l,tokenId:u,contractType:g}).then(H=>{I(H)}):I(void 0)},[a,l,u,g]);const R=n.map(H=>({label:H.title,value:H.chainId.toString()})),L=async()=>{a&&l&&b&&u&&g&&(await i.addCollectible({collectibleInfoParams:{chainId:a.chainId,address:l,tokenId:u,contractType:g},collectibleInfoResponse:b}),S(!1),o({variant:"success",title:"Collectible added"}),F(),t())},F=()=>{f(void 0),c(void 0),p(void 0),y(void 0)};return W.jsxs(en,{flexDirection:"column",paddingY:"4",paddingX:"8",marginBottom:"8",borderRadius:"md",width:"full",height:"full",alignItems:"center",disabled:C,children:[W.jsx(we,{children:W.jsx(Qe,{variant:"medium",color:"text80",children:"Import ERC721 or ERC1155 Collectible"})}),W.jsxs(we,{flexDirection:"column",width:"full",marginTop:"4",gap:"4",children:[W.jsx(k7,{label:"Collectible Network",labelLocation:"left",name:"collectibleNetwork",options:R,onValueChange:H=>c(r.find(_=>_.chainId===Number(H)))}),W.jsx(Pn,{width:"full",label:"Collectible Address",labelLocation:"left",name:"collectibleAddress",value:l??"",onChange:H=>{f(H.target.value)}}),W.jsx(k7,{label:"Collectible Type",labelLocation:"left",name:"collectibleType",options:[{value:"ERC721",label:"ERC721"},{value:"ERC1155",label:"ERC1155"}],onValueChange:H=>y(H)}),W.jsx(Pn,{width:"full",label:"Collectible Token ID",labelLocation:"left",name:"collectibleId",value:u??"",onKeyPress:H=>{/[0-9]/.test(H.key)||H.preventDefault()},onChange:H=>{if(H.target.value===""){p(void 0);return}p(H.target.value)}}),s&&W.jsx(we,{marginTop:"4",alignItems:"center",justifyContent:"center",children:W.jsx(fh,{size:"lg"})}),b&&!b.isOwner&&!s&&W.jsx(we,{alignItems:"center",justifyContent:"center",children:W.jsx(Qe,{variant:"medium",color:"warning",children:"You do not own this collectible"})}),b&&b.isOwner&&!s&&W.jsx(we,{marginTop:"4",alignItems:"center",justifyContent:"center",children:W.jsx(en,{flexDirection:"column",gap:"2",children:W.jsxs(we,{flexDirection:"row",gap:"6",children:[W.jsx("img",{src:b.image??"",alt:b.name??"",style:{width:"120px",height:"auto"}}),W.jsxs(we,{flexDirection:"column",gap:"2",children:[W.jsx(Qe,{variant:"medium",color:"text100",children:b.name??""}),W.jsx(W.Fragment,{children:b.balance&&W.jsxs(W.Fragment,{children:[W.jsx(Qe,{variant:"small",color:"text80",children:"Your Balance:"}),W.jsx(Qe,{variant:"medium",color:"text100",children:Number(uh(b.balance,b.decimals??0))})]})})]})]})})}),W.jsxs(we,{alignItems:"center",justifyContent:"flex-end",gap:"8",marginTop:"4",children:[W.jsx(Jt,{label:"Cancel",variant:"text",size:"md",shape:"square",disabled:C,onClick:()=>{F(),t()}}),W.jsx(Jt,{label:"Add",disabled:b===void 0||!b.isOwner||C,variant:"primary",size:"md",shape:"square",onClick:L})]})]})]})}function cFe({onSendClick:t}){const e=Br(JM),r=on(e.isFetchingBalances),n=on(e.userCollectibles),i=N.useMemo(()=>n,[n]),[s,o]=N.useState(!1);return W.jsxs(W.Fragment,{children:[W.jsxs(we,{width:"full",flexDirection:"row",flexWrap:"wrap",gap:"4",marginBottom:"8",children:[i.map(a=>W.jsx(we,{width:"1/3",children:W.jsx(oFe,{collectibleInfo:a,onSendClick:()=>{t(a)},onRemoveClick:()=>{e.removeCollectible(a)}})},a.collectibleInfoParams.chainId+a.collectibleInfoParams.address+a.collectibleInfoParams.tokenId)),r&&W.jsx(we,{marginTop:"4",alignItems:"center",justifyContent:"center",children:W.jsx(fh,{size:"lg"})})]}),W.jsxs(we,{width:"full",flexDirection:"column",alignItems:"center",justifyContent:"center",marginBottom:"4",children:[s&&W.jsx(aFe,{onClose:()=>o(!1)}),W.jsx(Jt,{label:"Import collectible",leftIcon:qH,variant:"primary",size:"md",shape:"square",onClick:()=>{o(!0)}})]})]})}function cS({symbol:t,chainId:e,to:r,amount:n}){return W.jsxs(we,{flexDirection:"column",width:"full",gap:"4",children:[W.jsx(Qe,{variant:"large",color:"text80",children:"Pending transaction"}),W.jsxs(we,{background:"backgroundMuted",flexDirection:"row",width:"full",height:"fit",borderRadius:"sm",paddingX:"4",paddingY:"2",alignItems:"center",gap:"5",children:[W.jsx(fh,{size:"md"}),W.jsxs(we,{flexDirection:"column",gap:"1",children:[W.jsxs(we,{flexDirection:"row",alignItems:"center",gap:"1",children:[W.jsxs(Qe,{variant:"small",color:"text100",children:["Sending ",n," ",t," on"]}),W.jsx(ZM,{chainId:e,paddingTop:"0",paddingBottom:"1"}),W.jsxs(Qe,{variant:"small",color:"text80",children:["to ",r]})]}),W.jsx(Qe,{variant:"small",color:"text50",children:"Your external wallet will prompt you to confirm the transaction"})]})]})]})}function lFe({onSelectProvider:t}){const e=Br(OE),r=Rte(),[n,i]=N.useState(!1),s=()=>window.confirm("All WalletConnect Dapp sessions will be disconnected. If you would like to continue, click OK and connect to WalletConnect again."),o=async()=>{try{if(!n){if(e.allSessions.get().length!==0){if(!s())throw new Error("User rejected wallet connect modal");await e.disconnectAllSessions(),t();return}i(!0);const a=await Mte(!0);await a.connect();let c=ore(a);t(c)}}catch(a){console.error(a)}};return W.jsx(W.Fragment,{children:!n&&W.jsxs(we,{flexDirection:"column",paddingY:"5",alignItems:"center",children:[W.jsx(Qe,{variant:"md",fontWeight:"bold",color:"text100",paddingX:"16",paddingBottom:"1",children:"Select an external wallet to send transactions"}),W.jsx(Pu,{color:"gradientPrimary",width:"full",height:"px"}),W.jsxs(we,{flexDirection:"column",gap:"4",padding:"8",children:[W.jsx(en,{flexDirection:"row",alignItems:"center",gap:"2",cursor:"pointer",background:{base:"buttonGlass",hover:"backgroundSecondary"},onClick:()=>{o()},children:W.jsxs(we,{flexDirection:"row",alignItems:"center",gap:"2",children:[W.jsx("img",{src:"https://avatars.githubusercontent.com/u/37784886",alt:"Wallet Connect",style:{width:"20px",height:"20px"}}),W.jsx(Qe,{variant:"normal",color:"text100",children:"Wallet Connect"})]})}),r.map(a=>W.jsx(en,{flexDirection:"row",alignItems:"center",gap:"2",cursor:"pointer",background:{base:"buttonGlass",hover:"backgroundSecondary"},onClick:()=>t(a),children:W.jsxs(we,{flexDirection:"row",alignItems:"center",gap:"2",children:[W.jsx("img",{src:a.info.icon,alt:a.info.name,style:{width:"20px",height:"20px"}}),W.jsx(Qe,{variant:"normal",color:"text100",children:a.info.name})]})},a.info.uuid))]})]})})}function fFe({collectibleInfo:t,onClose:e}){var y,b,I;const r=WP("isMobile"),n=Br(Zr),[i,s]=N.useState(void 0),[o,a]=N.useState(void 0),[c,l]=N.useState(!1),[f,u]=N.useState(!1);if(N.useEffect(()=>{const C=n.selectedExternalWalletAddress.get();c&&C&&a(n.selectedExternalWalletAddress.get())},[c]),N.useEffect(()=>{u(n.selectedExternalWalletAddress.get()!==void 0)},[n.selectedExternalWalletAddress]),!t)return null;const p=t.collectibleInfoParams.contractType==="ERC721",g=Ry(t.collectibleInfoParams.chainId);return W.jsxs(we,{flexDirection:"column",paddingY:"5",alignItems:"center",children:[W.jsxs(Qe,{variant:"md",fontWeight:"bold",color:"text100",paddingX:"16",paddingBottom:"1",children:["Sending ",(y=t==null?void 0:t.collectibleInfoResponse)==null?void 0:y.name," on ",g]}),W.jsx(Pu,{color:"gradientPrimary",width:"full",height:"px"}),W.jsxs(we,{style:{minWidth:r?"100vw":"520px"},paddingX:"6",flexDirection:"column",gap:"4",width:"full",marginTop:"6",children:[W.jsxs(we,{flexDirection:"column",gap:"2",children:[W.jsx(Pn,{label:"Amount",labelLocation:"top",name:"amount",placeholder:"Enter amount",value:p?"1":i??"",onChange:C=>{s(C.target.value)},disabled:p,controls:W.jsx(W.Fragment,{children:t.collectibleInfoParams.contractType==="ERC1155"&&W.jsx(Jt,{label:"Max",variant:"text",size:"md",shape:"square",paddingRight:"2",onClick:()=>{var C,S;s(uh((C=t==null?void 0:t.collectibleInfoResponse)==null?void 0:C.balance,((S=t==null?void 0:t.collectibleInfoResponse)==null?void 0:S.decimals)??18))}})})}),W.jsxs(Qe,{variant:"small",color:"text50",children:["Current balance:"," ",uh((b=t==null?void 0:t.collectibleInfoResponse)==null?void 0:b.balance,((I=t==null?void 0:t.collectibleInfoResponse)==null?void 0:I.decimals)??18)]})]}),W.jsxs(we,{flexDirection:"column",gap:"3",children:[W.jsx(Pn,{label:"To",labelLocation:"top",name:"to",placeholder:"0x...",value:o??"",onChange:C=>{a(C.target.value)},disabled:c}),W.jsx(K4,{label:f?"Send to connected external wallet address":"Connect external wallet to autofill address",checked:c,onCheckedChange:C=>l(C===!0),labelLocation:"right",disabled:!f})]}),W.jsxs(we,{alignItems:"center",justifyContent:"flex-end",gap:"8",marginTop:"4",children:[W.jsx(Jt,{label:"Cancel",variant:"text",size:"md",shape:"square",onClick:()=>{e()}}),W.jsx(Jt,{label:"Send",variant:"primary",size:"md",shape:"square",disabled:!(p&&o||!p&&o&&i),onClick:()=>{e(o,i)}})]})]})]})}function uFe({tokenBalance:t,onClose:e}){var g,y;const r=WP("isMobile"),n=Br(Zr),[i,s]=N.useState(void 0),[o,a]=N.useState(void 0),[c,l]=N.useState(!1),[f,u]=N.useState(!1);if(N.useEffect(()=>{const b=n.selectedExternalWalletAddress.get();c&&b&&a(n.selectedExternalWalletAddress.get())},[c]),N.useEffect(()=>{u(n.selectedExternalWalletAddress.get()!==void 0)},[n.selectedExternalWalletAddress]),!t)return null;const p=Ry(t.chainId);return W.jsxs(we,{flexDirection:"column",paddingY:"5",alignItems:"center",children:[W.jsxs(Qe,{variant:"md",fontWeight:"bold",color:"text100",paddingX:"16",paddingBottom:"1",children:["Sending ",(g=t==null?void 0:t.contractInfo)==null?void 0:g.symbol," on ",p]}),W.jsx(Pu,{color:"gradientPrimary",width:"full",height:"px"}),W.jsxs(we,{style:{minWidth:r?"100vw":"520px"},paddingX:"6",flexDirection:"column",gap:"4",width:"full",marginTop:"6",children:[W.jsxs(we,{flexDirection:"column",gap:"2",children:[W.jsx(Pn,{label:"Amount",labelLocation:"top",name:"amount",placeholder:"Enter amount",value:i??"",onChange:b=>{s(b.target.value)},controls:W.jsx(Jt,{label:"Max",variant:"text",size:"md",shape:"square",paddingRight:"2",onClick:()=>{var b;s(uh(t==null?void 0:t.balance,((b=t==null?void 0:t.contractInfo)==null?void 0:b.decimals)??18))}})}),W.jsxs(Qe,{variant:"small",color:"text50",children:["Current balance:"," ",uh(t==null?void 0:t.balance,((y=t==null?void 0:t.contractInfo)==null?void 0:y.decimals)??18)]})]}),W.jsxs(we,{flexDirection:"column",gap:"3",children:[W.jsx(Pn,{label:"To",labelLocation:"top",name:"to",placeholder:"0x...",value:o??"",onChange:b=>{a(b.target.value)},disabled:c}),W.jsx(K4,{label:f?"Send to connected external wallet address":"Connect external wallet to autofill address",checked:c,onCheckedChange:b=>l(b===!0),labelLocation:"right",disabled:!f})]}),W.jsxs(we,{alignItems:"center",justifyContent:"flex-end",gap:"8",marginTop:"4",children:[W.jsx(Jt,{label:"Cancel",variant:"text",size:"md",shape:"square",onClick:()=>{e()}}),W.jsx(Jt,{label:"Send",variant:"primary",size:"md",shape:"square",disabled:!o||!i,onClick:()=>{o&&i&&e(o,i)}})]})]})]})}function dFe({onClose:t}){const r=Br(Wn).networks.get(),n=r.filter(S=>S.type===Bt.MAINNET),i=Br(nE),s=on(i.isFetchingTokenInfo),o=f8(),[a,c]=N.useState(),[l,f]=N.useState(),[u,p]=N.useState(),[g,y]=N.useState(!1);N.useEffect(()=>{a&&l?i.getTokenInfo(a.chainId,l).then(S=>{p(S)}):p(void 0)},[a,l]);const b=n.map(S=>({label:S.title,value:S.chainId.toString()})),I=async()=>{a&&l&&u&&(y(!0),await i.addToken({chainId:a.chainId,address:l,contractType:hh.ERC20,symbol:u.symbol,decimals:u.decimals}),y(!1),o({variant:"success",title:"Token added"}),C(),t())},C=()=>{f(void 0),c(void 0)};return W.jsxs(en,{flexDirection:"column",paddingY:"4",paddingX:"8",borderRadius:"md",width:"full",height:"full",alignItems:"center",disabled:g,children:[W.jsx(we,{children:W.jsx(Qe,{variant:"medium",color:"text80",children:"Import ERC20 Token"})}),W.jsxs(we,{flexDirection:"column",width:"full",marginTop:"4",gap:"4",children:[W.jsx(k7,{label:"Token Network",labelLocation:"left",name:"tokenNetwork",options:b,onValueChange:S=>c(r.find(R=>R.chainId===Number(S)))}),W.jsx(Pn,{width:"full",label:"Token Address",labelLocation:"left",name:"tokenAddress",value:l??"",onChange:S=>{f(S.target.value)}}),s&&W.jsx(we,{marginTop:"4",alignItems:"center",justifyContent:"center",children:W.jsx(fh,{size:"lg"})}),u&&W.jsxs(W.Fragment,{children:[W.jsx(Pn,{width:"full",label:"Token Symbol",labelLocation:"left",name:"tokenSymbol",value:(u==null?void 0:u.symbol)??"",disabled:!0}),W.jsx(Pn,{width:"full",label:"Token Decimals",labelLocation:"left",name:"tokenDecimals",value:(u==null?void 0:u.decimals)??"",disabled:!0})]}),W.jsxs(we,{alignItems:"center",justifyContent:"flex-end",gap:"8",marginTop:"4",children:[W.jsx(Jt,{label:"Cancel",variant:"text",size:"md",shape:"square",disabled:g,onClick:()=>{C(),t()}}),W.jsx(Jt,{label:"Add",disabled:u===void 0||g,variant:"primary",size:"md",shape:"square",onClick:I})]})]})]})}const hFe=(t,e)=>Math.floor(t*10**e)/10**e;function pFe({disabled:t,tokenBalance:e,onSendClick:r,onRemoveClick:n}){var o,a;const i=uh(e.balance,((o=e.contractInfo)==null?void 0:o.decimals)??18),s=hFe(Number(i),5);return W.jsxs(en,{width:"full",flexDirection:"column",gap:"2",children:[W.jsxs(we,{flexDirection:"row",alignItems:"center",children:[W.jsx(Qe,{variant:"medium",color:"text80",children:((a=e.contractInfo)==null?void 0:a.symbol)??"Native Token"}),W.jsx(we,{marginLeft:"auto",children:W.jsx(Qe,{color:"text80",children:s})})]}),W.jsxs(we,{flexDirection:"row",children:[W.jsx(ZM,{chainId:e.chainId}),W.jsxs(we,{marginLeft:"auto",gap:"2",children:[W.jsx(Jt,{size:"xs",label:"Send",variant:"primary",shape:"square",disabled:t,onClick:r}),n&&W.jsx(Jt,{size:"xs",label:"Remove",shape:"square",onClick:n})]})]})]})}function vFe({filterZeroBalances:t,onSendClick:e}){const r=Br(Zr),n=Br(nE),i=on(n.balances),s=on(n.isFetchingBalances),o=on(r.selectedExternalProvider)!==void 0,a=N.useMemo(()=>t?i.filter(u=>u.balance!=="0"):i,[i,t,s]),[c,l]=N.useState(!1),f=u=>u.contractType===hh.NATIVE?void 0:()=>{var p,g;n.removeToken({chainId:u.chainId,address:u.contractAddress,contractType:u.contractType,decimals:(p=u.contractInfo)==null?void 0:p.decimals,symbol:(g=u.contractInfo)==null?void 0:g.symbol})};return W.jsxs(W.Fragment,{children:[W.jsxs(we,{width:"full",flexDirection:"column",gap:"4",marginBottom:"8",children:[a.map(u=>W.jsx(pFe,{tokenBalance:u,disabled:!o,onSendClick:()=>e(u),onRemoveClick:f(u)},u.contractAddress+u.chainId)),s&&W.jsx(we,{marginTop:"4",alignItems:"center",justifyContent:"center",children:W.jsx(fh,{size:"lg"})})]}),c&&W.jsx(dFe,{onClose:()=>l(!1)}),!c&&W.jsx(we,{width:"full",alignItems:"center",justifyContent:"center",marginBottom:"4",children:W.jsx(Jt,{label:"Import token",leftIcon:qH,variant:"primary",size:"md",shape:"square",onClick:()=>{l(!0)}})})]})}function gFe({onClose:t}){var a;const e=Br(Zr),r=on(e.connectOptions),[n,i]=N.useState(!1),s=async()=>{if(n)return;i(!0);const c=await e.walletRequestHandler.connect(r);e.connectDetails.set(c),i(!1),t()},o=()=>{e.connectDetails.set({connected:!1}),t()};return W.jsx(we,{children:r&&W.jsxs(we,{flexDirection:"column",padding:"10",alignItems:"center",gap:"4",children:[W.jsx(Qe,{variant:"md",fontWeight:"bold",color:"text100",paddingX:"16",paddingBottom:"1",children:"Would you like to allow this dapp to connect to your wallet?"}),W.jsx(Pu,{color:"gradientPrimary",width:"full",height:"px"}),W.jsxs(en,{flexDirection:"row",justifyContent:"space-between",alignItems:"center",children:[W.jsx(Qe,{variant:"md",color:"text100",children:r.app}),W.jsxs(we,{flexDirection:"row",alignItems:"center",gap:"3",children:[W.jsx(Qe,{variant:"md",color:"text100",children:(a=r.origin)==null?void 0:a.split("//")[1]}),W.jsx(mu,{size:"xs",icon:W4,onClick:()=>window.open(r.origin,"_blank")})]})]}),W.jsxs(en,{flexDirection:"row",justifyContent:"space-between",children:[W.jsx(Qe,{variant:"md",color:"text100",children:"Network"}),W.jsx(Qe,{variant:"md",color:"text100",children:`${Ry(Number(r.networkId))}`})]}),W.jsxs(we,{flexDirection:{sm:"column",md:"row"},gap:"2",width:"full",marginTop:"6",children:[W.jsx(Jt,{width:"full",label:"Cancel",onClick:o,"data-id":"signingCancel"}),W.jsx(Jt,{width:"full",variant:"primary",label:n?"Authorizing…":"Connect",disabled:n,onClick:s,"data-id":"signingContinue"})]})]})})}function yFe({sessionList:t}){const e=Br(OE);return W.jsxs(we,{flexDirection:"column",gap:"2",children:[t.length!==0&&W.jsx(Qe,{variant:"large",color:"text80",marginTop:"6",marginBottom:"2",children:"Connected Dapps via WalletConnect"}),t.map((r,n)=>W.jsxs(en,{flexDirection:"row",justifyContent:"space-between",alignItems:"center",gap:"2",padding:"2",children:[W.jsx(i8,{width:"8",height:"8",src:r.peer.metadata.icons[0]}),W.jsx(Qe,{variant:"normal",fontWeight:"bold",color:"text100",children:r.peer.metadata.name}),W.jsxs(we,{gap:"2",children:[r.peer.metadata.url&&W.jsx(mu,{size:"xs",icon:W4,onClick:()=>window.open(r.peer.metadata.url,"_blank")}),W.jsx(mu,{size:"xs",icon:Gg,onClick:()=>{e.disconnectSession(r.topic)}})]})]},n))]})}function mFe({onClose:t}){var l,f;const e=Br(Zr),r=Br(Mi),n=e.toSignMsgDetails.get(),i=r.accountAddress.get(),[s,o]=N.useState(""),[a,c]=N.useState("");return N.useEffect(()=>{if(console.log("details",n),c(new Date().toLocaleString()),n!=null&&n.message.message){const u=zLe(n.message.message);try{o(kp(u))}catch{o(ke(u))}}else n!=null&&n.message.typedData&&o(JSON.stringify(n.message.typedData,void 0,4))},[n]),W.jsx(we,{children:n&&W.jsxs(we,{flexDirection:"column",padding:"10",alignItems:"center",gap:"4",children:[W.jsx(Qe,{variant:"md",fontWeight:"bold",color:"text100",children:"Would you like to sign this message?"}),W.jsx(Pu,{color:"gradientPrimary",width:"full",height:"px"}),W.jsxs(en,{flexDirection:"row",justifyContent:"space-between",children:[W.jsx(Qe,{variant:"md",color:"text100",children:"Requested at"}),W.jsx(Qe,{variant:"md",color:"text100",children:a})]}),W.jsxs(en,{flexDirection:"row",justifyContent:"space-between",alignItems:"center",children:[W.jsx(Qe,{variant:"md",color:"text100",children:"Origin"}),W.jsxs(we,{alignItems:"center",gap:"3",children:[W.jsx(Qe,{variant:"md",color:"text100",children:(f=(l=n==null?void 0:n.options)==null?void 0:l.origin)==null?void 0:f.split("//")[1]}),W.jsx(mu,{size:"xs",icon:W4,onClick:()=>{var u;return window.open((u=n.options)==null?void 0:u.origin,"_blank")}})]})]}),W.jsxs(en,{flexDirection:"row",justifyContent:"space-between",children:[W.jsx(Qe,{variant:"md",color:"text100",children:"Network"}),W.jsx(Qe,{variant:"md",color:"text100",children:`${Ry(n.chainId)}`})]}),W.jsxs(en,{flexDirection:"column",gap:"4",children:[W.jsx(Qe,{variant:"md",color:"text100",children:"Signee"}),W.jsx(en,{children:W.jsx(Qe,{variant:"md",color:"text100",children:`${i}`})})]}),W.jsx(iP,{label:"Message Content",children:W.jsx(en,{children:W.jsx(Qe,{variant:"code",color:"text80",style:{overflowWrap:"anywhere",whiteSpace:"pre-wrap"},children:s})})}),W.jsxs(we,{flexDirection:{sm:"column",md:"row"},gap:"2",width:"full",marginTop:"10",children:[W.jsx(Jt,{width:"full",label:"Cancel",onClick:()=>{t()},"data-id":"signingCancel"}),W.jsx(Jt,{width:"full",variant:"primary",label:"Send",onClick:()=>{t(n)},"data-id":"signingContinue"})]})]})})}function bFe({onClose:t}){var I,C;const e=Br(Zr),r=Br(Wn),n=Br(JM),[i,s]=N.useState("Unknown"),[o,a]=N.useState(null),[c,l]=N.useState({name:null}),[f,u]=N.useState(null),[p,g]=N.useState(""),y=e.toSignTxnDetails.get();N.useEffect(()=>{if(!y)return;g(new Date().toLocaleString());const S=r.providerForChainId(y.chainId??0),R=y.txn[0].data,L=y.txn[0].to;b(R,L,S)},[y]),N.useEffect(()=>{if(!y||!(y!=null&&y.txn[0].to)||!o)return;const S=y.txn[0].to,R={chainId:y.chainId,address:S,tokenId:o,contractType:i};n.getCollectibleInfo(R)},[i,o]);async function b(S,R,L){try{const F=new Bn(R,qv,L);try{const ie=await F.symbol();s("ERC20"),l({name:ie});const K=new Fi(qv).parseTransaction({data:S}),k=await F.decimals();u(Number(uh(K==null?void 0:K.args[1],k??18)));return}catch{}const H=new Bn(R,h9e,L);if(await H.supportsInterface("0x80ac58cd")){s("ERC721");const ie=new Bn(R,pM,L),K=ie.interface.decodeFunctionData("safeTransferFrom",S).tokenId.toString();a(K);const k=await ie.name();l({name:k});return}if(await H.supportsInterface("0xd9b67a26")){s("ERC1155");const ie=new Bn(R,vM,L),K=ie.interface.decodeFunctionData("safeTransferFrom",S).id.toString();a(K);const k=await ie.uri(K);l({name:k});return}}catch(F){console.error("Error parsing contract type. The transaction is either using a smart contract that doesnt support ERC165 or the token is native:",F)}if(y!=null&&y.txn[0].value){s("Native Token"),l({name:`${Ry((y==null?void 0:y.chainId)??1)} Native Token`});return}console.info("Token info could not be decoded for this transaction")}return W.jsx(we,{children:y&&W.jsx(we,{children:W.jsxs(we,{flexDirection:"column",padding:"10",gap:"4",children:[W.jsx(Qe,{alignSelf:"center",variant:"md",fontWeight:"bold",color:"text100",children:"Would you like to approve this transaction?"}),W.jsx(Pu,{color:"gradientPrimary",width:"full",height:"px"}),W.jsxs(en,{flexDirection:"row",justifyContent:"space-between",children:[W.jsx(Qe,{variant:"md",color:"text100",children:"Requested at"}),W.jsx(Qe,{variant:"md",color:"text100",children:p})]}),W.jsxs(en,{flexDirection:"row",justifyContent:"space-between",alignItems:"center",children:[W.jsx(Qe,{variant:"md",color:"text100",children:"Origin"}),W.jsxs(we,{alignItems:"center",gap:"3",children:[W.jsx(Qe,{variant:"md",color:"text100",children:(C=(I=y==null?void 0:y.options)==null?void 0:I.origin)==null?void 0:C.split("//")[1]}),W.jsx(mu,{size:"xs",icon:W4,onClick:()=>{var S;return window.open((S=y.options)==null?void 0:S.origin,"_blank")}})]})]}),W.jsxs(en,{flexDirection:"row",justifyContent:"space-between",children:[W.jsx(Qe,{variant:"md",color:"text100",children:"Token Standard"}),W.jsx(Qe,{variant:"md",color:"text100",children:`${i}`})]}),i==="ERC721"||i==="ERC1155"&&W.jsxs(en,{flexDirection:"row",justifyContent:"space-between",children:[W.jsx(Qe,{variant:"md",color:"text100",children:"Token ID"}),W.jsx(Qe,{variant:"md",color:"text100",children:`${o}`})]}),W.jsxs(en,{flexDirection:"row",justifyContent:"space-between",children:[W.jsx(Qe,{variant:"md",color:"text100",children:"Amount"}),W.jsx(Qe,{variant:"md",color:"text100",children:`${f??0} ${c.name}`})]}),W.jsx(iP,{label:"Transaction Data",children:W.jsx(we,{flexDirection:"column",gap:"2",children:y.txn.map((S,R)=>W.jsx(en,{children:W.jsx(Qe,{variant:"code",color:"text80",style:{whiteSpace:"pre-wrap"},children:JSON.stringify(S,null,4)||"Native token transfer"})},R))})}),W.jsxs(we,{flexDirection:{sm:"column",md:"row"},gap:"2",width:"full",marginTop:"10",children:[W.jsx(Jt,{width:"full",label:"Cancel",onClick:()=>{t()},"data-id":"signingCancel"}),W.jsx(Jt,{width:"full",variant:"primary",label:"Send",onClick:()=>{t(y)},"data-id":"signingContinue"})]})]})})})}function wFe({warningType:t}){return W.jsx(we,{children:W.jsxs(we,{flexDirection:"column",padding:"10",alignItems:"center",gap:"6",children:[W.jsx(Qe,{variant:"md",fontWeight:"bold",color:"text100",children:"Warning:"}),W.jsx(we,{flexDirection:"column",children:W.jsx(en,{children:W.jsxs(Qe,{variant:"md",fontWeight:"bold",color:"text100",paddingX:"2",children:[t==="noProvider"&&'Please ensure that an external wallet is connected via the "Connect" button',t==="isWalletConnect"&&"Please switch your external wallet to an option other than WalletConnect",t==="notDeployed"&&"Please deploy our wallet on the required network before trying to sign messages"]})})})]})})}var Ote={},jo={};Object.defineProperty(jo,"__esModule",{value:!0});jo.compactObject=Bte;jo.deprecated=PFe;var xFe=jo.detectBrowser=kFe;jo.disableLog=_Fe;jo.disableWarnings=IFe;jo.extractVersion=D3;jo.filterStats=MFe;jo.log=TFe;jo.walkStats=u4;jo.wrapPeerConnectionEvent=SFe;function EFe(t,e,r){return e=CFe(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function CFe(t){var e=AFe(t,"string");return gh(e)=="symbol"?e:e+""}function AFe(t,e){if(gh(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(gh(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function gh(t){"@babel/helpers - typeof";return gh=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},gh(t)}var Nte=!0,Dte=!0;function D3(t,e,r){var n=t.match(e);return n&&n.length>=r&&parseInt(n[r],10)}function SFe(t,e,r){if(t.RTCPeerConnection){var n=t.RTCPeerConnection.prototype,i=n.addEventListener;n.addEventListener=function(o,a){if(o!==e)return i.apply(this,arguments);var c=function(f){var u=r(f);u&&(a.handleEvent?a.handleEvent(u):a(u))};return this._eventMap=this._eventMap||{},this._eventMap[e]||(this._eventMap[e]=new Map),this._eventMap[e].set(a,c),i.apply(this,[o,c])};var s=n.removeEventListener;n.removeEventListener=function(o,a){if(o!==e||!this._eventMap||!this._eventMap[e])return s.apply(this,arguments);if(!this._eventMap[e].has(a))return s.apply(this,arguments);var c=this._eventMap[e].get(a);return this._eventMap[e].delete(a),this._eventMap[e].size===0&&delete this._eventMap[e],Object.keys(this._eventMap).length===0&&delete this._eventMap,s.apply(this,[o,c])},Object.defineProperty(n,"on"+e,{get:function(){return this["_on"+e]},set:function(a){this["_on"+e]&&(this.removeEventListener(e,this["_on"+e]),delete this["_on"+e]),a&&this.addEventListener(e,this["_on"+e]=a)},enumerable:!0,configurable:!0})}}function _Fe(t){return typeof t!="boolean"?new Error("Argument type: "+gh(t)+". Please use a boolean."):(Nte=t,t?"adapter.js logging disabled":"adapter.js logging enabled")}function IFe(t){return typeof t!="boolean"?new Error("Argument type: "+gh(t)+". Please use a boolean."):(Dte=!t,"adapter.js deprecation warnings "+(t?"disabled":"enabled"))}function TFe(){if((typeof window>"u"?"undefined":gh(window))==="object"){if(Nte)return;typeof console<"u"&&typeof console.log=="function"&&console.log.apply(console,arguments)}}function PFe(t,e){Dte&&console.warn(t+" is deprecated, please use "+e+" instead.")}function kFe(t){var e={browser:null,version:null};if(typeof t>"u"||!t.navigator||!t.navigator.userAgent)return e.browser="Not a browser.",e;var r=t.navigator;if(r.userAgentData&&r.userAgentData.brands){var n=r.userAgentData.brands.find(function(i){return i.brand==="Chromium"});if(n)return{browser:"chrome",version:parseInt(n.version,10)}}if(r.mozGetUserMedia)e.browser="firefox",e.version=D3(r.userAgent,/Firefox\/(\d+)\./,1);else if(r.webkitGetUserMedia||t.isSecureContext===!1&&t.webkitRTCPeerConnection)e.browser="chrome",e.version=D3(r.userAgent,/Chrom(e|ium)\/(\d+)\./,2);else if(t.RTCPeerConnection&&r.userAgent.match(/AppleWebKit\/(\d+)\./))e.browser="safari",e.version=D3(r.userAgent,/AppleWebKit\/(\d+)\./,1),e.supportsUnifiedPlan=t.RTCRtpTransceiver&&"currentDirection"in t.RTCRtpTransceiver.prototype;else return e.browser="Not a supported browser.",e;return e}function D$(t){return Object.prototype.toString.call(t)==="[object Object]"}function Bte(t){return D$(t)?Object.keys(t).reduce(function(e,r){var n=D$(t[r]),i=n?Bte(t[r]):t[r],s=n&&!Object.keys(i).length;return i===void 0||s?e:Object.assign(e,EFe({},r,i))},{}):t}function u4(t,e,r){!e||r.has(e.id)||(r.set(e.id,e),Object.keys(e).forEach(function(n){n.endsWith("Id")?u4(t,t.get(e[n]),r):n.endsWith("Ids")&&e[n].forEach(function(i){u4(t,t.get(i),r)})}))}function MFe(t,e,r){var n=r?"outbound-rtp":"inbound-rtp",i=new Map;if(e===null)return i;var s=[];return t.forEach(function(o){o.type==="track"&&o.trackIdentifier===e.id&&s.push(o)}),s.forEach(function(o){t.forEach(function(a){a.type===n&&a.trackId===o.id&&u4(t,a,i)})}),i}Object.defineProperty(Ote,"__esModule",{value:!0});var RFe=Ote.shimGetUserMedia=DFe,OFe=NFe(jo);function Lte(t){if(typeof WeakMap!="function")return null;var e=new WeakMap,r=new WeakMap;return(Lte=function(i){return i?r:e})(t)}function NFe(t,e){if(t&&t.__esModule)return t;if(t===null||yd(t)!="object"&&typeof t!="function")return{default:t};var r=Lte(e);if(r&&r.has(t))return r.get(t);var n={__proto__:null},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in t)if(s!=="default"&&{}.hasOwnProperty.call(t,s)){var o=i?Object.getOwnPropertyDescriptor(t,s):null;o&&(o.get||o.set)?Object.defineProperty(n,s,o):n[s]=t[s]}return n.default=t,r&&r.set(t,n),n}function yd(t){"@babel/helpers - typeof";return yd=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},yd(t)}var B$=OFe.log;function DFe(t,e){var r=t&&t.navigator;if(r.mediaDevices){var n=function(l){if(yd(l)!=="object"||l.mandatory||l.optional)return l;var f={};return Object.keys(l).forEach(function(u){if(!(u==="require"||u==="advanced"||u==="mediaSource")){var p=yd(l[u])==="object"?l[u]:{ideal:l[u]};p.exact!==void 0&&typeof p.exact=="number"&&(p.min=p.max=p.exact);var g=function(I,C){return I?I+C.charAt(0).toUpperCase()+C.slice(1):C==="deviceId"?"sourceId":C};if(p.ideal!==void 0){f.optional=f.optional||[];var y={};typeof p.ideal=="number"?(y[g("min",u)]=p.ideal,f.optional.push(y),y={},y[g("max",u)]=p.ideal,f.optional.push(y)):(y[g("",u)]=p.ideal,f.optional.push(y))}p.exact!==void 0&&typeof p.exact!="number"?(f.mandatory=f.mandatory||{},f.mandatory[g("",u)]=p.exact):["min","max"].forEach(function(b){p[b]!==void 0&&(f.mandatory=f.mandatory||{},f.mandatory[g(b,u)]=p[b])})}}),l.advanced&&(f.optional=(f.optional||[]).concat(l.advanced)),f},i=function(l,f){if(e.version>=61)return f(l);if(l=JSON.parse(JSON.stringify(l)),l&&yd(l.audio)==="object"){var u=function(I,C,S){C in I&&!(S in I)&&(I[S]=I[C],delete I[C])};l=JSON.parse(JSON.stringify(l)),u(l.audio,"autoGainControl","googAutoGainControl"),u(l.audio,"noiseSuppression","googNoiseSuppression"),l.audio=n(l.audio)}if(l&&yd(l.video)==="object"){var p=l.video.facingMode;p=p&&(yd(p)==="object"?p:{ideal:p});var g=e.version<66;if(p&&(p.exact==="user"||p.exact==="environment"||p.ideal==="user"||p.ideal==="environment")&&!(r.mediaDevices.getSupportedConstraints&&r.mediaDevices.getSupportedConstraints().facingMode&&!g)){delete l.video.facingMode;var y;if(p.exact==="environment"||p.ideal==="environment"?y=["back","rear"]:(p.exact==="user"||p.ideal==="user")&&(y=["front"]),y)return r.mediaDevices.enumerateDevices().then(function(b){b=b.filter(function(C){return C.kind==="videoinput"});var I=b.find(function(C){return y.some(function(S){return C.label.toLowerCase().includes(S)})});return!I&&b.length&&y.includes("back")&&(I=b[b.length-1]),I&&(l.video.deviceId=p.exact?{exact:I.deviceId}:{ideal:I.deviceId}),l.video=n(l.video),B$("chrome: "+JSON.stringify(l)),f(l)})}l.video=n(l.video)}return B$("chrome: "+JSON.stringify(l)),f(l)},s=function(l){return e.version>=64?l:{name:{PermissionDeniedError:"NotAllowedError",PermissionDismissedError:"NotAllowedError",InvalidStateError:"NotAllowedError",DevicesNotFoundError:"NotFoundError",ConstraintNotSatisfiedError:"OverconstrainedError",TrackStartError:"NotReadableError",MediaDeviceFailedDueToShutdown:"NotAllowedError",MediaDeviceKillSwitchOn:"NotAllowedError",TabCaptureError:"AbortError",ScreenCaptureError:"AbortError",DeviceCaptureError:"AbortError"}[l.name]||l.name,message:l.message,constraint:l.constraint||l.constraintName,toString:function(){return this.name+(this.message&&": ")+this.message}}},o=function(l,f,u){i(l,function(p){r.webkitGetUserMedia(p,f,function(g){u&&u(s(g))})})};if(r.getUserMedia=o.bind(r),r.mediaDevices.getUserMedia){var a=r.mediaDevices.getUserMedia.bind(r.mediaDevices);r.mediaDevices.getUserMedia=function(c){return i(c,function(l){return a(l).then(function(f){if(l.audio&&!f.getAudioTracks().length||l.video&&!f.getVideoTracks().length)throw f.getTracks().forEach(function(u){u.stop()}),new DOMException("","NotFoundError");return f},function(f){return Promise.reject(s(f))})})}}}}var Fte={};Object.defineProperty(Fte,"__esModule",{value:!0});var BFe=Fte.shimGetUserMedia=jFe,LFe=FFe(jo);function jte(t){if(typeof WeakMap!="function")return null;var e=new WeakMap,r=new WeakMap;return(jte=function(i){return i?r:e})(t)}function FFe(t,e){if(t&&t.__esModule)return t;if(t===null||Kv(t)!="object"&&typeof t!="function")return{default:t};var r=jte(e);if(r&&r.has(t))return r.get(t);var n={__proto__:null},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in t)if(s!=="default"&&{}.hasOwnProperty.call(t,s)){var o=i?Object.getOwnPropertyDescriptor(t,s):null;o&&(o.get||o.set)?Object.defineProperty(n,s,o):n[s]=t[s]}return n.default=t,r&&r.set(t,n),n}function Kv(t){"@babel/helpers - typeof";return Kv=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Kv(t)}function jFe(t,e){var r=t&&t.navigator,n=t&&t.MediaStreamTrack;if(r.getUserMedia=function(c,l,f){LFe.deprecated("navigator.getUserMedia","navigator.mediaDevices.getUserMedia"),r.mediaDevices.getUserMedia(c).then(l,f)},!(e.version>55&&"autoGainControl"in r.mediaDevices.getSupportedConstraints())){var i=function(l,f,u){f in l&&!(u in l)&&(l[u]=l[f],delete l[f])},s=r.mediaDevices.getUserMedia.bind(r.mediaDevices);if(r.mediaDevices.getUserMedia=function(c){return Kv(c)==="object"&&Kv(c.audio)==="object"&&(c=JSON.parse(JSON.stringify(c)),i(c.audio,"autoGainControl","mozAutoGainControl"),i(c.audio,"noiseSuppression","mozNoiseSuppression")),s(c)},n&&n.prototype.getSettings){var o=n.prototype.getSettings;n.prototype.getSettings=function(){var c=o.apply(this,arguments);return i(c,"mozAutoGainControl","autoGainControl"),i(c,"mozNoiseSuppression","noiseSuppression"),c}}if(n&&n.prototype.applyConstraints){var a=n.prototype.applyConstraints;n.prototype.applyConstraints=function(c){return this.kind==="audio"&&Kv(c)==="object"&&(c=JSON.parse(JSON.stringify(c)),i(c,"autoGainControl","mozAutoGainControl"),i(c,"noiseSuppression","mozNoiseSuppression")),a.apply(this,[c])}}}}var tf={};Object.defineProperty(tf,"__esModule",{value:!0});tf.shimAudioContext=YFe;tf.shimCallbacksAPI=zFe;tf.shimConstraints=qte;tf.shimCreateOfferLegacy=KFe;var UFe=tf.shimGetUserMedia=HFe;tf.shimLocalStreamsAPI=qFe;tf.shimRTCIceServerUrls=GFe;tf.shimRemoteStreamsAPI=VFe;tf.shimTrackEventTransceiver=WFe;var Ute=$Fe(jo);function $te(t){if(typeof WeakMap!="function")return null;var e=new WeakMap,r=new WeakMap;return($te=function(i){return i?r:e})(t)}function $Fe(t,e){if(t&&t.__esModule)return t;if(t===null||yh(t)!="object"&&typeof t!="function")return{default:t};var r=$te(e);if(r&&r.has(t))return r.get(t);var n={__proto__:null},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in t)if(s!=="default"&&{}.hasOwnProperty.call(t,s)){var o=i?Object.getOwnPropertyDescriptor(t,s):null;o&&(o.get||o.set)?Object.defineProperty(n,s,o):n[s]=t[s]}return n.default=t,r&&r.set(t,n),n}function yh(t){"@babel/helpers - typeof";return yh=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},yh(t)}function qFe(t){if(!(yh(t)!=="object"||!t.RTCPeerConnection)){if("getLocalStreams"in t.RTCPeerConnection.prototype||(t.RTCPeerConnection.prototype.getLocalStreams=function(){return this._localStreams||(this._localStreams=[]),this._localStreams}),!("addStream"in t.RTCPeerConnection.prototype)){var e=t.RTCPeerConnection.prototype.addTrack;t.RTCPeerConnection.prototype.addStream=function(n){var i=this;this._localStreams||(this._localStreams=[]),this._localStreams.includes(n)||this._localStreams.push(n),n.getAudioTracks().forEach(function(s){return e.call(i,s,n)}),n.getVideoTracks().forEach(function(s){return e.call(i,s,n)})},t.RTCPeerConnection.prototype.addTrack=function(n){for(var i=this,s=arguments.length,o=new Array(s>1?s-1:0),a=1;a=0)){n._remoteStreams.push(s);var o=new Event("addstream");o.stream=s,n.dispatchEvent(o)}})}),e.apply(n,arguments)}}}function zFe(t){if(!(yh(t)!=="object"||!t.RTCPeerConnection)){var e=t.RTCPeerConnection.prototype,r=e.createOffer,n=e.createAnswer,i=e.setLocalDescription,s=e.setRemoteDescription,o=e.addIceCandidate;e.createOffer=function(l,f){var u=arguments.length>=2?arguments[2]:arguments[0],p=r.apply(this,[u]);return f?(p.then(l,f),Promise.resolve()):p},e.createAnswer=function(l,f){var u=arguments.length>=2?arguments[2]:arguments[0],p=n.apply(this,[u]);return f?(p.then(l,f),Promise.resolve()):p};var a=function(l,f,u){var p=i.apply(this,[l]);return u?(p.then(f,u),Promise.resolve()):p};e.setLocalDescription=a,a=function(l,f,u){var p=s.apply(this,[l]);return u?(p.then(f,u),Promise.resolve()):p},e.setRemoteDescription=a,a=function(l,f,u){var p=o.apply(this,[l]);return u?(p.then(f,u),Promise.resolve()):p},e.addIceCandidate=a}}function HFe(t){var e=t&&t.navigator;if(e.mediaDevices&&e.mediaDevices.getUserMedia){var r=e.mediaDevices,n=r.getUserMedia.bind(r);e.mediaDevices.getUserMedia=function(i){return n(qte(i))}}!e.getUserMedia&&e.mediaDevices&&e.mediaDevices.getUserMedia&&(e.getUserMedia=(function(s,o,a){e.mediaDevices.getUserMedia(s).then(o,a)}).bind(e))}function qte(t){return t&&t.video!==void 0?Object.assign({},t,{video:Ute.compactObject(t.video)}):t}function GFe(t){if(t.RTCPeerConnection){var e=t.RTCPeerConnection;t.RTCPeerConnection=function(n,i){if(n&&n.iceServers){for(var s=[],o=0;o{throw TypeError(t)},zte=(t,e,r)=>e.has(t)||Vte("Cannot "+r),QFe=(t,e,r)=>(zte(t,e,"read from private field"),r?r.call(t):e.get(t)),JFe=(t,e,r)=>e.has(t)?Vte("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,r),ZFe=(t,e,r,n)=>(zte(t,e,"write to private field"),e.set(t,r),r);const L$=["Aztec","Codabar","Code128","Code39","Code93","DataBar","DataBarExpanded","DataBarLimited","DataMatrix","DXFilmEdge","EAN-13","EAN-8","ITF","Linear-Codes","Matrix-Codes","MaxiCode","MicroQRCode","None","PDF417","QRCode","rMQRCode","UPC-A","UPC-E"];function XFe(t){return t.join("|")}function eje(t){const e=F$(t);let r=0,n=L$.length-1;for(;r<=n;){const i=Math.floor((r+n)/2),s=L$[i],o=F$(s);if(o===e)return s;o{const r=t.match(/_(.+?)\.wasm$/);return r?`https://fastly.jsdelivr.net/npm/zxing-wasm@1.3.4/dist/${r[1]}/${t}`:e+t}};let j$=new WeakMap;function XM(t,e){var r;const n=j$.get(t);if(n!=null&&n.modulePromise&&e===void 0)return n.modulePromise;const i=(r=n==null?void 0:n.moduleOverrides)!=null?r:aje,s=t({...i});return j$.set(t,{moduleOverrides:i,modulePromise:s}),s}async function cje(t,e,r=dy){const n={...dy,...r},i=await XM(t),{size:s}=e,o=new Uint8Array(await e.arrayBuffer()),a=i._malloc(s);i.HEAPU8.set(o,a);const c=i.readBarcodesFromImage(a,s,Hte(i,n));i._free(a);const l=[];for(let f=0;f{var t,e=typeof document<"u"&&((t=document.currentScript)==null?void 0:t.tagName.toUpperCase())==="SCRIPT"?document.currentScript.src:void 0;return function(r={}){var n,i=r,s,o,a=new Promise((q,V)=>{s=q,o=V}),c=typeof window=="object",l=typeof Bun<"u",f=typeof importScripts=="function";typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string"&&process.type!="renderer";var u=Object.assign({},i),p="./this.program",g="";function y(q){return i.locateFile?i.locateFile(q,g):g+q}var b,I;if(c||f||l){var C;f?g=self.location.href:typeof document<"u"&&((C=document.currentScript)===null||C===void 0?void 0:C.tagName.toUpperCase())==="SCRIPT"&&(g=document.currentScript.src),e&&(g=e),g.startsWith("blob:")?g="":g=g.substr(0,g.replace(/[?#].*/,"").lastIndexOf("/")+1),f&&(I=q=>{var V=new XMLHttpRequest;return V.open("GET",q,!1),V.responseType="arraybuffer",V.send(null),new Uint8Array(V.response)}),b=q=>fetch(q,{credentials:"same-origin"}).then(V=>V.ok?V.arrayBuffer():Promise.reject(new Error(V.status+" : "+V.url)))}var S=i.print||console.log.bind(console),R=i.printErr||console.error.bind(console);Object.assign(i,u),u=null,i.arguments&&i.arguments,i.thisProgram&&(p=i.thisProgram);var L=i.wasmBinary,F,H=!1,_,U,ie,ce,K,k,O,v;function m(){var q=F.buffer;i.HEAP8=_=new Int8Array(q),i.HEAP16=ie=new Int16Array(q),i.HEAPU8=U=new Uint8Array(q),i.HEAPU16=ce=new Uint16Array(q),i.HEAP32=K=new Int32Array(q),i.HEAPU32=k=new Uint32Array(q),i.HEAPF32=O=new Float32Array(q),i.HEAPF64=v=new Float64Array(q)}var M=[],B=[],E=[];function x(){var q=i.preRun;q&&(typeof q=="function"&&(q=[q]),q.forEach(P)),qe(M)}function w(){qe(B)}function T(){var q=i.postRun;q&&(typeof q=="function"&&(q=[q]),q.forEach(oe)),qe(E)}function P(q){M.unshift(q)}function z(q){B.unshift(q)}function oe(q){E.unshift(q)}var j=0,X=null;function G(q){var V;j++,(V=i.monitorRunDependencies)===null||V===void 0||V.call(i,j)}function Z(q){var V;if(j--,(V=i.monitorRunDependencies)===null||V===void 0||V.call(i,j),j==0&&X){var te=X;X=null,te()}}function re(q){var V;(V=i.onAbort)===null||V===void 0||V.call(i,q),q="Aborted("+q+")",R(q),H=!0,q+=". Build with -sASSERTIONS for more info.";var te=new WebAssembly.RuntimeError(q);throw o(te),te}var D="data:application/octet-stream;base64,",ee=q=>q.startsWith(D);function fe(){var q="zxing_reader.wasm";return ee(q)?q:y(q)}var Ee;function _e(q){if(q==Ee&&L)return new Uint8Array(L);if(I)return I(q);throw"both async and sync fetching of the wasm failed"}function Me(q){return L?Promise.resolve().then(()=>_e(q)):b(q).then(V=>new Uint8Array(V),()=>_e(q))}function Ze(q,V,te){return Me(q).then(ae=>WebAssembly.instantiate(ae,V)).then(te,ae=>{R(`failed to asynchronously prepare wasm: ${ae}`),re(ae)})}function ze(q,V,te,ae){return!q&&typeof WebAssembly.instantiateStreaming=="function"&&!ee(V)&&typeof fetch=="function"?fetch(V,{credentials:"same-origin"}).then(ve=>{var me=WebAssembly.instantiateStreaming(ve,te);return me.then(ae,function(Se){return R(`wasm streaming compile failed: ${Se}`),R("falling back to ArrayBuffer instantiation"),Ze(V,te,ae)})}):Ze(V,te,ae)}function et(){return{a:WE}}function Re(){var q,V=et();function te(ve,me){return Kr=ve.exports,F=Kr.za,m(),c1=Kr.Da,z(Kr.Aa),Z(),Kr}G();function ae(ve){te(ve.instance)}if(i.instantiateWasm)try{return i.instantiateWasm(V,te)}catch(ve){R(`Module.instantiateWasm callback failed with error: ${ve}`),o(ve)}return(q=Ee)!==null&&q!==void 0||(Ee=fe()),ze(L,Ee,V,ae).catch(o),{}}var qe=q=>{q.forEach(V=>V(i))};i.noExitRuntime;var Te=q=>e2(q),De=()=>t2(),Je=[],Ge=0,tt=q=>{var V=new it(q);return V.get_caught()||(V.set_caught(!0),Ge--),V.set_rethrown(!1),Je.push(V),df(q),Zy(q)},rt=0,We=()=>{nr(0,0);var q=Je.pop();r2(q.excPtr),rt=0};class it{constructor(V){this.excPtr=V,this.ptr=V-24}set_type(V){k[this.ptr+4>>2]=V}get_type(){return k[this.ptr+4>>2]}set_destructor(V){k[this.ptr+8>>2]=V}get_destructor(){return k[this.ptr+8>>2]}set_caught(V){V=V?1:0,_[this.ptr+12]=V}get_caught(){return _[this.ptr+12]!=0}set_rethrown(V){V=V?1:0,_[this.ptr+13]=V}get_rethrown(){return _[this.ptr+13]!=0}init(V,te){this.set_adjusted_ptr(0),this.set_type(V),this.set_destructor(te)}set_adjusted_ptr(V){k[this.ptr+16>>2]=V}get_adjusted_ptr(){return k[this.ptr+16>>2]}}var pt=q=>{throw rt||(rt=q),rt},Ke=q=>Gh(q),vt=q=>{var V=rt;if(!V)return Ke(0),0;var te=new it(V);te.set_adjusted_ptr(V);var ae=te.get_type();if(!ae)return Ke(0),V;for(var ve of q){if(ve===0||ve===ae)break;var me=te.ptr+16;if(vo(ve,ae,me))return Ke(ve),V}return Ke(ae),V},bt=()=>vt([]),nt=q=>vt([q]),_t=(q,V)=>vt([q,V]),Ct=()=>{var q=Je.pop();q||re("no exception to throw");var V=q.excPtr;throw q.get_rethrown()||(Je.push(q),q.set_rethrown(!0),q.set_caught(!1),Ge++),rt=V,rt},It=(q,V,te)=>{var ae=new it(q);throw ae.init(V,te),rt=q,Ge++,rt},er=()=>Ge,ur=()=>{re("")},wt={},lr=q=>{for(;q.length;){var V=q.pop(),te=q.pop();te(V)}};function ir(q){return this.fromWireType(k[q>>2])}var Pt={},Ot={},Nt={},dt,Lt=q=>{throw new dt(q)},kt=(q,V,te)=>{q.forEach(Ae=>Nt[Ae]=V);function ae(Ae){var Ne=te(Ae);Ne.length!==q.length&&Lt("Mismatched type converter count");for(var Ye=0;Ye{Ot.hasOwnProperty(Ae)?ve[Ne]=Ot[Ae]:(me.push(Ae),Pt.hasOwnProperty(Ae)||(Pt[Ae]=[]),Pt[Ae].push(()=>{ve[Ne]=Ot[Ae],++Se,Se===me.length&&ae(ve)}))}),me.length===0&&ae(ve)},ut=q=>{var V=wt[q];delete wt[q];var te=V.rawConstructor,ae=V.rawDestructor,ve=V.fields,me=ve.map(Se=>Se.getterReturnType).concat(ve.map(Se=>Se.setterArgumentType));kt([q],me,Se=>{var Ae={};return ve.forEach((Ne,Ye)=>{var ot=Ne.fieldName,Ft=Se[Ye],wr=Ne.getter,Gt=Ne.getterContext,dr=Se[Ye+ve.length],Qn=Ne.setter,$n=Ne.setterContext;Ae[ot]={read:Mn=>Ft.fromWireType(wr(Gt,Mn)),write:(Mn,hf)=>{var gi=[];Qn($n,Mn,dr.toWireType(gi,hf)),lr(gi)}}}),[{name:V.name,fromWireType:Ne=>{var Ye={};for(var ot in Ae)Ye[ot]=Ae[ot].read(Ne);return ae(Ne),Ye},toWireType:(Ne,Ye)=>{for(var ot in Ae)if(!(ot in Ye))throw new TypeError(`Missing field: "${ot}"`);var Ft=te();for(ot in Ae)Ae[ot].write(Ft,Ye[ot]);return Ne!==null&&Ne.push(ae,Ft),Ft},argPackAdvance:lt,readValueFromPointer:ir,destructorFunction:ae}]})},Vt=(q,V,te,ae,ve)=>{},zt=()=>{for(var q=new Array(256),V=0;V<256;++V)q[V]=String.fromCharCode(V);ht=q},ht,xt=q=>{for(var V="",te=q;U[te];)V+=ht[U[te++]];return V},Dt,He=q=>{throw new Dt(q)};function $t(q,V){let te=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};var ae=V.name;if(q||He(`type "${ae}" must have a positive integer typeid pointer`),Ot.hasOwnProperty(q)){if(te.ignoreDuplicateRegistrations)return;He(`Cannot register type '${ae}' twice`)}if(Ot[q]=V,delete Nt[q],Pt.hasOwnProperty(q)){var ve=Pt[q];delete Pt[q],ve.forEach(me=>me())}}function Et(q,V){let te=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return $t(q,V,te)}var lt=8,Ht=(q,V,te,ae)=>{V=xt(V),Et(q,{name:V,fromWireType:function(ve){return!!ve},toWireType:function(ve,me){return me?te:ae},argPackAdvance:lt,readValueFromPointer:function(ve){return this.fromWireType(U[ve])},destructorFunction:null})},Nr=q=>({count:q.count,deleteScheduled:q.deleteScheduled,preservePointerOnDelete:q.preservePointerOnDelete,ptr:q.ptr,ptrType:q.ptrType,smartPtr:q.smartPtr,smartPtrType:q.smartPtrType}),Ut=q=>{function V(te){return te.$$.ptrType.registeredClass.name}He(V(q)+" instance already deleted")},Ir=!1,tr=q=>{},Mr=q=>{q.smartPtr?q.smartPtrType.rawDestructor(q.smartPtr):q.ptrType.registeredClass.rawDestructor(q.ptr)},hi=q=>{q.count.value-=1;var V=q.count.value===0;V&&Mr(q)},pi=(q,V,te)=>{if(V===te)return q;if(te.baseClass===void 0)return null;var ae=pi(q,V,te.baseClass);return ae===null?null:te.downcast(ae)},vi={},Ci={},_n=(q,V)=>{for(V===void 0&&He("ptr should not be undefined");q.baseClass;)V=q.upcast(V),q=q.baseClass;return V},us=(q,V)=>(V=_n(q,V),Ci[V]),ds=(q,V)=>{(!V.ptrType||!V.ptr)&&Lt("makeClassHandle requires ptr and ptrType");var te=!!V.smartPtrType,ae=!!V.smartPtr;return te!==ae&&Lt("Both smartPtrType and smartPtr must be specified"),V.count={value:1},Vi(Object.create(q,{$$:{value:V,writable:!0}}))};function hs(q){var V=this.getPointee(q);if(!V)return this.destructor(q),null;var te=us(this.registeredClass,V);if(te!==void 0){if(te.$$.count.value===0)return te.$$.ptr=V,te.$$.smartPtr=q,te.clone();var ae=te.clone();return this.destructor(q),ae}function ve(){return this.isSmartPointer?ds(this.registeredClass.instancePrototype,{ptrType:this.pointeeType,ptr:V,smartPtrType:this,smartPtr:q}):ds(this.registeredClass.instancePrototype,{ptrType:this,ptr:q})}var me=this.registeredClass.getActualType(V),Se=vi[me];if(!Se)return ve.call(this);var Ae;this.isConst?Ae=Se.constPointerType:Ae=Se.pointerType;var Ne=pi(V,this.registeredClass,Ae.registeredClass);return Ne===null?ve.call(this):this.isSmartPointer?ds(Ae.registeredClass.instancePrototype,{ptrType:Ae,ptr:Ne,smartPtrType:this,smartPtr:q}):ds(Ae.registeredClass.instancePrototype,{ptrType:Ae,ptr:Ne})}var Vi=q=>typeof FinalizationRegistry>"u"?(Vi=V=>V,q):(Ir=new FinalizationRegistry(V=>{hi(V.$$)}),Vi=V=>{var te=V.$$,ae=!!te.smartPtr;if(ae){var ve={$$:te};Ir.register(V,ve,V)}return V},tr=V=>Ir.unregister(V),Vi(q)),ps=[],vs=()=>{for(;ps.length;){var q=ps.pop();q.$$.deleteScheduled=!1,q.delete()}},Us,fo=()=>{Object.assign(In.prototype,{isAliasOf(q){if(!(this instanceof In)||!(q instanceof In))return!1;var V=this.$$.ptrType.registeredClass,te=this.$$.ptr;q.$$=q.$$;for(var ae=q.$$.ptrType.registeredClass,ve=q.$$.ptr;V.baseClass;)te=V.upcast(te),V=V.baseClass;for(;ae.baseClass;)ve=ae.upcast(ve),ae=ae.baseClass;return V===ae&&te===ve},clone(){if(this.$$.ptr||Ut(this),this.$$.preservePointerOnDelete)return this.$$.count.value+=1,this;var q=Vi(Object.create(Object.getPrototypeOf(this),{$$:{value:Nr(this.$$)}}));return q.$$.count.value+=1,q.$$.deleteScheduled=!1,q},delete(){this.$$.ptr||Ut(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&He("Object already scheduled for deletion"),tr(this),hi(this.$$),this.$$.preservePointerOnDelete||(this.$$.smartPtr=void 0,this.$$.ptr=void 0)},isDeleted(){return!this.$$.ptr},deleteLater(){return this.$$.ptr||Ut(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&He("Object already scheduled for deletion"),ps.push(this),ps.length===1&&Us&&Us(vs),this.$$.deleteScheduled=!0,this}})};function In(){}var zi=(q,V)=>Object.defineProperty(V,"name",{value:q}),uo=(q,V,te)=>{if(q[V].overloadTable===void 0){var ae=q[V];q[V]=function(){for(var ve=arguments.length,me=new Array(ve),Se=0;Se{i.hasOwnProperty(q)?((te===void 0||i[q].overloadTable!==void 0&&i[q].overloadTable[te]!==void 0)&&He(`Cannot register public name '${q}' twice`),uo(i,q,q),i.hasOwnProperty(te)&&He(`Cannot register multiple overloads of a function with the same number of arguments (${te})!`),i[q].overloadTable[te]=V):(i[q]=V,te!==void 0&&(i[q].numArguments=te))},rf=48,Zc=57,s1=q=>{q=q.replace(/[^a-zA-Z0-9_]/g,"$");var V=q.charCodeAt(0);return V>=rf&&V<=Zc?`_${q}`:q};function nf(q,V,te,ae,ve,me,Se,Ae){this.name=q,this.constructor=V,this.instancePrototype=te,this.rawDestructor=ae,this.baseClass=ve,this.getActualType=me,this.upcast=Se,this.downcast=Ae,this.pureVirtualFunctions=[]}var sf=(q,V,te)=>{for(;V!==te;)V.upcast||He(`Expected null or instance of ${te.name}, got an instance of ${V.name}`),q=V.upcast(q),V=V.baseClass;return q};function of(q,V){if(V===null)return this.isReference&&He(`null is not a valid ${this.name}`),0;V.$$||He(`Cannot pass "${le(V)}" as a ${this.name}`),V.$$.ptr||He(`Cannot pass deleted object as a pointer of type ${this.name}`);var te=V.$$.ptrType.registeredClass,ae=sf(V.$$.ptr,te,this.registeredClass);return ae}function Bh(q,V){var te;if(V===null)return this.isReference&&He(`null is not a valid ${this.name}`),this.isSmartPointer?(te=this.rawConstructor(),q!==null&&q.push(this.rawDestructor,te),te):0;(!V||!V.$$)&&He(`Cannot pass "${le(V)}" as a ${this.name}`),V.$$.ptr||He(`Cannot pass deleted object as a pointer of type ${this.name}`),!this.isConst&&V.$$.ptrType.isConst&&He(`Cannot convert argument of type ${V.$$.smartPtrType?V.$$.smartPtrType.name:V.$$.ptrType.name} to parameter type ${this.name}`);var ae=V.$$.ptrType.registeredClass;if(te=sf(V.$$.ptr,ae,this.registeredClass),this.isSmartPointer)switch(V.$$.smartPtr===void 0&&He("Passing raw pointer to smart pointer is illegal"),this.sharingPolicy){case 0:V.$$.smartPtrType===this?te=V.$$.smartPtr:He(`Cannot convert argument of type ${V.$$.smartPtrType?V.$$.smartPtrType.name:V.$$.ptrType.name} to parameter type ${this.name}`);break;case 1:te=V.$$.smartPtr;break;case 2:if(V.$$.smartPtrType===this)te=V.$$.smartPtr;else{var ve=V.clone();te=this.rawShare(te,ho.toHandle(()=>ve.delete())),q!==null&&q.push(this.rawDestructor,te)}break;default:He("Unsupporting sharing policy")}return te}function af(q,V){if(V===null)return this.isReference&&He(`null is not a valid ${this.name}`),0;V.$$||He(`Cannot pass "${le(V)}" as a ${this.name}`),V.$$.ptr||He(`Cannot pass deleted object as a pointer of type ${this.name}`),V.$$.ptrType.isConst&&He(`Cannot convert argument of type ${V.$$.ptrType.name} to parameter type ${this.name}`);var te=V.$$.ptrType.registeredClass,ae=sf(V.$$.ptr,te,this.registeredClass);return ae}var o1=()=>{Object.assign(Bu.prototype,{getPointee(q){return this.rawGetPointee&&(q=this.rawGetPointee(q)),q},destructor(q){var V;(V=this.rawDestructor)===null||V===void 0||V.call(this,q)},argPackAdvance:lt,readValueFromPointer:ir,fromWireType:hs})};function Bu(q,V,te,ae,ve,me,Se,Ae,Ne,Ye,ot){this.name=q,this.registeredClass=V,this.isReference=te,this.isConst=ae,this.isSmartPointer=ve,this.pointeeType=me,this.sharingPolicy=Se,this.rawGetPointee=Ae,this.rawConstructor=Ne,this.rawShare=Ye,this.rawDestructor=ot,!ve&&V.baseClass===void 0?ae?(this.toWireType=of,this.destructorFunction=null):(this.toWireType=af,this.destructorFunction=null):this.toWireType=Bh}var Lh=(q,V,te)=>{i.hasOwnProperty(q)||Lt("Replacing nonexistent public symbol"),i[q].overloadTable!==void 0&&te!==void 0?i[q].overloadTable[te]=V:(i[q]=V,i[q].argCount=te)},a1=(q,V,te)=>{q=q.replace(/p/g,"i");var ae=i["dynCall_"+q];return ae(V,...te)},dc=[],c1,yr=q=>{var V=dc[q];return V||(q>=dc.length&&(dc.length=q+1),dc[q]=V=c1.get(q)),V},Lu=function(q,V){let te=arguments.length>2&&arguments[2]!==void 0?arguments[2]:[];if(q.includes("j"))return a1(q,V,te);var ae=yr(V)(...te);return ae},Xc=(q,V)=>function(){for(var te=arguments.length,ae=new Array(te),ve=0;ve{q=xt(q);function te(){return q.includes("j")?Xc(q,V):yr(V)}var ae=te();return typeof ae!="function"&&He(`unknown function pointer with signature ${q}: ${V}`),ae},l1=(q,V)=>{var te=zi(V,function(ae){this.name=V,this.message=ae;var ve=new Error(ae).stack;ve!==void 0&&(this.stack=this.toString()+` -`+ve.replace(/^Error(:[^\n]*)?\n/,""))});return te.prototype=Object.create(q.prototype),te.prototype.constructor=te,te.prototype.toString=function(){return this.message===void 0?this.name:`${this.name}: ${this.message}`},te},Fh,Uo=q=>{var V=Xx(q),te=xt(V);return pc(V),te},cf=(q,V)=>{var te=[],ae={};function ve(me){if(!ae[me]&&!Ot[me]){if(Nt[me]){Nt[me].forEach(ve);return}te.push(me),ae[me]=!0}}throw V.forEach(ve),new Fh(`${q}: `+te.map(Uo).join([", "]))},f1=(q,V,te,ae,ve,me,Se,Ae,Ne,Ye,ot,Ft,wr)=>{ot=xt(ot),me=xn(ve,me),Ae&&(Ae=xn(Se,Ae)),Ye&&(Ye=xn(Ne,Ye)),wr=xn(Ft,wr);var Gt=s1(ot);$s(Gt,function(){cf(`Cannot construct ${ot} due to unbound types`,[ae])}),kt([q,V,te],ae?[ae]:[],dr=>{dr=dr[0];var Qn,$n;ae?(Qn=dr.registeredClass,$n=Qn.instancePrototype):$n=In.prototype;var Mn=zi(ot,function(){if(Object.getPrototypeOf(this)!==hf)throw new Dt("Use 'new' to construct "+ot);if(gi.constructor_body===void 0)throw new Dt(ot+" has no accessible constructor");for(var Yh=arguments.length,vc=new Array(Yh),A1=0;A1{for(var te=[],ae=0;ae>2]);return te};function u1(q){for(var V=1;V{var Se=Fu(V,te);ve=xn(ae,ve),kt([],[q],Ae=>{Ae=Ae[0];var Ne=`constructor ${Ae.name}`;if(Ae.registeredClass.constructor_body===void 0&&(Ae.registeredClass.constructor_body=[]),Ae.registeredClass.constructor_body[V-1]!==void 0)throw new Dt(`Cannot register multiple constructors with identical number of parameters (${V-1}) for class '${Ae.name}'! Overload resolution is currently only performed using the parameter count, not actual type info!`);return Ae.registeredClass.constructor_body[V-1]=()=>{cf(`Cannot construct ${Ae.name} due to unbound types`,Se)},kt([],Se,Ye=>(Ye.splice(1,0,null),Ae.registeredClass.constructor_body[V-1]=jh(Ne,Ye,null,ve,me),[])),[]})},Uh=q=>{q=q.trim();const V=q.indexOf("(");return V!==-1?q.substr(0,V):q},d1=(q,V,te,ae,ve,me,Se,Ae,Ne,Ye)=>{var ot=Fu(te,ae);V=xt(V),V=Uh(V),me=xn(ve,me),kt([],[q],Ft=>{Ft=Ft[0];var wr=`${Ft.name}.${V}`;V.startsWith("@@")&&(V=Symbol[V.substring(2)]),Ae&&Ft.registeredClass.pureVirtualFunctions.push(V);function Gt(){cf(`Cannot call ${wr} due to unbound types`,ot)}var dr=Ft.registeredClass.instancePrototype,Qn=dr[V];return Qn===void 0||Qn.overloadTable===void 0&&Qn.className!==Ft.name&&Qn.argCount===te-2?(Gt.argCount=te-2,Gt.className=Ft.name,dr[V]=Gt):(uo(dr,V,wr),dr[V].overloadTable[te-2]=Gt),kt([],ot,$n=>{var Mn=jh(wr,$n,Ft,me,Se);return dr[V].overloadTable===void 0?(Mn.argCount=te-2,dr[V]=Mn):dr[V].overloadTable[te-2]=Mn,[]}),[]})},el=[],$o=[],lf=q=>{q>9&&--$o[q+1]===0&&($o[q]=void 0,el.push(q))},zy=()=>$o.length/2-5-el.length,ju=()=>{$o.push(0,1,void 0,1,null,1,!0,1,!1,1),i.count_emval_handles=zy},ho={toValue:q=>(q||He("Cannot use deleted val. handle = "+q),$o[q]),toHandle:q=>{switch(q){case void 0:return 2;case null:return 4;case!0:return 6;case!1:return 8;default:{const V=el.pop()||$o.length;return $o[V]=q,$o[V+1]=1,V}}}},$h={name:"emscripten::val",fromWireType:q=>{var V=ho.toValue(q);return lf(q),V},toWireType:(q,V)=>ho.toHandle(V),argPackAdvance:lt,readValueFromPointer:ir,destructorFunction:null},ff=q=>Et(q,$h),h1=(q,V,te)=>{switch(V){case 1:return te?function(ae){return this.fromWireType(_[ae])}:function(ae){return this.fromWireType(U[ae])};case 2:return te?function(ae){return this.fromWireType(ie[ae>>1])}:function(ae){return this.fromWireType(ce[ae>>1])};case 4:return te?function(ae){return this.fromWireType(K[ae>>2])}:function(ae){return this.fromWireType(k[ae>>2])};default:throw new TypeError(`invalid integer width (${V}): ${q}`)}},Hy=(q,V,te,ae)=>{V=xt(V);function ve(){}ve.values={},Et(q,{name:V,constructor:ve,fromWireType:function(me){return this.constructor.values[me]},toWireType:(me,Se)=>Se.value,argPackAdvance:lt,readValueFromPointer:h1(V,te,ae),destructorFunction:null}),$s(V,ve)},zr=(q,V)=>{var te=Ot[q];return te===void 0&&He(`${V} has unknown type ${Uo(q)}`),te},Wr=(q,V,te)=>{var ae=zr(q,"enum");V=xt(V);var ve=ae.constructor,me=Object.create(ae.constructor.prototype,{value:{value:te},constructor:{value:zi(`${ae.name}_${V}`,function(){})}});ve.values[te]=me,ve[V]=me},le=q=>{if(q===null)return"null";var V=typeof q;return V==="object"||V==="array"||V==="function"?q.toString():""+q},xe=(q,V)=>{switch(V){case 4:return function(te){return this.fromWireType(O[te>>2])};case 8:return function(te){return this.fromWireType(v[te>>3])};default:throw new TypeError(`invalid float width (${V}): ${q}`)}},$e=(q,V,te)=>{V=xt(V),Et(q,{name:V,fromWireType:ae=>ae,toWireType:(ae,ve)=>ve,argPackAdvance:lt,readValueFromPointer:xe(V,te),destructorFunction:null})},gt=(q,V,te,ae,ve,me,Se,Ae)=>{var Ne=Fu(V,te);q=xt(q),q=Uh(q),ve=xn(ae,ve),$s(q,function(){cf(`Cannot call ${q} due to unbound types`,Ne)},V-1),kt([],Ne,Ye=>{var ot=[Ye[0],null].concat(Ye.slice(1));return Lh(q,jh(q,ot,null,ve,me),V-1),[]})},tn=(q,V,te)=>{switch(V){case 1:return te?ae=>_[ae]:ae=>U[ae];case 2:return te?ae=>ie[ae>>1]:ae=>ce[ae>>1];case 4:return te?ae=>K[ae>>2]:ae=>k[ae>>2];default:throw new TypeError(`invalid integer width (${V}): ${q}`)}},rr=(q,V,te,ae,ve)=>{V=xt(V);var me=ot=>ot;if(ae===0){var Se=32-8*te;me=ot=>ot<>>Se}var Ae=V.includes("unsigned"),Ne=(ot,Ft)=>{},Ye;Ae?Ye=function(ot,Ft){return Ne(Ft,this.name),Ft>>>0}:Ye=function(ot,Ft){return Ne(Ft,this.name),Ft},Et(q,{name:V,fromWireType:me,toWireType:Ye,argPackAdvance:lt,readValueFromPointer:tn(V,te,ae!==0),destructorFunction:null})},pn=(q,V,te)=>{var ae=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array],ve=ae[V];function me(Se){var Ae=k[Se>>2],Ne=k[Se+4>>2];return new ve(_.buffer,Ne,Ae)}te=xt(te),Et(q,{name:te,fromWireType:me,argPackAdvance:lt,readValueFromPointer:me},{ignoreDuplicateRegistrations:!0})},Un=Object.assign({optional:!0},$h),Er=(q,V)=>{Et(q,Un)},rn=(q,V,te,ae)=>{if(!(ae>0))return 0;for(var ve=te,me=te+ae-1,Se=0;Se=55296&&Ae<=57343){var Ne=q.charCodeAt(++Se);Ae=65536+((Ae&1023)<<10)|Ne&1023}if(Ae<=127){if(te>=me)break;V[te++]=Ae}else if(Ae<=2047){if(te+1>=me)break;V[te++]=192|Ae>>6,V[te++]=128|Ae&63}else if(Ae<=65535){if(te+2>=me)break;V[te++]=224|Ae>>12,V[te++]=128|Ae>>6&63,V[te++]=128|Ae&63}else{if(te+3>=me)break;V[te++]=240|Ae>>18,V[te++]=128|Ae>>12&63,V[te++]=128|Ae>>6&63,V[te++]=128|Ae&63}}return V[te]=0,te-ve},vn=(q,V,te)=>rn(q,U,V,te),gs=q=>{for(var V=0,te=0;te=55296&&ae<=57343?(V+=4,++te):V+=3}return V},kn=typeof TextDecoder<"u"?new TextDecoder:void 0,fn=function(q){let V=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,te=arguments.length>2&&arguments[2]!==void 0?arguments[2]:NaN;for(var ae=V+te,ve=V;q[ve]&&!(ve>=ae);)++ve;if(ve-V>16&&q.buffer&&kn)return kn.decode(q.subarray(V,ve));for(var me="";V>10,56320|Ye&1023)}}return me},Hi=(q,V)=>q?fn(U,q,V):"",qo=(q,V)=>{V=xt(V);var te=V==="std::string";Et(q,{name:V,fromWireType(ae){var ve=k[ae>>2],me=ae+4,Se;if(te)for(var Ae=me,Ne=0;Ne<=ve;++Ne){var Ye=me+Ne;if(Ne==ve||U[Ye]==0){var ot=Ye-Ae,Ft=Hi(Ae,ot);Se===void 0?Se=Ft:(Se+="\0",Se+=Ft),Ae=Ye+1}}else{for(var wr=new Array(ve),Ne=0;Ne>2]=me,te&&Se)vn(ve,Ne,me+1);else if(Se)for(var Ye=0;Ye255&&(pc(Ne),He("String has UTF-16 code units that do not fit in 8 bits")),U[Ne+Ye]=ot}else for(var Ye=0;Ye{for(var te=q,ae=te>>1,ve=ae+V/2;!(ae>=ve)&&ce[ae];)++ae;if(te=ae<<1,te-q>32&&qs)return qs.decode(U.subarray(q,te));for(var me="",Se=0;!(Se>=V/2);++Se){var Ae=ie[q+Se*2>>1];if(Ae==0)break;me+=String.fromCharCode(Ae)}return me},qh=(q,V,te)=>{var ae;if((ae=te)!==null&&ae!==void 0||(te=2147483647),te<2)return 0;te-=2;for(var ve=V,me=te>1]=Ae,V+=2}return ie[V>>1]=0,V-ve},uf=q=>q.length*2,li=(q,V)=>{for(var te=0,ae="";!(te>=V/4);){var ve=K[q+te*4>>2];if(ve==0)break;if(++te,ve>=65536){var me=ve-65536;ae+=String.fromCharCode(55296|me>>10,56320|me&1023)}else ae+=String.fromCharCode(ve)}return ae},NE=(q,V,te)=>{var ae;if((ae=te)!==null&&ae!==void 0||(te=2147483647),te<4)return 0;for(var ve=V,me=ve+te-4,Se=0;Se=55296&&Ae<=57343){var Ne=q.charCodeAt(++Se);Ae=65536+((Ae&1023)<<10)|Ne&1023}if(K[V>>2]=Ae,V+=4,V+4>me)break}return K[V>>2]=0,V-ve},po=q=>{for(var V=0,te=0;te=55296&&ae<=57343&&++te,V+=4}return V},DE=(q,V,te)=>{te=xt(te);var ae,ve,me,Se;V===2?(ae=wa,ve=qh,Se=uf,me=Ae=>ce[Ae>>1]):V===4&&(ae=li,ve=NE,Se=po,me=Ae=>k[Ae>>2]),Et(q,{name:te,fromWireType:Ae=>{for(var Ne=k[Ae>>2],Ye,ot=Ae+4,Ft=0;Ft<=Ne;++Ft){var wr=Ae+4+Ft*V;if(Ft==Ne||me(wr)==0){var Gt=wr-ot,dr=ae(ot,Gt);Ye===void 0?Ye=dr:(Ye+="\0",Ye+=dr),ot=wr+V}}return pc(Ae),Ye},toWireType:(Ae,Ne)=>{typeof Ne!="string"&&He(`Cannot pass non-string to C++ string type ${te}`);var Ye=Se(Ne),ot=Hh(4+Ye+V);return k[ot>>2]=Ye/V,ve(Ne,ot+4,Ye+V),Ae!==null&&Ae.push(pc,ot),ot},argPackAdvance:lt,readValueFromPointer:ir,destructorFunction(Ae){pc(Ae)}})},Gx=(q,V,te,ae,ve,me)=>{wt[q]={name:xt(V),rawConstructor:xn(te,ae),rawDestructor:xn(ve,me),fields:[]}},tl=(q,V,te,ae,ve,me,Se,Ae,Ne,Ye)=>{wt[q].fields.push({fieldName:xt(V),getterReturnType:te,getter:xn(ae,ve),getterContext:me,setterArgumentType:Se,setter:xn(Ae,Ne),setterContext:Ye})},p1=(q,V)=>{V=xt(V),Et(q,{isVoid:!0,name:V,argPackAdvance:0,fromWireType:()=>{},toWireType:(te,ae)=>{}})},Gy=(q,V,te)=>U.copyWithin(q,V,V+te),un=[],rl=(q,V,te,ae)=>(q=un[q],V=ho.toValue(V),q(null,V,te,ae)),Wy={},BE=q=>{var V=Wy[q];return V===void 0?xt(q):V},v1=()=>{if(typeof globalThis=="object")return globalThis;function q(V){V.$$$embind_global$$$=V;var te=typeof $$$embind_global$$$=="object"&&V.$$$embind_global$$$==V;return te||delete V.$$$embind_global$$$,te}if(typeof $$$embind_global$$$=="object"||(typeof global=="object"&&q(global)?$$$embind_global$$$=global:typeof self=="object"&&q(self)&&($$$embind_global$$$=self),typeof $$$embind_global$$$=="object"))return $$$embind_global$$$;throw Error("unable to get global object.")},LE=q=>q===0?ho.toHandle(v1()):(q=BE(q),ho.toHandle(v1()[q])),FE=q=>{var V=un.length;return un.push(q),V},jE=(q,V)=>{for(var te=new Array(q),ae=0;ae>2],"parameter "+ae);return te},Wx=Reflect.construct,g1=(q,V,te)=>{var ae=[],ve=q.toWireType(ae,te);return ae.length&&(k[V>>2]=ho.toHandle(ae)),ve},Uu=(q,V,te)=>{var ae=jE(q,V),ve=ae.shift();q--;var me=new Array(q),Se=(Ne,Ye,ot,Ft)=>{for(var wr=0,Gt=0;GtNe.name).join(", ")}) => ${ve.name}>`;return FE(zi(Ae,Se))},UE=q=>{q>9&&($o[q+1]+=1)},Kx=q=>{var V=ho.toValue(q);lr(V),lf(q)},Yx=(q,V)=>{q=zr(q,"_emval_take_value");var te=q.readValueFromPointer(V);return ho.toHandle(te)},Ky=(q,V,te,ae)=>{var ve=new Date().getFullYear(),me=new Date(ve,0,1),Se=new Date(ve,6,1),Ae=me.getTimezoneOffset(),Ne=Se.getTimezoneOffset(),Ye=Math.max(Ae,Ne);k[q>>2]=Ye*60,K[V>>2]=+(Ae!=Ne);var ot=Gt=>{var dr=Gt>=0?"-":"+",Qn=Math.abs(Gt),$n=String(Math.floor(Qn/60)).padStart(2,"0"),Mn=String(Qn%60).padStart(2,"0");return`UTC${dr}${$n}${Mn}`},Ft=ot(Ae),wr=ot(Ne);Ne2147483648,Qx=(q,V)=>Math.ceil(q/V)*V,$E=q=>{var V=F.buffer,te=(q-V.byteLength+65535)/65536|0;try{return F.grow(te),m(),1}catch{}},Qy=q=>{var V=U.length;q>>>=0;var te=Yy();if(q>te)return!1;for(var ae=1;ae<=4;ae*=2){var ve=V*(1+.2/ae);ve=Math.min(ve,q+100663296);var me=Math.min(te,Qx(Math.max(q,ve),65536)),Se=$E(me);if(Se)return!0}return!1},Vh={},qE=()=>p||"./this.program",$u=()=>{if(!$u.strings){var q=(typeof navigator=="object"&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",V={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:q,_:qE()};for(var te in Vh)Vh[te]===void 0?delete V[te]:V[te]=Vh[te];var ae=[];for(var te in V)ae.push(`${te}=${V[te]}`);$u.strings=ae}return $u.strings},Vs=(q,V)=>{for(var te=0;te{var te=0;return $u().forEach((ae,ve)=>{var me=V+te;k[q+ve*4>>2]=me,Vs(ae,me),te+=ae.length+1}),0},zh=(q,V)=>{var te=$u();k[q>>2]=te.length;var ae=0;return te.forEach(ve=>ae+=ve.length+1),k[V>>2]=ae,0},Jx=q=>52;function Zx(q,V,te,ae,ve){return 70}var VE=[null,[],[]],zE=(q,V)=>{var te=VE[q];V===0||V===10?((q===1?S:R)(fn(te)),te.length=0):te.push(V)},HE=(q,V,te,ae)=>{for(var ve=0,me=0;me>2],Ae=k[V+4>>2];V+=8;for(var Ne=0;Ne>2]=ve,0},GE=q=>q;dt=i.InternalError=class extends Error{constructor(q){super(q),this.name="InternalError"}},zt(),Dt=i.BindingError=class extends Error{constructor(q){super(q),this.name="BindingError"}},fo(),o1(),Fh=i.UnboundTypeError=l1(Error,"UnboundTypeError"),ju();var WE={t:tt,x:We,a:bt,j:nt,k:_t,O:Ct,q:It,ga:er,d:pt,ca:ur,va:ut,ba:Vt,pa:Ht,ta:f1,sa:hc,E:d1,oa:ff,F:Hy,n:Wr,W:$e,X:gt,y:rr,u:pn,ua:Er,V:qo,P:DE,L:Gx,wa:tl,qa:p1,ja:Gy,T:rl,xa:lf,ya:LE,U:Uu,Y:UE,Z:Kx,ra:Yx,da:Ky,ha:Qy,ea:Jy,fa:zh,ia:Jx,$:Zx,S:HE,J:b1,C:eC,Q:qu,R:nl,r:y1,b:KE,D:m1,la:w1,c:Oe,ka:tC,h:JE,i:Lr,s:Yn,N:Vu,w:em,I:nC,K:XE,z:i2,H:E1,aa:C1,_:o2,l:Pe,f:be,e:QE,g:YE,M:x1,m:Xt,ma:Hr,p:nn,v:ZE,na:go,B:rC,o:mt,G:s2,A:GE},Kr=Re(),Xx=q=>(Xx=Kr.Ba)(q),pc=i._free=q=>(pc=i._free=Kr.Ca)(q),Hh=i._malloc=q=>(Hh=i._malloc=Kr.Ea)(q),Zy=q=>(Zy=Kr.Fa)(q),nr=(q,V)=>(nr=Kr.Ga)(q,V),Gh=q=>(Gh=Kr.Ha)(q),e2=q=>(e2=Kr.Ia)(q),t2=()=>(t2=Kr.Ja)(),r2=q=>(r2=Kr.Ka)(q),df=q=>(df=Kr.La)(q),vo=(q,V,te)=>(vo=Kr.Ma)(q,V,te);i.dynCall_viijii=(q,V,te,ae,ve,me,Se)=>(i.dynCall_viijii=Kr.Na)(q,V,te,ae,ve,me,Se);var Xy=i.dynCall_jiii=(q,V,te,ae)=>(Xy=i.dynCall_jiii=Kr.Oa)(q,V,te,ae);i.dynCall_jiji=(q,V,te,ae,ve)=>(i.dynCall_jiji=Kr.Pa)(q,V,te,ae,ve);var n2=i.dynCall_jiiii=(q,V,te,ae,ve)=>(n2=i.dynCall_jiiii=Kr.Qa)(q,V,te,ae,ve);i.dynCall_iiiiij=(q,V,te,ae,ve,me,Se)=>(i.dynCall_iiiiij=Kr.Ra)(q,V,te,ae,ve,me,Se),i.dynCall_iiiiijj=(q,V,te,ae,ve,me,Se,Ae,Ne)=>(i.dynCall_iiiiijj=Kr.Sa)(q,V,te,ae,ve,me,Se,Ae,Ne),i.dynCall_iiiiiijj=(q,V,te,ae,ve,me,Se,Ae,Ne,Ye)=>(i.dynCall_iiiiiijj=Kr.Ta)(q,V,te,ae,ve,me,Se,Ae,Ne,Ye);function KE(q,V){var te=De();try{return yr(q)(V)}catch(ae){if(Te(te),ae!==ae+0)throw ae;nr(1,0)}}function YE(q,V,te,ae){var ve=De();try{yr(q)(V,te,ae)}catch(me){if(Te(ve),me!==me+0)throw me;nr(1,0)}}function QE(q,V,te){var ae=De();try{yr(q)(V,te)}catch(ve){if(Te(ae),ve!==ve+0)throw ve;nr(1,0)}}function JE(q,V,te,ae){var ve=De();try{return yr(q)(V,te,ae)}catch(me){if(Te(ve),me!==me+0)throw me;nr(1,0)}}function qu(q,V,te,ae,ve){var me=De();try{return yr(q)(V,te,ae,ve)}catch(Se){if(Te(me),Se!==Se+0)throw Se;nr(1,0)}}function be(q,V){var te=De();try{yr(q)(V)}catch(ae){if(Te(te),ae!==ae+0)throw ae;nr(1,0)}}function Oe(q,V,te){var ae=De();try{return yr(q)(V,te)}catch(ve){if(Te(ae),ve!==ve+0)throw ve;nr(1,0)}}function Pe(q){var V=De();try{yr(q)()}catch(te){if(Te(V),te!==te+0)throw te;nr(1,0)}}function mt(q,V,te,ae,ve,me,Se,Ae,Ne,Ye,ot){var Ft=De();try{yr(q)(V,te,ae,ve,me,Se,Ae,Ne,Ye,ot)}catch(wr){if(Te(Ft),wr!==wr+0)throw wr;nr(1,0)}}function Xt(q,V,te,ae,ve){var me=De();try{yr(q)(V,te,ae,ve)}catch(Se){if(Te(me),Se!==Se+0)throw Se;nr(1,0)}}function Lr(q,V,te,ae,ve){var me=De();try{return yr(q)(V,te,ae,ve)}catch(Se){if(Te(me),Se!==Se+0)throw Se;nr(1,0)}}function Yn(q,V,te,ae,ve,me){var Se=De();try{return yr(q)(V,te,ae,ve,me)}catch(Ae){if(Te(Se),Ae!==Ae+0)throw Ae;nr(1,0)}}function nn(q,V,te,ae,ve,me){var Se=De();try{yr(q)(V,te,ae,ve,me)}catch(Ae){if(Te(Se),Ae!==Ae+0)throw Ae;nr(1,0)}}function em(q,V,te,ae,ve,me,Se){var Ae=De();try{return yr(q)(V,te,ae,ve,me,Se)}catch(Ne){if(Te(Ae),Ne!==Ne+0)throw Ne;nr(1,0)}}function ZE(q,V,te,ae,ve,me,Se,Ae){var Ne=De();try{yr(q)(V,te,ae,ve,me,Se,Ae)}catch(Ye){if(Te(Ne),Ye!==Ye+0)throw Ye;nr(1,0)}}function go(q,V,te,ae,ve,me,Se,Ae,Ne){var Ye=De();try{yr(q)(V,te,ae,ve,me,Se,Ae,Ne)}catch(ot){if(Te(Ye),ot!==ot+0)throw ot;nr(1,0)}}function y1(q){var V=De();try{return yr(q)()}catch(te){if(Te(V),te!==te+0)throw te;nr(1,0)}}function XE(q,V,te,ae,ve,me,Se,Ae,Ne){var Ye=De();try{return yr(q)(V,te,ae,ve,me,Se,Ae,Ne)}catch(ot){if(Te(Ye),ot!==ot+0)throw ot;nr(1,0)}}function Vu(q,V,te,ae,ve,me,Se){var Ae=De();try{return yr(q)(V,te,ae,ve,me,Se)}catch(Ne){if(Te(Ae),Ne!==Ne+0)throw Ne;nr(1,0)}}function m1(q,V,te,ae){var ve=De();try{return yr(q)(V,te,ae)}catch(me){if(Te(ve),me!==me+0)throw me;nr(1,0)}}function b1(q,V,te,ae){var ve=De();try{return yr(q)(V,te,ae)}catch(me){if(Te(ve),me!==me+0)throw me;nr(1,0)}}function Hr(q,V,te,ae,ve,me,Se,Ae){var Ne=De();try{yr(q)(V,te,ae,ve,me,Se,Ae)}catch(Ye){if(Te(Ne),Ye!==Ye+0)throw Ye;nr(1,0)}}function eC(q,V,te,ae,ve,me){var Se=De();try{return yr(q)(V,te,ae,ve,me)}catch(Ae){if(Te(Se),Ae!==Ae+0)throw Ae;nr(1,0)}}function i2(q,V,te,ae,ve,me,Se,Ae,Ne,Ye){var ot=De();try{return yr(q)(V,te,ae,ve,me,Se,Ae,Ne,Ye)}catch(Ft){if(Te(ot),Ft!==Ft+0)throw Ft;nr(1,0)}}function w1(q,V,te){var ae=De();try{return yr(q)(V,te)}catch(ve){if(Te(ae),ve!==ve+0)throw ve;nr(1,0)}}function tC(q,V,te,ae,ve){var me=De();try{return yr(q)(V,te,ae,ve)}catch(Se){if(Te(me),Se!==Se+0)throw Se;nr(1,0)}}function rC(q,V,te,ae,ve,me,Se,Ae,Ne,Ye){var ot=De();try{yr(q)(V,te,ae,ve,me,Se,Ae,Ne,Ye)}catch(Ft){if(Te(ot),Ft!==Ft+0)throw Ft;nr(1,0)}}function nC(q,V,te,ae,ve,me,Se,Ae){var Ne=De();try{return yr(q)(V,te,ae,ve,me,Se,Ae)}catch(Ye){if(Te(Ne),Ye!==Ye+0)throw Ye;nr(1,0)}}function x1(q,V,te,ae,ve,me,Se){var Ae=De();try{yr(q)(V,te,ae,ve,me,Se)}catch(Ne){if(Te(Ae),Ne!==Ne+0)throw Ne;nr(1,0)}}function nl(q,V,te,ae){var ve=De();try{return yr(q)(V,te,ae)}catch(me){if(Te(ve),me!==me+0)throw me;nr(1,0)}}function E1(q,V,te,ae,ve,me,Se,Ae,Ne,Ye,ot,Ft){var wr=De();try{return yr(q)(V,te,ae,ve,me,Se,Ae,Ne,Ye,ot,Ft)}catch(Gt){if(Te(wr),Gt!==Gt+0)throw Gt;nr(1,0)}}function s2(q,V,te,ae,ve,me,Se,Ae,Ne,Ye,ot,Ft,wr,Gt,dr,Qn){var $n=De();try{yr(q)(V,te,ae,ve,me,Se,Ae,Ne,Ye,ot,Ft,wr,Gt,dr,Qn)}catch(Mn){if(Te($n),Mn!==Mn+0)throw Mn;nr(1,0)}}function C1(q,V,te,ae){var ve=De();try{return Xy(q,V,te,ae)}catch(me){if(Te(ve),me!==me+0)throw me;nr(1,0)}}function o2(q,V,te,ae,ve){var me=De();try{return n2(q,V,te,ae,ve)}catch(Se){if(Te(me),Se!==Se+0)throw Se;nr(1,0)}}var Wh,Kh;X=function q(){Wh||tm(),Wh||(X=q)};function tm(){if(j>0||!Kh&&(Kh=1,x(),j>0))return;function q(){var V;Wh||(Wh=1,i.calledRun=1,!H&&(w(),s(i),(V=i.onRuntimeInitialized)===null||V===void 0||V.call(i),T()))}i.setStatus?(i.setStatus("Running..."),setTimeout(()=>{setTimeout(()=>i.setStatus(""),1),q()},1)):q()}if(i.preInit)for(typeof i.preInit=="function"&&(i.preInit=[i.preInit]);i.preInit.length>0;)i.preInit.pop()();return tm(),n=a,n}})();function fje(t){return XM(eR,t)}async function uje(t,e){return cje(eR,t,e)}async function dje(t,e){return lje(eR,t,e)}const Wte=[["aztec","Aztec"],["code_128","Code128"],["code_39","Code39"],["code_93","Code93"],["codabar","Codabar"],["databar","DataBar"],["databar_expanded","DataBarExpanded"],["databar_limited","DataBarLimited"],["data_matrix","DataMatrix"],["dx_film_edge","DXFilmEdge"],["ean_13","EAN-13"],["ean_8","EAN-8"],["itf","ITF"],["maxi_code","MaxiCode"],["micro_qr_code","MicroQRCode"],["pdf417","PDF417"],["qr_code","QRCode"],["rm_qr_code","rMQRCode"],["upc_a","UPC-A"],["upc_e","UPC-E"],["linear_codes","Linear-Codes"],["matrix_codes","Matrix-Codes"]],hje=[...Wte,["unknown"]].map(t=>t[0]),II=new Map(Wte);function pje(t){for(const[e,r]of II)if(t===r)return e;return"unknown"}function vje(t){if(Kte(t))return{width:t.naturalWidth,height:t.naturalHeight};if(Yte(t))return{width:t.width.baseVal.value,height:t.height.baseVal.value};if(Qte(t))return{width:t.videoWidth,height:t.videoHeight};if(Zte(t))return{width:t.width,height:t.height};if(ere(t))return{width:t.displayWidth,height:t.displayHeight};if(Jte(t))return{width:t.width,height:t.height};if(Xte(t))return{width:t.width,height:t.height};throw new TypeError("The provided value is not of type '(Blob or HTMLCanvasElement or HTMLImageElement or HTMLVideoElement or ImageBitmap or ImageData or OffscreenCanvas or SVGImageElement or VideoFrame)'.")}function Kte(t){var e,r;try{return t instanceof((r=(e=t==null?void 0:t.ownerDocument)==null?void 0:e.defaultView)==null?void 0:r.HTMLImageElement)}catch{return!1}}function Yte(t){var e,r;try{return t instanceof((r=(e=t==null?void 0:t.ownerDocument)==null?void 0:e.defaultView)==null?void 0:r.SVGImageElement)}catch{return!1}}function Qte(t){var e,r;try{return t instanceof((r=(e=t==null?void 0:t.ownerDocument)==null?void 0:e.defaultView)==null?void 0:r.HTMLVideoElement)}catch{return!1}}function Jte(t){var e,r;try{return t instanceof((r=(e=t==null?void 0:t.ownerDocument)==null?void 0:e.defaultView)==null?void 0:r.HTMLCanvasElement)}catch{return!1}}function Zte(t){try{return t instanceof ImageBitmap||Object.prototype.toString.call(t)==="[object ImageBitmap]"}catch{return!1}}function Xte(t){try{return t instanceof OffscreenCanvas||Object.prototype.toString.call(t)==="[object OffscreenCanvas]"}catch{return!1}}function ere(t){try{return t instanceof VideoFrame||Object.prototype.toString.call(t)==="[object VideoFrame]"}catch{return!1}}function tre(t){try{return t instanceof Blob||Object.prototype.toString.call(t)==="[object Blob]"}catch{return!1}}function gje(t){try{return t instanceof ImageData||Object.prototype.toString.call(t)==="[object ImageData]"}catch{return!1}}function yje(t,e){try{const r=new OffscreenCanvas(t,e);if(r.getContext("2d")instanceof OffscreenCanvasRenderingContext2D)return r;throw void 0}catch{const r=document.createElement("canvas");return r.width=t,r.height=e,r}}async function rre(t){if(Kte(t)&&!await xje(t))throw new DOMException("Failed to load or decode HTMLImageElement.","InvalidStateError");if(Yte(t)&&!await Eje(t))throw new DOMException("Failed to load or decode SVGImageElement.","InvalidStateError");if(ere(t)&&Cje(t))throw new DOMException("VideoFrame is closed.","InvalidStateError");if(Qte(t)&&(t.readyState===0||t.readyState===1))throw new DOMException("Invalid element or state.","InvalidStateError");if(Zte(t)&&Sje(t))throw new DOMException("The image source is detached.","InvalidStateError");const{width:e,height:r}=vje(t);if(e===0||r===0)return null;const n=yje(e,r).getContext("2d");n.drawImage(t,0,0);try{return n.getImageData(0,0,e,r)}catch{throw new DOMException("Source would taint origin.","SecurityError")}}async function mje(t){let e;try{if(globalThis.createImageBitmap)e=await createImageBitmap(t);else if(globalThis.Image){e=new Image;let r="";try{r=URL.createObjectURL(t),e.src=r,await e.decode()}finally{URL.revokeObjectURL(r)}}else return t}catch{throw new DOMException("Failed to load or decode Blob.","InvalidStateError")}return await rre(e)}function bje(t){const{width:e,height:r}=t;if(e===0||r===0)return null;const n=t.getContext("2d");try{return n.getImageData(0,0,e,r)}catch{throw new DOMException("Source would taint origin.","SecurityError")}}async function wje(t){if(tre(t))return await mje(t);if(gje(t)){if(Aje(t))throw new DOMException("The image data has been detached.","InvalidStateError");return t}return Jte(t)||Xte(t)?bje(t):await rre(t)}async function xje(t){try{return await t.decode(),!0}catch{return!1}}async function Eje(t){var e;try{return await((e=t.decode)==null?void 0:e.call(t)),!0}catch{return!1}}function Cje(t){return t.format===null}function Aje(t){return t.data.buffer.byteLength===0}function Sje(t){return t.width===0&&t.height===0}function U$(t,e){return _je(t)?new DOMException(`${e}: ${t.message}`,t.name):Ije(t)?new t.constructor(`${e}: ${t.message}`):new Error(`${e}: ${t}`)}function _je(t){return t instanceof DOMException||Object.prototype.toString.call(t)==="[object DOMException]"}function Ije(t){return t instanceof Error||Object.prototype.toString.call(t)==="[object Error]"}var B3;class TI extends EventTarget{constructor(e={}){var r;super(),JFe(this,B3);try{const n=(r=e==null?void 0:e.formats)==null?void 0:r.filter(i=>i!=="unknown");if((n==null?void 0:n.length)===0)throw new TypeError("Hint option provided, but is empty.");for(const i of n??[])if(!II.has(i))throw new TypeError(`Failed to read the 'formats' property from 'BarcodeDetectorOptions': The provided value '${i}' is not a valid enum value of type BarcodeFormat.`);ZFe(this,B3,n??[]),fje().then(i=>{this.dispatchEvent(new CustomEvent("load",{detail:i}))}).catch(i=>{this.dispatchEvent(new CustomEvent("error",{detail:i}))})}catch(n){throw U$(n,"Failed to construct 'BarcodeDetector'")}}static async getSupportedFormats(){return hje.filter(e=>e!=="unknown")}async detect(e){try{const r=await wje(e);if(r===null)return[];let n;const i={tryHarder:!0,returnCodabarStartEnd:!0,formats:QFe(this,B3).map(s=>II.get(s))};try{tre(r)?n=await uje(r,i):n=await dje(r,i)}catch(s){throw console.error(s),new DOMException("Barcode detection service unavailable.","NotSupportedError")}return n.map(s=>{const{topLeft:{x:o,y:a},topRight:{x:c,y:l},bottomLeft:{x:f,y:u},bottomRight:{x:p,y:g}}=s.position,y=Math.min(o,c,f,p),b=Math.min(a,l,u,g),I=Math.max(o,c,f,p),C=Math.max(a,l,u,g);return{boundingBox:new DOMRectReadOnly(y,b,I-y,C-b),rawValue:s.text,format:pje(s.format),cornerPoints:[{x:o,y:a},{x:c,y:l},{x:p,y:g},{x:f,y:u}]}})}catch(r){throw U$(r,"Failed to execute 'detect' on 'BarcodeDetector'")}}}B3=new WeakMap;globalThis.BarcodeDetector!=null||(globalThis.BarcodeDetector=TI);function Tje(t){const{onClick:e,disabled:r,className:n}=t,i={cursor:r?"default":"pointer",stroke:r?"grey":"yellow",strokeLineJoin:"round",strokeLineCap:"round",strokeWidth:1.5,...t.style};return qt.createElement("svg",{onClick:r?void 0:e,className:n,style:i,width:"28px",height:"28px",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},qt.createElement("path",{d:"M3 3L6.00007 6.00007M21 21L19.8455 19.8221M9.74194 4.06811C9.83646 4.04279 9.93334 4.02428 10.0319 4.01299C10.1453 4 10.2683 4 10.5141 4H13.5327C13.7786 4 13.9015 4 14.015 4.01299C14.6068 4.08078 15.1375 4.40882 15.4628 4.90782C15.5252 5.00345 15.5802 5.11345 15.6901 5.33333C15.7451 5.44329 15.7726 5.49827 15.8037 5.54609C15.9664 5.79559 16.2318 5.95961 16.5277 5.9935C16.5844 6 16.6459 6 16.7688 6H17.8234C18.9435 6 19.5036 6 19.9314 6.21799C20.3077 6.40973 20.6137 6.71569 20.8055 7.09202C21.0234 7.51984 21.0234 8.0799 21.0234 9.2V15.3496M19.8455 19.8221C19.4278 20 18.8702 20 17.8234 20H6.22344C5.10333 20 4.54328 20 4.11546 19.782C3.73913 19.5903 3.43317 19.2843 3.24142 18.908C3.02344 18.4802 3.02344 17.9201 3.02344 16.8V9.2C3.02344 8.0799 3.02344 7.51984 3.24142 7.09202C3.43317 6.71569 3.73913 6.40973 4.11546 6.21799C4.51385 6.015 5.0269 6.00103 6.00007 6.00007M19.8455 19.8221L14.5619 14.5619M14.5619 14.5619C14.0349 15.4243 13.0847 16 12 16C10.3431 16 9 14.6569 9 13C9 11.9153 9.57566 10.9651 10.4381 10.4381M14.5619 14.5619L10.4381 10.4381M10.4381 10.4381L6.00007 6.00007"}))}function Pje(t){const{onClick:e,disabled:r,className:n}=t,i={cursor:r?"default":"pointer",stroke:r?"grey":"yellow",strokeLineJoin:"round",strokeLineCap:"round",strokeWidth:1.5,...t.style};return qt.createElement("svg",{onClick:r?void 0:e,className:n,style:i,width:"28px",height:"28px",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},qt.createElement("path",{d:"M12 16C13.6569 16 15 14.6569 15 13C15 11.3431 13.6569 10 12 10C10.3431 10 9 11.3431 9 13C9 14.6569 10.3431 16 12 16Z"}),qt.createElement("path",{d:"M3 16.8V9.2C3 8.0799 3 7.51984 3.21799 7.09202C3.40973 6.71569 3.71569 6.40973 4.09202 6.21799C4.51984 6 5.0799 6 6.2 6H7.25464C7.37758 6 7.43905 6 7.49576 5.9935C7.79166 5.95961 8.05705 5.79559 8.21969 5.54609C8.25086 5.49827 8.27836 5.44328 8.33333 5.33333C8.44329 5.11342 8.49827 5.00346 8.56062 4.90782C8.8859 4.40882 9.41668 4.08078 10.0085 4.01299C10.1219 4 10.2448 4 10.4907 4H13.5093C13.7552 4 13.8781 4 13.9915 4.01299C14.5833 4.08078 15.1141 4.40882 15.4394 4.90782C15.5017 5.00345 15.5567 5.11345 15.6667 5.33333C15.7216 5.44329 15.7491 5.49827 15.7803 5.54609C15.943 5.79559 16.2083 5.95961 16.5042 5.9935C16.561 6 16.6224 6 16.7454 6H17.8C18.9201 6 19.4802 6 19.908 6.21799C20.2843 6.40973 20.5903 6.71569 20.782 7.09202C21 7.51984 21 8.0799 21 9.2V16.8C21 17.9201 21 18.4802 20.782 18.908C20.5903 19.2843 20.2843 19.5903 19.908 19.782C19.4802 20 18.9201 20 17.8 20H6.2C5.0799 20 4.51984 20 4.09202 19.782C3.71569 19.5903 3.40973 19.2843 3.21799 18.908C3 18.4802 3 17.9201 3 16.8Z"}))}function kje(t){const{scanning:e,startScanning:r,stopScanning:n}=t,[i,s]=N.useState(!1);function o(){s(!0),e?n():r(),setTimeout(()=>s(!1),1e3)}return qt.createElement("div",{style:{bottom:85,right:3,position:"absolute",zIndex:2,cursor:i?"default":"pointer"}},e?qt.createElement(Tje,{disabled:i,onClick:o}):qt.createElement(Pje,{disabled:i,onClick:o}))}function Mje(t){const{onClick:e,className:r,style:n}=t;return qt.createElement("svg",{onClick:e,width:"30px",height:"30px",viewBox:"0 0 24 24",className:r,style:n,xmlns:"http://www.w3.org/2000/svg"},qt.createElement("path",{strokeWidth:.2,stroke:"yellow",fill:"yellow",d:"M13.225 9l5.025-7h-7.972l-3.3 11h5.359l-2.452 8.648.75.364L20.374 9zm.438 3H8.322l2.7-9H16.3l-5.025 7h7.101l-6.7 8.953z"}))}function Rje(t){const{onClick:e,className:r,style:n}=t;return qt.createElement("svg",{onClick:e,width:"30px",height:"30px",viewBox:"0 0 24 24",className:r,style:n,xmlns:"http://www.w3.org/2000/svg"},qt.createElement("path",{strokeWidth:.2,stroke:"yellow",fill:"yellow",d:"M14.516 15.158l.714.714-4.595 6.14-.75-.364L12.337 13H6.978L8.22 8.861l.803.803L8.322 12h3.036l1.793 1.792-1.475 5.16zm5.984 4.05L4.793 3.5l.707-.707 3.492 3.492L10.278 2h7.972l-5.025 7h7.149l-3.71 4.957 4.543 4.543zM12.707 10l3.243 3.243L18.376 10zM9.795 7.088l2.079 2.079L16.3 3h-5.278z"}))}function Oje(t){const{status:e,scanning:r,torchToggle:n}=t;function i(s){n(s)}return r&&n?qt.createElement("div",{style:{bottom:35,right:3,position:"absolute",zIndex:2,cursor:"pointer"}},e?qt.createElement(Rje,{onClick:()=>i(!1)}):qt.createElement(Mje,{onClick:()=>i(!0)})):null}function Nje(t){const{onClick:e,className:r,disabled:n=!1}=t,i={cursor:n?"default":"pointer",stroke:n?"grey":"yellow",fill:n?"grey":"yellow",...t.style};return qt.createElement("svg",{onClick:n?void 0:e,width:"30px",height:"30px",viewBox:"0 0 24 24",className:r,style:i,xmlns:"http://www.w3.org/2000/svg"},qt.createElement("path",{strokeWidth:.3,d:"M16.279,17.039c-1.396,1.209 -3.216,1.941 -5.206,1.941c-4.393,0 -7.96,-3.567 -7.96,-7.96c-0,-4.393 3.567,-7.96 7.96,-7.96c4.393,0 7.96,3.567 7.96,7.96c-0,2.044 -0.772,3.909 -2.04,5.319l0.165,0.165c1.194,1.194 2.388,2.388 3.583,3.582c0.455,0.456 -0.252,1.163 -0.707,0.708l-3.755,-3.755Zm1.754,-6.019c-0,-3.841 -3.119,-6.96 -6.96,-6.96c-3.842,0 -6.96,3.119 -6.96,6.96c-0,3.841 3.118,6.96 6.96,6.96c3.841,0 6.96,-3.119 6.96,-6.96Zm-7.46,0.5l-1.5,0c-0.645,0 -0.643,-1 -0,-1l1.5,0l-0,-1.5c-0,-0.645 1,-0.643 1,0l-0,1.5l1.5,0c0.645,0 0.643,1 -0,1l-1.5,0l-0,1.5c-0,0.645 -1,0.643 -1,0l-0,-1.5Z"}))}function Dje(t){const{onClick:e,className:r,disabled:n=!1}=t,i={cursor:n?"default":"pointer",stroke:n?"grey":"yellow",fill:n?"grey":"yellow",...t.style};return qt.createElement("svg",{onClick:n?void 0:e,width:"30px",height:"30px",viewBox:"0 0 24 24",className:r,style:i,xmlns:"http://www.w3.org/2000/svg"},qt.createElement("path",{strokeWidth:.3,d:"M16.279,17.039c-1.396,1.209 -3.216,1.941 -5.206,1.941c-4.393,0 -7.96,-3.567 -7.96,-7.96c-0,-4.393 3.567,-7.96 7.96,-7.96c4.393,0 7.96,3.567 7.96,7.96c-0,2.044 -0.772,3.909 -2.04,5.319l0.165,0.165c1.194,1.194 2.388,2.388 3.583,3.582c0.455,0.456 -0.252,1.163 -0.707,0.708l-3.755,-3.755Zm1.754,-6.019c-0,-3.841 -3.119,-6.96 -6.96,-6.96c-3.842,0 -6.96,3.119 -6.96,6.96c-0,3.841 3.118,6.96 6.96,6.96c3.841,0 6.96,-3.119 6.96,-6.96Zm-4.96,-0.5c0.645,0 0.643,1 -0,1l-4,0c-0.645,0 -0.643,-1 -0,-1l4,0Z"}))}function Bje(t){const{scanning:e,capabilities:r,onZoom:n,value:i}=t;if(!e||!n)return null;const s=(r.max-r.min)/3;return qt.createElement(N.Fragment,null,qt.createElement("div",{style:{bottom:130,right:3,position:"absolute",zIndex:2,cursor:"pointer"}},qt.createElement(Dje,{disabled:i<=r.min,onClick:function(){n(Math.max(i-s,r.min))}})),qt.createElement("div",{style:{bottom:180,right:3,position:"absolute",zIndex:2,cursor:"pointer"}},qt.createElement(Nje,{disabled:i>=r.max,onClick:function(){n(Math.min(i+s,r.max))}})))}function Lje(t){const{scanning:e,loading:r,capabilities:n,border:i=35,onOff:s,torch:o,zoom:a,startScanning:c,stopScanning:l}=t,f="rgba(255, 0, 0, 0.5)";return qt.createElement("div",{style:{position:"relative"}},qt.createElement("svg",{viewBox:"0 0 100 100",style:{top:0,left:0,zIndex:1,boxSizing:"border-box",border:`${i>=35?i:35}px solid rgba(0, 0, 0, 0.2)`}},r&&qt.createElement("text",{x:"50",y:"50",textAnchor:"middle",fill:"black",fontSize:"8",fontFamily:"Arial",fontWeight:"bold"},"Loading ...",qt.createElement("animate",{attributeName:"opacity",values:"0;1;0",dur:"2s",repeatCount:"indefinite"})),qt.createElement("path",{fill:"none",d:"M23,0 L0,0 L0,23",stroke:f,strokeWidth:3}),qt.createElement("path",{fill:"none",d:"M0,77 L0,100 L23,100",stroke:f,strokeWidth:3}),qt.createElement("path",{fill:"none",d:"M77,100 L100,100 L100,77",stroke:f,strokeWidth:3}),qt.createElement("path",{fill:"none",d:"M100,23 L100,0 77,0",stroke:f,strokeWidth:3})),s&&qt.createElement(kje,{scanning:e,startScanning:c,stopScanning:l}),o&&n.torch&&qt.createElement(Oje,{scanning:e,status:o.status,torchToggle:o.toggle}),a&&n.zoom&&qt.createElement(Bje,{scanning:e,capabilities:n.zoom,value:a.value,onZoom:a.onChange}))}const Fje={facingMode:"environment",width:{min:640,ideal:720,max:1920},height:{min:640,ideal:720,max:1080}},jje={audio:!0,tracker:void 0,onOff:!1,finder:!0,torch:!0,zoom:!1},Uje={width:"100%",height:"100%",position:"relative"},$je={top:0,left:0,width:"100%",height:"100%",display:"block",overflow:"hidden"};var qje=function(t){let e,r=!1;return(...n)=>(r||(e=t(n),r=!0),e)}(()=>{const t=xFe(window);switch(t.browser){case"chrome":RFe(window,t);break;case"firefox":BFe(window,t);break;case"safari":UFe(window,t);break;default:throw new Error("Unsupported browser")}});const Vje="data:audio/mp3;base64,//PkZAAhghE0AKToAJra/n0FQygAAAGIkYJgmCYXBMAAGCTJz3zhCEM//z//1hz//8MMMMN08ssV6e5DDWIQreAgCvFKy8bXgIKMkUDDBgzJwIBtkRMQAocxIFdxghQGKDoEziAzQxOBOdH92i/iGi+zDCAEIX46a73HrSybZw1x3JZjXp7dSNy/P68rjcbt7p7fakMP5LVMyzCaj1pjvejYYAIDgDGzECjEAk1Jl3559HIon8hzlfPVTCvGJZzfcKSxXfyMWM88//9VKSxXdtnb9vomOuuRyiWVYbf+X8zp6fKGHIdycuWMMMMMMKSnp+6wsYc/9f/7z7rPPWHN556p6fP8MMMP///PPP/7+GHK9PT6p7f/unldP2np7YeHjweiYA4GLNAgAiI7u57n5//oc5/yfk6znOcPhwOBwggHCMpA4HA4KEyHOc5znO+hPIc5//+fqJh8XQPh90JU5xQinOf//87/zvP+ggAYuhCKHxdA+Hxd0EA4KKHA4ciB3kOXfXB/gmf8p/B96lAMKAgAADU+BujARHgwdisgHMfAUHAiceBg4ASBgZBiBIBH4ZaHOJsLhf8R+HYEciIgYSwj/+Bi7EqBh+AcBn5P6Bh4TuBmrAMBiZH7gaLEWgew//PkZFMlyek60MpYAShzqqZhm6gCUWeEUWAewEWYGN4X4GDEPwGE8S4GDoOIGAYKgIQOkz//gGARAUB+CwGxTwMAACAEgyAwdAlAxKhzAxXiZ///AxcEwAwJjDAziCAAwQgdAwRgdAsJQDAmAcGzYDwAhZIAKAcIQB4GT9TQMJ9/4Gi1Fv/AcAYUqKBAwGgNAwVBAAwGhwAwdBlAxFg1AwlgzAwNBuAkJQDBgEEDEqGECgChFgBgL//CIswYYH//+HKCpk4K0C9AaKKCAOBeMcR4X9C44BwABCgGAsGYCgTwHAcAwXAiAwS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IjqVi0ylBqJIkiSJIkmJj605EkSRJPetWAyVacmodBUVhGfrAZPF0AUrgRLNiqDU4VHo8h6HRObJJNdqlRBMFT0qdNE0WZhmay2tCuOY6oieWieianCnVSbzjd7SGhrLi6eUSeLcZTWqdML5PM50uOGJms9VqtYU6hrgrm4V0frUzTvYsiegR2FOkqUxSKdVCpmRCSkIAUZ4VPhqEKgFDU2VhUiIhUaIg0RAkTBYEjYBUbBMuCJgLAkCUBUinABgBE3/9EQqFRM0s0qzktk9ZFqqFC6RULE11JVDkd8Y1vVFOx9oUIpZ8Vnq5klkxBTUUzLjEwMKqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq";var db=t=>t instanceof Date,nre=t=>t==null;const ire=t=>typeof t=="object";var $$=t=>!nre(t)&&!Array.isArray(t)&&ire(t)&&!db(t),q$=t=>nre(t)||!ire(t);function sre(t,e){if(q$(t)||q$(e))return t===e;if(db(t)&&db(e))return t.getTime()===e.getTime();const r=Object.keys(t),n=Object.keys(e);if(r.length!==n.length)return!1;for(const i of r){const s=t[i];if(!n.includes(i))return!1;if(i!=="ref"){const o=e[i];if(db(s)&&db(o)||$$(s)&&$$(o)||Array.isArray(s)&&Array.isArray(o)?!sre(s,o):s!==o)return!1}}return!0}function D6(t){if(t===null)throw new Error("Canvas should always be defined when component is mounted.");const e=t.getContext("2d");if(e===null)throw new Error("Canvas 2D context should be non-null");e.clearRect(0,0,t.width,t.height)}function zje(t){var e;const{onScan:r,constraints:n,formats:i=["qr_code"],paused:s=!1,components:o,children:a,styles:c,classNames:l,allowMultiple:f,scanDelay:u,onError:p}=t,g=N.useRef(null),y=N.useRef(null),b=N.useRef(null),I=N.useMemo(()=>({...Fje,...n}),[n]),C=N.useMemo(()=>({...jje,...o}),[o]),[S,R]=N.useState(!1),[L,F]=N.useState(!0),[H,_]=N.useState(I),U=function(){const v=N.useRef(Promise.resolve({type:"stop",data:{}})),m=N.useRef(null),M=N.useRef(null),[B,E]=N.useState({}),[x,w]=N.useState({}),T=N.useCallback(async(X,G)=>{var Z,re,D;if(!window.isSecureContext)throw new Error("camera access is only permitted in secure context. Use HTTPS or localhost rather than HTTP.");if(((Z=navigator==null?void 0:navigator.mediaDevices)===null||Z===void 0?void 0:Z.getUserMedia)===void 0)throw new Error("this browser has no Stream API support");qje();const ee=await navigator.mediaDevices.getUserMedia({audio:!1,video:G});X.srcObject!==void 0?X.srcObject=ee:X.mozSrcObject!==void 0?X.mozSrcObject=ee:window.URL.createObjectURL?X.src=window.URL.createObjectURL(ee):window.webkitURL?X.src=window.webkitURL.createObjectURL(ee):X.src=ee.id,await Promise.race([X.play(),new Promise(Ee=>setTimeout(Ee,3e3)).then(()=>{throw new Error("Loading camera stream timed out after 3 seconds.")})]),await new Promise(Ee=>setTimeout(Ee,500));const[fe]=ee.getVideoTracks();return w(fe.getSettings()),E((D=(re=fe==null?void 0:fe.getCapabilities)===null||re===void 0?void 0:re.call(fe))!==null&&D!==void 0?D:{}),m.current=ee,M.current=fe,{type:"start",data:{videoEl:X,stream:ee,constraints:G}}},[]),P=N.useCallback(async(X,G)=>{X.src="",X.srcObject=null,X.load();for(const Z of G.getTracks())G.removeTrack(Z),Z.stop();return m.current=null,M.current=null,w({}),{type:"stop",data:{}}},[]),z=N.useCallback(async(X,{constraints:G,restart:Z=!1})=>{if(v.current=v.current.then(re=>{if(re.type==="start"){const{data:{videoEl:D,stream:ee,constraints:fe}}=re;return Z||X!==D||G!==fe?P(D,ee).then(()=>T(X,G)):re}return T(X,G)}),(await v.current).type==="stop")throw new Error("Something went wrong with the camera task queue (start task).")},[T,P]),oe=N.useCallback(async()=>{if(v.current=v.current.then(X=>{if(X.type==="stop")return X;const{data:{videoEl:G,stream:Z}}=X;return P(G,Z)}),(await v.current).type==="start")throw new Error("Something went wrong with the camera task queue (stop task).")},[P]),j=N.useCallback(async X=>{const G=M.current;if(!G)throw new Error("No active video track found.");{X.advanced&&X.advanced[0].zoom&&G.getCapabilities().torch&&await G.applyConstraints({advanced:[{torch:!1}]}),await G.applyConstraints(X);const Z=G.getCapabilities(),re=G.getSettings();E(Z),w(re)}},[]);return N.useEffect(()=>()=>{(async()=>await oe())()},[oe]),{capabilities:B,settings:x,startCamera:z,stopCamera:oe,updateConstraints:j}}(),{startScanning:ie,stopScanning:ce}=function(v){const{videoElementRef:m,onScan:M,onFound:B,retryDelay:E=100,scanDelay:x=0,formats:w=[],audio:T=!0,allowMultiple:P=!1}=v,z=N.useRef(new TI({formats:w})),oe=N.useRef(null),j=N.useRef(null);N.useEffect(()=>{z.current=new TI({formats:w})},[w]),N.useEffect(()=>{typeof window<"u"&&T&&(oe.current=new Audio(Vje))},[T]);const X=N.useCallback(G=>async Z=>{if(m.current!==null&&m.current.readyState>1){const{lastScan:re,contentBefore:D,lastScanHadContent:ee}=G;if(Z-re!D.includes(ze.rawValue)),_e=fe.length>0;let Me=G.lastOnScan;(Ee||P&&_e&&Z-Me>=x)&&(T&&oe.current&&oe.current.paused&&oe.current.play().catch(ze=>console.error("Error playing the sound",ze)),Me=Z,M(fe)),_e&&B(fe),!_e&&ee&&B(fe);const Ze={lastScan:Z,lastOnScan:Me,lastScanHadContent:_e,contentBefore:Ee?fe.map(ze=>ze.rawValue):D};j.current=window.requestAnimationFrame(X(Ze))}}},[m.current,M,B,E]);return{startScanning:N.useCallback(()=>{const G=performance.now(),Z={lastScan:G,lastOnScan:G,contentBefore:[],lastScanHadContent:!1};j.current=window.requestAnimationFrame(X(Z))},[X]),stopScanning:N.useCallback(()=>{j.current!==null&&(window.cancelAnimationFrame(j.current),j.current=null)},[])}}({videoElementRef:g,onScan:r,onFound:v=>function(m,M,B,E){const x=B;if(x==null)throw new Error("onFound handler should only be called when component is mounted. Thus tracking canvas is always defined.");const w=M;if(w==null)throw new Error("onFound handler should only be called when component is mounted. Thus video element is always defined.");if(m.length===0||E===void 0)D6(x);else{const T=w.offsetWidth,P=w.offsetHeight,z=w.videoWidth,oe=w.videoHeight,j=Math.max(T/z,P/oe),X=z*j,G=oe*j,Z=X/z,re=G/oe,D=(T-X)/2,ee=(P-G)/2,fe=({x:Ze,y:ze})=>({x:Math.floor(Ze*Z),y:Math.floor(ze*re)}),Ee=({x:Ze,y:ze})=>({x:Math.floor(Ze+D),y:Math.floor(ze+ee)}),_e=m.map(Ze=>{const{boundingBox:ze,cornerPoints:et}=Ze,{x:Re,y:qe}=Ee(fe({x:ze.x,y:ze.y})),{x:Te,y:De}=fe({x:ze.width,y:ze.height});return{...Ze,cornerPoints:et.map(Je=>Ee(fe(Je))),boundingBox:DOMRectReadOnly.fromRect({x:Re,y:qe,width:Te,height:De})}});x.width=w.offsetWidth,x.height=w.offsetHeight;const Me=x.getContext("2d");if(Me===null)throw new Error("onFound handler should only be called when component is mounted. Thus tracking canvas 2D context is always defined.");E(_e,Me)}}(v,g.current,b.current,C.tracker),formats:i,audio:C.audio,allowMultiple:f,retryDelay:C.tracker===void 0?500:10,scanDelay:u});N.useEffect(()=>(R(!0),()=>{R(!1)}),[]),N.useEffect(()=>{S&&(ce(),ie())},[o==null?void 0:o.tracker]),N.useEffect(()=>{if(!sre(I,H)){const v=I;n!=null&&n.deviceId&&delete v.facingMode,_(v)}},[n]);const K=N.useMemo(()=>({constraints:H,shouldStream:S&&!s}),[H,S,s]),k=async()=>{const v=g.current;if(v==null)throw new Error("Video should be defined when component is mounted.");const m=y.current;if(m==null)throw new Error("Canvas should be defined when component is mounted.");const M=m.getContext("2d");if(M==null)throw new Error("Canvas should be defined when component is mounted.");if(K.shouldStream){await U.stopCamera(),F(!1);try{await U.startCamera(v,K),v?F(!0):await U.stopCamera()}catch(B){p==null||p(B),console.error("error",B)}}else m.width=v.videoWidth,m.height=v.videoHeight,M.drawImage(v,0,0,v.videoWidth,v.videoHeight),await U.stopCamera(),F(!1)};N.useEffect(()=>{(async()=>await k())()},[K]);const O=N.useMemo(()=>K.shouldStream&&L,[K.shouldStream,L]);return N.useEffect(()=>{if(O){if(y.current===void 0)throw new Error("shouldScan effect should only be triggered when component is mounted. Thus pause frame canvas is defined");if(D6(y.current),b.current===void 0)throw new Error("shouldScan effect should only be triggered when component is mounted. Thus tracking canvas is defined");if(D6(b.current),g.current==null)throw new Error("shouldScan effect should only be triggered when component is mounted. Thus video element is defined");ie()}},[O]),qt.createElement("div",{style:{...Uje,...c==null?void 0:c.container},className:l==null?void 0:l.container},qt.createElement("video",{ref:g,style:{...$je,...c==null?void 0:c.video,visibility:s?"hidden":"visible"},className:l==null?void 0:l.video,autoPlay:!0,muted:!0,playsInline:!0}),qt.createElement("canvas",{ref:y,style:{display:s?"block":"none",position:"absolute",top:0,left:0,width:"100%"}}),qt.createElement("canvas",{ref:b,style:{position:"absolute",top:0,left:0,width:"100%",height:"100%"}}),qt.createElement("div",{style:{top:0,left:0,position:"absolute",width:"100%",height:"100%"}},C.finder&&qt.createElement(Lje,{scanning:L,capabilities:U.capabilities,loading:!1,onOff:C.onOff,zoom:C.zoom&&U.settings.zoom?{value:U.settings.zoom,onChange:async v=>{const m={...H,advanced:[{zoom:v}]};await U.updateConstraints(m)}}:void 0,torch:C.torch?{status:(e=U.settings.torch)!==null&&e!==void 0&&e,toggle:async v=>{const m={...H,advanced:[{torch:v}]};await U.updateConstraints(m)}}:void 0,startScanning:async()=>await k(),stopScanning:async()=>{await U.stopCamera(),D6(b.current),F(!1)},border:c==null?void 0:c.finderBorder}),a))}function Hje({onQrUri:t}){const e=Br(OE),[r,n]=N.useState(""),i=async()=>{if(r){console.log(r);try{await e.pair(r)}catch(s){console.error(s),t(!1)}}t(!0)};return W.jsxs(we,{flexDirection:"column",justifyContent:"space-between",padding:"12",gap:"3",children:[W.jsx(zje,{onScan:s=>{s[0].rawValue&&n(s[0].rawValue)},styles:{video:{transform:"scaleX(-1)",borderRadius:"10px",minHeight:"500px"}}}),W.jsxs(we,{children:[W.jsx(Pn,{label:"Paste Connection String",labelLocation:"top",name:"signClientUri",value:r??"",onChange:s=>{n(s.target.value)}}),W.jsx(we,{justifyContent:"flex-end",children:W.jsx(Jt,{marginTop:"4",variant:"primary",size:"md",shape:"square",label:"Connect Dapp",disabled:!r,onClick:()=>{r&&i()}})})]})]})}const ore=t=>({info:{walletId:"",uuid:"",name:"WalletConnect",icon:"https://avatars.githubusercontent.com/u/37784886"},provider:t});function Gje(){var ze,et;const t=Rte(),e=Br(Mi),r=Br(nE),n=Br(Zr),i=Br(Wn),s=Br(OE),o=rk(),a=on(e.accountAddress),c=on(e.isPasswordSet),l=on(n.isSigningTxn),f=on(n.isSigningMsg),u=on(s.allSessions),p=on(i.networks),g=f8(),y=WP("isMobile"),b=rFe();N.useEffect(()=>{a&&p.length>0&&r.loadBalances(a,p)},[a,p]),N.useEffect(()=>{if(b&&b.connected&&!n.selectedExternalProvider.get()){let Re=ore(b),qe=n.availableExternalProviders.get();qe?n.availableExternalProviders.set([Re,...qe]):n.availableExternalProviders.set([Re])}},[b]),N.useEffect(()=>{t.length>0&&n.availableExternalProviders.set(t)},[t]);const I=on(n.selectedExternalProvider),C=on(n.selectedExternalWalletAddress),S=on(n.isSendingTokenTransaction),R=on(n.isSendingCollectibleTransaction),L=on(n.isSendingSignedTokenTransaction),[F,H]=N.useState(!0),[_,U]=N.useState(void 0),[ie,ce]=N.useState(void 0),[K,k]=N.useState(!1),[O,v]=N.useState(!1),[m,M]=N.useState(!1),[B,E]=N.useState(!1),[x,w]=N.useState(!1),[T,P]=N.useState(!1),[z,oe]=N.useState(!1),j=on(n.signClientWarningType),X=Re=>{ce(void 0),n.isSendingCollectibleTransaction.set(void 0),U(Re),w(!0)},G=Re=>{U(void 0),n.isSendingTokenTransaction.set(void 0),ce(Re),P(!0)},Z=async(Re=!1)=>{(I===void 0||Re)&&M(!0)},re=async()=>{n.setExternalProvider(void 0);const Re=I;(Re==null?void 0:Re.info.name)==="WalletConnect"&&Re.provider.disconnect()},D=async(Re,qe)=>{if(!n.selectedExternalProvider.get()){console.warn("No external provider selected");return}var Te;let De;try{if(_)Te=_.chainId,De=await n.sendToken(_,Re,qe);else if(ie)Te=ie.collectibleInfoParams.chainId,De=await n.sendCollectible(ie,Re,qe);else{console.warn("No pending send found");return}}catch(tt){tt.code===4001&&g({variant:"error",title:"User denied transaction signature."}),console.error(tt);return}const Je=i.providerForChainId(Te),Ge=await O$(Je,De.hash);Ge&&g({variant:"success",title:"Transaction confirmed",description:"You can view the transaction details on your connected external wallet"}),_&&r.updateTokenBalance(_),U(void 0),ce(void 0),n.isSendingTokenTransaction.set(void 0),n.isSendingCollectibleTransaction.set(void 0),console.log("receipt",Ge)},ee=async(Re,qe)=>{const Te=i.providerForChainId(qe);await O$(Te,Re)&&(n.isSendingSignedTokenTransaction.set(void 0),g({variant:"success",title:"Sign transaction confirmed",description:"You can view the transaction details on your connected external wallet"}))},fe=()=>{s.rejectRequest(),n.toSignPermission.set("cancelled")};async function Ee(Re){var Ge;const qe=async(tt,rt,We)=>{try{const it=await n.getExternalProviderAddress(Te);if(!it)throw new Error("No provider address found");return console.log("sendTransaction chainId",rt),await n.sendTransaction(De,Te,it,tt,rt)}catch(it){throw n.isSendingSignedTokenTransaction.set(void 0),it}},Te=(Ge=n.selectedExternalProvider.get())==null?void 0:Ge.provider,De=e.account;let Je;if(Re)try{n.isSendingSignedTokenTransaction.set(Re),Je=await qe(Re.txn,Re.chainId,Re.options),ee(Je.hash,Re.chainId),n.toSignResult.set(Je),n.toSignPermission.set("approved")}catch(tt){throw n.isSendingSignedTokenTransaction.set(void 0),fe(),tt}}async function _e(Re){const qe=async(Je,Ge)=>{try{let tt;if(Je.message)console.log("signMessage chainId",Je.chainId),tt=await Te.signMessage(Je.message,Je.chainId,Je.eip6492?"eip6492":"throw");else if(Je.typedData){const rt=Je.typedData;tt=await Te.signTypedData(rt.domain,rt.types,rt.message,Je.chainId,Je.eip6492?"eip6492":"throw")}if(!tt)throw new Error("Account sign method failed");return{hash:tt}}catch(tt){throw tt}},Te=e.account;let De;if(Re)try{De=await qe(Re.message),n.toSignResult.set(De),n.toSignPermission.set("approved")}catch(Je){throw n.isSendingSignedTokenTransaction.set(void 0),fe(),Je}}const Me=async()=>{var Re;((Re=n.selectedExternalProvider.get())==null?void 0:Re.info.name)==="WalletConnect"?n.signClientWarningType.set("isWalletConnect"):oe(!0)},Ze=async()=>{E(!0)};return W.jsxs(W.Fragment,{children:[W.jsxs(we,{flexDirection:"column",background:"backgroundPrimary",width:"full",height:"full",alignItems:"center",justifyContent:"center",children:[W.jsxs(we,{flexDirection:"row",width:"full",background:"backgroundMuted",paddingX:"8",paddingY:"4",alignItems:"center",children:[W.jsx("img",{src:yM,alt:"Sequence Logo",width:"40"}),W.jsxs(we,{marginLeft:"auto",marginRight:"16",children:[W.jsx(Jt,{label:"Networks",variant:"text",marginRight:"8",onClick:()=>v(!0)}),c&&W.jsx(Jt,{label:"Password Lock",variant:"text",marginRight:"8",onClick:()=>window.location.reload()}),W.jsx(Jt,{label:"Sign Out",variant:"text",onClick:()=>k(!0)})]})]}),W.jsxs(we,{width:"full",paddingX:"8",style:{maxWidth:"800px"},marginBottom:"16",children:[W.jsxs(en,{flexDirection:"column",alignItems:"center",padding:"6",marginTop:"10",children:[W.jsx(Qe,{variant:"large",color:"text80",marginBottom:"4",children:"Your recovered wallet address"}),W.jsx(Qe,{variant:"normal",fontWeight:"bold",color:"text100",children:a}),W.jsx(yFe,{sessionList:u}),W.jsx(Jt,{marginTop:"4",variant:"primary",size:"sm",shape:"square",label:"Connect to a Dapp with WalletConnect",leftIcon:zpe,onClick:()=>{Me()}})]}),W.jsxs(en,{alignItems:"center",flexDirection:"column",padding:"6",marginTop:"4",children:[W.jsx(Qe,{variant:"large",color:"text80",marginBottom:"4",children:I?"Your external wallet that will be used to relay transactions":"Connect an external wallet to relay transactions"}),I&&W.jsx(we,{flexDirection:"row",alignItems:"center",gap:"2",children:W.jsxs(we,{flexDirection:"column",alignItems:"center",gap:"2",children:[W.jsxs(we,{flexDirection:"row",gap:"2",children:[W.jsx("img",{src:I.info.icon,alt:I.info.name,style:{width:"20px",height:"20px"}}),W.jsx(Qe,{variant:"normal",color:"text100",children:I.info.name})]}),C&&W.jsxs(Qe,{variant:"normal",color:"text100",children:["(",C,")"]}),W.jsxs(we,{flexDirection:"row",children:[W.jsx(Jt,{size:"xs",label:"Change external wallet",variant:"text",shape:"square",marginRight:"10",onClick:()=>Z(!0)}),W.jsx(Jt,{size:"xs",label:"Disconnect",variant:"text",shape:"square",onClick:()=>re()})]})]})}),!I&&W.jsx(Jt,{label:"Connect",variant:"primary",size:"md",shape:"square",onClick:Z})]}),S&&W.jsx(we,{marginTop:"8",alignItems:"center",justifyContent:"center",children:W.jsx(cS,{symbol:((et=(ze=S.tokenBalance)==null?void 0:ze.contractInfo)==null?void 0:et.symbol)??"",chainId:S.tokenBalance.chainId,to:S.to,amount:S.amount})}),R&&W.jsx(we,{marginTop:"8",alignItems:"center",justifyContent:"center",children:W.jsx(cS,{symbol:R.collectibleInfo.collectibleInfoResponse.name??"",chainId:R.collectibleInfo.collectibleInfoParams.chainId,to:R.to,amount:R.amount})}),L&&W.jsx(we,{marginTop:"8",alignItems:"center",justifyContent:"center",children:W.jsx(cS,{symbol:"tokens",chainId:L.chainId,to:L.txn[0].to,amount:String(Number(L.txn[0].value))})}),W.jsxs(we,{flexDirection:"column",alignItems:"flex-start",justifyContent:"flex-start",marginTop:"8",children:[W.jsxs(we,{width:"full",flexDirection:"row",alignItems:"center",marginBottom:"4",children:[W.jsx(Qe,{variant:"large",color:"text80",children:"Coins"}),W.jsx(we,{marginLeft:"auto",children:W.jsx(Ybe,{label:"Filter zero balances",checked:F,onCheckedChange:H})})]}),W.jsx(vFe,{filterZeroBalances:F,onSendClick:X})]}),W.jsxs(we,{flexDirection:"column",alignItems:"flex-start",justifyContent:"flex-start",marginTop:"8",children:[W.jsx(Qe,{variant:"large",color:"text80",marginBottom:"4",children:"Collectibles"}),W.jsx(cFe,{onSendClick:G})]})]})]}),K&&W.jsx(Ko,{size:"sm",onClose:()=>k(!1),children:W.jsxs(we,{flexDirection:"column",padding:"8",children:[W.jsx(Qe,{variant:"medium",color:"text80",marginRight:"8",children:"You will need to re-enter your mnemonic if you sign out. Continue?"}),W.jsxs(we,{flexDirection:"row",width:"full",justifyContent:"flex-end",marginTop:"8",gap:"4",children:[W.jsx(Jt,{label:"Sign Out",shape:"square",variant:"primary",onClick:()=>{e.logout(),o("/")}}),W.jsx(Jt,{label:"Cancel",shape:"square",onClick:()=>k(!1)})]})]})}),O&&W.jsx(Ko,{onClose:()=>v(!1),children:W.jsx(gM,{})}),m&&W.jsx(Ko,{size:"md",onClose:()=>M(!1),children:W.jsx(lFe,{onSelectProvider:async Re=>{var qe,Te;Re&&(((qe=n.selectedExternalProvider.get())==null?void 0:qe.info.name)==="WalletConnect"&&await((Te=n.selectedExternalProvider.get())==null?void 0:Te.provider).disconnect(),n.setExternalProvider(Re)),M(!1)}})}),B&&W.jsx(Ko,{size:"md",onClose:()=>E(!1),children:W.jsx(gFe,{onClose:()=>E(!1)})}),z&&W.jsx(Ko,{size:"md",contentProps:{style:{width:y?"100%":"600px",height:y?"":"750px"}},onClose:()=>oe(!1),children:W.jsx(Hje,{onQrUri:Re=>{Re&&Ze(),oe(!1)}})}),l&&W.jsx(Ko,{isDismissible:!1,size:"md",contentProps:{style:{width:y?"100%":"800px",maxHeight:"100%",overflowY:"auto"}},children:W.jsx(bFe,{onClose:Re=>{var qe;n.isSigningTxn.set(!1),Re?n.selectedExternalProvider.get()===void 0?(fe(),n.signClientWarningType.set("noProvider")):((qe=n.selectedExternalProvider.get())==null?void 0:qe.info.name)==="WalletConnect"?(fe(),n.signClientWarningType.set("isWalletConnect")):Ee(Re):fe()}})}),f&&W.jsx(Ko,{isDismissible:!1,size:"md",contentProps:{style:{width:y?"100%":"800px",maxHeight:"90%",overflowY:"auto"}},children:W.jsx(mFe,{onClose:Re=>{var qe;n.isSigningMsg.set(!1),Re?n.selectedExternalProvider.get()===void 0?(fe(),n.signClientWarningType.set("noProvider")):((qe=n.selectedExternalProvider.get())==null?void 0:qe.info.name)==="WalletConnect"?(fe(),n.signClientWarningType.set("isWalletConnect")):_e(Re):fe()}})}),j&&W.jsx(Ko,{size:"md",onClose:()=>n.signClientWarningType.set(!1),children:W.jsx(wFe,{warningType:j})}),x&&W.jsx(Ko,{size:"md",onClose:()=>w(!1),children:W.jsx(uFe,{tokenBalance:_,onClose:(Re,qe)=>{w(!1),Re&&qe&&D(Re,qe)}})}),T&&W.jsx(Ko,{size:"md",onClose:()=>P(!1),children:W.jsx(fFe,{collectibleInfo:ie,onClose:(Re,qe)=>{P(!1),(Re&&(ie==null?void 0:ie.collectibleInfoParams.contractType)==="ERC721"||Re&&qe)&&D(Re,qe)}})})]})}const Wje=()=>{const t=Br(Mi),e=on(t.accountAddress);return W.jsx(x2e,{basename:"/",children:W.jsxs(p2e,{children:[W.jsx(t3,{path:"/",element:e?W.jsx(QA,{replace:!0,to:"/wallet"}):W.jsx(y9e,{})}),W.jsx(t3,{path:"recovery",element:e?W.jsx(QA,{replace:!0,to:"/wallet"}):W.jsx(w9e,{})}),W.jsx(t3,{path:"wallet",element:e?W.jsx(Gje,{}):W.jsx(QA,{replace:!0,to:"/"})})]})})},Kje=Sxe();B7.createRoot(document.getElementById("root")).render(W.jsx(qt.StrictMode,{children:W.jsx(_xe,{store:Kje,children:W.jsx(Eme,{theme:"dark",children:W.jsx(Owe,{children:W.jsx(Wje,{})})})})}));export{C9e as _}; +`),VLe=t=>bu(t)?je(t):Ei(t),Tte=t=>{const e=VLe(t);return LLe(e)?e:je(qr([N3,Ei(String(e.length)),e]))},zLe=t=>{if(JSON.stringify(t.slice(0,N3.length))!==JSON.stringify(N3))return t;const e=t.slice(N3.length),r=String(e.length).length;let n,i;try{i=Number(kp(e.slice(0,r)))}catch{i=Number(ke(e.slice(0,r)))}return i>e.length||!Number.isInteger(i)?n=r-1:n=r,e.slice(n)},k$=async(t,e,r,n)=>new yt.reader.OnChainReader(n).isValidSignature(t,e,r);async function HLe(t){return Array.isArray(t)?Promise.all(t.map(e=>fi(e))):fi(t)}function GLe(t){return[t,...t.auxiliary||[]]}const WLe=1e4;class KLe{constructor(e,r,n){var i=this;this.account=void 0,this.signerReadyCallbacks=[],this.prompter=void 0,this.networks=void 0,this._openIntent=void 0,this._connectOptions=void 0,this.events=new xLe.EventEmitter2,this.onConnectOptionsChange=void 0,this.promptConnect=async function(s){if(!s&&!i._connectOptions)throw new Error("prompter connect options are empty");if(!i.prompter)return i.connect(s);const o=await i.prompter.promptConnect(s||i._connectOptions).catch(c=>({connected:!1})),a=o;return a.connected&&!a.session&&(a.session=await i.walletSession(s==null?void 0:s.networkId)),o},this.isSignedIn=async function(){return await i.signerReady(),!!i.account},this.getAccount=async function(){if(await i.signerReady(),i.account===void 0)throw new Error("signerReady failed resolve");return i.account},this.account=e,this.prompter=r,this.networks=n}defaultChainId(){var e,r;return(e=(r=this.prompter)==null?void 0:r.getDefaultChainId())!=null?e:this.networks[0].chainId}async signIn(e,r={}){this.setAccount(e);const{connect:n,defaultNetworkId:i}=r;if(n){const a=this._connectOptions;let c;if(this.prompter!==null){var s;c=await((s=this.prompter)==null?void 0:s.promptSignInConnect(a))}else c=await this.connect(a);this.notifyConnect(c),(!a||a.keepWalletOpened!==!0)&&this.notifyClose()}if(i&&this.defaultChainId()!==i){var o;await((o=this.prompter)==null?void 0:o.promptChangeNetwork(i))}}signOut(){this.account&&this.notifyDisconnect(),this.setAccount(null)}signerReset(){this.account=void 0}signerReady(e=WLe){return new Promise((r,n)=>{this.account!==void 0?r():(setTimeout(()=>{this.account===void 0&&(this.signerReadyCallbacks=[],n("signerReady timed out"))},e),this.signerReadyCallbacks.push(r))})}async connect(e){var r,n;if(!this.account)return{connected:!1,chainId:"0x0",error:"unable to connect without signed in account"};const i=(r=(n=e==null?void 0:e.networkId)!=null?n:this.defaultChainId())!=null?r:ge.MAINNET,s=RCe(i).chainId,o={connected:!0,chainId:jc(s)};if(e&&e.authorize){const a={app:e.app,origin:e.origin,expiry:e.expiry,nonce:e.authorizeNonce};try{o.proof=await kLe(this.account,s,a)}catch(c){return mi.warn(`connect, signAuthorization failed for options: ${JSON.stringify(e)}, due to: ${c.message}`),{connected:!1,chainId:"0x0",error:`signAuthorization failed: ${c.message}`}}}return o.session=this.walletSession(s),o}async sendMessageRequest(e){var r;const i=Number(((r=e.clientVersion)==null?void 0:r.split(".")[0])||"0")<2,s={id:e.data.id,jsonrpc:"2.0",result:null,error:void 0};try{const o=await this.request({method:e.data.method,params:e.data.params,chainId:e.chainId});return Bc({},e,{data:i?Bc({},s,{result:o}):o})}catch(o){return Bc({},e,{data:i?Bc({},s,{error:o}):{error:o}})}}async request(e){await this.getAccount();try{var r,n;if((!this.account||this.account===null)&&!YLe.includes(e.method))throw BLe;const l=this.account;if(!l)throw new Error("WalletRequestHandler: wallet account is not configured");const f=(r=this.account)==null?void 0:r.providerFor((n=e.chainId)!=null?n:this.defaultChainId());if(!f)throw new Error(`WalletRequestHandler: wallet provider is not configured for chainId ${e.chainId}`);const u=QLe(f)?f:void 0;switch(e.method){case"net_version":{if(!u)throw new Error("Account provider doesn't support send method");return await u.send("net_version",[])}case"eth_chainId":{if(!u)throw new Error("Account provider doesn't support send method");return await u.send("eth_chainId",[])}case"eth_accounts":return[l.address];case"eth_getBalance":{const[p,g]=e.params,y=await f.getBalance(p,g);return jv(y)}case"sequence_sign":case"personal_sign":case"eth_sign":{let p;switch(e.method){case"sequence_sign":case"personal_sign":{const[I,C]=e.params;p=I;break}case"eth_sign":{const[I,C]=e.params;p=C;break}}let g="";const y=Tte(p),b=e.method==="sequence_sign";if(this.prompter===null){var i;g=await l.signMessage(y,(i=e.chainId)!=null?i:this.defaultChainId(),b?"eip6492":"ignore")}else g=await this.prompter.promptSignMessage({chainId:e.chainId,message:je(y),eip6492:b},this.connectOptions);if(g&&g.length>0)return g;throw new Error("declined by user")}case"sequence_signTypedData_v4":case"eth_signTypedData":case"eth_signTypedData_v4":{const[p,g]=e.params;let y;if(typeof g=="string")try{y=JSON.parse(g)}catch(C){console.warn("walletRequestHandler: error parsing typedData",C)}else y=g;if(!y||!y.domain||!y.types||!y.message)throw new Error("invalid typedData object");let b="";const I=e.method==="sequence_signTypedData_v4";if(this.prompter===null){var s;b=await l.signTypedData(y.domain,y.types,y.message,(s=e.chainId)!=null?s:this.defaultChainId(),I?"eip6492":"ignore")}else b=await this.prompter.promptSignMessage({chainId:e.chainId,typedData:y,eip6492:I},this.connectOptions);if(b&&b.length>0)return b;throw new Error("declined by user")}case"eth_sendTransaction":{const p=GLe(e.params[0]).map(y=>("gas"in y&&y.gasLimit===void 0&&(y.gasLimit=y.gas,delete y.gas),y));_I(l.address,p);let g="";if(this.prompter===null){var o,a;const y=await l.sendTransaction(p,(o=e.chainId)!=null?o:this.defaultChainId());g=(a=y==null?void 0:y.hash)!=null?a:""}else g=await this.prompter.promptSendTransaction(p,e.chainId,this.connectOptions);if(g)return g;throw new Error("declined by user")}case"eth_signTransaction":{const[p]=e.params;if(Zt(p.from)!==l.address)throw new Error("sender address does not match wallet");if(_I(l.address,p),this.prompter===null){var c;return await l.signTransactions(p,(c=e.chainId)!=null?c:this.defaultChainId())}else return await this.prompter.promptSignTransaction(p,e.chainId,this.connectOptions)}case"eth_sendRawTransaction":if(yt.transaction.isSignedTransactionBundle(e.params[0])){const p=Number(e.params[0].chainId);return(await l.relayer(p).relay(e.params[0])).hash}else return(await f.broadcastTransaction(e.params[0])).hash;case"eth_getTransactionCount":{const p=Zt(e.params[0]),g=e.params[1],y=await f.getTransactionCount(p,g);return jv(BigInt(y))}case"eth_blockNumber":return await f.getBlockNumber();case"eth_getBlockByNumber":return await f.getBlock(e.params[0]);case"eth_getBlockByHash":return await f.getBlock(e.params[0]);case"eth_getTransactionByHash":return await f.getTransaction(e.params[0]);case"eth_call":{const[p,g]=e.params;return await f.call(Bc({},p,{blockTag:g}))}case"eth_getCode":{const[p,g]=e.params;return await f.getCode(p,g)}case"eth_estimateGas":{const[p]=e.params;return await f.estimateGas(p)}case"eth_gasPrice":{const p=await f.getFeeData();return p.gasPrice===null?null:jv(p.gasPrice)}case"wallet_switchEthereumChain":{const[p]=e.params;if(!p.chainId||p.chainId.length===0)throw new Error("invalid chainId");const g=BigInt(p.chainId);return this.setDefaultChainId(Number(g)),null}case"sequence_getWalletContext":return l.contexts;case"sequence_getWalletConfig":{const[p]=e.params;return p?[(await l.status(p)).onChain.config]:await Promise.all(l.networks.map(async function(g){return(await l.status(g.chainId)).onChain.config}))}case"sequence_getWalletState":{const[p]=e.params;return p?[M$(p,await l.status(p))]:await Promise.all(l.networks.map(async function(g){const y=await l.status(g.chainId);return M$(g.chainId,y)}))}case"sequence_getNetworks":return await this.getNetworks(!0);case"sequence_isSequence":return!0;case"sequence_updateConfig":throw new Error("sequence_updateConfig method is not allowed from a dapp");case"sequence_publishConfig":throw new Error("sequence_publishConfig method is not allowed from a dapp");case"sequence_gasRefundOptions":break;case"sequence_getNonce":break;case"sequence_relay":break;case"sequence_setDefaultNetwork":{const[p]=e.params;if(!p)throw new Error("invalid request, method argument defaultChainId cannot be empty");return this.setDefaultChainId(p),await this.getNetworks(!0)}default:{if(!u)throw new Error("Account provider doesn't support send method");return await u.send(e.method,e.params)}}}catch(l){throw mi.error(l),{message:typeof l=="string"?l:(l==null?void 0:l.message)||"unkown error",code:4001}}}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}async getAddress(){var e,r;return(e=(r=this.account)==null?void 0:r.address)!=null?e:""}get openIntent(){return this._openIntent}setOpenIntent(e){this._openIntent=e}get connectOptions(){return this._connectOptions}setConnectOptions(e){var r;this._connectOptions=e,(r=this.onConnectOptionsChange)==null||r.call(this,e)}async setDefaultChainId(e){var r;return await((r=this.prompter)==null?void 0:r.promptChangeNetwork(e)),this.defaultChainId()}async getNetworks(e){return this.account?e?this.account.networks.map(r=>{const n=Bc({},r);return n.provider=void 0,n.relayer=void 0,n}):this.account.networks:(mi.warn("signer not set: getNetworks is returning an empty list"),[])}walletSession(e){if(!this.account)return;const r={walletContext:this.account.contexts,accountAddress:this.account.address,networks:this.account.networks.map(i=>Bc({},i,{provider:void 0,relayer:void 0}))};if(e){const i=Pw(r.networks,e);if(i){var n;(n=r.networks)==null||n.forEach(s=>delete s.isDefaultChain),i.isDefaultChain=!0}}return r}notifyConnect(e,r){var n;if(console.log("emit connect",e),this.events.emit("connect",e),(n=e.session)!=null&&n.accountAddress){var i;this.events.emit("accountsChanged",[(i=e.session)==null?void 0:i.accountAddress],r)}}notifyDisconnect(e){this.events.emit("accountsChanged",[],e),this.events.emit("disconnect",void 0,e)}notifyChainChanged(e,r){this.events.emit("chainChanged",jc(e),r)}async notifyNetworks(e){const r=e||await this.getNetworks(!0);if(this.events.emit("networks",r),r.length>0){const n=r.find(i=>i.chainId===this.defaultChainId());n&&this.events.emit("chainChanged",jc(n.chainId))}else this.events.emit("chainChanged","0x0")}async notifyWalletContext(){if(!this.account){mi.warn("signer not set: skipping to notify wallet context");return}const e=this.account.contexts;this.events.emit("walletContext",e)}notifyClose(e){this.events.emit("close",e)}setAccount(e){if(this.account=e,e!==void 0){for(let r=0;rc.canOnchainValidate||c.original.version===2&&n,o=await r.status(i);if(s(o))return!0;if(await e.promptConfirmWalletDeploy(i,this.connectOptions)){const c=await r.status(i);return s(c)?!0:(mi.error("WalletRequestHandler: result for promptConfirmWalletDeploy is not correct"),!1)}return!1}}function M$(t,e){return{context:e.original.context,config:e.onChain.config,address:yt.context.addressOf(e.original.context,e.original.imageHash),chainId:t,deployed:e.onChain.deployed,imageHash:e.imageHash,lastImageHash:e.onChain.imageHash,published:!0,status:e}}const YLe=["net_version","eth_chainId","eth_getBalance","eth_getTransactionCount","eth_blockNumber","eth_getBlockByNumber","eth_getBlockByHash","eth_getTransactionByHash","eth_getCode","eth_estimateGas","eth_gasPrice","sequence_getWalletContext","sequence_getNetworks","sequence_setDefaultNetwork"];function QLe(t){return t&&typeof t=="object"&&typeof t.send=="function"&&typeof t.getNetwork=="function"}function JLe(t,e){if(t==null)return{};var r={};for(var n in t)if({}.hasOwnProperty.call(t,n)){if(e.includes(n))continue;r[n]=t[n]}return r}class RE{get utils(){return this.provider.utils}constructor(e,r){this.client=e,this.provider=r,this.singleNetworkSigners={},this._isSequenceSigner=!0}async getAddress(){return this.client.getAddress()}connect(e){if(!QM.is(e))throw new Error("SequenceSigner can only be connected to a SequenceProvider");return new RE(this.client,e)}getSigner(e){if(!e)return this;const r=this.provider.toChainId(e);return this.singleNetworkSigners[r]||(this.singleNetworkSigners[r]=new Pte(this.client,this.provider,r)),this.singleNetworkSigners[r]}useChainId(e){return this.provider.toChainId(e)||this.client.getChainId()}async signMessage(e,r){const{eip6492:n=!0}=r||{},i=this.useChainId(r==null?void 0:r.chainId);return this.client.signMessage(e,{eip6492:n,chainId:i})}async signTypedData(e,r,n,i){const{eip6492:s=!0}=i||{},o=this.useChainId(i==null?void 0:i.chainId);return this.client.signTypedData({domain:e,types:r,message:n},{eip6492:s,chainId:o})}getProvider(e){return this.provider.getProvider(e)}async sendTransaction(e,r){const n=this.useChainId(r==null?void 0:r.chainId),i=await HLe(e),s=await this.client.sendTransaction(i,{chainId:n}),o=this.getProvider(n);try{return await new Promise(c=>{(async function f(){const u=await o.getTransaction(s);if(u!==null)return c(u);await o.once("block",f)})()})}catch(a){throw a.transactionHash=s,a}}async getWalletConfig(e){const r=this.useChainId(e);return this.client.getOnchainWalletConfig({chainId:r})}getNetworks(){return this.client.getNetworks()}async getBalance(e,r){return this.getProvider(r==null?void 0:r.chainId).getBalance(this.getAddress(),e)}async estimateGas(e,r){return this.getProvider(r==null?void 0:r.chainId).estimateGas(e)}async call(e,r){return this.getProvider(r==null?void 0:r.chainId).call(e)}getChainId(){return Promise.resolve(this.client.getChainId())}async getFeeData(e){return this.getProvider(e==null?void 0:e.chainId).getFeeData()}async resolveName(e){const r=await this.provider.resolveName(e);if(r===null)throw new Error(`ENS name not found: ${e}`);return r}_checkProvider(e){}getNonce(e){throw new Error("SequenceSigner does not support getNonce")}populateCall(e){throw new Error("SequenceSigner does not support populateCall")}populateTransaction(e){throw new Error("SequenceSigner does not support populateTransaction")}checkTransaction(e){throw new Error("SequenceSigner does not support checkTransaction")}getTransactionCount(e){throw new Error("SequenceSigner does not support getTransactionCount")}signTransaction(e){throw new Error("SequenceWallet does not support signTransaction, use sendTransaction instead.")}static is(e){return e&&typeof e=="object"&&e._isSequenceSigner===!0}}class Pte extends RE{constructor(e,r,n){super(e,r.getProvider(n)),this.chainId=n,this._isSingleNetworkSequenceSigner=!0}_useChainId(e){const r=this.provider.toChainId(e);if(r&&r!==this.chainId)throw new Error(`This signer only supports the network ${this.chainId}, but ${r} was requested.`);return r||this.provider.toChainId(this.chainId)}useChainId(e){return this._useChainId(e)}getChainId(){return Promise.resolve(this.provider.toChainId(this.chainId))}getProvider(e){return super.getProvider(this._useChainId(e))}getSigner(e){if(this._useChainId(e)!==this.chainId)throw new Error("Unreachable code");return this}static is(e){return e&&typeof e=="object"&&e._isSingleNetworkSequenceSigner===!0}}class ZLe{constructor(e){if(this.signer=e,Pte.is(e))throw new Error("WalletUtils does not support SingleNetworkSequenceSigner")}signMessage(e,r,n){return this.signer.signMessage(e,{chainId:r,eip6492:n})}signTypedData(e,r,n,i,s){return this.signer.signTypedData(e,r,n,{chainId:i,eip6492:s})}async isValidSignature(e,r,n,i){return k$(e,r,n,this.signer.getProvider(i))}async isValidMessageSignature(e,r,n,i){const s=this.signer.getProvider(i),o=Tte(r),a=CEe(o);return k$(e,a,n,s)}isValidTypedDataSignature(e,r,n,i){return this.isValidSignature(e,Nk(r),n,i)}}const XLe=["method"],R$=["connect","disconnect","chainChanged","accountsChanged"];class QM extends dJ{constructor(e,r,n=Zk,i){super(e.getChainId(),i),this.client=e,this.providerFor=r,this.networks=n,this.options=i,this.singleNetworkProviders={},this._isSequenceProvider=!0,this.utils=void 0,this.signer=void 0,this.eip1193EventListeners=new Map,e.onConnect(s=>{var o;(o=this.eip1193EventListeners.get("connect"))==null||o.forEach(a=>a(s))}),e.onDisconnect(s=>{var o;(o=this.eip1193EventListeners.get("disconnect"))==null||o.forEach(a=>a(s))}),e.onDefaultChainIdChanged(s=>{var o;(o=this.eip1193EventListeners.get("chainChanged"))==null||o.forEach(a=>a(s))}),e.onAccountsChanged(s=>{var o;(o=this.eip1193EventListeners.get("accountsChanged"))==null||o.forEach(a=>a(s))}),this.signer=new RE(this.client,this),this.utils=new ZLe(this.signer)}async on(e,r){if(R$.includes(e)){const n=this.eip1193EventListeners.get(e)||new Set;return n.add(r),this.eip1193EventListeners.set(e,n),this}return super.on(e,r)}async off(e,r){if(R$.includes(e)){const n=this.eip1193EventListeners.get(e);return n&&(r?n.delete(r):n.clear()),this}return super.off(e,r)}getSigner(e){return this.signer.getSigner(e)}connect(e){return this.client.connect(e)}disconnect(){return this.client.disconnect()}isConnected(){return this.client.isConnected()}getSession(){return this.client.getSession()}listAccounts(){return[this.client.getAddress()]}getAddress(){return this.client.getAddress()}getNetworks(){return this.client.getNetworks()}getChainId(){return this.client.getChainId()}setDefaultChainId(e){return this.client.setDefaultChainId(this.toChainId(e))}isOpened(){return this.client.isOpened()}closeWallet(){return this.client.closeWallet()}getWalletContext(){return this.client.getWalletContext()}async getWalletConfig(e){const r=await this.useChainId(e);return this.client.getOnchainWalletConfig({chainId:r})}authorize(e){return this.client.connect(Bc({},e,{authorize:!0}))}async openWallet(e,r){return await this.client.openWallet(e,r),!0}toChainId(e){if(e===void 0)return;const r=Pw(this.networks,e);if(!r)throw new Error(`Unsupported network ${e}`);return r.chainId}async useChainId(e){return this.toChainId(e)||this.client.getChainId()}getProvider(e){if(!e)return this;const r=this.toChainId(e);return this.singleNetworkProviders[r]||(this.singleNetworkProviders[r]=new eFe(this.client,this.providerFor,r,this.options)),this.singleNetworkProviders[r]}async _getSubprovider(e){const r=await this.useChainId(e),n=this.providerFor(r);if(!n)throw new Error(`Unsupported network ${r}`);return n}async _perform(e){var r;const{method:n}=e,i=JLe(e,XLe),s=await this._getSubprovider(),o=(r=s.getRpcRequest(e))!=null?r:{method:n,args:Object.values(i)};if(!o)throw new Error(`Unsupported method ${e.method}`);return s.send(o.method,o.args)}async perform(e,r){if(e==="eth_chainId")return jc(await this.useChainId());if(e==="eth_accounts")return[this.client.getAddress()];if(e==="wallet_switchEthereumChain"){const n=r[0],i=kte(n);return this.setDefaultChainId(i)}return e==="eth_sendTransaction"||e==="eth_sign"||e==="eth_signTypedData"||e==="eth_signTypedData_v4"||e==="personal_sign"||e==="sequence_sign"||e==="sequence_signTypedData_v4"?this.client.request({method:e,params:r,chainId:this.getChainId()}):this._perform(Bc({method:e},r))}send(e,r){return this.perform(e,r)}request(e){return this.perform(e.method,e.params)}async _detectNetwork(){const e=this.client.getChainId(),r=Pw(this.networks,e);if(!r)throw new Error(`Unknown network ${e}`);return new sa(r.name,r.chainId)}async detectNetwork(){return this._detectNetwork()}async waitForTransaction(e,r,n,i){return(await this._getSubprovider(i==null?void 0:i.chainId)).waitForTransaction(e,r,n)}async getBlockNumber(e){return(await this._getSubprovider(e==null?void 0:e.chainId)).getBlockNumber()}async getFeeData(e){return(await this._getSubprovider(e==null?void 0:e.chainId)).getFeeData()}async getBalance(e,r,n){return(await this._getSubprovider(n==null?void 0:n.chainId)).getBalance(e,r)}async getTransactionCount(e,r,n){return(await this._getSubprovider(n==null?void 0:n.chainId)).getTransactionCount(e,r)}async getCode(e,r,n){return(await this._getSubprovider(n==null?void 0:n.chainId)).getCode(e,r)}async getStorage(e,r,n,i){return(await this._getSubprovider(i==null?void 0:i.chainId)).getStorage(e,r,n)}async call(e,r){return(await this._getSubprovider(r==null?void 0:r.chainId)).call(e)}async estimateGas(e,r){return(await this._getSubprovider(r==null?void 0:r.chainId)).estimateGas(e)}async getBlock(e,r,n){return(await this._getSubprovider(n==null?void 0:n.chainId)).getBlock(e,r)}async getTransaction(e,r){return(await this._getSubprovider(r==null?void 0:r.chainId)).getTransaction(e)}async getLogs(e,r){return(await this._getSubprovider(r==null?void 0:r.chainId)).getLogs(e)}async supportsENS(){return(await this.getNetworks()).some(r=>r.chainId===1)}async getResolver(e){return await this.supportsENS()?(await this._getSubprovider(1)).getResolver(e):null}async resolveName(e){return yw(e)?e:await this.supportsENS()?(await this._getSubprovider(1)).resolveName(e):null}async lookupAddress(e){return await this.supportsENS()?(await this._getSubprovider(1)).lookupAddress(e):null}async getAvatar(e){return await this.supportsENS()?(await this._getSubprovider(1)).getAvatar(e):null}}QM.is=t=>t&&typeof t=="object"&&t._isSequenceProvider===!0;function kte(t){return typeof t=="object"?kte(t.chainId):Number(t)}class eFe extends QM{constructor(e,r,n,i){super(e,r,void 0,i),this.chainId=n,this._isSingleNetworkSequenceProvider=!0}_useChainId(e){const r=this.toChainId(e);if(r&&r!==this.chainId)throw new Error(`This provider only supports the network ${this.chainId}, but ${r} was requested.`);return r||super.toChainId(this.chainId)}useChainId(e){return Promise.resolve(this._useChainId(e))}getChainId(){return super.toChainId(this.chainId)}async getNetwork(){const e=await this.client.getNetworks(),r=Pw(e,this.chainId);if(!r)throw new Error(`Unsupported network ${this.chainId}`);return new sa(r.name,r.chainId)}getProvider(e){if(this._useChainId(e)!==this.chainId)throw new Error("Unreachable code");return this}getSigner(e){return super.getSigner(this._useChainId(e))}setDefaultChainId(e){throw new Error(`This provider only supports the network ${this.chainId}; use the parent provider to switch networks.`)}static is(e){return e&&typeof e=="object"&&e._isSingleNetworkSequenceProvider===!0}}class Zr{constructor(e){ue(this,"networkStore",Br(Wn));ue(this,"authStore",Br(Mi));ue(this,"accountAddress",this.authStore.accountAddress.get());ue(this,"availableExternalProviders",Or([]));ue(this,"selectedExternalProvider",Or(void 0));ue(this,"selectedExternalWalletAddress",Or(void 0));ue(this,"isSendingTokenTransaction",Or(void 0));ue(this,"isSendingCollectibleTransaction",Or(void 0));ue(this,"isSendingSignedTokenTransaction",Or(void 0));ue(this,"connectDetails",Or(void 0));ue(this,"connectOptions",Or(void 0));ue(this,"isSigningTxn",Or(!1));ue(this,"isSigningMsg",Or(!1));ue(this,"toSignPermission",Or(void 0));ue(this,"toSignResult",Or(void 0));ue(this,"toSignTxnDetails",Or(void 0));ue(this,"toSignMsgDetails",Or(void 0));ue(this,"isCheckingWalletDeployment",Or(!1));ue(this,"signClientWarningType",Or(!1));ue(this,"walletRequestHandler");ue(this,"local",{lastConnectedExternalProviderInfo:new eu(Ol.LAST_CONNECTED_EXTERNAL_PROVIDER_INFO)});ue(this,"defaultNetwork",new eu(Ol.DEFAULT_NETWORK));ue(this,"getLastConnectedExternalProviderInfo",()=>this.local.lastConnectedExternalProviderInfo.get());ue(this,"sendToken",async(e,r,n)=>{var i,s;try{const o=this.store.get(Mi).account,a=e.chainId;if(!o)throw new Error("No account found");const c=this.store.get(Wn).providerForChainId(a);this.isSendingTokenTransaction.set({tokenBalance:e,to:r,amount:n});const l=(i=this.selectedExternalProvider.get())==null?void 0:i.provider;if(!l)throw new Error("No external provider selected");const u=(await this.getExternalProviderAccounts(l))[0];await this.switchToChain(l,a);let p;if(!n)return{hash:""};if(e.contractType===hh.NATIVE?(console.info("Sending native token with address, on chainId: ",e.contractAddress,a),p={to:r,value:d6e(n)}):e.contractType===hh.ERC20&&(console.info("Sending ERC20 token with address, on chainId: ",e.contractAddress,a),p=await new Bn(e.contractAddress,qv,c).transfer.populateTransaction(r,G7(n,((s=e.contractInfo)==null?void 0:s.decimals)??18))),!p)throw this.isSendingTokenTransaction.set(void 0),new Error("Could not create transaction");let g;try{g=(await this.sendTransaction(o,l,u,p,a)).hash}catch(y){throw this.isSendingTokenTransaction.set(void 0),y}return{hash:g}}catch{throw this.isSendingTokenTransaction.set(void 0),new Error("Could not create transaction")}});ue(this,"sendCollectible",async(e,r,n)=>{var i,s;try{const o=this.store.get(Mi).account,a=e.collectibleInfoParams.chainId;if(!o)throw new Error("No account found");const c=this.store.get(Wn).providerForChainId(a);this.isSendingCollectibleTransaction.set({collectibleInfo:e,to:r,amount:n});const l=(i=this.selectedExternalProvider.get())==null?void 0:i.provider;if(!l)throw new Error("No external provider selected");const u=(await this.getExternalProviderAccounts(l))[0];await this.switchToChain(l,a);let p;if(e.collectibleInfoParams.contractType==="ERC721")console.info("Sending ERC721 non-fungible token with address, on chainId: ",e.collectibleInfoParams.address,a),p=await new Bn(e.collectibleInfoParams.address,pM,c).safeTransferFrom.populateTransaction(o,r,e.collectibleInfoParams.tokenId);else if(e.collectibleInfoParams.contractType==="ERC1155"){console.info("Sending ERC1155 token with address, on chainId: ",e.collectibleInfoParams.address,a);const y=new Bn(e.collectibleInfoParams.address,vM,c);if(!n)return{hash:""};p=await y.safeTransferFrom.populateTransaction(o,r,e.collectibleInfoParams.tokenId,G7(n,((s=e==null?void 0:e.collectibleInfoResponse)==null?void 0:s.decimals)??18),"0x")}if(!p)throw this.isSendingCollectibleTransaction.set(void 0),new Error("Could not create transaction");let g;try{g=(await this.sendTransaction(o,l,u,p,a)).hash}catch(y){throw this.isSendingCollectibleTransaction.set(void 0),y}return{hash:g}}catch{throw this.isSendingCollectibleTransaction.set(void 0),new Error("Could not create transaction")}});ue(this,"setExternalProvider",async e=>{if(!e){this.selectedExternalProvider.set(void 0),this.selectedExternalWalletAddress.set(void 0),this.local.lastConnectedExternalProviderInfo.set(void 0);return}const n=(await this.getExternalProviderAccounts(e.provider))[0];this.local.lastConnectedExternalProviderInfo.set(e.info),this.selectedExternalProvider.set(e),this.selectedExternalWalletAddress.set(n),e.provider.on("accountsChanged",async i=>{if(i.length===0){this.selectedExternalProvider.set(void 0),this.selectedExternalWalletAddress.set(void 0);return}if(i[0]!==n){const o=(await this.getExternalProviderAccounts(e.provider))[0];this.selectedExternalWalletAddress.set(o)}})});ue(this,"resetSignObservables",()=>{this.isSigningTxn.set(!1),this.toSignTxnDetails.set(void 0),this.toSignMsgDetails.set(void 0),this.toSignPermission.set(void 0),this.toSignResult.set(void 0)});ue(this,"checkWalletDeployment",async e=>{const r=this.store.get(Mi).account;if(!r)throw new Error("No account found");return(await r.status(e)).onChain.deployed});this.store=e,this.walletRequestHandler=new KLe(void 0,new tFe(e),this.networkStore.networks.get()),this.walletRequestHandler.onConnectOptionsChange=n=>{this.connectOptions.set(n)},this.availableExternalProviders.subscribe(n=>{const i=this.local.lastConnectedExternalProviderInfo.get(),s=n.find(o=>(i==null?void 0:i.name)===o.info.name);s&&this.setExternalProvider(s)});const r=this.store.get(Mi).account;this.walletRequestHandler.signIn(r??null)}async sendTransaction(e,r,n,i,s){const o=await e.status(s),a=await e.predecorateTransactions(i,o,s),c=await e.signTransactions(a,s,void 0,{serial:!0}),l=await e.decorateTransactions(c,o);await this.switchToChain(r,s);const f=await r.request({method:"eth_estimateGas",params:[{from:n,to:l.entrypoint,data:yt.transaction.encodeBundleExecData(l)}]});return{hash:await r.request({method:"eth_sendTransaction",params:[{from:n,to:l.entrypoint,data:yt.transaction.encodeBundleExecData(l),gas:f}]})}}async getExternalProviderAccounts(e){return new Promise((r,n)=>{var i;(i=e.sendAsync)==null||i.call(e,{method:"eth_requestAccounts",params:[]},(s,o)=>{s&&n(s),o.result.length===0&&n(new Error("No accounts found")),r(o.result)})})}async getExternalProviderAddress(e){return(await this.getExternalProviderAccounts(e))[0]}async switchToChain(e,r){return new Promise((n,i)=>{var s;(s=e.sendAsync)==null||s.call(e,{method:"wallet_switchEthereumChain",params:[{chainId:jc(r)}]},(o,a)=>{o&&i(o),n(a)})})}}class tFe{constructor(e){this.store=e}getDefaultChainId(){return this.store.get(Zr).defaultNetwork.get()??1}async promptChangeNetwork(e){return this.store.get(Wn).networks.get().some(n=>n.chainId===e)?(this.store.get(Zr).defaultNetwork.set(e),!0):!1}async promptConfirmWalletDeploy(e,r){if(console.log("prompt confirm wallet deploy:",e,r),!e)return Promise.resolve(!1);const n=await this.store.get(Zr).checkWalletDeployment(e);return new Promise((i,s)=>{i(!!n)})}async promptConnect(e){console.log("promptconnect",e);const r=this.store.get(Mi).account;return await this.store.get(Zr).walletRequestHandler.signIn(r??null),e&&this.store.get(Zr).walletRequestHandler.setConnectOptions(e),new Promise((n,i)=>{const s=this.store.get(Zr).connectDetails.subscribe(o=>{s(),!o||!o.connected?i("connect cancelled by user"):n(o)})})}async promptSignInConnect(e){return console.log("prompt sign in connect:",e),{connected:!1}}async promptSignMessage(e,r){return console.log("prompt sign message:",e,r),e.chainId?e.eip6492!==!0&&!(await this.store.get(Mi).account.status(e.chainId)).canOnchainValidate&&!await this.promptConfirmWalletDeploy(e.chainId,r)?(this.store.get(Zr).signClientWarningType.set("notDeployed"),Promise.reject("User rejected wallet deploy request")):(this.store.get(Zr).isSigningMsg.set(!0),this.store.get(Zr).toSignMsgDetails.set({message:e,chainId:e.chainId,options:r}),new Promise((n,i)=>{const s=this.store.get(Zr).toSignPermission.subscribe(()=>{s();const o=this.store.get(Zr).toSignPermission.get();if(this.store.get(Zr).toSignPermission.set(void 0),!o||o==="cancelled")i("request failed");else{const a=this.store.get(Zr).toSignResult.get();a&&n(a.hash)}})})):Promise.reject("No chainId found in message")}promptSignTransaction(e,r,n){console.log("prompt sign transaction:",e,r,n);let i;Array.isArray(e)?i=e:i=[e];const s=this.store.get(Mi).accountAddress.get();if(!s)throw new Error("Unknown account address");const o=yt.transaction.fromTransactionish(s,i);return console.log("prompt sign txn:",o,r,n),_I(s,i),new Promise((a,c)=>{this.store.get(Zr).toSignTxnDetails.set({txn:i,chainId:r,options:n}),this.store.get(Zr).isSigningTxn.set(!0);const l=this.store.get(Zr).toSignPermission.subscribe(()=>{l();const f=this.store.get(Zr).toSignPermission.get();if(this.store.get(Zr).toSignPermission.set(void 0),!f||f==="cancelled")c("request failed");else{const u=this.store.get(Zr).toSignResult.get();u&&a(u.hash)}})})}promptSendTransaction(e,r,n){return this.promptSignTransaction(e,r,n)}}async function Mte(t){return await wLe.init({projectId:iX,showQrModal:t,optionalChains:[1],metadata:{name:"Sequence Recovery Wallet External Wallet",description:"",url:"TODO_CHANGE_LATER",icons:[]}})}function rFe(){const[t,e]=N.useState(null),n=Br(Zr).getLastConnectedExternalProviderInfo();return N.useEffect(()=>{async function i(){const s=await Mte(!1);await s.enable(),e(s)}return(n==null?void 0:n.name)==="WalletConnect"&&i(),()=>{t&&t.disconnect()}},[]),t}const O$=async(t,e,r=15)=>{let n,i=0;do{if(i>5&&await new Promise(s=>setTimeout(s,100*i)),n=await t.getTransactionReceipt(e),i===r){console.warn(`Could not get receipt for transaction ${e} after ${i} tries`);return}if(n)return n;i++}while(!n&&i<=r)};let N6=[];const aS={value:()=>N6,subscribe:t=>{function e(r){N6.some(n=>n.info.uuid===r.detail.info.uuid)||(N6=[...N6,r.detail],t())}return window.addEventListener("eip6963:announceProvider",e),window.dispatchEvent(new Event("eip6963:requestProvider")),()=>window.removeEventListener("eip6963:announceProvider",e)}},Rte=()=>N.useSyncExternalStore(aS.subscribe,aS.value,aS.value);class OE{constructor(e){ue(this,"authStore",Br(Mi));ue(this,"accountAddress",this.authStore.accountAddress.get());ue(this,"isReady",Or(!1));ue(this,"signClient");ue(this,"currentRequestInfo");ue(this,"allSessions",Or([]));ue(this,"sessions",this.allSessions.readOnly());ue(this,"createSignClient",async()=>{this.signClient=await ME.init({projectId:iX,metadata:{name:"Sequence Recovery Wallet",description:"Sequence Recovery Wallet - Recover Your Wallet",url:"http://localhost:5173",icons:["https://sequence.app/apple-touch-icon.png"]}}),this.signClient.on("session_proposal",this.onSessionProposal),this.signClient.on("session_request",this.onSessionRequest),this.signClient.on("session_ping",this.onSessionPing),this.signClient.on("session_event",this.onSessionEvent),this.signClient.on("session_update",this.onSessionUpdate),this.signClient.on("session_delete",this.onSessionDelete);const e=this.getSignClientSessions();e?this.allSessions.set(e):this.allSessions.set([]),this.isReady.set(!0)});ue(this,"getSignClientSessions",()=>this.signClient.session.getAll().filter(r=>r.self.metadata.name!=="Sequence Recovery Wallet External Wallet"));ue(this,"pair",async e=>{if(!this.signClient)throw new Error("WalletConnect signClient not initialized.");await this.signClient.core.pairing.pair({uri:e}),this.allSessions.set(this.getSignClientSessions())});ue(this,"rejectRequest",()=>{var e;this.currentRequestInfo&&((e=this.signClient)==null||e.respond({topic:this.currentRequestInfo.topic,response:{id:this.currentRequestInfo.id,jsonrpc:"2.0",error:{message:"User rejected.",code:4001}}}))});ue(this,"disconnectSession",async e=>{var n,i;const r=(n=this.signClient)==null?void 0:n.session.get(e);r&&(await((i=this.signClient)==null?void 0:i.engine.client.disconnect({topic:r.topic,reason:{message:"User disconnected.",code:6e3}})),this.allSessions.set(this.getSignClientSessions()??[]))});ue(this,"disconnectAllSessions",async()=>{var r;(((r=this.signClient)==null?void 0:r.session.getAll())??[]).forEach(async n=>{var i;await((i=this.signClient)==null?void 0:i.engine.client.disconnect({topic:n.topic,reason:{message:"User disconnected.",code:6e3}}))}),this.allSessions.set([])});ue(this,"onSessionProposal",async e=>{var l,f,u,p,g;console.log("onSessionProposal",e);const r=e.params.requiredNamespaces,n=e.params.optionalNamespaces,i=Object.keys(r).length===0?[]:r.eip155.chains??[],s=Object.keys(n).length===0?[]:n.eip155.chains??[],o=((l=i[0])==null?void 0:l.split(":").pop())??((f=s[0])==null?void 0:f.split(":").pop());if(!o)throw new Error("No chainId found in WalletConnect session proposal namespaces.");const a={app:e.params.proposer.metadata.name,origin:e.params.proposer.metadata.url,networkId:o,keepWalletOpened:!0},c=await this.store.get(Zr).walletRequestHandler.promptConnect(a);if(c&&c.connected){const b=this.store.get(Wn).networks.get(),I=i.map(_=>Number(_.split(":").pop())),C=s.map(_=>Number(_.split(":").pop())),L={eip155:{accounts:b.map(_=>_.chainId).filter(_=>[...I,...C].includes(_)).map(_=>"eip155:"+_+":"+this.accountAddress),methods:["eth_sendTransaction","eth_sign","personal_sign","eth_signTypedData","eth_signTypedData_v4","wallet_switchEthereumChain"],events:["chainChanged","accountsChanged","connect","disconnect"]}},F=await((u=this.signClient)==null?void 0:u.approve({id:e.id,namespaces:L})),H=await(F==null?void 0:F.acknowledged());console.log("session",H),this.allSessions.set(this.getSignClientSessions()??[]),(p=this.signClient)==null||p.core.pairing.getPairings().filter(_=>e.params.pairingTopic!==_.topic).forEach(async _=>{var U,ie;e.params.proposer.metadata.url===((U=_.peerMetadata)==null?void 0:U.url)&&await((ie=this.signClient)==null?void 0:ie.core.pairing.disconnect({topic:_.topic}))})}else(g=this.signClient)==null||g.reject({id:e.id,reason:{message:"User rejected.",code:5e3}})});ue(this,"onSessionRequest",async e=>{var o,a,c;console.log("onSessionRequest",e);const r=e.params.chainId.split(":").pop(),n={jsonrpc:"2.0",id:e.id,method:e.params.request.method,params:e.params.request.params,chainId:Number(r)};n.method==="eth_sendTransaction"&&Array.isArray(n.params)&&n.params.forEach(l=>{delete l.nonce});const i=(o=this.signClient)==null?void 0:o.session.get(e.topic),s={app:(i==null?void 0:i.peer.metadata.name)??"",origin:i==null?void 0:i.peer.metadata.url,networkId:r};this.store.get(Zr).walletRequestHandler.setConnectOptions(s),this.currentRequestInfo={topic:e.topic,id:e.id};try{const l=await this.store.get(Zr).walletRequestHandler.request(n);(a=this.signClient)==null||a.respond({topic:e.topic,response:{id:e.id,jsonrpc:"2.0",result:l}})}catch(l){(c=this.signClient)==null||c.respond({topic:e.topic,response:{id:e.id,jsonrpc:"2.0",error:{message:l.message,code:l.code??4001}}})}this.currentRequestInfo=void 0});ue(this,"onSessionPing",async e=>{console.log("onSessionPing",e)});ue(this,"onSessionEvent",async e=>{console.log("onSessionEvent",e)});ue(this,"onSessionUpdate",async e=>{console.log("onSessionUpdate",e)});ue(this,"onSessionDelete",async e=>{console.log("onSessionDelete",e),this.allSessions.set(this.getSignClientSessions()??[])});this.store=e,this.createSignClient()}}const N$=["https://dweb.link/ipfs/","https://gateway.pinata.cloud/ipfs/","https://nftstorage.link/ipfs/","https://flk-ipfs.io/ipfs/","https://storry.tv/ipfs/","https://ipfs.io/ipfs/","https://hardbin.com/ipfs/","https://ipfs.runfission.com/ipfs/","https://ipfs.eth.aragon.network/ipfs/","https://4everland.io/ipfs/","https://w3s.link/ipfs/","https://trustless-gateway.link/ipfs/"],nFe="QmeSjSinHpPnmXmspMjwiXyN6zS4E9zccariGR3jxcaWtq/1";class iFe{constructor(){ue(this,"gatewayURL");ue(this,"localStore");this.localStore=new eu(Ol.GATEWAY_ADDRESS),this.gatewayURL=this.localStore.get(),this.findAccessibleGateway()}async findAccessibleGateway(){const e=this.localStore.get();if(e&&await this.isGatewayAccessible(e)){this.gatewayURL=e;return}for(const r of N$)if(await this.isGatewayAccessible(r)){this.gatewayURL=r,this.localStore.set(r);return}this.gatewayURL=N$[0],console.warn("No accessible IPFS gateways found, falling back to default")}async isGatewayAccessible(e){try{return await fetch(`${e}${nFe}`,{signal:AbortSignal.timeout(3e3)}),!0}catch{return!1}}async fetch(e){this.gatewayURL||await this.findAccessibleGateway();const r=await this.getGatewayURL(e);return fetch(r,{signal:AbortSignal.timeout(3e3)})}async getGatewayURL(e){if(this.gatewayURL||await this.findAccessibleGateway(),!e.startsWith("ipfs://"))throw new Error("Invalid IPFS URI");return e.replace("ipfs://",this.gatewayURL)}}function sFe(t,e){e(t.get()),t.subscribe(e)}class JM{constructor(e){ue(this,"isFetchingBalances",Or(!1));ue(this,"isFetchingCollectibleInfo",Or(!1));ue(this,"ipfsGatewayHelper",new iFe);ue(this,"userCollectibles",Or([]));ue(this,"local",{userCollectibles:new eu(Ol.COLLECTIBLES)});this.store=e;const r=this.store.get(Wn);sFe(r.networks,n=>{const i=this.store.get(Mi).accountAddress.get();i&&n.length>0&&this.loadBalances(i)})}async loadBalances(e){const r=this.local.userCollectibles.get()??[];if(r.length===0)return;this.isFetchingBalances.set(!0);const n=[],i=r.map(async s=>{const o=await this.getCollectibleInfo(s);if(!o.isOwner){this.removeCollectible({collectibleInfoParams:s,collectibleInfoResponse:o});return}n.push({collectibleInfoParams:s,collectibleInfoResponse:o})});await Promise.allSettled(i),this.userCollectibles.set(n),this.isFetchingBalances.set(!1)}async getCollectibleInfo(e){const r=this.store.get(Mi).accountAddress.get();if(!r)throw new Error("No account found");const n=this.store.get(Wn).providerForChainId(e.chainId);this.isFetchingCollectibleInfo.set(!0);let i,s,o,a,c;if(e.contractType===hh.ERC721){const f=new Bn(e.address,pM,n),p=(await f.ownerOf(e.tokenId)).toLowerCase()===r.toLowerCase();if(!p)return this.isFetchingCollectibleInfo.set(!1),{isOwner:p,uri:""};i=await f.tokenURI(e.tokenId)}else if(e.contractType===hh.ERC1155){const f=new Bn(e.address,vM,n);if(a=await f.balanceOf(r,e.tokenId),!a)return this.isFetchingCollectibleInfo.set(!1),{isOwner:!1,uri:""};a=a??BigInt(1),i=await f.uri(e.tokenId)}if(!i)throw new Error("Could not get collectible URI");i.includes("{id}")&&(i=i.replace("{id}",e.tokenId.toString()));let l;try{i.startsWith("ipfs://")?l=await this.ipfsGatewayHelper.fetch(i).then(f=>f.json()):l=await fetch(i).then(f=>f.json()),l&&(c=l.decimals,s=l.image,o=l.name),s!=null&&s.startsWith("ipfs://")&&(s=await this.ipfsGatewayHelper.getGatewayURL(s))}catch{o||(o=`No Metadata Found Address: ${e.address} TokenId: ${e.tokenId}`)}return c=c??0,this.isFetchingCollectibleInfo.set(!1),{isOwner:!0,uri:i,image:s,name:o,balance:a,decimals:c}}async addCollectible(e){if(e.collectibleInfoResponse.isOwner){const r=this.local.userCollectibles.get()??[];if(r.some(n=>n.address===e.collectibleInfoParams.address&&n.tokenId===e.collectibleInfoParams.tokenId))throw new Error("Collectible already added");this.local.userCollectibles.set([...r,e.collectibleInfoParams]),this.isFetchingCollectibleInfo.set(!0),this.loadBalances(),this.isFetchingCollectibleInfo.set(!1)}}async removeCollectible(e){const n=(this.local.userCollectibles.get()??[]).filter(o=>o.address!==e.collectibleInfoParams.address||o.tokenId!==e.collectibleInfoParams.tokenId);this.local.userCollectibles.set(n);const s=this.userCollectibles.get().filter(o=>o.collectibleInfoParams.address!==e.collectibleInfoParams.address||o.collectibleInfoParams.tokenId!==e.collectibleInfoParams.tokenId);this.userCollectibles.set(s)}}function ZM({chainId:t,paddingTop:e="1",paddingBottom:r="2"}){return W.jsx(we,{background:"backgroundMuted",width:"fit",height:"fit",borderRadius:"sm",paddingTop:e,paddingBottom:r,paddingX:"2",children:W.jsx(Qe,{variant:"xsmall",color:"text100",children:Ry(t)})})}function oFe({collectibleInfo:t,onSendClick:e,onRemoveClick:r}){return W.jsxs(en,{width:"full",flexDirection:"column",gap:"2",padding:"4",children:[W.jsx(we,{flexDirection:"row",alignItems:"center",gap:"2",children:W.jsx(Qe,{variant:"medium",color:"text80",wordBreak:"break-word",children:t.collectibleInfoResponse.name??"Collectible"})}),t.collectibleInfoResponse.image&&W.jsx(we,{style:{height:"200px"},children:W.jsx(i8,{style:{maxWidth:"100%",maxHeight:"100%",objectFit:"contain"},src:t.collectibleInfoResponse.image,width:"full"})}),W.jsx(we,{justifyContent:"flex-end",children:W.jsx(Qe,{variant:"medium",color:"text100",children:t.collectibleInfoParams.contractType==="ERC1155"?Number(uh(t.collectibleInfoResponse.balance,t.collectibleInfoResponse.decimals??0)):1})}),W.jsxs(we,{flexDirection:"row",justifyContent:"space-between",children:[W.jsx(ZM,{chainId:t.collectibleInfoParams.chainId}),W.jsxs(we,{children:[W.jsx(Jt,{size:"xs",label:"Send",variant:"primary",shape:"square",onClick:e}),r&&W.jsx(Jt,{marginLeft:"2",size:"xs",label:"Remove",shape:"square",onClick:r})]})]})]})}function aFe({onClose:t}){const r=Br(Wn).networks.get(),n=r.filter(H=>H.type===Bt.MAINNET),i=Br(JM),s=on(i.isFetchingCollectibleInfo),o=f8(),[a,c]=N.useState(),[l,f]=N.useState(),[u,p]=N.useState(),[g,y]=N.useState(),[b,I]=N.useState(),[C,S]=N.useState(!1);N.useEffect(()=>{a&&l&&u&&g?i.getCollectibleInfo({chainId:a.chainId,address:l,tokenId:u,contractType:g}).then(H=>{I(H)}):I(void 0)},[a,l,u,g]);const R=n.map(H=>({label:H.title,value:H.chainId.toString()})),L=async()=>{a&&l&&b&&u&&g&&(await i.addCollectible({collectibleInfoParams:{chainId:a.chainId,address:l,tokenId:u,contractType:g},collectibleInfoResponse:b}),S(!1),o({variant:"success",title:"Collectible added"}),F(),t())},F=()=>{f(void 0),c(void 0),p(void 0),y(void 0)};return W.jsxs(en,{flexDirection:"column",paddingY:"4",paddingX:"8",marginBottom:"8",borderRadius:"md",width:"full",height:"full",alignItems:"center",disabled:C,children:[W.jsx(we,{children:W.jsx(Qe,{variant:"medium",color:"text80",children:"Import ERC721 or ERC1155 Collectible"})}),W.jsxs(we,{flexDirection:"column",width:"full",marginTop:"4",gap:"4",children:[W.jsx(k7,{label:"Collectible Network",labelLocation:"left",name:"collectibleNetwork",options:R,onValueChange:H=>c(r.find(_=>_.chainId===Number(H)))}),W.jsx(Pn,{width:"full",label:"Collectible Address",labelLocation:"left",name:"collectibleAddress",value:l??"",onChange:H=>{f(H.target.value)}}),W.jsx(k7,{label:"Collectible Type",labelLocation:"left",name:"collectibleType",options:[{value:"ERC721",label:"ERC721"},{value:"ERC1155",label:"ERC1155"}],onValueChange:H=>y(H)}),W.jsx(Pn,{width:"full",label:"Collectible Token ID",labelLocation:"left",name:"collectibleId",value:u??"",onKeyPress:H=>{/[0-9]/.test(H.key)||H.preventDefault()},onChange:H=>{if(H.target.value===""){p(void 0);return}p(H.target.value)}}),s&&W.jsx(we,{marginTop:"4",alignItems:"center",justifyContent:"center",children:W.jsx(fh,{size:"lg"})}),b&&!b.isOwner&&!s&&W.jsx(we,{alignItems:"center",justifyContent:"center",children:W.jsx(Qe,{variant:"medium",color:"warning",children:"You do not own this collectible"})}),b&&b.isOwner&&!s&&W.jsx(we,{marginTop:"4",alignItems:"center",justifyContent:"center",children:W.jsx(en,{flexDirection:"column",gap:"2",children:W.jsxs(we,{flexDirection:"row",gap:"6",children:[W.jsx("img",{src:b.image??"",alt:b.name??"",style:{width:"120px",height:"auto"}}),W.jsxs(we,{flexDirection:"column",gap:"2",children:[W.jsx(Qe,{variant:"medium",color:"text100",children:b.name??""}),W.jsx(W.Fragment,{children:b.balance&&W.jsxs(W.Fragment,{children:[W.jsx(Qe,{variant:"small",color:"text80",children:"Your Balance:"}),W.jsx(Qe,{variant:"medium",color:"text100",children:Number(uh(b.balance,b.decimals??0))})]})})]})]})})}),W.jsxs(we,{alignItems:"center",justifyContent:"flex-end",gap:"8",marginTop:"4",children:[W.jsx(Jt,{label:"Cancel",variant:"text",size:"md",shape:"square",disabled:C,onClick:()=>{F(),t()}}),W.jsx(Jt,{label:"Add",disabled:b===void 0||!b.isOwner||C,variant:"primary",size:"md",shape:"square",onClick:L})]})]})]})}function cFe({onSendClick:t}){const e=Br(JM),r=on(e.isFetchingBalances),n=on(e.userCollectibles),i=N.useMemo(()=>n,[n]),[s,o]=N.useState(!1);return W.jsxs(W.Fragment,{children:[W.jsxs(we,{width:"full",flexDirection:"row",flexWrap:"wrap",gap:"4",marginBottom:"8",children:[i.map(a=>W.jsx(we,{width:"1/3",children:W.jsx(oFe,{collectibleInfo:a,onSendClick:()=>{t(a)},onRemoveClick:()=>{e.removeCollectible(a)}})},a.collectibleInfoParams.chainId+a.collectibleInfoParams.address+a.collectibleInfoParams.tokenId)),r&&W.jsx(we,{marginTop:"4",alignItems:"center",justifyContent:"center",children:W.jsx(fh,{size:"lg"})})]}),W.jsxs(we,{width:"full",flexDirection:"column",alignItems:"center",justifyContent:"center",marginBottom:"4",children:[s&&W.jsx(aFe,{onClose:()=>o(!1)}),W.jsx(Jt,{label:"Import collectible",leftIcon:qH,variant:"primary",size:"md",shape:"square",onClick:()=>{o(!0)}})]})]})}function cS({symbol:t,chainId:e,to:r,amount:n}){return W.jsxs(we,{flexDirection:"column",width:"full",gap:"4",children:[W.jsx(Qe,{variant:"large",color:"text80",children:"Pending transaction"}),W.jsxs(we,{background:"backgroundMuted",flexDirection:"row",width:"full",height:"fit",borderRadius:"sm",paddingX:"4",paddingY:"2",alignItems:"center",gap:"5",children:[W.jsx(fh,{size:"md"}),W.jsxs(we,{flexDirection:"column",gap:"1",children:[W.jsxs(we,{flexDirection:"row",alignItems:"center",gap:"1",children:[W.jsxs(Qe,{variant:"small",color:"text100",children:["Sending ",n," ",t," on"]}),W.jsx(ZM,{chainId:e,paddingTop:"0",paddingBottom:"1"}),W.jsxs(Qe,{variant:"small",color:"text80",children:["to ",r]})]}),W.jsx(Qe,{variant:"small",color:"text50",children:"Your external wallet will prompt you to confirm the transaction"})]})]})]})}function lFe({onSelectProvider:t}){const e=Br(OE),r=Rte(),[n,i]=N.useState(!1),s=()=>window.confirm("All WalletConnect Dapp sessions will be disconnected. If you would like to continue, click OK and connect to WalletConnect again."),o=async()=>{try{if(!n){if(e.allSessions.get().length!==0){if(!s())throw new Error("User rejected wallet connect modal");await e.disconnectAllSessions(),t();return}i(!0);const a=await Mte(!0);await a.connect();let c=ore(a);t(c)}}catch(a){console.error(a)}};return W.jsx(W.Fragment,{children:!n&&W.jsxs(we,{flexDirection:"column",paddingY:"5",alignItems:"center",children:[W.jsx(Qe,{variant:"md",fontWeight:"bold",color:"text100",paddingX:"16",paddingBottom:"1",children:"Select an external wallet to send transactions"}),W.jsx(Pu,{color:"gradientPrimary",width:"full",height:"px"}),W.jsxs(we,{flexDirection:"column",gap:"4",padding:"8",children:[W.jsx(en,{flexDirection:"row",alignItems:"center",gap:"2",cursor:"pointer",background:{base:"buttonGlass",hover:"backgroundSecondary"},onClick:()=>{o()},children:W.jsxs(we,{flexDirection:"row",alignItems:"center",gap:"2",children:[W.jsx("img",{src:"https://avatars.githubusercontent.com/u/37784886",alt:"Wallet Connect",style:{width:"20px",height:"20px"}}),W.jsx(Qe,{variant:"normal",color:"text100",children:"Wallet Connect"})]})}),r.map(a=>W.jsx(en,{flexDirection:"row",alignItems:"center",gap:"2",cursor:"pointer",background:{base:"buttonGlass",hover:"backgroundSecondary"},onClick:()=>t(a),children:W.jsxs(we,{flexDirection:"row",alignItems:"center",gap:"2",children:[W.jsx("img",{src:a.info.icon,alt:a.info.name,style:{width:"20px",height:"20px"}}),W.jsx(Qe,{variant:"normal",color:"text100",children:a.info.name})]})},a.info.uuid))]})]})})}function fFe({collectibleInfo:t,onClose:e}){var y,b,I;const r=WP("isMobile"),n=Br(Zr),[i,s]=N.useState(void 0),[o,a]=N.useState(void 0),[c,l]=N.useState(!1),[f,u]=N.useState(!1);if(N.useEffect(()=>{const C=n.selectedExternalWalletAddress.get();c&&C&&a(n.selectedExternalWalletAddress.get())},[c]),N.useEffect(()=>{u(n.selectedExternalWalletAddress.get()!==void 0)},[n.selectedExternalWalletAddress]),!t)return null;const p=t.collectibleInfoParams.contractType==="ERC721",g=Ry(t.collectibleInfoParams.chainId);return W.jsxs(we,{flexDirection:"column",paddingY:"5",alignItems:"center",children:[W.jsxs(Qe,{variant:"md",fontWeight:"bold",color:"text100",paddingX:"16",paddingBottom:"1",children:["Sending ",(y=t==null?void 0:t.collectibleInfoResponse)==null?void 0:y.name," on ",g]}),W.jsx(Pu,{color:"gradientPrimary",width:"full",height:"px"}),W.jsxs(we,{style:{minWidth:r?"100vw":"520px"},paddingX:"6",flexDirection:"column",gap:"4",width:"full",marginTop:"6",children:[W.jsxs(we,{flexDirection:"column",gap:"2",children:[W.jsx(Pn,{label:"Amount",labelLocation:"top",name:"amount",placeholder:"Enter amount",value:p?"1":i??"",onChange:C=>{s(C.target.value)},disabled:p,controls:W.jsx(W.Fragment,{children:t.collectibleInfoParams.contractType==="ERC1155"&&W.jsx(Jt,{label:"Max",variant:"text",size:"md",shape:"square",paddingRight:"2",onClick:()=>{var C,S;s(uh((C=t==null?void 0:t.collectibleInfoResponse)==null?void 0:C.balance,((S=t==null?void 0:t.collectibleInfoResponse)==null?void 0:S.decimals)??18))}})})}),W.jsxs(Qe,{variant:"small",color:"text50",children:["Current balance:"," ",uh((b=t==null?void 0:t.collectibleInfoResponse)==null?void 0:b.balance,((I=t==null?void 0:t.collectibleInfoResponse)==null?void 0:I.decimals)??18)]})]}),W.jsxs(we,{flexDirection:"column",gap:"3",children:[W.jsx(Pn,{label:"To",labelLocation:"top",name:"to",placeholder:"0x...",value:o??"",onChange:C=>{a(C.target.value)},disabled:c}),W.jsx(K4,{label:f?"Send to connected external wallet address":"Connect external wallet to autofill address",checked:c,onCheckedChange:C=>l(C===!0),labelLocation:"right",disabled:!f})]}),W.jsxs(we,{alignItems:"center",justifyContent:"flex-end",gap:"8",marginTop:"4",children:[W.jsx(Jt,{label:"Cancel",variant:"text",size:"md",shape:"square",onClick:()=>{e()}}),W.jsx(Jt,{label:"Send",variant:"primary",size:"md",shape:"square",disabled:!(p&&o||!p&&o&&i),onClick:()=>{e(o,i)}})]})]})]})}function uFe({tokenBalance:t,onClose:e}){var g,y;const r=WP("isMobile"),n=Br(Zr),[i,s]=N.useState(void 0),[o,a]=N.useState(void 0),[c,l]=N.useState(!1),[f,u]=N.useState(!1);if(N.useEffect(()=>{const b=n.selectedExternalWalletAddress.get();c&&b&&a(n.selectedExternalWalletAddress.get())},[c]),N.useEffect(()=>{u(n.selectedExternalWalletAddress.get()!==void 0)},[n.selectedExternalWalletAddress]),!t)return null;const p=Ry(t.chainId);return W.jsxs(we,{flexDirection:"column",paddingY:"5",alignItems:"center",children:[W.jsxs(Qe,{variant:"md",fontWeight:"bold",color:"text100",paddingX:"16",paddingBottom:"1",children:["Sending ",(g=t==null?void 0:t.contractInfo)==null?void 0:g.symbol," on ",p]}),W.jsx(Pu,{color:"gradientPrimary",width:"full",height:"px"}),W.jsxs(we,{style:{minWidth:r?"100vw":"520px"},paddingX:"6",flexDirection:"column",gap:"4",width:"full",marginTop:"6",children:[W.jsxs(we,{flexDirection:"column",gap:"2",children:[W.jsx(Pn,{label:"Amount",labelLocation:"top",name:"amount",placeholder:"Enter amount",value:i??"",onChange:b=>{s(b.target.value)},controls:W.jsx(Jt,{label:"Max",variant:"text",size:"md",shape:"square",paddingRight:"2",onClick:()=>{var b;s(uh(t==null?void 0:t.balance,((b=t==null?void 0:t.contractInfo)==null?void 0:b.decimals)??18))}})}),W.jsxs(Qe,{variant:"small",color:"text50",children:["Current balance:"," ",uh(t==null?void 0:t.balance,((y=t==null?void 0:t.contractInfo)==null?void 0:y.decimals)??18)]})]}),W.jsxs(we,{flexDirection:"column",gap:"3",children:[W.jsx(Pn,{label:"To",labelLocation:"top",name:"to",placeholder:"0x...",value:o??"",onChange:b=>{a(b.target.value)},disabled:c}),W.jsx(K4,{label:f?"Send to connected external wallet address":"Connect external wallet to autofill address",checked:c,onCheckedChange:b=>l(b===!0),labelLocation:"right",disabled:!f})]}),W.jsxs(we,{alignItems:"center",justifyContent:"flex-end",gap:"8",marginTop:"4",children:[W.jsx(Jt,{label:"Cancel",variant:"text",size:"md",shape:"square",onClick:()=>{e()}}),W.jsx(Jt,{label:"Send",variant:"primary",size:"md",shape:"square",disabled:!o||!i,onClick:()=>{o&&i&&e(o,i)}})]})]})]})}function dFe({onClose:t}){const r=Br(Wn).networks.get(),n=r.filter(S=>S.type===Bt.MAINNET),i=Br(nE),s=on(i.isFetchingTokenInfo),o=f8(),[a,c]=N.useState(),[l,f]=N.useState(),[u,p]=N.useState(),[g,y]=N.useState(!1);N.useEffect(()=>{a&&l?i.getTokenInfo(a.chainId,l).then(S=>{p(S)}):p(void 0)},[a,l]);const b=n.map(S=>({label:S.title,value:S.chainId.toString()})),I=async()=>{a&&l&&u&&(y(!0),await i.addToken({chainId:a.chainId,address:l,contractType:hh.ERC20,symbol:u.symbol,decimals:u.decimals}),y(!1),o({variant:"success",title:"Token added"}),C(),t())},C=()=>{f(void 0),c(void 0)};return W.jsxs(en,{flexDirection:"column",paddingY:"4",paddingX:"8",borderRadius:"md",width:"full",height:"full",alignItems:"center",disabled:g,children:[W.jsx(we,{children:W.jsx(Qe,{variant:"medium",color:"text80",children:"Import ERC20 Token"})}),W.jsxs(we,{flexDirection:"column",width:"full",marginTop:"4",gap:"4",children:[W.jsx(k7,{label:"Token Network",labelLocation:"left",name:"tokenNetwork",options:b,onValueChange:S=>c(r.find(R=>R.chainId===Number(S)))}),W.jsx(Pn,{width:"full",label:"Token Address",labelLocation:"left",name:"tokenAddress",value:l??"",onChange:S=>{f(S.target.value)}}),s&&W.jsx(we,{marginTop:"4",alignItems:"center",justifyContent:"center",children:W.jsx(fh,{size:"lg"})}),u&&W.jsxs(W.Fragment,{children:[W.jsx(Pn,{width:"full",label:"Token Symbol",labelLocation:"left",name:"tokenSymbol",value:(u==null?void 0:u.symbol)??"",disabled:!0}),W.jsx(Pn,{width:"full",label:"Token Decimals",labelLocation:"left",name:"tokenDecimals",value:(u==null?void 0:u.decimals)??"",disabled:!0})]}),W.jsxs(we,{alignItems:"center",justifyContent:"flex-end",gap:"8",marginTop:"4",children:[W.jsx(Jt,{label:"Cancel",variant:"text",size:"md",shape:"square",disabled:g,onClick:()=>{C(),t()}}),W.jsx(Jt,{label:"Add",disabled:u===void 0||g,variant:"primary",size:"md",shape:"square",onClick:I})]})]})]})}const hFe=(t,e)=>Math.floor(t*10**e)/10**e;function pFe({disabled:t,tokenBalance:e,onSendClick:r,onRemoveClick:n}){var o,a;const i=uh(e.balance,((o=e.contractInfo)==null?void 0:o.decimals)??18),s=hFe(Number(i),5);return W.jsxs(en,{width:"full",flexDirection:"column",gap:"2",children:[W.jsxs(we,{flexDirection:"row",alignItems:"center",children:[W.jsx(Qe,{variant:"medium",color:"text80",children:((a=e.contractInfo)==null?void 0:a.symbol)??"Native Token"}),W.jsx(we,{marginLeft:"auto",children:W.jsx(Qe,{color:"text80",children:s})})]}),W.jsxs(we,{flexDirection:"row",children:[W.jsx(ZM,{chainId:e.chainId}),W.jsxs(we,{marginLeft:"auto",gap:"2",children:[W.jsx(Jt,{size:"xs",label:"Send",variant:"primary",shape:"square",disabled:t,onClick:r}),n&&W.jsx(Jt,{size:"xs",label:"Remove",shape:"square",onClick:n})]})]})]})}function vFe({filterZeroBalances:t,onSendClick:e}){const r=Br(Zr),n=Br(nE),i=on(n.balances),s=on(n.isFetchingBalances),o=on(r.selectedExternalProvider)!==void 0,a=N.useMemo(()=>t?i.filter(u=>u.balance!=="0"):i,[i,t,s]),[c,l]=N.useState(!1),f=u=>u.contractType===hh.NATIVE?void 0:()=>{var p,g;n.removeToken({chainId:u.chainId,address:u.contractAddress,contractType:u.contractType,decimals:(p=u.contractInfo)==null?void 0:p.decimals,symbol:(g=u.contractInfo)==null?void 0:g.symbol})};return W.jsxs(W.Fragment,{children:[W.jsxs(we,{width:"full",flexDirection:"column",gap:"4",marginBottom:"8",children:[a.map(u=>W.jsx(pFe,{tokenBalance:u,disabled:!o,onSendClick:()=>e(u),onRemoveClick:f(u)},u.contractAddress+u.chainId)),s&&W.jsx(we,{marginTop:"4",alignItems:"center",justifyContent:"center",children:W.jsx(fh,{size:"lg"})})]}),c&&W.jsx(dFe,{onClose:()=>l(!1)}),!c&&W.jsx(we,{width:"full",alignItems:"center",justifyContent:"center",marginBottom:"4",children:W.jsx(Jt,{label:"Import token",leftIcon:qH,variant:"primary",size:"md",shape:"square",onClick:()=>{l(!0)}})})]})}function gFe({onClose:t}){var a;const e=Br(Zr),r=on(e.connectOptions),[n,i]=N.useState(!1),s=async()=>{if(n)return;i(!0);const c=await e.walletRequestHandler.connect(r);e.connectDetails.set(c),i(!1),t()},o=()=>{e.connectDetails.set({connected:!1}),t()};return W.jsx(we,{children:r&&W.jsxs(we,{flexDirection:"column",padding:"10",alignItems:"center",gap:"4",children:[W.jsx(Qe,{variant:"md",fontWeight:"bold",color:"text100",paddingX:"16",paddingBottom:"1",children:"Would you like to allow this dapp to connect to your wallet?"}),W.jsx(Pu,{color:"gradientPrimary",width:"full",height:"px"}),W.jsxs(en,{flexDirection:"row",justifyContent:"space-between",alignItems:"center",children:[W.jsx(Qe,{variant:"md",color:"text100",children:r.app}),W.jsxs(we,{flexDirection:"row",alignItems:"center",gap:"3",children:[W.jsx(Qe,{variant:"md",color:"text100",children:(a=r.origin)==null?void 0:a.split("//")[1]}),W.jsx(mu,{size:"xs",icon:W4,onClick:()=>window.open(r.origin,"_blank")})]})]}),W.jsxs(en,{flexDirection:"row",justifyContent:"space-between",children:[W.jsx(Qe,{variant:"md",color:"text100",children:"Network"}),W.jsx(Qe,{variant:"md",color:"text100",children:`${Ry(Number(r.networkId))}`})]}),W.jsxs(we,{flexDirection:{sm:"column",md:"row"},gap:"2",width:"full",marginTop:"6",children:[W.jsx(Jt,{width:"full",label:"Cancel",onClick:o,"data-id":"signingCancel"}),W.jsx(Jt,{width:"full",variant:"primary",label:n?"Authorizing…":"Connect",disabled:n,onClick:s,"data-id":"signingContinue"})]})]})})}function yFe({sessionList:t}){const e=Br(OE);return W.jsxs(we,{flexDirection:"column",gap:"2",children:[t.length!==0&&W.jsx(Qe,{variant:"large",color:"text80",marginTop:"6",marginBottom:"2",children:"Connected dapps via WalletConnect"}),t.map((r,n)=>W.jsxs(en,{flexDirection:"row",alignItems:"center",gap:"2",padding:"2",children:[W.jsx(i8,{width:"8",height:"8",src:r.peer.metadata.icons[0]}),W.jsx(Qe,{variant:"normal",fontWeight:"bold",color:"text100",children:r.peer.metadata.name===""||!r.peer.metadata.name?r.peer.metadata.url:r.peer.metadata.name}),W.jsxs(we,{gap:"2",marginLeft:"auto",children:[r.peer.metadata.url&&W.jsx(mu,{size:"xs",icon:W4,onClick:()=>window.open(r.peer.metadata.url,"_blank")}),W.jsx(mu,{size:"xs",icon:Gg,onClick:()=>{e.disconnectSession(r.topic)}})]})]},n))]})}function mFe({onClose:t}){var l,f;const e=Br(Zr),r=Br(Mi),n=e.toSignMsgDetails.get(),i=r.accountAddress.get(),[s,o]=N.useState(""),[a,c]=N.useState("");return N.useEffect(()=>{if(console.log("details",n),c(new Date().toLocaleString()),n!=null&&n.message.message){const u=zLe(n.message.message);try{o(kp(u))}catch{o(ke(u))}}else n!=null&&n.message.typedData&&o(JSON.stringify(n.message.typedData,void 0,4))},[n]),W.jsx(we,{children:n&&W.jsxs(we,{flexDirection:"column",padding:"10",alignItems:"center",gap:"4",children:[W.jsx(Qe,{variant:"md",fontWeight:"bold",color:"text100",children:"Would you like to sign this message?"}),W.jsx(Pu,{color:"gradientPrimary",width:"full",height:"px"}),W.jsxs(en,{flexDirection:"row",justifyContent:"space-between",children:[W.jsx(Qe,{variant:"md",color:"text100",children:"Requested at"}),W.jsx(Qe,{variant:"md",color:"text100",children:a})]}),W.jsxs(en,{flexDirection:"row",justifyContent:"space-between",alignItems:"center",children:[W.jsx(Qe,{variant:"md",color:"text100",children:"Origin"}),W.jsxs(we,{alignItems:"center",gap:"3",children:[W.jsx(Qe,{variant:"md",color:"text100",children:(f=(l=n==null?void 0:n.options)==null?void 0:l.origin)==null?void 0:f.split("//")[1]}),W.jsx(mu,{size:"xs",icon:W4,onClick:()=>{var u;return window.open((u=n.options)==null?void 0:u.origin,"_blank")}})]})]}),W.jsxs(en,{flexDirection:"row",justifyContent:"space-between",children:[W.jsx(Qe,{variant:"md",color:"text100",children:"Network"}),W.jsx(Qe,{variant:"md",color:"text100",children:`${Ry(n.chainId)}`})]}),W.jsxs(en,{flexDirection:"column",gap:"4",children:[W.jsx(Qe,{variant:"md",color:"text100",children:"Signee"}),W.jsx(en,{children:W.jsx(Qe,{variant:"md",color:"text100",children:`${i}`})})]}),W.jsx(iP,{label:"Message Content",children:W.jsx(en,{children:W.jsx(Qe,{variant:"code",color:"text80",style:{overflowWrap:"anywhere",whiteSpace:"pre-wrap"},children:s})})}),W.jsxs(we,{flexDirection:{sm:"column",md:"row"},gap:"2",width:"full",marginTop:"10",children:[W.jsx(Jt,{width:"full",label:"Cancel",onClick:()=>{t()},"data-id":"signingCancel"}),W.jsx(Jt,{width:"full",variant:"primary",label:"Send",onClick:()=>{t(n)},"data-id":"signingContinue"})]})]})})}function bFe({onClose:t}){var I,C;const e=Br(Zr),r=Br(Wn),n=Br(JM),[i,s]=N.useState("Unknown"),[o,a]=N.useState(null),[c,l]=N.useState({name:null}),[f,u]=N.useState(null),[p,g]=N.useState(""),y=e.toSignTxnDetails.get();N.useEffect(()=>{if(!y)return;g(new Date().toLocaleString());const S=r.providerForChainId(y.chainId??0),R=y.txn[0].data,L=y.txn[0].to;b(R,L,S)},[y]),N.useEffect(()=>{if(!y||!(y!=null&&y.txn[0].to)||!o)return;const S=y.txn[0].to,R={chainId:y.chainId,address:S,tokenId:o,contractType:i};n.getCollectibleInfo(R)},[i,o]);async function b(S,R,L){try{const F=new Bn(R,qv,L);try{const ie=await F.symbol();s("ERC20"),l({name:ie});const K=new Fi(qv).parseTransaction({data:S}),k=await F.decimals();u(Number(uh(K==null?void 0:K.args[1],k??18)));return}catch{}const H=new Bn(R,h9e,L);if(await H.supportsInterface("0x80ac58cd")){s("ERC721");const ie=new Bn(R,pM,L),K=ie.interface.decodeFunctionData("safeTransferFrom",S).tokenId.toString();a(K);const k=await ie.name();l({name:k});return}if(await H.supportsInterface("0xd9b67a26")){s("ERC1155");const ie=new Bn(R,vM,L),K=ie.interface.decodeFunctionData("safeTransferFrom",S).id.toString();a(K);const k=await ie.uri(K);l({name:k});return}}catch(F){console.error("Error parsing contract type. The transaction is either using a smart contract that doesnt support ERC165 or the token is native:",F)}if(y!=null&&y.txn[0].value){s("Native Token"),l({name:`${Ry((y==null?void 0:y.chainId)??1)} Native Token`});return}console.info("Token info could not be decoded for this transaction")}return W.jsx(we,{children:y&&W.jsx(we,{children:W.jsxs(we,{flexDirection:"column",padding:"10",gap:"4",children:[W.jsx(Qe,{alignSelf:"center",variant:"md",fontWeight:"bold",color:"text100",children:"Would you like to approve this transaction?"}),W.jsx(Pu,{color:"gradientPrimary",width:"full",height:"px"}),W.jsxs(en,{flexDirection:"row",justifyContent:"space-between",children:[W.jsx(Qe,{variant:"md",color:"text100",children:"Requested at"}),W.jsx(Qe,{variant:"md",color:"text100",children:p})]}),W.jsxs(en,{flexDirection:"row",justifyContent:"space-between",alignItems:"center",children:[W.jsx(Qe,{variant:"md",color:"text100",children:"Origin"}),W.jsxs(we,{alignItems:"center",gap:"3",children:[W.jsx(Qe,{variant:"md",color:"text100",children:(C=(I=y==null?void 0:y.options)==null?void 0:I.origin)==null?void 0:C.split("//")[1]}),W.jsx(mu,{size:"xs",icon:W4,onClick:()=>{var S;return window.open((S=y.options)==null?void 0:S.origin,"_blank")}})]})]}),W.jsxs(en,{flexDirection:"row",justifyContent:"space-between",children:[W.jsx(Qe,{variant:"md",color:"text100",children:"Token Standard"}),W.jsx(Qe,{variant:"md",color:"text100",children:`${i}`})]}),i==="ERC721"||i==="ERC1155"&&W.jsxs(en,{flexDirection:"row",justifyContent:"space-between",children:[W.jsx(Qe,{variant:"md",color:"text100",children:"Token ID"}),W.jsx(Qe,{variant:"md",color:"text100",children:`${o}`})]}),W.jsxs(en,{flexDirection:"row",justifyContent:"space-between",children:[W.jsx(Qe,{variant:"md",color:"text100",children:"Amount"}),W.jsx(Qe,{variant:"md",color:"text100",children:`${f??0} ${c.name}`})]}),W.jsx(iP,{label:"Transaction Data",children:W.jsx(we,{flexDirection:"column",gap:"2",children:y.txn.map((S,R)=>W.jsx(en,{children:W.jsx(Qe,{variant:"code",color:"text80",style:{whiteSpace:"pre-wrap"},children:JSON.stringify(S,null,4)||"Native token transfer"})},R))})}),W.jsxs(we,{flexDirection:{sm:"column",md:"row"},gap:"2",width:"full",marginTop:"10",children:[W.jsx(Jt,{width:"full",label:"Cancel",onClick:()=>{t()},"data-id":"signingCancel"}),W.jsx(Jt,{width:"full",variant:"primary",label:"Send",onClick:()=>{t(y)},"data-id":"signingContinue"})]})]})})})}function wFe({warningType:t}){return W.jsx(we,{children:W.jsxs(we,{flexDirection:"column",padding:"10",alignItems:"center",gap:"6",children:[W.jsx(Qe,{variant:"md",fontWeight:"bold",color:"text100",children:"Warning:"}),W.jsx(we,{flexDirection:"column",children:W.jsx(en,{children:W.jsxs(Qe,{variant:"md",fontWeight:"bold",color:"text100",paddingX:"2",children:[t==="noProvider"&&'Please ensure that an external wallet is connected via the "Connect" button',t==="isWalletConnect"&&"Please switch your external wallet to an option other than WalletConnect",t==="notDeployed"&&"Please deploy our wallet on the required network before trying to sign messages"]})})})]})})}var Ote={},jo={};Object.defineProperty(jo,"__esModule",{value:!0});jo.compactObject=Bte;jo.deprecated=PFe;var xFe=jo.detectBrowser=kFe;jo.disableLog=_Fe;jo.disableWarnings=IFe;jo.extractVersion=D3;jo.filterStats=MFe;jo.log=TFe;jo.walkStats=u4;jo.wrapPeerConnectionEvent=SFe;function EFe(t,e,r){return e=CFe(e),e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function CFe(t){var e=AFe(t,"string");return gh(e)=="symbol"?e:e+""}function AFe(t,e){if(gh(t)!="object"||!t)return t;var r=t[Symbol.toPrimitive];if(r!==void 0){var n=r.call(t,e||"default");if(gh(n)!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function gh(t){"@babel/helpers - typeof";return gh=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},gh(t)}var Nte=!0,Dte=!0;function D3(t,e,r){var n=t.match(e);return n&&n.length>=r&&parseInt(n[r],10)}function SFe(t,e,r){if(t.RTCPeerConnection){var n=t.RTCPeerConnection.prototype,i=n.addEventListener;n.addEventListener=function(o,a){if(o!==e)return i.apply(this,arguments);var c=function(f){var u=r(f);u&&(a.handleEvent?a.handleEvent(u):a(u))};return this._eventMap=this._eventMap||{},this._eventMap[e]||(this._eventMap[e]=new Map),this._eventMap[e].set(a,c),i.apply(this,[o,c])};var s=n.removeEventListener;n.removeEventListener=function(o,a){if(o!==e||!this._eventMap||!this._eventMap[e])return s.apply(this,arguments);if(!this._eventMap[e].has(a))return s.apply(this,arguments);var c=this._eventMap[e].get(a);return this._eventMap[e].delete(a),this._eventMap[e].size===0&&delete this._eventMap[e],Object.keys(this._eventMap).length===0&&delete this._eventMap,s.apply(this,[o,c])},Object.defineProperty(n,"on"+e,{get:function(){return this["_on"+e]},set:function(a){this["_on"+e]&&(this.removeEventListener(e,this["_on"+e]),delete this["_on"+e]),a&&this.addEventListener(e,this["_on"+e]=a)},enumerable:!0,configurable:!0})}}function _Fe(t){return typeof t!="boolean"?new Error("Argument type: "+gh(t)+". Please use a boolean."):(Nte=t,t?"adapter.js logging disabled":"adapter.js logging enabled")}function IFe(t){return typeof t!="boolean"?new Error("Argument type: "+gh(t)+". Please use a boolean."):(Dte=!t,"adapter.js deprecation warnings "+(t?"disabled":"enabled"))}function TFe(){if((typeof window>"u"?"undefined":gh(window))==="object"){if(Nte)return;typeof console<"u"&&typeof console.log=="function"&&console.log.apply(console,arguments)}}function PFe(t,e){Dte&&console.warn(t+" is deprecated, please use "+e+" instead.")}function kFe(t){var e={browser:null,version:null};if(typeof t>"u"||!t.navigator||!t.navigator.userAgent)return e.browser="Not a browser.",e;var r=t.navigator;if(r.userAgentData&&r.userAgentData.brands){var n=r.userAgentData.brands.find(function(i){return i.brand==="Chromium"});if(n)return{browser:"chrome",version:parseInt(n.version,10)}}if(r.mozGetUserMedia)e.browser="firefox",e.version=D3(r.userAgent,/Firefox\/(\d+)\./,1);else if(r.webkitGetUserMedia||t.isSecureContext===!1&&t.webkitRTCPeerConnection)e.browser="chrome",e.version=D3(r.userAgent,/Chrom(e|ium)\/(\d+)\./,2);else if(t.RTCPeerConnection&&r.userAgent.match(/AppleWebKit\/(\d+)\./))e.browser="safari",e.version=D3(r.userAgent,/AppleWebKit\/(\d+)\./,1),e.supportsUnifiedPlan=t.RTCRtpTransceiver&&"currentDirection"in t.RTCRtpTransceiver.prototype;else return e.browser="Not a supported browser.",e;return e}function D$(t){return Object.prototype.toString.call(t)==="[object Object]"}function Bte(t){return D$(t)?Object.keys(t).reduce(function(e,r){var n=D$(t[r]),i=n?Bte(t[r]):t[r],s=n&&!Object.keys(i).length;return i===void 0||s?e:Object.assign(e,EFe({},r,i))},{}):t}function u4(t,e,r){!e||r.has(e.id)||(r.set(e.id,e),Object.keys(e).forEach(function(n){n.endsWith("Id")?u4(t,t.get(e[n]),r):n.endsWith("Ids")&&e[n].forEach(function(i){u4(t,t.get(i),r)})}))}function MFe(t,e,r){var n=r?"outbound-rtp":"inbound-rtp",i=new Map;if(e===null)return i;var s=[];return t.forEach(function(o){o.type==="track"&&o.trackIdentifier===e.id&&s.push(o)}),s.forEach(function(o){t.forEach(function(a){a.type===n&&a.trackId===o.id&&u4(t,a,i)})}),i}Object.defineProperty(Ote,"__esModule",{value:!0});var RFe=Ote.shimGetUserMedia=DFe,OFe=NFe(jo);function Lte(t){if(typeof WeakMap!="function")return null;var e=new WeakMap,r=new WeakMap;return(Lte=function(i){return i?r:e})(t)}function NFe(t,e){if(t&&t.__esModule)return t;if(t===null||yd(t)!="object"&&typeof t!="function")return{default:t};var r=Lte(e);if(r&&r.has(t))return r.get(t);var n={__proto__:null},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in t)if(s!=="default"&&{}.hasOwnProperty.call(t,s)){var o=i?Object.getOwnPropertyDescriptor(t,s):null;o&&(o.get||o.set)?Object.defineProperty(n,s,o):n[s]=t[s]}return n.default=t,r&&r.set(t,n),n}function yd(t){"@babel/helpers - typeof";return yd=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},yd(t)}var B$=OFe.log;function DFe(t,e){var r=t&&t.navigator;if(r.mediaDevices){var n=function(l){if(yd(l)!=="object"||l.mandatory||l.optional)return l;var f={};return Object.keys(l).forEach(function(u){if(!(u==="require"||u==="advanced"||u==="mediaSource")){var p=yd(l[u])==="object"?l[u]:{ideal:l[u]};p.exact!==void 0&&typeof p.exact=="number"&&(p.min=p.max=p.exact);var g=function(I,C){return I?I+C.charAt(0).toUpperCase()+C.slice(1):C==="deviceId"?"sourceId":C};if(p.ideal!==void 0){f.optional=f.optional||[];var y={};typeof p.ideal=="number"?(y[g("min",u)]=p.ideal,f.optional.push(y),y={},y[g("max",u)]=p.ideal,f.optional.push(y)):(y[g("",u)]=p.ideal,f.optional.push(y))}p.exact!==void 0&&typeof p.exact!="number"?(f.mandatory=f.mandatory||{},f.mandatory[g("",u)]=p.exact):["min","max"].forEach(function(b){p[b]!==void 0&&(f.mandatory=f.mandatory||{},f.mandatory[g(b,u)]=p[b])})}}),l.advanced&&(f.optional=(f.optional||[]).concat(l.advanced)),f},i=function(l,f){if(e.version>=61)return f(l);if(l=JSON.parse(JSON.stringify(l)),l&&yd(l.audio)==="object"){var u=function(I,C,S){C in I&&!(S in I)&&(I[S]=I[C],delete I[C])};l=JSON.parse(JSON.stringify(l)),u(l.audio,"autoGainControl","googAutoGainControl"),u(l.audio,"noiseSuppression","googNoiseSuppression"),l.audio=n(l.audio)}if(l&&yd(l.video)==="object"){var p=l.video.facingMode;p=p&&(yd(p)==="object"?p:{ideal:p});var g=e.version<66;if(p&&(p.exact==="user"||p.exact==="environment"||p.ideal==="user"||p.ideal==="environment")&&!(r.mediaDevices.getSupportedConstraints&&r.mediaDevices.getSupportedConstraints().facingMode&&!g)){delete l.video.facingMode;var y;if(p.exact==="environment"||p.ideal==="environment"?y=["back","rear"]:(p.exact==="user"||p.ideal==="user")&&(y=["front"]),y)return r.mediaDevices.enumerateDevices().then(function(b){b=b.filter(function(C){return C.kind==="videoinput"});var I=b.find(function(C){return y.some(function(S){return C.label.toLowerCase().includes(S)})});return!I&&b.length&&y.includes("back")&&(I=b[b.length-1]),I&&(l.video.deviceId=p.exact?{exact:I.deviceId}:{ideal:I.deviceId}),l.video=n(l.video),B$("chrome: "+JSON.stringify(l)),f(l)})}l.video=n(l.video)}return B$("chrome: "+JSON.stringify(l)),f(l)},s=function(l){return e.version>=64?l:{name:{PermissionDeniedError:"NotAllowedError",PermissionDismissedError:"NotAllowedError",InvalidStateError:"NotAllowedError",DevicesNotFoundError:"NotFoundError",ConstraintNotSatisfiedError:"OverconstrainedError",TrackStartError:"NotReadableError",MediaDeviceFailedDueToShutdown:"NotAllowedError",MediaDeviceKillSwitchOn:"NotAllowedError",TabCaptureError:"AbortError",ScreenCaptureError:"AbortError",DeviceCaptureError:"AbortError"}[l.name]||l.name,message:l.message,constraint:l.constraint||l.constraintName,toString:function(){return this.name+(this.message&&": ")+this.message}}},o=function(l,f,u){i(l,function(p){r.webkitGetUserMedia(p,f,function(g){u&&u(s(g))})})};if(r.getUserMedia=o.bind(r),r.mediaDevices.getUserMedia){var a=r.mediaDevices.getUserMedia.bind(r.mediaDevices);r.mediaDevices.getUserMedia=function(c){return i(c,function(l){return a(l).then(function(f){if(l.audio&&!f.getAudioTracks().length||l.video&&!f.getVideoTracks().length)throw f.getTracks().forEach(function(u){u.stop()}),new DOMException("","NotFoundError");return f},function(f){return Promise.reject(s(f))})})}}}}var Fte={};Object.defineProperty(Fte,"__esModule",{value:!0});var BFe=Fte.shimGetUserMedia=jFe,LFe=FFe(jo);function jte(t){if(typeof WeakMap!="function")return null;var e=new WeakMap,r=new WeakMap;return(jte=function(i){return i?r:e})(t)}function FFe(t,e){if(t&&t.__esModule)return t;if(t===null||Kv(t)!="object"&&typeof t!="function")return{default:t};var r=jte(e);if(r&&r.has(t))return r.get(t);var n={__proto__:null},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in t)if(s!=="default"&&{}.hasOwnProperty.call(t,s)){var o=i?Object.getOwnPropertyDescriptor(t,s):null;o&&(o.get||o.set)?Object.defineProperty(n,s,o):n[s]=t[s]}return n.default=t,r&&r.set(t,n),n}function Kv(t){"@babel/helpers - typeof";return Kv=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Kv(t)}function jFe(t,e){var r=t&&t.navigator,n=t&&t.MediaStreamTrack;if(r.getUserMedia=function(c,l,f){LFe.deprecated("navigator.getUserMedia","navigator.mediaDevices.getUserMedia"),r.mediaDevices.getUserMedia(c).then(l,f)},!(e.version>55&&"autoGainControl"in r.mediaDevices.getSupportedConstraints())){var i=function(l,f,u){f in l&&!(u in l)&&(l[u]=l[f],delete l[f])},s=r.mediaDevices.getUserMedia.bind(r.mediaDevices);if(r.mediaDevices.getUserMedia=function(c){return Kv(c)==="object"&&Kv(c.audio)==="object"&&(c=JSON.parse(JSON.stringify(c)),i(c.audio,"autoGainControl","mozAutoGainControl"),i(c.audio,"noiseSuppression","mozNoiseSuppression")),s(c)},n&&n.prototype.getSettings){var o=n.prototype.getSettings;n.prototype.getSettings=function(){var c=o.apply(this,arguments);return i(c,"mozAutoGainControl","autoGainControl"),i(c,"mozNoiseSuppression","noiseSuppression"),c}}if(n&&n.prototype.applyConstraints){var a=n.prototype.applyConstraints;n.prototype.applyConstraints=function(c){return this.kind==="audio"&&Kv(c)==="object"&&(c=JSON.parse(JSON.stringify(c)),i(c,"autoGainControl","mozAutoGainControl"),i(c,"noiseSuppression","mozNoiseSuppression")),a.apply(this,[c])}}}}var tf={};Object.defineProperty(tf,"__esModule",{value:!0});tf.shimAudioContext=YFe;tf.shimCallbacksAPI=zFe;tf.shimConstraints=qte;tf.shimCreateOfferLegacy=KFe;var UFe=tf.shimGetUserMedia=HFe;tf.shimLocalStreamsAPI=qFe;tf.shimRTCIceServerUrls=GFe;tf.shimRemoteStreamsAPI=VFe;tf.shimTrackEventTransceiver=WFe;var Ute=$Fe(jo);function $te(t){if(typeof WeakMap!="function")return null;var e=new WeakMap,r=new WeakMap;return($te=function(i){return i?r:e})(t)}function $Fe(t,e){if(t&&t.__esModule)return t;if(t===null||yh(t)!="object"&&typeof t!="function")return{default:t};var r=$te(e);if(r&&r.has(t))return r.get(t);var n={__proto__:null},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var s in t)if(s!=="default"&&{}.hasOwnProperty.call(t,s)){var o=i?Object.getOwnPropertyDescriptor(t,s):null;o&&(o.get||o.set)?Object.defineProperty(n,s,o):n[s]=t[s]}return n.default=t,r&&r.set(t,n),n}function yh(t){"@babel/helpers - typeof";return yh=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},yh(t)}function qFe(t){if(!(yh(t)!=="object"||!t.RTCPeerConnection)){if("getLocalStreams"in t.RTCPeerConnection.prototype||(t.RTCPeerConnection.prototype.getLocalStreams=function(){return this._localStreams||(this._localStreams=[]),this._localStreams}),!("addStream"in t.RTCPeerConnection.prototype)){var e=t.RTCPeerConnection.prototype.addTrack;t.RTCPeerConnection.prototype.addStream=function(n){var i=this;this._localStreams||(this._localStreams=[]),this._localStreams.includes(n)||this._localStreams.push(n),n.getAudioTracks().forEach(function(s){return e.call(i,s,n)}),n.getVideoTracks().forEach(function(s){return e.call(i,s,n)})},t.RTCPeerConnection.prototype.addTrack=function(n){for(var i=this,s=arguments.length,o=new Array(s>1?s-1:0),a=1;a=0)){n._remoteStreams.push(s);var o=new Event("addstream");o.stream=s,n.dispatchEvent(o)}})}),e.apply(n,arguments)}}}function zFe(t){if(!(yh(t)!=="object"||!t.RTCPeerConnection)){var e=t.RTCPeerConnection.prototype,r=e.createOffer,n=e.createAnswer,i=e.setLocalDescription,s=e.setRemoteDescription,o=e.addIceCandidate;e.createOffer=function(l,f){var u=arguments.length>=2?arguments[2]:arguments[0],p=r.apply(this,[u]);return f?(p.then(l,f),Promise.resolve()):p},e.createAnswer=function(l,f){var u=arguments.length>=2?arguments[2]:arguments[0],p=n.apply(this,[u]);return f?(p.then(l,f),Promise.resolve()):p};var a=function(l,f,u){var p=i.apply(this,[l]);return u?(p.then(f,u),Promise.resolve()):p};e.setLocalDescription=a,a=function(l,f,u){var p=s.apply(this,[l]);return u?(p.then(f,u),Promise.resolve()):p},e.setRemoteDescription=a,a=function(l,f,u){var p=o.apply(this,[l]);return u?(p.then(f,u),Promise.resolve()):p},e.addIceCandidate=a}}function HFe(t){var e=t&&t.navigator;if(e.mediaDevices&&e.mediaDevices.getUserMedia){var r=e.mediaDevices,n=r.getUserMedia.bind(r);e.mediaDevices.getUserMedia=function(i){return n(qte(i))}}!e.getUserMedia&&e.mediaDevices&&e.mediaDevices.getUserMedia&&(e.getUserMedia=(function(s,o,a){e.mediaDevices.getUserMedia(s).then(o,a)}).bind(e))}function qte(t){return t&&t.video!==void 0?Object.assign({},t,{video:Ute.compactObject(t.video)}):t}function GFe(t){if(t.RTCPeerConnection){var e=t.RTCPeerConnection;t.RTCPeerConnection=function(n,i){if(n&&n.iceServers){for(var s=[],o=0;o{throw TypeError(t)},zte=(t,e,r)=>e.has(t)||Vte("Cannot "+r),QFe=(t,e,r)=>(zte(t,e,"read from private field"),r?r.call(t):e.get(t)),JFe=(t,e,r)=>e.has(t)?Vte("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,r),ZFe=(t,e,r,n)=>(zte(t,e,"write to private field"),e.set(t,r),r);const L$=["Aztec","Codabar","Code128","Code39","Code93","DataBar","DataBarExpanded","DataBarLimited","DataMatrix","DXFilmEdge","EAN-13","EAN-8","ITF","Linear-Codes","Matrix-Codes","MaxiCode","MicroQRCode","None","PDF417","QRCode","rMQRCode","UPC-A","UPC-E"];function XFe(t){return t.join("|")}function eje(t){const e=F$(t);let r=0,n=L$.length-1;for(;r<=n;){const i=Math.floor((r+n)/2),s=L$[i],o=F$(s);if(o===e)return s;o{const r=t.match(/_(.+?)\.wasm$/);return r?`https://fastly.jsdelivr.net/npm/zxing-wasm@1.3.4/dist/${r[1]}/${t}`:e+t}};let j$=new WeakMap;function XM(t,e){var r;const n=j$.get(t);if(n!=null&&n.modulePromise&&e===void 0)return n.modulePromise;const i=(r=n==null?void 0:n.moduleOverrides)!=null?r:aje,s=t({...i});return j$.set(t,{moduleOverrides:i,modulePromise:s}),s}async function cje(t,e,r=dy){const n={...dy,...r},i=await XM(t),{size:s}=e,o=new Uint8Array(await e.arrayBuffer()),a=i._malloc(s);i.HEAPU8.set(o,a);const c=i.readBarcodesFromImage(a,s,Hte(i,n));i._free(a);const l=[];for(let f=0;f{var t,e=typeof document<"u"&&((t=document.currentScript)==null?void 0:t.tagName.toUpperCase())==="SCRIPT"?document.currentScript.src:void 0;return function(r={}){var n,i=r,s,o,a=new Promise((q,V)=>{s=q,o=V}),c=typeof window=="object",l=typeof Bun<"u",f=typeof importScripts=="function";typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string"&&process.type!="renderer";var u=Object.assign({},i),p="./this.program",g="";function y(q){return i.locateFile?i.locateFile(q,g):g+q}var b,I;if(c||f||l){var C;f?g=self.location.href:typeof document<"u"&&((C=document.currentScript)===null||C===void 0?void 0:C.tagName.toUpperCase())==="SCRIPT"&&(g=document.currentScript.src),e&&(g=e),g.startsWith("blob:")?g="":g=g.substr(0,g.replace(/[?#].*/,"").lastIndexOf("/")+1),f&&(I=q=>{var V=new XMLHttpRequest;return V.open("GET",q,!1),V.responseType="arraybuffer",V.send(null),new Uint8Array(V.response)}),b=q=>fetch(q,{credentials:"same-origin"}).then(V=>V.ok?V.arrayBuffer():Promise.reject(new Error(V.status+" : "+V.url)))}var S=i.print||console.log.bind(console),R=i.printErr||console.error.bind(console);Object.assign(i,u),u=null,i.arguments&&i.arguments,i.thisProgram&&(p=i.thisProgram);var L=i.wasmBinary,F,H=!1,_,U,ie,ce,K,k,O,v;function m(){var q=F.buffer;i.HEAP8=_=new Int8Array(q),i.HEAP16=ie=new Int16Array(q),i.HEAPU8=U=new Uint8Array(q),i.HEAPU16=ce=new Uint16Array(q),i.HEAP32=K=new Int32Array(q),i.HEAPU32=k=new Uint32Array(q),i.HEAPF32=O=new Float32Array(q),i.HEAPF64=v=new Float64Array(q)}var M=[],B=[],E=[];function x(){var q=i.preRun;q&&(typeof q=="function"&&(q=[q]),q.forEach(P)),qe(M)}function w(){qe(B)}function T(){var q=i.postRun;q&&(typeof q=="function"&&(q=[q]),q.forEach(oe)),qe(E)}function P(q){M.unshift(q)}function z(q){B.unshift(q)}function oe(q){E.unshift(q)}var j=0,X=null;function G(q){var V;j++,(V=i.monitorRunDependencies)===null||V===void 0||V.call(i,j)}function Z(q){var V;if(j--,(V=i.monitorRunDependencies)===null||V===void 0||V.call(i,j),j==0&&X){var te=X;X=null,te()}}function re(q){var V;(V=i.onAbort)===null||V===void 0||V.call(i,q),q="Aborted("+q+")",R(q),H=!0,q+=". Build with -sASSERTIONS for more info.";var te=new WebAssembly.RuntimeError(q);throw o(te),te}var D="data:application/octet-stream;base64,",ee=q=>q.startsWith(D);function fe(){var q="zxing_reader.wasm";return ee(q)?q:y(q)}var Ee;function _e(q){if(q==Ee&&L)return new Uint8Array(L);if(I)return I(q);throw"both async and sync fetching of the wasm failed"}function Me(q){return L?Promise.resolve().then(()=>_e(q)):b(q).then(V=>new Uint8Array(V),()=>_e(q))}function Ze(q,V,te){return Me(q).then(ae=>WebAssembly.instantiate(ae,V)).then(te,ae=>{R(`failed to asynchronously prepare wasm: ${ae}`),re(ae)})}function ze(q,V,te,ae){return!q&&typeof WebAssembly.instantiateStreaming=="function"&&!ee(V)&&typeof fetch=="function"?fetch(V,{credentials:"same-origin"}).then(ve=>{var me=WebAssembly.instantiateStreaming(ve,te);return me.then(ae,function(Se){return R(`wasm streaming compile failed: ${Se}`),R("falling back to ArrayBuffer instantiation"),Ze(V,te,ae)})}):Ze(V,te,ae)}function et(){return{a:WE}}function Re(){var q,V=et();function te(ve,me){return Kr=ve.exports,F=Kr.za,m(),c1=Kr.Da,z(Kr.Aa),Z(),Kr}G();function ae(ve){te(ve.instance)}if(i.instantiateWasm)try{return i.instantiateWasm(V,te)}catch(ve){R(`Module.instantiateWasm callback failed with error: ${ve}`),o(ve)}return(q=Ee)!==null&&q!==void 0||(Ee=fe()),ze(L,Ee,V,ae).catch(o),{}}var qe=q=>{q.forEach(V=>V(i))};i.noExitRuntime;var Te=q=>e2(q),De=()=>t2(),Je=[],Ge=0,tt=q=>{var V=new it(q);return V.get_caught()||(V.set_caught(!0),Ge--),V.set_rethrown(!1),Je.push(V),df(q),Zy(q)},rt=0,We=()=>{nr(0,0);var q=Je.pop();r2(q.excPtr),rt=0};class it{constructor(V){this.excPtr=V,this.ptr=V-24}set_type(V){k[this.ptr+4>>2]=V}get_type(){return k[this.ptr+4>>2]}set_destructor(V){k[this.ptr+8>>2]=V}get_destructor(){return k[this.ptr+8>>2]}set_caught(V){V=V?1:0,_[this.ptr+12]=V}get_caught(){return _[this.ptr+12]!=0}set_rethrown(V){V=V?1:0,_[this.ptr+13]=V}get_rethrown(){return _[this.ptr+13]!=0}init(V,te){this.set_adjusted_ptr(0),this.set_type(V),this.set_destructor(te)}set_adjusted_ptr(V){k[this.ptr+16>>2]=V}get_adjusted_ptr(){return k[this.ptr+16>>2]}}var pt=q=>{throw rt||(rt=q),rt},Ke=q=>Gh(q),vt=q=>{var V=rt;if(!V)return Ke(0),0;var te=new it(V);te.set_adjusted_ptr(V);var ae=te.get_type();if(!ae)return Ke(0),V;for(var ve of q){if(ve===0||ve===ae)break;var me=te.ptr+16;if(vo(ve,ae,me))return Ke(ve),V}return Ke(ae),V},bt=()=>vt([]),nt=q=>vt([q]),_t=(q,V)=>vt([q,V]),Ct=()=>{var q=Je.pop();q||re("no exception to throw");var V=q.excPtr;throw q.get_rethrown()||(Je.push(q),q.set_rethrown(!0),q.set_caught(!1),Ge++),rt=V,rt},It=(q,V,te)=>{var ae=new it(q);throw ae.init(V,te),rt=q,Ge++,rt},er=()=>Ge,ur=()=>{re("")},wt={},lr=q=>{for(;q.length;){var V=q.pop(),te=q.pop();te(V)}};function ir(q){return this.fromWireType(k[q>>2])}var Pt={},Ot={},Nt={},dt,Lt=q=>{throw new dt(q)},kt=(q,V,te)=>{q.forEach(Ae=>Nt[Ae]=V);function ae(Ae){var Ne=te(Ae);Ne.length!==q.length&&Lt("Mismatched type converter count");for(var Ye=0;Ye{Ot.hasOwnProperty(Ae)?ve[Ne]=Ot[Ae]:(me.push(Ae),Pt.hasOwnProperty(Ae)||(Pt[Ae]=[]),Pt[Ae].push(()=>{ve[Ne]=Ot[Ae],++Se,Se===me.length&&ae(ve)}))}),me.length===0&&ae(ve)},ut=q=>{var V=wt[q];delete wt[q];var te=V.rawConstructor,ae=V.rawDestructor,ve=V.fields,me=ve.map(Se=>Se.getterReturnType).concat(ve.map(Se=>Se.setterArgumentType));kt([q],me,Se=>{var Ae={};return ve.forEach((Ne,Ye)=>{var ot=Ne.fieldName,Ft=Se[Ye],wr=Ne.getter,Gt=Ne.getterContext,dr=Se[Ye+ve.length],Qn=Ne.setter,$n=Ne.setterContext;Ae[ot]={read:Mn=>Ft.fromWireType(wr(Gt,Mn)),write:(Mn,hf)=>{var gi=[];Qn($n,Mn,dr.toWireType(gi,hf)),lr(gi)}}}),[{name:V.name,fromWireType:Ne=>{var Ye={};for(var ot in Ae)Ye[ot]=Ae[ot].read(Ne);return ae(Ne),Ye},toWireType:(Ne,Ye)=>{for(var ot in Ae)if(!(ot in Ye))throw new TypeError(`Missing field: "${ot}"`);var Ft=te();for(ot in Ae)Ae[ot].write(Ft,Ye[ot]);return Ne!==null&&Ne.push(ae,Ft),Ft},argPackAdvance:lt,readValueFromPointer:ir,destructorFunction:ae}]})},Vt=(q,V,te,ae,ve)=>{},zt=()=>{for(var q=new Array(256),V=0;V<256;++V)q[V]=String.fromCharCode(V);ht=q},ht,xt=q=>{for(var V="",te=q;U[te];)V+=ht[U[te++]];return V},Dt,He=q=>{throw new Dt(q)};function $t(q,V){let te=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};var ae=V.name;if(q||He(`type "${ae}" must have a positive integer typeid pointer`),Ot.hasOwnProperty(q)){if(te.ignoreDuplicateRegistrations)return;He(`Cannot register type '${ae}' twice`)}if(Ot[q]=V,delete Nt[q],Pt.hasOwnProperty(q)){var ve=Pt[q];delete Pt[q],ve.forEach(me=>me())}}function Et(q,V){let te=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return $t(q,V,te)}var lt=8,Ht=(q,V,te,ae)=>{V=xt(V),Et(q,{name:V,fromWireType:function(ve){return!!ve},toWireType:function(ve,me){return me?te:ae},argPackAdvance:lt,readValueFromPointer:function(ve){return this.fromWireType(U[ve])},destructorFunction:null})},Nr=q=>({count:q.count,deleteScheduled:q.deleteScheduled,preservePointerOnDelete:q.preservePointerOnDelete,ptr:q.ptr,ptrType:q.ptrType,smartPtr:q.smartPtr,smartPtrType:q.smartPtrType}),Ut=q=>{function V(te){return te.$$.ptrType.registeredClass.name}He(V(q)+" instance already deleted")},Ir=!1,tr=q=>{},Mr=q=>{q.smartPtr?q.smartPtrType.rawDestructor(q.smartPtr):q.ptrType.registeredClass.rawDestructor(q.ptr)},hi=q=>{q.count.value-=1;var V=q.count.value===0;V&&Mr(q)},pi=(q,V,te)=>{if(V===te)return q;if(te.baseClass===void 0)return null;var ae=pi(q,V,te.baseClass);return ae===null?null:te.downcast(ae)},vi={},Ci={},_n=(q,V)=>{for(V===void 0&&He("ptr should not be undefined");q.baseClass;)V=q.upcast(V),q=q.baseClass;return V},us=(q,V)=>(V=_n(q,V),Ci[V]),ds=(q,V)=>{(!V.ptrType||!V.ptr)&&Lt("makeClassHandle requires ptr and ptrType");var te=!!V.smartPtrType,ae=!!V.smartPtr;return te!==ae&&Lt("Both smartPtrType and smartPtr must be specified"),V.count={value:1},Vi(Object.create(q,{$$:{value:V,writable:!0}}))};function hs(q){var V=this.getPointee(q);if(!V)return this.destructor(q),null;var te=us(this.registeredClass,V);if(te!==void 0){if(te.$$.count.value===0)return te.$$.ptr=V,te.$$.smartPtr=q,te.clone();var ae=te.clone();return this.destructor(q),ae}function ve(){return this.isSmartPointer?ds(this.registeredClass.instancePrototype,{ptrType:this.pointeeType,ptr:V,smartPtrType:this,smartPtr:q}):ds(this.registeredClass.instancePrototype,{ptrType:this,ptr:q})}var me=this.registeredClass.getActualType(V),Se=vi[me];if(!Se)return ve.call(this);var Ae;this.isConst?Ae=Se.constPointerType:Ae=Se.pointerType;var Ne=pi(V,this.registeredClass,Ae.registeredClass);return Ne===null?ve.call(this):this.isSmartPointer?ds(Ae.registeredClass.instancePrototype,{ptrType:Ae,ptr:Ne,smartPtrType:this,smartPtr:q}):ds(Ae.registeredClass.instancePrototype,{ptrType:Ae,ptr:Ne})}var Vi=q=>typeof FinalizationRegistry>"u"?(Vi=V=>V,q):(Ir=new FinalizationRegistry(V=>{hi(V.$$)}),Vi=V=>{var te=V.$$,ae=!!te.smartPtr;if(ae){var ve={$$:te};Ir.register(V,ve,V)}return V},tr=V=>Ir.unregister(V),Vi(q)),ps=[],vs=()=>{for(;ps.length;){var q=ps.pop();q.$$.deleteScheduled=!1,q.delete()}},Us,fo=()=>{Object.assign(In.prototype,{isAliasOf(q){if(!(this instanceof In)||!(q instanceof In))return!1;var V=this.$$.ptrType.registeredClass,te=this.$$.ptr;q.$$=q.$$;for(var ae=q.$$.ptrType.registeredClass,ve=q.$$.ptr;V.baseClass;)te=V.upcast(te),V=V.baseClass;for(;ae.baseClass;)ve=ae.upcast(ve),ae=ae.baseClass;return V===ae&&te===ve},clone(){if(this.$$.ptr||Ut(this),this.$$.preservePointerOnDelete)return this.$$.count.value+=1,this;var q=Vi(Object.create(Object.getPrototypeOf(this),{$$:{value:Nr(this.$$)}}));return q.$$.count.value+=1,q.$$.deleteScheduled=!1,q},delete(){this.$$.ptr||Ut(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&He("Object already scheduled for deletion"),tr(this),hi(this.$$),this.$$.preservePointerOnDelete||(this.$$.smartPtr=void 0,this.$$.ptr=void 0)},isDeleted(){return!this.$$.ptr},deleteLater(){return this.$$.ptr||Ut(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&He("Object already scheduled for deletion"),ps.push(this),ps.length===1&&Us&&Us(vs),this.$$.deleteScheduled=!0,this}})};function In(){}var zi=(q,V)=>Object.defineProperty(V,"name",{value:q}),uo=(q,V,te)=>{if(q[V].overloadTable===void 0){var ae=q[V];q[V]=function(){for(var ve=arguments.length,me=new Array(ve),Se=0;Se{i.hasOwnProperty(q)?((te===void 0||i[q].overloadTable!==void 0&&i[q].overloadTable[te]!==void 0)&&He(`Cannot register public name '${q}' twice`),uo(i,q,q),i.hasOwnProperty(te)&&He(`Cannot register multiple overloads of a function with the same number of arguments (${te})!`),i[q].overloadTable[te]=V):(i[q]=V,te!==void 0&&(i[q].numArguments=te))},rf=48,Zc=57,s1=q=>{q=q.replace(/[^a-zA-Z0-9_]/g,"$");var V=q.charCodeAt(0);return V>=rf&&V<=Zc?`_${q}`:q};function nf(q,V,te,ae,ve,me,Se,Ae){this.name=q,this.constructor=V,this.instancePrototype=te,this.rawDestructor=ae,this.baseClass=ve,this.getActualType=me,this.upcast=Se,this.downcast=Ae,this.pureVirtualFunctions=[]}var sf=(q,V,te)=>{for(;V!==te;)V.upcast||He(`Expected null or instance of ${te.name}, got an instance of ${V.name}`),q=V.upcast(q),V=V.baseClass;return q};function of(q,V){if(V===null)return this.isReference&&He(`null is not a valid ${this.name}`),0;V.$$||He(`Cannot pass "${le(V)}" as a ${this.name}`),V.$$.ptr||He(`Cannot pass deleted object as a pointer of type ${this.name}`);var te=V.$$.ptrType.registeredClass,ae=sf(V.$$.ptr,te,this.registeredClass);return ae}function Bh(q,V){var te;if(V===null)return this.isReference&&He(`null is not a valid ${this.name}`),this.isSmartPointer?(te=this.rawConstructor(),q!==null&&q.push(this.rawDestructor,te),te):0;(!V||!V.$$)&&He(`Cannot pass "${le(V)}" as a ${this.name}`),V.$$.ptr||He(`Cannot pass deleted object as a pointer of type ${this.name}`),!this.isConst&&V.$$.ptrType.isConst&&He(`Cannot convert argument of type ${V.$$.smartPtrType?V.$$.smartPtrType.name:V.$$.ptrType.name} to parameter type ${this.name}`);var ae=V.$$.ptrType.registeredClass;if(te=sf(V.$$.ptr,ae,this.registeredClass),this.isSmartPointer)switch(V.$$.smartPtr===void 0&&He("Passing raw pointer to smart pointer is illegal"),this.sharingPolicy){case 0:V.$$.smartPtrType===this?te=V.$$.smartPtr:He(`Cannot convert argument of type ${V.$$.smartPtrType?V.$$.smartPtrType.name:V.$$.ptrType.name} to parameter type ${this.name}`);break;case 1:te=V.$$.smartPtr;break;case 2:if(V.$$.smartPtrType===this)te=V.$$.smartPtr;else{var ve=V.clone();te=this.rawShare(te,ho.toHandle(()=>ve.delete())),q!==null&&q.push(this.rawDestructor,te)}break;default:He("Unsupporting sharing policy")}return te}function af(q,V){if(V===null)return this.isReference&&He(`null is not a valid ${this.name}`),0;V.$$||He(`Cannot pass "${le(V)}" as a ${this.name}`),V.$$.ptr||He(`Cannot pass deleted object as a pointer of type ${this.name}`),V.$$.ptrType.isConst&&He(`Cannot convert argument of type ${V.$$.ptrType.name} to parameter type ${this.name}`);var te=V.$$.ptrType.registeredClass,ae=sf(V.$$.ptr,te,this.registeredClass);return ae}var o1=()=>{Object.assign(Bu.prototype,{getPointee(q){return this.rawGetPointee&&(q=this.rawGetPointee(q)),q},destructor(q){var V;(V=this.rawDestructor)===null||V===void 0||V.call(this,q)},argPackAdvance:lt,readValueFromPointer:ir,fromWireType:hs})};function Bu(q,V,te,ae,ve,me,Se,Ae,Ne,Ye,ot){this.name=q,this.registeredClass=V,this.isReference=te,this.isConst=ae,this.isSmartPointer=ve,this.pointeeType=me,this.sharingPolicy=Se,this.rawGetPointee=Ae,this.rawConstructor=Ne,this.rawShare=Ye,this.rawDestructor=ot,!ve&&V.baseClass===void 0?ae?(this.toWireType=of,this.destructorFunction=null):(this.toWireType=af,this.destructorFunction=null):this.toWireType=Bh}var Lh=(q,V,te)=>{i.hasOwnProperty(q)||Lt("Replacing nonexistent public symbol"),i[q].overloadTable!==void 0&&te!==void 0?i[q].overloadTable[te]=V:(i[q]=V,i[q].argCount=te)},a1=(q,V,te)=>{q=q.replace(/p/g,"i");var ae=i["dynCall_"+q];return ae(V,...te)},dc=[],c1,yr=q=>{var V=dc[q];return V||(q>=dc.length&&(dc.length=q+1),dc[q]=V=c1.get(q)),V},Lu=function(q,V){let te=arguments.length>2&&arguments[2]!==void 0?arguments[2]:[];if(q.includes("j"))return a1(q,V,te);var ae=yr(V)(...te);return ae},Xc=(q,V)=>function(){for(var te=arguments.length,ae=new Array(te),ve=0;ve{q=xt(q);function te(){return q.includes("j")?Xc(q,V):yr(V)}var ae=te();return typeof ae!="function"&&He(`unknown function pointer with signature ${q}: ${V}`),ae},l1=(q,V)=>{var te=zi(V,function(ae){this.name=V,this.message=ae;var ve=new Error(ae).stack;ve!==void 0&&(this.stack=this.toString()+` +`+ve.replace(/^Error(:[^\n]*)?\n/,""))});return te.prototype=Object.create(q.prototype),te.prototype.constructor=te,te.prototype.toString=function(){return this.message===void 0?this.name:`${this.name}: ${this.message}`},te},Fh,Uo=q=>{var V=Xx(q),te=xt(V);return pc(V),te},cf=(q,V)=>{var te=[],ae={};function ve(me){if(!ae[me]&&!Ot[me]){if(Nt[me]){Nt[me].forEach(ve);return}te.push(me),ae[me]=!0}}throw V.forEach(ve),new Fh(`${q}: `+te.map(Uo).join([", "]))},f1=(q,V,te,ae,ve,me,Se,Ae,Ne,Ye,ot,Ft,wr)=>{ot=xt(ot),me=xn(ve,me),Ae&&(Ae=xn(Se,Ae)),Ye&&(Ye=xn(Ne,Ye)),wr=xn(Ft,wr);var Gt=s1(ot);$s(Gt,function(){cf(`Cannot construct ${ot} due to unbound types`,[ae])}),kt([q,V,te],ae?[ae]:[],dr=>{dr=dr[0];var Qn,$n;ae?(Qn=dr.registeredClass,$n=Qn.instancePrototype):$n=In.prototype;var Mn=zi(ot,function(){if(Object.getPrototypeOf(this)!==hf)throw new Dt("Use 'new' to construct "+ot);if(gi.constructor_body===void 0)throw new Dt(ot+" has no accessible constructor");for(var Yh=arguments.length,vc=new Array(Yh),A1=0;A1{for(var te=[],ae=0;ae>2]);return te};function u1(q){for(var V=1;V{var Se=Fu(V,te);ve=xn(ae,ve),kt([],[q],Ae=>{Ae=Ae[0];var Ne=`constructor ${Ae.name}`;if(Ae.registeredClass.constructor_body===void 0&&(Ae.registeredClass.constructor_body=[]),Ae.registeredClass.constructor_body[V-1]!==void 0)throw new Dt(`Cannot register multiple constructors with identical number of parameters (${V-1}) for class '${Ae.name}'! Overload resolution is currently only performed using the parameter count, not actual type info!`);return Ae.registeredClass.constructor_body[V-1]=()=>{cf(`Cannot construct ${Ae.name} due to unbound types`,Se)},kt([],Se,Ye=>(Ye.splice(1,0,null),Ae.registeredClass.constructor_body[V-1]=jh(Ne,Ye,null,ve,me),[])),[]})},Uh=q=>{q=q.trim();const V=q.indexOf("(");return V!==-1?q.substr(0,V):q},d1=(q,V,te,ae,ve,me,Se,Ae,Ne,Ye)=>{var ot=Fu(te,ae);V=xt(V),V=Uh(V),me=xn(ve,me),kt([],[q],Ft=>{Ft=Ft[0];var wr=`${Ft.name}.${V}`;V.startsWith("@@")&&(V=Symbol[V.substring(2)]),Ae&&Ft.registeredClass.pureVirtualFunctions.push(V);function Gt(){cf(`Cannot call ${wr} due to unbound types`,ot)}var dr=Ft.registeredClass.instancePrototype,Qn=dr[V];return Qn===void 0||Qn.overloadTable===void 0&&Qn.className!==Ft.name&&Qn.argCount===te-2?(Gt.argCount=te-2,Gt.className=Ft.name,dr[V]=Gt):(uo(dr,V,wr),dr[V].overloadTable[te-2]=Gt),kt([],ot,$n=>{var Mn=jh(wr,$n,Ft,me,Se);return dr[V].overloadTable===void 0?(Mn.argCount=te-2,dr[V]=Mn):dr[V].overloadTable[te-2]=Mn,[]}),[]})},el=[],$o=[],lf=q=>{q>9&&--$o[q+1]===0&&($o[q]=void 0,el.push(q))},zy=()=>$o.length/2-5-el.length,ju=()=>{$o.push(0,1,void 0,1,null,1,!0,1,!1,1),i.count_emval_handles=zy},ho={toValue:q=>(q||He("Cannot use deleted val. handle = "+q),$o[q]),toHandle:q=>{switch(q){case void 0:return 2;case null:return 4;case!0:return 6;case!1:return 8;default:{const V=el.pop()||$o.length;return $o[V]=q,$o[V+1]=1,V}}}},$h={name:"emscripten::val",fromWireType:q=>{var V=ho.toValue(q);return lf(q),V},toWireType:(q,V)=>ho.toHandle(V),argPackAdvance:lt,readValueFromPointer:ir,destructorFunction:null},ff=q=>Et(q,$h),h1=(q,V,te)=>{switch(V){case 1:return te?function(ae){return this.fromWireType(_[ae])}:function(ae){return this.fromWireType(U[ae])};case 2:return te?function(ae){return this.fromWireType(ie[ae>>1])}:function(ae){return this.fromWireType(ce[ae>>1])};case 4:return te?function(ae){return this.fromWireType(K[ae>>2])}:function(ae){return this.fromWireType(k[ae>>2])};default:throw new TypeError(`invalid integer width (${V}): ${q}`)}},Hy=(q,V,te,ae)=>{V=xt(V);function ve(){}ve.values={},Et(q,{name:V,constructor:ve,fromWireType:function(me){return this.constructor.values[me]},toWireType:(me,Se)=>Se.value,argPackAdvance:lt,readValueFromPointer:h1(V,te,ae),destructorFunction:null}),$s(V,ve)},zr=(q,V)=>{var te=Ot[q];return te===void 0&&He(`${V} has unknown type ${Uo(q)}`),te},Wr=(q,V,te)=>{var ae=zr(q,"enum");V=xt(V);var ve=ae.constructor,me=Object.create(ae.constructor.prototype,{value:{value:te},constructor:{value:zi(`${ae.name}_${V}`,function(){})}});ve.values[te]=me,ve[V]=me},le=q=>{if(q===null)return"null";var V=typeof q;return V==="object"||V==="array"||V==="function"?q.toString():""+q},xe=(q,V)=>{switch(V){case 4:return function(te){return this.fromWireType(O[te>>2])};case 8:return function(te){return this.fromWireType(v[te>>3])};default:throw new TypeError(`invalid float width (${V}): ${q}`)}},$e=(q,V,te)=>{V=xt(V),Et(q,{name:V,fromWireType:ae=>ae,toWireType:(ae,ve)=>ve,argPackAdvance:lt,readValueFromPointer:xe(V,te),destructorFunction:null})},gt=(q,V,te,ae,ve,me,Se,Ae)=>{var Ne=Fu(V,te);q=xt(q),q=Uh(q),ve=xn(ae,ve),$s(q,function(){cf(`Cannot call ${q} due to unbound types`,Ne)},V-1),kt([],Ne,Ye=>{var ot=[Ye[0],null].concat(Ye.slice(1));return Lh(q,jh(q,ot,null,ve,me),V-1),[]})},tn=(q,V,te)=>{switch(V){case 1:return te?ae=>_[ae]:ae=>U[ae];case 2:return te?ae=>ie[ae>>1]:ae=>ce[ae>>1];case 4:return te?ae=>K[ae>>2]:ae=>k[ae>>2];default:throw new TypeError(`invalid integer width (${V}): ${q}`)}},rr=(q,V,te,ae,ve)=>{V=xt(V);var me=ot=>ot;if(ae===0){var Se=32-8*te;me=ot=>ot<>>Se}var Ae=V.includes("unsigned"),Ne=(ot,Ft)=>{},Ye;Ae?Ye=function(ot,Ft){return Ne(Ft,this.name),Ft>>>0}:Ye=function(ot,Ft){return Ne(Ft,this.name),Ft},Et(q,{name:V,fromWireType:me,toWireType:Ye,argPackAdvance:lt,readValueFromPointer:tn(V,te,ae!==0),destructorFunction:null})},pn=(q,V,te)=>{var ae=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array],ve=ae[V];function me(Se){var Ae=k[Se>>2],Ne=k[Se+4>>2];return new ve(_.buffer,Ne,Ae)}te=xt(te),Et(q,{name:te,fromWireType:me,argPackAdvance:lt,readValueFromPointer:me},{ignoreDuplicateRegistrations:!0})},Un=Object.assign({optional:!0},$h),Er=(q,V)=>{Et(q,Un)},rn=(q,V,te,ae)=>{if(!(ae>0))return 0;for(var ve=te,me=te+ae-1,Se=0;Se=55296&&Ae<=57343){var Ne=q.charCodeAt(++Se);Ae=65536+((Ae&1023)<<10)|Ne&1023}if(Ae<=127){if(te>=me)break;V[te++]=Ae}else if(Ae<=2047){if(te+1>=me)break;V[te++]=192|Ae>>6,V[te++]=128|Ae&63}else if(Ae<=65535){if(te+2>=me)break;V[te++]=224|Ae>>12,V[te++]=128|Ae>>6&63,V[te++]=128|Ae&63}else{if(te+3>=me)break;V[te++]=240|Ae>>18,V[te++]=128|Ae>>12&63,V[te++]=128|Ae>>6&63,V[te++]=128|Ae&63}}return V[te]=0,te-ve},vn=(q,V,te)=>rn(q,U,V,te),gs=q=>{for(var V=0,te=0;te=55296&&ae<=57343?(V+=4,++te):V+=3}return V},kn=typeof TextDecoder<"u"?new TextDecoder:void 0,fn=function(q){let V=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,te=arguments.length>2&&arguments[2]!==void 0?arguments[2]:NaN;for(var ae=V+te,ve=V;q[ve]&&!(ve>=ae);)++ve;if(ve-V>16&&q.buffer&&kn)return kn.decode(q.subarray(V,ve));for(var me="";V>10,56320|Ye&1023)}}return me},Hi=(q,V)=>q?fn(U,q,V):"",qo=(q,V)=>{V=xt(V);var te=V==="std::string";Et(q,{name:V,fromWireType(ae){var ve=k[ae>>2],me=ae+4,Se;if(te)for(var Ae=me,Ne=0;Ne<=ve;++Ne){var Ye=me+Ne;if(Ne==ve||U[Ye]==0){var ot=Ye-Ae,Ft=Hi(Ae,ot);Se===void 0?Se=Ft:(Se+="\0",Se+=Ft),Ae=Ye+1}}else{for(var wr=new Array(ve),Ne=0;Ne>2]=me,te&&Se)vn(ve,Ne,me+1);else if(Se)for(var Ye=0;Ye255&&(pc(Ne),He("String has UTF-16 code units that do not fit in 8 bits")),U[Ne+Ye]=ot}else for(var Ye=0;Ye{for(var te=q,ae=te>>1,ve=ae+V/2;!(ae>=ve)&&ce[ae];)++ae;if(te=ae<<1,te-q>32&&qs)return qs.decode(U.subarray(q,te));for(var me="",Se=0;!(Se>=V/2);++Se){var Ae=ie[q+Se*2>>1];if(Ae==0)break;me+=String.fromCharCode(Ae)}return me},qh=(q,V,te)=>{var ae;if((ae=te)!==null&&ae!==void 0||(te=2147483647),te<2)return 0;te-=2;for(var ve=V,me=te>1]=Ae,V+=2}return ie[V>>1]=0,V-ve},uf=q=>q.length*2,li=(q,V)=>{for(var te=0,ae="";!(te>=V/4);){var ve=K[q+te*4>>2];if(ve==0)break;if(++te,ve>=65536){var me=ve-65536;ae+=String.fromCharCode(55296|me>>10,56320|me&1023)}else ae+=String.fromCharCode(ve)}return ae},NE=(q,V,te)=>{var ae;if((ae=te)!==null&&ae!==void 0||(te=2147483647),te<4)return 0;for(var ve=V,me=ve+te-4,Se=0;Se=55296&&Ae<=57343){var Ne=q.charCodeAt(++Se);Ae=65536+((Ae&1023)<<10)|Ne&1023}if(K[V>>2]=Ae,V+=4,V+4>me)break}return K[V>>2]=0,V-ve},po=q=>{for(var V=0,te=0;te=55296&&ae<=57343&&++te,V+=4}return V},DE=(q,V,te)=>{te=xt(te);var ae,ve,me,Se;V===2?(ae=wa,ve=qh,Se=uf,me=Ae=>ce[Ae>>1]):V===4&&(ae=li,ve=NE,Se=po,me=Ae=>k[Ae>>2]),Et(q,{name:te,fromWireType:Ae=>{for(var Ne=k[Ae>>2],Ye,ot=Ae+4,Ft=0;Ft<=Ne;++Ft){var wr=Ae+4+Ft*V;if(Ft==Ne||me(wr)==0){var Gt=wr-ot,dr=ae(ot,Gt);Ye===void 0?Ye=dr:(Ye+="\0",Ye+=dr),ot=wr+V}}return pc(Ae),Ye},toWireType:(Ae,Ne)=>{typeof Ne!="string"&&He(`Cannot pass non-string to C++ string type ${te}`);var Ye=Se(Ne),ot=Hh(4+Ye+V);return k[ot>>2]=Ye/V,ve(Ne,ot+4,Ye+V),Ae!==null&&Ae.push(pc,ot),ot},argPackAdvance:lt,readValueFromPointer:ir,destructorFunction(Ae){pc(Ae)}})},Gx=(q,V,te,ae,ve,me)=>{wt[q]={name:xt(V),rawConstructor:xn(te,ae),rawDestructor:xn(ve,me),fields:[]}},tl=(q,V,te,ae,ve,me,Se,Ae,Ne,Ye)=>{wt[q].fields.push({fieldName:xt(V),getterReturnType:te,getter:xn(ae,ve),getterContext:me,setterArgumentType:Se,setter:xn(Ae,Ne),setterContext:Ye})},p1=(q,V)=>{V=xt(V),Et(q,{isVoid:!0,name:V,argPackAdvance:0,fromWireType:()=>{},toWireType:(te,ae)=>{}})},Gy=(q,V,te)=>U.copyWithin(q,V,V+te),un=[],rl=(q,V,te,ae)=>(q=un[q],V=ho.toValue(V),q(null,V,te,ae)),Wy={},BE=q=>{var V=Wy[q];return V===void 0?xt(q):V},v1=()=>{if(typeof globalThis=="object")return globalThis;function q(V){V.$$$embind_global$$$=V;var te=typeof $$$embind_global$$$=="object"&&V.$$$embind_global$$$==V;return te||delete V.$$$embind_global$$$,te}if(typeof $$$embind_global$$$=="object"||(typeof global=="object"&&q(global)?$$$embind_global$$$=global:typeof self=="object"&&q(self)&&($$$embind_global$$$=self),typeof $$$embind_global$$$=="object"))return $$$embind_global$$$;throw Error("unable to get global object.")},LE=q=>q===0?ho.toHandle(v1()):(q=BE(q),ho.toHandle(v1()[q])),FE=q=>{var V=un.length;return un.push(q),V},jE=(q,V)=>{for(var te=new Array(q),ae=0;ae>2],"parameter "+ae);return te},Wx=Reflect.construct,g1=(q,V,te)=>{var ae=[],ve=q.toWireType(ae,te);return ae.length&&(k[V>>2]=ho.toHandle(ae)),ve},Uu=(q,V,te)=>{var ae=jE(q,V),ve=ae.shift();q--;var me=new Array(q),Se=(Ne,Ye,ot,Ft)=>{for(var wr=0,Gt=0;GtNe.name).join(", ")}) => ${ve.name}>`;return FE(zi(Ae,Se))},UE=q=>{q>9&&($o[q+1]+=1)},Kx=q=>{var V=ho.toValue(q);lr(V),lf(q)},Yx=(q,V)=>{q=zr(q,"_emval_take_value");var te=q.readValueFromPointer(V);return ho.toHandle(te)},Ky=(q,V,te,ae)=>{var ve=new Date().getFullYear(),me=new Date(ve,0,1),Se=new Date(ve,6,1),Ae=me.getTimezoneOffset(),Ne=Se.getTimezoneOffset(),Ye=Math.max(Ae,Ne);k[q>>2]=Ye*60,K[V>>2]=+(Ae!=Ne);var ot=Gt=>{var dr=Gt>=0?"-":"+",Qn=Math.abs(Gt),$n=String(Math.floor(Qn/60)).padStart(2,"0"),Mn=String(Qn%60).padStart(2,"0");return`UTC${dr}${$n}${Mn}`},Ft=ot(Ae),wr=ot(Ne);Ne2147483648,Qx=(q,V)=>Math.ceil(q/V)*V,$E=q=>{var V=F.buffer,te=(q-V.byteLength+65535)/65536|0;try{return F.grow(te),m(),1}catch{}},Qy=q=>{var V=U.length;q>>>=0;var te=Yy();if(q>te)return!1;for(var ae=1;ae<=4;ae*=2){var ve=V*(1+.2/ae);ve=Math.min(ve,q+100663296);var me=Math.min(te,Qx(Math.max(q,ve),65536)),Se=$E(me);if(Se)return!0}return!1},Vh={},qE=()=>p||"./this.program",$u=()=>{if(!$u.strings){var q=(typeof navigator=="object"&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",V={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:q,_:qE()};for(var te in Vh)Vh[te]===void 0?delete V[te]:V[te]=Vh[te];var ae=[];for(var te in V)ae.push(`${te}=${V[te]}`);$u.strings=ae}return $u.strings},Vs=(q,V)=>{for(var te=0;te{var te=0;return $u().forEach((ae,ve)=>{var me=V+te;k[q+ve*4>>2]=me,Vs(ae,me),te+=ae.length+1}),0},zh=(q,V)=>{var te=$u();k[q>>2]=te.length;var ae=0;return te.forEach(ve=>ae+=ve.length+1),k[V>>2]=ae,0},Jx=q=>52;function Zx(q,V,te,ae,ve){return 70}var VE=[null,[],[]],zE=(q,V)=>{var te=VE[q];V===0||V===10?((q===1?S:R)(fn(te)),te.length=0):te.push(V)},HE=(q,V,te,ae)=>{for(var ve=0,me=0;me>2],Ae=k[V+4>>2];V+=8;for(var Ne=0;Ne>2]=ve,0},GE=q=>q;dt=i.InternalError=class extends Error{constructor(q){super(q),this.name="InternalError"}},zt(),Dt=i.BindingError=class extends Error{constructor(q){super(q),this.name="BindingError"}},fo(),o1(),Fh=i.UnboundTypeError=l1(Error,"UnboundTypeError"),ju();var WE={t:tt,x:We,a:bt,j:nt,k:_t,O:Ct,q:It,ga:er,d:pt,ca:ur,va:ut,ba:Vt,pa:Ht,ta:f1,sa:hc,E:d1,oa:ff,F:Hy,n:Wr,W:$e,X:gt,y:rr,u:pn,ua:Er,V:qo,P:DE,L:Gx,wa:tl,qa:p1,ja:Gy,T:rl,xa:lf,ya:LE,U:Uu,Y:UE,Z:Kx,ra:Yx,da:Ky,ha:Qy,ea:Jy,fa:zh,ia:Jx,$:Zx,S:HE,J:b1,C:eC,Q:qu,R:nl,r:y1,b:KE,D:m1,la:w1,c:Oe,ka:tC,h:JE,i:Lr,s:Yn,N:Vu,w:em,I:nC,K:XE,z:i2,H:E1,aa:C1,_:o2,l:Pe,f:be,e:QE,g:YE,M:x1,m:Xt,ma:Hr,p:nn,v:ZE,na:go,B:rC,o:mt,G:s2,A:GE},Kr=Re(),Xx=q=>(Xx=Kr.Ba)(q),pc=i._free=q=>(pc=i._free=Kr.Ca)(q),Hh=i._malloc=q=>(Hh=i._malloc=Kr.Ea)(q),Zy=q=>(Zy=Kr.Fa)(q),nr=(q,V)=>(nr=Kr.Ga)(q,V),Gh=q=>(Gh=Kr.Ha)(q),e2=q=>(e2=Kr.Ia)(q),t2=()=>(t2=Kr.Ja)(),r2=q=>(r2=Kr.Ka)(q),df=q=>(df=Kr.La)(q),vo=(q,V,te)=>(vo=Kr.Ma)(q,V,te);i.dynCall_viijii=(q,V,te,ae,ve,me,Se)=>(i.dynCall_viijii=Kr.Na)(q,V,te,ae,ve,me,Se);var Xy=i.dynCall_jiii=(q,V,te,ae)=>(Xy=i.dynCall_jiii=Kr.Oa)(q,V,te,ae);i.dynCall_jiji=(q,V,te,ae,ve)=>(i.dynCall_jiji=Kr.Pa)(q,V,te,ae,ve);var n2=i.dynCall_jiiii=(q,V,te,ae,ve)=>(n2=i.dynCall_jiiii=Kr.Qa)(q,V,te,ae,ve);i.dynCall_iiiiij=(q,V,te,ae,ve,me,Se)=>(i.dynCall_iiiiij=Kr.Ra)(q,V,te,ae,ve,me,Se),i.dynCall_iiiiijj=(q,V,te,ae,ve,me,Se,Ae,Ne)=>(i.dynCall_iiiiijj=Kr.Sa)(q,V,te,ae,ve,me,Se,Ae,Ne),i.dynCall_iiiiiijj=(q,V,te,ae,ve,me,Se,Ae,Ne,Ye)=>(i.dynCall_iiiiiijj=Kr.Ta)(q,V,te,ae,ve,me,Se,Ae,Ne,Ye);function KE(q,V){var te=De();try{return yr(q)(V)}catch(ae){if(Te(te),ae!==ae+0)throw ae;nr(1,0)}}function YE(q,V,te,ae){var ve=De();try{yr(q)(V,te,ae)}catch(me){if(Te(ve),me!==me+0)throw me;nr(1,0)}}function QE(q,V,te){var ae=De();try{yr(q)(V,te)}catch(ve){if(Te(ae),ve!==ve+0)throw ve;nr(1,0)}}function JE(q,V,te,ae){var ve=De();try{return yr(q)(V,te,ae)}catch(me){if(Te(ve),me!==me+0)throw me;nr(1,0)}}function qu(q,V,te,ae,ve){var me=De();try{return yr(q)(V,te,ae,ve)}catch(Se){if(Te(me),Se!==Se+0)throw Se;nr(1,0)}}function be(q,V){var te=De();try{yr(q)(V)}catch(ae){if(Te(te),ae!==ae+0)throw ae;nr(1,0)}}function Oe(q,V,te){var ae=De();try{return yr(q)(V,te)}catch(ve){if(Te(ae),ve!==ve+0)throw ve;nr(1,0)}}function Pe(q){var V=De();try{yr(q)()}catch(te){if(Te(V),te!==te+0)throw te;nr(1,0)}}function mt(q,V,te,ae,ve,me,Se,Ae,Ne,Ye,ot){var Ft=De();try{yr(q)(V,te,ae,ve,me,Se,Ae,Ne,Ye,ot)}catch(wr){if(Te(Ft),wr!==wr+0)throw wr;nr(1,0)}}function Xt(q,V,te,ae,ve){var me=De();try{yr(q)(V,te,ae,ve)}catch(Se){if(Te(me),Se!==Se+0)throw Se;nr(1,0)}}function Lr(q,V,te,ae,ve){var me=De();try{return yr(q)(V,te,ae,ve)}catch(Se){if(Te(me),Se!==Se+0)throw Se;nr(1,0)}}function Yn(q,V,te,ae,ve,me){var Se=De();try{return yr(q)(V,te,ae,ve,me)}catch(Ae){if(Te(Se),Ae!==Ae+0)throw Ae;nr(1,0)}}function nn(q,V,te,ae,ve,me){var Se=De();try{yr(q)(V,te,ae,ve,me)}catch(Ae){if(Te(Se),Ae!==Ae+0)throw Ae;nr(1,0)}}function em(q,V,te,ae,ve,me,Se){var Ae=De();try{return yr(q)(V,te,ae,ve,me,Se)}catch(Ne){if(Te(Ae),Ne!==Ne+0)throw Ne;nr(1,0)}}function ZE(q,V,te,ae,ve,me,Se,Ae){var Ne=De();try{yr(q)(V,te,ae,ve,me,Se,Ae)}catch(Ye){if(Te(Ne),Ye!==Ye+0)throw Ye;nr(1,0)}}function go(q,V,te,ae,ve,me,Se,Ae,Ne){var Ye=De();try{yr(q)(V,te,ae,ve,me,Se,Ae,Ne)}catch(ot){if(Te(Ye),ot!==ot+0)throw ot;nr(1,0)}}function y1(q){var V=De();try{return yr(q)()}catch(te){if(Te(V),te!==te+0)throw te;nr(1,0)}}function XE(q,V,te,ae,ve,me,Se,Ae,Ne){var Ye=De();try{return yr(q)(V,te,ae,ve,me,Se,Ae,Ne)}catch(ot){if(Te(Ye),ot!==ot+0)throw ot;nr(1,0)}}function Vu(q,V,te,ae,ve,me,Se){var Ae=De();try{return yr(q)(V,te,ae,ve,me,Se)}catch(Ne){if(Te(Ae),Ne!==Ne+0)throw Ne;nr(1,0)}}function m1(q,V,te,ae){var ve=De();try{return yr(q)(V,te,ae)}catch(me){if(Te(ve),me!==me+0)throw me;nr(1,0)}}function b1(q,V,te,ae){var ve=De();try{return yr(q)(V,te,ae)}catch(me){if(Te(ve),me!==me+0)throw me;nr(1,0)}}function Hr(q,V,te,ae,ve,me,Se,Ae){var Ne=De();try{yr(q)(V,te,ae,ve,me,Se,Ae)}catch(Ye){if(Te(Ne),Ye!==Ye+0)throw Ye;nr(1,0)}}function eC(q,V,te,ae,ve,me){var Se=De();try{return yr(q)(V,te,ae,ve,me)}catch(Ae){if(Te(Se),Ae!==Ae+0)throw Ae;nr(1,0)}}function i2(q,V,te,ae,ve,me,Se,Ae,Ne,Ye){var ot=De();try{return yr(q)(V,te,ae,ve,me,Se,Ae,Ne,Ye)}catch(Ft){if(Te(ot),Ft!==Ft+0)throw Ft;nr(1,0)}}function w1(q,V,te){var ae=De();try{return yr(q)(V,te)}catch(ve){if(Te(ae),ve!==ve+0)throw ve;nr(1,0)}}function tC(q,V,te,ae,ve){var me=De();try{return yr(q)(V,te,ae,ve)}catch(Se){if(Te(me),Se!==Se+0)throw Se;nr(1,0)}}function rC(q,V,te,ae,ve,me,Se,Ae,Ne,Ye){var ot=De();try{yr(q)(V,te,ae,ve,me,Se,Ae,Ne,Ye)}catch(Ft){if(Te(ot),Ft!==Ft+0)throw Ft;nr(1,0)}}function nC(q,V,te,ae,ve,me,Se,Ae){var Ne=De();try{return yr(q)(V,te,ae,ve,me,Se,Ae)}catch(Ye){if(Te(Ne),Ye!==Ye+0)throw Ye;nr(1,0)}}function x1(q,V,te,ae,ve,me,Se){var Ae=De();try{yr(q)(V,te,ae,ve,me,Se)}catch(Ne){if(Te(Ae),Ne!==Ne+0)throw Ne;nr(1,0)}}function nl(q,V,te,ae){var ve=De();try{return yr(q)(V,te,ae)}catch(me){if(Te(ve),me!==me+0)throw me;nr(1,0)}}function E1(q,V,te,ae,ve,me,Se,Ae,Ne,Ye,ot,Ft){var wr=De();try{return yr(q)(V,te,ae,ve,me,Se,Ae,Ne,Ye,ot,Ft)}catch(Gt){if(Te(wr),Gt!==Gt+0)throw Gt;nr(1,0)}}function s2(q,V,te,ae,ve,me,Se,Ae,Ne,Ye,ot,Ft,wr,Gt,dr,Qn){var $n=De();try{yr(q)(V,te,ae,ve,me,Se,Ae,Ne,Ye,ot,Ft,wr,Gt,dr,Qn)}catch(Mn){if(Te($n),Mn!==Mn+0)throw Mn;nr(1,0)}}function C1(q,V,te,ae){var ve=De();try{return Xy(q,V,te,ae)}catch(me){if(Te(ve),me!==me+0)throw me;nr(1,0)}}function o2(q,V,te,ae,ve){var me=De();try{return n2(q,V,te,ae,ve)}catch(Se){if(Te(me),Se!==Se+0)throw Se;nr(1,0)}}var Wh,Kh;X=function q(){Wh||tm(),Wh||(X=q)};function tm(){if(j>0||!Kh&&(Kh=1,x(),j>0))return;function q(){var V;Wh||(Wh=1,i.calledRun=1,!H&&(w(),s(i),(V=i.onRuntimeInitialized)===null||V===void 0||V.call(i),T()))}i.setStatus?(i.setStatus("Running..."),setTimeout(()=>{setTimeout(()=>i.setStatus(""),1),q()},1)):q()}if(i.preInit)for(typeof i.preInit=="function"&&(i.preInit=[i.preInit]);i.preInit.length>0;)i.preInit.pop()();return tm(),n=a,n}})();function fje(t){return XM(eR,t)}async function uje(t,e){return cje(eR,t,e)}async function dje(t,e){return lje(eR,t,e)}const Wte=[["aztec","Aztec"],["code_128","Code128"],["code_39","Code39"],["code_93","Code93"],["codabar","Codabar"],["databar","DataBar"],["databar_expanded","DataBarExpanded"],["databar_limited","DataBarLimited"],["data_matrix","DataMatrix"],["dx_film_edge","DXFilmEdge"],["ean_13","EAN-13"],["ean_8","EAN-8"],["itf","ITF"],["maxi_code","MaxiCode"],["micro_qr_code","MicroQRCode"],["pdf417","PDF417"],["qr_code","QRCode"],["rm_qr_code","rMQRCode"],["upc_a","UPC-A"],["upc_e","UPC-E"],["linear_codes","Linear-Codes"],["matrix_codes","Matrix-Codes"]],hje=[...Wte,["unknown"]].map(t=>t[0]),II=new Map(Wte);function pje(t){for(const[e,r]of II)if(t===r)return e;return"unknown"}function vje(t){if(Kte(t))return{width:t.naturalWidth,height:t.naturalHeight};if(Yte(t))return{width:t.width.baseVal.value,height:t.height.baseVal.value};if(Qte(t))return{width:t.videoWidth,height:t.videoHeight};if(Zte(t))return{width:t.width,height:t.height};if(ere(t))return{width:t.displayWidth,height:t.displayHeight};if(Jte(t))return{width:t.width,height:t.height};if(Xte(t))return{width:t.width,height:t.height};throw new TypeError("The provided value is not of type '(Blob or HTMLCanvasElement or HTMLImageElement or HTMLVideoElement or ImageBitmap or ImageData or OffscreenCanvas or SVGImageElement or VideoFrame)'.")}function Kte(t){var e,r;try{return t instanceof((r=(e=t==null?void 0:t.ownerDocument)==null?void 0:e.defaultView)==null?void 0:r.HTMLImageElement)}catch{return!1}}function Yte(t){var e,r;try{return t instanceof((r=(e=t==null?void 0:t.ownerDocument)==null?void 0:e.defaultView)==null?void 0:r.SVGImageElement)}catch{return!1}}function Qte(t){var e,r;try{return t instanceof((r=(e=t==null?void 0:t.ownerDocument)==null?void 0:e.defaultView)==null?void 0:r.HTMLVideoElement)}catch{return!1}}function Jte(t){var e,r;try{return t instanceof((r=(e=t==null?void 0:t.ownerDocument)==null?void 0:e.defaultView)==null?void 0:r.HTMLCanvasElement)}catch{return!1}}function Zte(t){try{return t instanceof ImageBitmap||Object.prototype.toString.call(t)==="[object ImageBitmap]"}catch{return!1}}function Xte(t){try{return t instanceof OffscreenCanvas||Object.prototype.toString.call(t)==="[object OffscreenCanvas]"}catch{return!1}}function ere(t){try{return t instanceof VideoFrame||Object.prototype.toString.call(t)==="[object VideoFrame]"}catch{return!1}}function tre(t){try{return t instanceof Blob||Object.prototype.toString.call(t)==="[object Blob]"}catch{return!1}}function gje(t){try{return t instanceof ImageData||Object.prototype.toString.call(t)==="[object ImageData]"}catch{return!1}}function yje(t,e){try{const r=new OffscreenCanvas(t,e);if(r.getContext("2d")instanceof OffscreenCanvasRenderingContext2D)return r;throw void 0}catch{const r=document.createElement("canvas");return r.width=t,r.height=e,r}}async function rre(t){if(Kte(t)&&!await xje(t))throw new DOMException("Failed to load or decode HTMLImageElement.","InvalidStateError");if(Yte(t)&&!await Eje(t))throw new DOMException("Failed to load or decode SVGImageElement.","InvalidStateError");if(ere(t)&&Cje(t))throw new DOMException("VideoFrame is closed.","InvalidStateError");if(Qte(t)&&(t.readyState===0||t.readyState===1))throw new DOMException("Invalid element or state.","InvalidStateError");if(Zte(t)&&Sje(t))throw new DOMException("The image source is detached.","InvalidStateError");const{width:e,height:r}=vje(t);if(e===0||r===0)return null;const n=yje(e,r).getContext("2d");n.drawImage(t,0,0);try{return n.getImageData(0,0,e,r)}catch{throw new DOMException("Source would taint origin.","SecurityError")}}async function mje(t){let e;try{if(globalThis.createImageBitmap)e=await createImageBitmap(t);else if(globalThis.Image){e=new Image;let r="";try{r=URL.createObjectURL(t),e.src=r,await e.decode()}finally{URL.revokeObjectURL(r)}}else return t}catch{throw new DOMException("Failed to load or decode Blob.","InvalidStateError")}return await rre(e)}function bje(t){const{width:e,height:r}=t;if(e===0||r===0)return null;const n=t.getContext("2d");try{return n.getImageData(0,0,e,r)}catch{throw new DOMException("Source would taint origin.","SecurityError")}}async function wje(t){if(tre(t))return await mje(t);if(gje(t)){if(Aje(t))throw new DOMException("The image data has been detached.","InvalidStateError");return t}return Jte(t)||Xte(t)?bje(t):await rre(t)}async function xje(t){try{return await t.decode(),!0}catch{return!1}}async function Eje(t){var e;try{return await((e=t.decode)==null?void 0:e.call(t)),!0}catch{return!1}}function Cje(t){return t.format===null}function Aje(t){return t.data.buffer.byteLength===0}function Sje(t){return t.width===0&&t.height===0}function U$(t,e){return _je(t)?new DOMException(`${e}: ${t.message}`,t.name):Ije(t)?new t.constructor(`${e}: ${t.message}`):new Error(`${e}: ${t}`)}function _je(t){return t instanceof DOMException||Object.prototype.toString.call(t)==="[object DOMException]"}function Ije(t){return t instanceof Error||Object.prototype.toString.call(t)==="[object Error]"}var B3;class TI extends EventTarget{constructor(e={}){var r;super(),JFe(this,B3);try{const n=(r=e==null?void 0:e.formats)==null?void 0:r.filter(i=>i!=="unknown");if((n==null?void 0:n.length)===0)throw new TypeError("Hint option provided, but is empty.");for(const i of n??[])if(!II.has(i))throw new TypeError(`Failed to read the 'formats' property from 'BarcodeDetectorOptions': The provided value '${i}' is not a valid enum value of type BarcodeFormat.`);ZFe(this,B3,n??[]),fje().then(i=>{this.dispatchEvent(new CustomEvent("load",{detail:i}))}).catch(i=>{this.dispatchEvent(new CustomEvent("error",{detail:i}))})}catch(n){throw U$(n,"Failed to construct 'BarcodeDetector'")}}static async getSupportedFormats(){return hje.filter(e=>e!=="unknown")}async detect(e){try{const r=await wje(e);if(r===null)return[];let n;const i={tryHarder:!0,returnCodabarStartEnd:!0,formats:QFe(this,B3).map(s=>II.get(s))};try{tre(r)?n=await uje(r,i):n=await dje(r,i)}catch(s){throw console.error(s),new DOMException("Barcode detection service unavailable.","NotSupportedError")}return n.map(s=>{const{topLeft:{x:o,y:a},topRight:{x:c,y:l},bottomLeft:{x:f,y:u},bottomRight:{x:p,y:g}}=s.position,y=Math.min(o,c,f,p),b=Math.min(a,l,u,g),I=Math.max(o,c,f,p),C=Math.max(a,l,u,g);return{boundingBox:new DOMRectReadOnly(y,b,I-y,C-b),rawValue:s.text,format:pje(s.format),cornerPoints:[{x:o,y:a},{x:c,y:l},{x:p,y:g},{x:f,y:u}]}})}catch(r){throw U$(r,"Failed to execute 'detect' on 'BarcodeDetector'")}}}B3=new WeakMap;globalThis.BarcodeDetector!=null||(globalThis.BarcodeDetector=TI);function Tje(t){const{onClick:e,disabled:r,className:n}=t,i={cursor:r?"default":"pointer",stroke:r?"grey":"yellow",strokeLineJoin:"round",strokeLineCap:"round",strokeWidth:1.5,...t.style};return qt.createElement("svg",{onClick:r?void 0:e,className:n,style:i,width:"28px",height:"28px",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},qt.createElement("path",{d:"M3 3L6.00007 6.00007M21 21L19.8455 19.8221M9.74194 4.06811C9.83646 4.04279 9.93334 4.02428 10.0319 4.01299C10.1453 4 10.2683 4 10.5141 4H13.5327C13.7786 4 13.9015 4 14.015 4.01299C14.6068 4.08078 15.1375 4.40882 15.4628 4.90782C15.5252 5.00345 15.5802 5.11345 15.6901 5.33333C15.7451 5.44329 15.7726 5.49827 15.8037 5.54609C15.9664 5.79559 16.2318 5.95961 16.5277 5.9935C16.5844 6 16.6459 6 16.7688 6H17.8234C18.9435 6 19.5036 6 19.9314 6.21799C20.3077 6.40973 20.6137 6.71569 20.8055 7.09202C21.0234 7.51984 21.0234 8.0799 21.0234 9.2V15.3496M19.8455 19.8221C19.4278 20 18.8702 20 17.8234 20H6.22344C5.10333 20 4.54328 20 4.11546 19.782C3.73913 19.5903 3.43317 19.2843 3.24142 18.908C3.02344 18.4802 3.02344 17.9201 3.02344 16.8V9.2C3.02344 8.0799 3.02344 7.51984 3.24142 7.09202C3.43317 6.71569 3.73913 6.40973 4.11546 6.21799C4.51385 6.015 5.0269 6.00103 6.00007 6.00007M19.8455 19.8221L14.5619 14.5619M14.5619 14.5619C14.0349 15.4243 13.0847 16 12 16C10.3431 16 9 14.6569 9 13C9 11.9153 9.57566 10.9651 10.4381 10.4381M14.5619 14.5619L10.4381 10.4381M10.4381 10.4381L6.00007 6.00007"}))}function Pje(t){const{onClick:e,disabled:r,className:n}=t,i={cursor:r?"default":"pointer",stroke:r?"grey":"yellow",strokeLineJoin:"round",strokeLineCap:"round",strokeWidth:1.5,...t.style};return qt.createElement("svg",{onClick:r?void 0:e,className:n,style:i,width:"28px",height:"28px",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},qt.createElement("path",{d:"M12 16C13.6569 16 15 14.6569 15 13C15 11.3431 13.6569 10 12 10C10.3431 10 9 11.3431 9 13C9 14.6569 10.3431 16 12 16Z"}),qt.createElement("path",{d:"M3 16.8V9.2C3 8.0799 3 7.51984 3.21799 7.09202C3.40973 6.71569 3.71569 6.40973 4.09202 6.21799C4.51984 6 5.0799 6 6.2 6H7.25464C7.37758 6 7.43905 6 7.49576 5.9935C7.79166 5.95961 8.05705 5.79559 8.21969 5.54609C8.25086 5.49827 8.27836 5.44328 8.33333 5.33333C8.44329 5.11342 8.49827 5.00346 8.56062 4.90782C8.8859 4.40882 9.41668 4.08078 10.0085 4.01299C10.1219 4 10.2448 4 10.4907 4H13.5093C13.7552 4 13.8781 4 13.9915 4.01299C14.5833 4.08078 15.1141 4.40882 15.4394 4.90782C15.5017 5.00345 15.5567 5.11345 15.6667 5.33333C15.7216 5.44329 15.7491 5.49827 15.7803 5.54609C15.943 5.79559 16.2083 5.95961 16.5042 5.9935C16.561 6 16.6224 6 16.7454 6H17.8C18.9201 6 19.4802 6 19.908 6.21799C20.2843 6.40973 20.5903 6.71569 20.782 7.09202C21 7.51984 21 8.0799 21 9.2V16.8C21 17.9201 21 18.4802 20.782 18.908C20.5903 19.2843 20.2843 19.5903 19.908 19.782C19.4802 20 18.9201 20 17.8 20H6.2C5.0799 20 4.51984 20 4.09202 19.782C3.71569 19.5903 3.40973 19.2843 3.21799 18.908C3 18.4802 3 17.9201 3 16.8Z"}))}function kje(t){const{scanning:e,startScanning:r,stopScanning:n}=t,[i,s]=N.useState(!1);function o(){s(!0),e?n():r(),setTimeout(()=>s(!1),1e3)}return qt.createElement("div",{style:{bottom:85,right:3,position:"absolute",zIndex:2,cursor:i?"default":"pointer"}},e?qt.createElement(Tje,{disabled:i,onClick:o}):qt.createElement(Pje,{disabled:i,onClick:o}))}function Mje(t){const{onClick:e,className:r,style:n}=t;return qt.createElement("svg",{onClick:e,width:"30px",height:"30px",viewBox:"0 0 24 24",className:r,style:n,xmlns:"http://www.w3.org/2000/svg"},qt.createElement("path",{strokeWidth:.2,stroke:"yellow",fill:"yellow",d:"M13.225 9l5.025-7h-7.972l-3.3 11h5.359l-2.452 8.648.75.364L20.374 9zm.438 3H8.322l2.7-9H16.3l-5.025 7h7.101l-6.7 8.953z"}))}function Rje(t){const{onClick:e,className:r,style:n}=t;return qt.createElement("svg",{onClick:e,width:"30px",height:"30px",viewBox:"0 0 24 24",className:r,style:n,xmlns:"http://www.w3.org/2000/svg"},qt.createElement("path",{strokeWidth:.2,stroke:"yellow",fill:"yellow",d:"M14.516 15.158l.714.714-4.595 6.14-.75-.364L12.337 13H6.978L8.22 8.861l.803.803L8.322 12h3.036l1.793 1.792-1.475 5.16zm5.984 4.05L4.793 3.5l.707-.707 3.492 3.492L10.278 2h7.972l-5.025 7h7.149l-3.71 4.957 4.543 4.543zM12.707 10l3.243 3.243L18.376 10zM9.795 7.088l2.079 2.079L16.3 3h-5.278z"}))}function Oje(t){const{status:e,scanning:r,torchToggle:n}=t;function i(s){n(s)}return r&&n?qt.createElement("div",{style:{bottom:35,right:3,position:"absolute",zIndex:2,cursor:"pointer"}},e?qt.createElement(Rje,{onClick:()=>i(!1)}):qt.createElement(Mje,{onClick:()=>i(!0)})):null}function Nje(t){const{onClick:e,className:r,disabled:n=!1}=t,i={cursor:n?"default":"pointer",stroke:n?"grey":"yellow",fill:n?"grey":"yellow",...t.style};return qt.createElement("svg",{onClick:n?void 0:e,width:"30px",height:"30px",viewBox:"0 0 24 24",className:r,style:i,xmlns:"http://www.w3.org/2000/svg"},qt.createElement("path",{strokeWidth:.3,d:"M16.279,17.039c-1.396,1.209 -3.216,1.941 -5.206,1.941c-4.393,0 -7.96,-3.567 -7.96,-7.96c-0,-4.393 3.567,-7.96 7.96,-7.96c4.393,0 7.96,3.567 7.96,7.96c-0,2.044 -0.772,3.909 -2.04,5.319l0.165,0.165c1.194,1.194 2.388,2.388 3.583,3.582c0.455,0.456 -0.252,1.163 -0.707,0.708l-3.755,-3.755Zm1.754,-6.019c-0,-3.841 -3.119,-6.96 -6.96,-6.96c-3.842,0 -6.96,3.119 -6.96,6.96c-0,3.841 3.118,6.96 6.96,6.96c3.841,0 6.96,-3.119 6.96,-6.96Zm-7.46,0.5l-1.5,0c-0.645,0 -0.643,-1 -0,-1l1.5,0l-0,-1.5c-0,-0.645 1,-0.643 1,0l-0,1.5l1.5,0c0.645,0 0.643,1 -0,1l-1.5,0l-0,1.5c-0,0.645 -1,0.643 -1,0l-0,-1.5Z"}))}function Dje(t){const{onClick:e,className:r,disabled:n=!1}=t,i={cursor:n?"default":"pointer",stroke:n?"grey":"yellow",fill:n?"grey":"yellow",...t.style};return qt.createElement("svg",{onClick:n?void 0:e,width:"30px",height:"30px",viewBox:"0 0 24 24",className:r,style:i,xmlns:"http://www.w3.org/2000/svg"},qt.createElement("path",{strokeWidth:.3,d:"M16.279,17.039c-1.396,1.209 -3.216,1.941 -5.206,1.941c-4.393,0 -7.96,-3.567 -7.96,-7.96c-0,-4.393 3.567,-7.96 7.96,-7.96c4.393,0 7.96,3.567 7.96,7.96c-0,2.044 -0.772,3.909 -2.04,5.319l0.165,0.165c1.194,1.194 2.388,2.388 3.583,3.582c0.455,0.456 -0.252,1.163 -0.707,0.708l-3.755,-3.755Zm1.754,-6.019c-0,-3.841 -3.119,-6.96 -6.96,-6.96c-3.842,0 -6.96,3.119 -6.96,6.96c-0,3.841 3.118,6.96 6.96,6.96c3.841,0 6.96,-3.119 6.96,-6.96Zm-4.96,-0.5c0.645,0 0.643,1 -0,1l-4,0c-0.645,0 -0.643,-1 -0,-1l4,0Z"}))}function Bje(t){const{scanning:e,capabilities:r,onZoom:n,value:i}=t;if(!e||!n)return null;const s=(r.max-r.min)/3;return qt.createElement(N.Fragment,null,qt.createElement("div",{style:{bottom:130,right:3,position:"absolute",zIndex:2,cursor:"pointer"}},qt.createElement(Dje,{disabled:i<=r.min,onClick:function(){n(Math.max(i-s,r.min))}})),qt.createElement("div",{style:{bottom:180,right:3,position:"absolute",zIndex:2,cursor:"pointer"}},qt.createElement(Nje,{disabled:i>=r.max,onClick:function(){n(Math.min(i+s,r.max))}})))}function Lje(t){const{scanning:e,loading:r,capabilities:n,border:i=35,onOff:s,torch:o,zoom:a,startScanning:c,stopScanning:l}=t,f="rgba(255, 0, 0, 0.5)";return qt.createElement("div",{style:{position:"relative"}},qt.createElement("svg",{viewBox:"0 0 100 100",style:{top:0,left:0,zIndex:1,boxSizing:"border-box",border:`${i>=35?i:35}px solid rgba(0, 0, 0, 0.2)`}},r&&qt.createElement("text",{x:"50",y:"50",textAnchor:"middle",fill:"black",fontSize:"8",fontFamily:"Arial",fontWeight:"bold"},"Loading ...",qt.createElement("animate",{attributeName:"opacity",values:"0;1;0",dur:"2s",repeatCount:"indefinite"})),qt.createElement("path",{fill:"none",d:"M23,0 L0,0 L0,23",stroke:f,strokeWidth:3}),qt.createElement("path",{fill:"none",d:"M0,77 L0,100 L23,100",stroke:f,strokeWidth:3}),qt.createElement("path",{fill:"none",d:"M77,100 L100,100 L100,77",stroke:f,strokeWidth:3}),qt.createElement("path",{fill:"none",d:"M100,23 L100,0 77,0",stroke:f,strokeWidth:3})),s&&qt.createElement(kje,{scanning:e,startScanning:c,stopScanning:l}),o&&n.torch&&qt.createElement(Oje,{scanning:e,status:o.status,torchToggle:o.toggle}),a&&n.zoom&&qt.createElement(Bje,{scanning:e,capabilities:n.zoom,value:a.value,onZoom:a.onChange}))}const Fje={facingMode:"environment",width:{min:640,ideal:720,max:1920},height:{min:640,ideal:720,max:1080}},jje={audio:!0,tracker:void 0,onOff:!1,finder:!0,torch:!0,zoom:!1},Uje={width:"100%",height:"100%",position:"relative"},$je={top:0,left:0,width:"100%",height:"100%",display:"block",overflow:"hidden"};var qje=function(t){let e,r=!1;return(...n)=>(r||(e=t(n),r=!0),e)}(()=>{const t=xFe(window);switch(t.browser){case"chrome":RFe(window,t);break;case"firefox":BFe(window,t);break;case"safari":UFe(window,t);break;default:throw new Error("Unsupported browser")}});const Vje="data:audio/mp3;base64,//PkZAAhghE0AKToAJra/n0FQygAAAGIkYJgmCYXBMAAGCTJz3zhCEM//z//1hz//8MMMMN08ssV6e5DDWIQreAgCvFKy8bXgIKMkUDDBgzJwIBtkRMQAocxIFdxghQGKDoEziAzQxOBOdH92i/iGi+zDCAEIX46a73HrSybZw1x3JZjXp7dSNy/P68rjcbt7p7fakMP5LVMyzCaj1pjvejYYAIDgDGzECjEAk1Jl3559HIon8hzlfPVTCvGJZzfcKSxXfyMWM88//9VKSxXdtnb9vomOuuRyiWVYbf+X8zp6fKGHIdycuWMMMMMMKSnp+6wsYc/9f/7z7rPPWHN556p6fP8MMMP///PPP/7+GHK9PT6p7f/unldP2np7YeHjweiYA4GLNAgAiI7u57n5//oc5/yfk6znOcPhwOBwggHCMpA4HA4KEyHOc5znO+hPIc5//+fqJh8XQPh90JU5xQinOf//87/zvP+ggAYuhCKHxdA+Hxd0EA4KKHA4ciB3kOXfXB/gmf8p/B96lAMKAgAADU+BujARHgwdisgHMfAUHAiceBg4ASBgZBiBIBH4ZaHOJsLhf8R+HYEciIgYSwj/+Bi7EqBh+AcBn5P6Bh4TuBmrAMBiZH7gaLEWgew//PkZFMlyek60MpYAShzqqZhm6gCUWeEUWAewEWYGN4X4GDEPwGE8S4GDoOIGAYKgIQOkz//gGARAUB+CwGxTwMAACAEgyAwdAlAxKhzAxXiZ///AxcEwAwJjDAziCAAwQgdAwRgdAsJ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jGj31odPkkSjJtbWs6OIjKmlXHR9K5MTv5pdZolE10kk2lly74TFx5KTXeTGLrS6ExiucvJSSDUdXZm3NLn1rtYBCUEoRj77WOhCPc+g5//PkZJ8XPgzoAABMTrz8BfQyY9ONGxJULutaa1TE5LHxWEo+XecmMa3p0kqBCR6qOFaFUGpNJIIjqVi0ylBqJIkiSJIkmJj605EkSRJPetWAyVacmodBUVhGfrAZPF0AUrgRLNiqDU4VHo8h6HRObJJNdqlRBMFT0qdNE0WZhmay2tCuOY6oieWieianCnVSbzjd7SGhrLi6eUSeLcZTWqdML5PM50uOGJms9VqtYU6hrgrm4V0frUzTvYsiegR2FOkqUxSKdVCpmRCSkIAUZ4VPhqEKgFDU2VhUiIhUaIg0RAkTBYEjYBUbBMuCJgLAkCUBUinABgBE3/9EQqFRM0s0qzktk9ZFqqFC6RULE11JVDkd8Y1vVFOx9oUIpZ8Vnq5klkxBTUUzLjEwMKqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqq";var db=t=>t instanceof Date,nre=t=>t==null;const ire=t=>typeof t=="object";var $$=t=>!nre(t)&&!Array.isArray(t)&&ire(t)&&!db(t),q$=t=>nre(t)||!ire(t);function sre(t,e){if(q$(t)||q$(e))return t===e;if(db(t)&&db(e))return t.getTime()===e.getTime();const r=Object.keys(t),n=Object.keys(e);if(r.length!==n.length)return!1;for(const i of r){const s=t[i];if(!n.includes(i))return!1;if(i!=="ref"){const o=e[i];if(db(s)&&db(o)||$$(s)&&$$(o)||Array.isArray(s)&&Array.isArray(o)?!sre(s,o):s!==o)return!1}}return!0}function D6(t){if(t===null)throw new Error("Canvas should always be defined when component is mounted.");const e=t.getContext("2d");if(e===null)throw new Error("Canvas 2D context should be non-null");e.clearRect(0,0,t.width,t.height)}function zje(t){var e;const{onScan:r,constraints:n,formats:i=["qr_code"],paused:s=!1,components:o,children:a,styles:c,classNames:l,allowMultiple:f,scanDelay:u,onError:p}=t,g=N.useRef(null),y=N.useRef(null),b=N.useRef(null),I=N.useMemo(()=>({...Fje,...n}),[n]),C=N.useMemo(()=>({...jje,...o}),[o]),[S,R]=N.useState(!1),[L,F]=N.useState(!0),[H,_]=N.useState(I),U=function(){const v=N.useRef(Promise.resolve({type:"stop",data:{}})),m=N.useRef(null),M=N.useRef(null),[B,E]=N.useState({}),[x,w]=N.useState({}),T=N.useCallback(async(X,G)=>{var Z,re,D;if(!window.isSecureContext)throw new Error("camera access is only permitted in secure context. Use HTTPS or localhost rather than HTTP.");if(((Z=navigator==null?void 0:navigator.mediaDevices)===null||Z===void 0?void 0:Z.getUserMedia)===void 0)throw new Error("this browser has no Stream API support");qje();const ee=await navigator.mediaDevices.getUserMedia({audio:!1,video:G});X.srcObject!==void 0?X.srcObject=ee:X.mozSrcObject!==void 0?X.mozSrcObject=ee:window.URL.createObjectURL?X.src=window.URL.createObjectURL(ee):window.webkitURL?X.src=window.webkitURL.createObjectURL(ee):X.src=ee.id,await Promise.race([X.play(),new Promise(Ee=>setTimeout(Ee,3e3)).then(()=>{throw new Error("Loading camera stream timed out after 3 seconds.")})]),await new Promise(Ee=>setTimeout(Ee,500));const[fe]=ee.getVideoTracks();return w(fe.getSettings()),E((D=(re=fe==null?void 0:fe.getCapabilities)===null||re===void 0?void 0:re.call(fe))!==null&&D!==void 0?D:{}),m.current=ee,M.current=fe,{type:"start",data:{videoEl:X,stream:ee,constraints:G}}},[]),P=N.useCallback(async(X,G)=>{X.src="",X.srcObject=null,X.load();for(const Z of G.getTracks())G.removeTrack(Z),Z.stop();return m.current=null,M.current=null,w({}),{type:"stop",data:{}}},[]),z=N.useCallback(async(X,{constraints:G,restart:Z=!1})=>{if(v.current=v.current.then(re=>{if(re.type==="start"){const{data:{videoEl:D,stream:ee,constraints:fe}}=re;return Z||X!==D||G!==fe?P(D,ee).then(()=>T(X,G)):re}return T(X,G)}),(await v.current).type==="stop")throw new Error("Something went wrong with the camera task queue (start task).")},[T,P]),oe=N.useCallback(async()=>{if(v.current=v.current.then(X=>{if(X.type==="stop")return X;const{data:{videoEl:G,stream:Z}}=X;return P(G,Z)}),(await v.current).type==="start")throw new Error("Something went wrong with the camera task queue (stop task).")},[P]),j=N.useCallback(async X=>{const G=M.current;if(!G)throw new Error("No active video track found.");{X.advanced&&X.advanced[0].zoom&&G.getCapabilities().torch&&await G.applyConstraints({advanced:[{torch:!1}]}),await G.applyConstraints(X);const Z=G.getCapabilities(),re=G.getSettings();E(Z),w(re)}},[]);return N.useEffect(()=>()=>{(async()=>await oe())()},[oe]),{capabilities:B,settings:x,startCamera:z,stopCamera:oe,updateConstraints:j}}(),{startScanning:ie,stopScanning:ce}=function(v){const{videoElementRef:m,onScan:M,onFound:B,retryDelay:E=100,scanDelay:x=0,formats:w=[],audio:T=!0,allowMultiple:P=!1}=v,z=N.useRef(new TI({formats:w})),oe=N.useRef(null),j=N.useRef(null);N.useEffect(()=>{z.current=new TI({formats:w})},[w]),N.useEffect(()=>{typeof window<"u"&&T&&(oe.current=new Audio(Vje))},[T]);const X=N.useCallback(G=>async Z=>{if(m.current!==null&&m.current.readyState>1){const{lastScan:re,contentBefore:D,lastScanHadContent:ee}=G;if(Z-re!D.includes(ze.rawValue)),_e=fe.length>0;let Me=G.lastOnScan;(Ee||P&&_e&&Z-Me>=x)&&(T&&oe.current&&oe.current.paused&&oe.current.play().catch(ze=>console.error("Error playing the sound",ze)),Me=Z,M(fe)),_e&&B(fe),!_e&&ee&&B(fe);const Ze={lastScan:Z,lastOnScan:Me,lastScanHadContent:_e,contentBefore:Ee?fe.map(ze=>ze.rawValue):D};j.current=window.requestAnimationFrame(X(Ze))}}},[m.current,M,B,E]);return{startScanning:N.useCallback(()=>{const G=performance.now(),Z={lastScan:G,lastOnScan:G,contentBefore:[],lastScanHadContent:!1};j.current=window.requestAnimationFrame(X(Z))},[X]),stopScanning:N.useCallback(()=>{j.current!==null&&(window.cancelAnimationFrame(j.current),j.current=null)},[])}}({videoElementRef:g,onScan:r,onFound:v=>function(m,M,B,E){const x=B;if(x==null)throw new Error("onFound handler should only be called when component is mounted. Thus tracking canvas is always defined.");const w=M;if(w==null)throw new Error("onFound handler should only be called when component is mounted. Thus video element is always defined.");if(m.length===0||E===void 0)D6(x);else{const T=w.offsetWidth,P=w.offsetHeight,z=w.videoWidth,oe=w.videoHeight,j=Math.max(T/z,P/oe),X=z*j,G=oe*j,Z=X/z,re=G/oe,D=(T-X)/2,ee=(P-G)/2,fe=({x:Ze,y:ze})=>({x:Math.floor(Ze*Z),y:Math.floor(ze*re)}),Ee=({x:Ze,y:ze})=>({x:Math.floor(Ze+D),y:Math.floor(ze+ee)}),_e=m.map(Ze=>{const{boundingBox:ze,cornerPoints:et}=Ze,{x:Re,y:qe}=Ee(fe({x:ze.x,y:ze.y})),{x:Te,y:De}=fe({x:ze.width,y:ze.height});return{...Ze,cornerPoints:et.map(Je=>Ee(fe(Je))),boundingBox:DOMRectReadOnly.fromRect({x:Re,y:qe,width:Te,height:De})}});x.width=w.offsetWidth,x.height=w.offsetHeight;const Me=x.getContext("2d");if(Me===null)throw new Error("onFound handler should only be called when component is mounted. Thus tracking canvas 2D context is always defined.");E(_e,Me)}}(v,g.current,b.current,C.tracker),formats:i,audio:C.audio,allowMultiple:f,retryDelay:C.tracker===void 0?500:10,scanDelay:u});N.useEffect(()=>(R(!0),()=>{R(!1)}),[]),N.useEffect(()=>{S&&(ce(),ie())},[o==null?void 0:o.tracker]),N.useEffect(()=>{if(!sre(I,H)){const v=I;n!=null&&n.deviceId&&delete v.facingMode,_(v)}},[n]);const K=N.useMemo(()=>({constraints:H,shouldStream:S&&!s}),[H,S,s]),k=async()=>{const v=g.current;if(v==null)throw new Error("Video should be defined when component is mounted.");const m=y.current;if(m==null)throw new Error("Canvas should be defined when component is mounted.");const M=m.getContext("2d");if(M==null)throw new Error("Canvas should be defined when component is mounted.");if(K.shouldStream){await U.stopCamera(),F(!1);try{await U.startCamera(v,K),v?F(!0):await U.stopCamera()}catch(B){p==null||p(B),console.error("error",B)}}else m.width=v.videoWidth,m.height=v.videoHeight,M.drawImage(v,0,0,v.videoWidth,v.videoHeight),await U.stopCamera(),F(!1)};N.useEffect(()=>{(async()=>await k())()},[K]);const O=N.useMemo(()=>K.shouldStream&&L,[K.shouldStream,L]);return N.useEffect(()=>{if(O){if(y.current===void 0)throw new Error("shouldScan effect should only be triggered when component is mounted. Thus pause frame canvas is defined");if(D6(y.current),b.current===void 0)throw new Error("shouldScan effect should only be triggered when component is mounted. Thus tracking canvas is defined");if(D6(b.current),g.current==null)throw new Error("shouldScan effect should only be triggered when component is mounted. Thus video element is defined");ie()}},[O]),qt.createElement("div",{style:{...Uje,...c==null?void 0:c.container},className:l==null?void 0:l.container},qt.createElement("video",{ref:g,style:{...$je,...c==null?void 0:c.video,visibility:s?"hidden":"visible"},className:l==null?void 0:l.video,autoPlay:!0,muted:!0,playsInline:!0}),qt.createElement("canvas",{ref:y,style:{display:s?"block":"none",position:"absolute",top:0,left:0,width:"100%"}}),qt.createElement("canvas",{ref:b,style:{position:"absolute",top:0,left:0,width:"100%",height:"100%"}}),qt.createElement("div",{style:{top:0,left:0,position:"absolute",width:"100%",height:"100%"}},C.finder&&qt.createElement(Lje,{scanning:L,capabilities:U.capabilities,loading:!1,onOff:C.onOff,zoom:C.zoom&&U.settings.zoom?{value:U.settings.zoom,onChange:async v=>{const m={...H,advanced:[{zoom:v}]};await U.updateConstraints(m)}}:void 0,torch:C.torch?{status:(e=U.settings.torch)!==null&&e!==void 0&&e,toggle:async v=>{const m={...H,advanced:[{torch:v}]};await U.updateConstraints(m)}}:void 0,startScanning:async()=>await k(),stopScanning:async()=>{await U.stopCamera(),D6(b.current),F(!1)},border:c==null?void 0:c.finderBorder}),a))}function Hje({onQrUri:t}){const e=Br(OE),[r,n]=N.useState(""),i=async()=>{if(r){console.log(r);try{await e.pair(r)}catch(s){console.error(s),t(!1)}}t(!0)};return W.jsxs(we,{flexDirection:"column",justifyContent:"space-between",padding:"12",gap:"3",children:[W.jsx(zje,{onScan:s=>{s[0].rawValue&&n(s[0].rawValue)},styles:{video:{transform:"scaleX(-1)",borderRadius:"10px",minHeight:"500px"}}}),W.jsxs(we,{children:[W.jsx(Pn,{label:"Paste Connection String",labelLocation:"top",name:"signClientUri",value:r??"",onChange:s=>{n(s.target.value)}}),W.jsx(we,{justifyContent:"flex-end",children:W.jsx(Jt,{marginTop:"4",variant:"primary",size:"md",shape:"square",label:"Connect Dapp",disabled:!r,onClick:()=>{r&&i()}})})]})]})}const ore=t=>({info:{walletId:"",uuid:"",name:"WalletConnect",icon:"https://avatars.githubusercontent.com/u/37784886"},provider:t});function Gje(){var ze,et;const t=Rte(),e=Br(Mi),r=Br(nE),n=Br(Zr),i=Br(Wn),s=Br(OE),o=rk(),a=on(e.accountAddress),c=on(e.isPasswordSet),l=on(n.isSigningTxn),f=on(n.isSigningMsg),u=on(s.allSessions),p=on(i.networks),g=f8(),y=WP("isMobile"),b=rFe();N.useEffect(()=>{a&&p.length>0&&r.loadBalances(a,p)},[a,p]),N.useEffect(()=>{if(b&&b.connected&&!n.selectedExternalProvider.get()){let Re=ore(b),qe=n.availableExternalProviders.get();qe?n.availableExternalProviders.set([Re,...qe]):n.availableExternalProviders.set([Re])}},[b]),N.useEffect(()=>{t.length>0&&n.availableExternalProviders.set(t)},[t]);const I=on(n.selectedExternalProvider),C=on(n.selectedExternalWalletAddress),S=on(n.isSendingTokenTransaction),R=on(n.isSendingCollectibleTransaction),L=on(n.isSendingSignedTokenTransaction),[F,H]=N.useState(!0),[_,U]=N.useState(void 0),[ie,ce]=N.useState(void 0),[K,k]=N.useState(!1),[O,v]=N.useState(!1),[m,M]=N.useState(!1),[B,E]=N.useState(!1),[x,w]=N.useState(!1),[T,P]=N.useState(!1),[z,oe]=N.useState(!1),j=on(n.signClientWarningType),X=Re=>{ce(void 0),n.isSendingCollectibleTransaction.set(void 0),U(Re),w(!0)},G=Re=>{U(void 0),n.isSendingTokenTransaction.set(void 0),ce(Re),P(!0)},Z=async(Re=!1)=>{(I===void 0||Re)&&M(!0)},re=async()=>{n.setExternalProvider(void 0);const Re=I;(Re==null?void 0:Re.info.name)==="WalletConnect"&&Re.provider.disconnect()},D=async(Re,qe)=>{if(!n.selectedExternalProvider.get()){console.warn("No external provider selected");return}var Te;let De;try{if(_)Te=_.chainId,De=await n.sendToken(_,Re,qe);else if(ie)Te=ie.collectibleInfoParams.chainId,De=await n.sendCollectible(ie,Re,qe);else{console.warn("No pending send found");return}}catch(tt){tt.code===4001&&g({variant:"error",title:"User denied transaction signature."}),console.error(tt);return}const Je=i.providerForChainId(Te),Ge=await O$(Je,De.hash);Ge&&g({variant:"success",title:"Transaction confirmed",description:"You can view the transaction details on your connected external wallet"}),_&&r.updateTokenBalance(_),U(void 0),ce(void 0),n.isSendingTokenTransaction.set(void 0),n.isSendingCollectibleTransaction.set(void 0),console.log("receipt",Ge)},ee=async(Re,qe)=>{const Te=i.providerForChainId(qe);await O$(Te,Re)&&(n.isSendingSignedTokenTransaction.set(void 0),g({variant:"success",title:"Sign transaction confirmed",description:"You can view the transaction details on your connected external wallet"}))},fe=()=>{s.rejectRequest(),n.toSignPermission.set("cancelled")};async function Ee(Re){var Ge;const qe=async(tt,rt,We)=>{try{const it=await n.getExternalProviderAddress(Te);if(!it)throw new Error("No provider address found");return console.log("sendTransaction chainId",rt),await n.sendTransaction(De,Te,it,tt,rt)}catch(it){throw n.isSendingSignedTokenTransaction.set(void 0),it}},Te=(Ge=n.selectedExternalProvider.get())==null?void 0:Ge.provider,De=e.account;let Je;if(Re)try{n.isSendingSignedTokenTransaction.set(Re),Je=await qe(Re.txn,Re.chainId,Re.options),ee(Je.hash,Re.chainId),n.toSignResult.set(Je),n.toSignPermission.set("approved")}catch(tt){throw n.isSendingSignedTokenTransaction.set(void 0),fe(),tt}}async function _e(Re){const qe=async(Je,Ge)=>{try{let tt;if(Je.message)console.log("signMessage chainId",Je.chainId),tt=await Te.signMessage(Je.message,Je.chainId,Je.eip6492?"eip6492":"throw");else if(Je.typedData){const rt=Je.typedData;tt=await Te.signTypedData(rt.domain,rt.types,rt.message,Je.chainId,Je.eip6492?"eip6492":"throw")}if(!tt)throw new Error("Account sign method failed");return{hash:tt}}catch(tt){throw tt}},Te=e.account;let De;if(Re)try{De=await qe(Re.message),n.toSignResult.set(De),n.toSignPermission.set("approved")}catch(Je){throw n.isSendingSignedTokenTransaction.set(void 0),fe(),Je}}const Me=async()=>{var Re;((Re=n.selectedExternalProvider.get())==null?void 0:Re.info.name)==="WalletConnect"?n.signClientWarningType.set("isWalletConnect"):oe(!0)},Ze=async()=>{E(!0)};return W.jsxs(W.Fragment,{children:[W.jsxs(we,{flexDirection:"column",background:"backgroundPrimary",width:"full",height:"full",alignItems:"center",justifyContent:"center",children:[W.jsxs(we,{flexDirection:"row",width:"full",background:"backgroundMuted",paddingX:"8",paddingY:"4",alignItems:"center",children:[W.jsx("img",{src:yM,alt:"Sequence Logo",width:"40"}),W.jsxs(we,{marginLeft:"auto",marginRight:"16",children:[W.jsx(Jt,{label:"Networks",variant:"text",marginRight:"8",onClick:()=>v(!0)}),c&&W.jsx(Jt,{label:"Password Lock",variant:"text",marginRight:"8",onClick:()=>window.location.reload()}),W.jsx(Jt,{label:"Sign Out",variant:"text",onClick:()=>k(!0)})]})]}),W.jsxs(we,{width:"full",paddingX:"8",style:{maxWidth:"800px"},marginBottom:"16",children:[W.jsxs(en,{flexDirection:"column",alignItems:"center",padding:"6",marginTop:"10",children:[W.jsx(Qe,{variant:"large",color:"text80",marginBottom:"4",children:"Your recovered wallet address"}),W.jsx(Qe,{variant:"normal",fontWeight:"bold",color:"text100",children:a}),W.jsx(yFe,{sessionList:u}),W.jsx(Jt,{marginTop:"4",variant:"primary",size:"sm",shape:"square",label:"Connect to a dapp via WalletConnect",leftIcon:zpe,onClick:()=>{Me()}})]}),W.jsxs(en,{alignItems:"center",flexDirection:"column",padding:"6",marginTop:"4",children:[W.jsx(Qe,{variant:"large",color:"text80",marginBottom:"4",children:I?"Your external wallet that will be used to relay transactions":"Connect an external wallet to relay transactions"}),I&&W.jsx(we,{flexDirection:"row",alignItems:"center",gap:"2",children:W.jsxs(we,{flexDirection:"column",alignItems:"center",gap:"2",children:[W.jsxs(we,{flexDirection:"row",gap:"2",children:[W.jsx("img",{src:I.info.icon,alt:I.info.name,style:{width:"20px",height:"20px"}}),W.jsx(Qe,{variant:"normal",color:"text100",children:I.info.name})]}),C&&W.jsxs(Qe,{variant:"normal",color:"text100",children:["(",C,")"]}),W.jsxs(we,{flexDirection:"row",children:[W.jsx(Jt,{size:"xs",label:"Change external wallet",variant:"text",shape:"square",marginRight:"10",onClick:()=>Z(!0)}),W.jsx(Jt,{size:"xs",label:"Disconnect",variant:"text",shape:"square",onClick:()=>re()})]})]})}),!I&&W.jsx(Jt,{label:"Connect",variant:"primary",size:"md",shape:"square",onClick:Z})]}),S&&W.jsx(we,{marginTop:"8",alignItems:"center",justifyContent:"center",children:W.jsx(cS,{symbol:((et=(ze=S.tokenBalance)==null?void 0:ze.contractInfo)==null?void 0:et.symbol)??"",chainId:S.tokenBalance.chainId,to:S.to,amount:S.amount})}),R&&W.jsx(we,{marginTop:"8",alignItems:"center",justifyContent:"center",children:W.jsx(cS,{symbol:R.collectibleInfo.collectibleInfoResponse.name??"",chainId:R.collectibleInfo.collectibleInfoParams.chainId,to:R.to,amount:R.amount})}),L&&W.jsx(we,{marginTop:"8",alignItems:"center",justifyContent:"center",children:W.jsx(cS,{symbol:"tokens",chainId:L.chainId,to:L.txn[0].to,amount:String(Number(L.txn[0].value))})}),W.jsxs(we,{flexDirection:"column",alignItems:"flex-start",justifyContent:"flex-start",marginTop:"8",children:[W.jsxs(we,{width:"full",flexDirection:"row",alignItems:"center",marginBottom:"4",children:[W.jsx(Qe,{variant:"large",color:"text80",children:"Coins"}),W.jsx(we,{marginLeft:"auto",children:W.jsx(Ybe,{label:"Filter zero balances",checked:F,onCheckedChange:H})})]}),W.jsx(vFe,{filterZeroBalances:F,onSendClick:X})]}),W.jsxs(we,{flexDirection:"column",alignItems:"flex-start",justifyContent:"flex-start",marginTop:"8",children:[W.jsx(Qe,{variant:"large",color:"text80",marginBottom:"4",children:"Collectibles"}),W.jsx(cFe,{onSendClick:G})]})]})]}),K&&W.jsx(Ko,{size:"sm",onClose:()=>k(!1),children:W.jsxs(we,{flexDirection:"column",padding:"8",children:[W.jsx(Qe,{variant:"medium",color:"text80",marginRight:"8",children:"You will need to re-enter your mnemonic if you sign out. Continue?"}),W.jsxs(we,{flexDirection:"row",width:"full",justifyContent:"flex-end",marginTop:"8",gap:"4",children:[W.jsx(Jt,{label:"Sign Out",shape:"square",variant:"primary",onClick:()=>{e.logout(),o("/")}}),W.jsx(Jt,{label:"Cancel",shape:"square",onClick:()=>k(!1)})]})]})}),O&&W.jsx(Ko,{onClose:()=>v(!1),children:W.jsx(gM,{})}),m&&W.jsx(Ko,{size:"md",onClose:()=>M(!1),children:W.jsx(lFe,{onSelectProvider:async Re=>{var qe,Te;Re&&(((qe=n.selectedExternalProvider.get())==null?void 0:qe.info.name)==="WalletConnect"&&await((Te=n.selectedExternalProvider.get())==null?void 0:Te.provider).disconnect(),n.setExternalProvider(Re)),M(!1)}})}),B&&W.jsx(Ko,{size:"md",onClose:()=>E(!1),children:W.jsx(gFe,{onClose:()=>E(!1)})}),z&&W.jsx(Ko,{size:"md",contentProps:{style:{width:y?"100%":"600px",height:y?"":"750px"}},onClose:()=>oe(!1),children:W.jsx(Hje,{onQrUri:Re=>{Re&&Ze(),oe(!1)}})}),l&&W.jsx(Ko,{isDismissible:!1,size:"md",contentProps:{style:{width:y?"100%":"800px",maxHeight:"100%",overflowY:"auto"}},children:W.jsx(bFe,{onClose:Re=>{var qe;n.isSigningTxn.set(!1),Re?n.selectedExternalProvider.get()===void 0?(fe(),n.signClientWarningType.set("noProvider")):((qe=n.selectedExternalProvider.get())==null?void 0:qe.info.name)==="WalletConnect"?(fe(),n.signClientWarningType.set("isWalletConnect")):Ee(Re):fe()}})}),f&&W.jsx(Ko,{isDismissible:!1,size:"md",contentProps:{style:{width:y?"100%":"800px",maxHeight:"90%",overflowY:"auto"}},children:W.jsx(mFe,{onClose:Re=>{var qe;n.isSigningMsg.set(!1),Re?n.selectedExternalProvider.get()===void 0?(fe(),n.signClientWarningType.set("noProvider")):((qe=n.selectedExternalProvider.get())==null?void 0:qe.info.name)==="WalletConnect"?(fe(),n.signClientWarningType.set("isWalletConnect")):_e(Re):fe()}})}),j&&W.jsx(Ko,{size:"md",onClose:()=>n.signClientWarningType.set(!1),children:W.jsx(wFe,{warningType:j})}),x&&W.jsx(Ko,{size:"md",onClose:()=>w(!1),children:W.jsx(uFe,{tokenBalance:_,onClose:(Re,qe)=>{w(!1),Re&&qe&&D(Re,qe)}})}),T&&W.jsx(Ko,{size:"md",onClose:()=>P(!1),children:W.jsx(fFe,{collectibleInfo:ie,onClose:(Re,qe)=>{P(!1),(Re&&(ie==null?void 0:ie.collectibleInfoParams.contractType)==="ERC721"||Re&&qe)&&D(Re,qe)}})})]})}const Wje=()=>{const t=Br(Mi),e=on(t.accountAddress);return W.jsx(x2e,{basename:"/",children:W.jsxs(p2e,{children:[W.jsx(t3,{path:"/",element:e?W.jsx(QA,{replace:!0,to:"/wallet"}):W.jsx(y9e,{})}),W.jsx(t3,{path:"recovery",element:e?W.jsx(QA,{replace:!0,to:"/wallet"}):W.jsx(w9e,{})}),W.jsx(t3,{path:"wallet",element:e?W.jsx(Gje,{}):W.jsx(QA,{replace:!0,to:"/"})})]})})},Kje=Sxe();B7.createRoot(document.getElementById("root")).render(W.jsx(qt.StrictMode,{children:W.jsx(_xe,{store:Kje,children:W.jsx(Eme,{theme:"dark",children:W.jsx(Owe,{children:W.jsx(Wje,{})})})})}));export{C9e as _}; diff --git a/index.html b/index.html index b8e7d79..8d083b1 100644 --- a/index.html +++ b/index.html @@ -5,7 +5,7 @@ Sequence Wallet Recovery - +